ttpy icon indicating copy to clipboard operation
ttpy copied to clipboard

slicing returns error if tt_vector has only 1 core

Open aiboyko opened this issue 7 years ago • 1 comments

@Bihaqo

aiboyko avatar Aug 14 '18 21:08 aiboyko

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.

Bihaqo avatar Aug 15 '18 10:08 Bihaqo