oseledets/ttpy

slicing returns error if tt_vector has only 1 core

Opened this issue · 1 comments

Please change this line: https://github.com/oseledets/ttpy/blob/master/tt/core/vector.py#L189 from
answ_cores[-1] = _np.dot(answ_cores[-1], running_fact)
to

if len(answ_cores) > 0:
  answ_cores[-1] = _np.dot(answ_cores[-1], running_fact)
else:
  # Result is a number.
  answ_cores = [reshape(running_fact, (1, 1, 1))]

And add a test for this behavior.