def ttv(self, v, modes=[], without=False):
"""
Tensor times vector product
Parameters
----------
v : 1-d array or tuple of 1-d arrays
Vector to be multiplied with tensor.
modes : array_like of integers, optional
Modes in which the vectors should be multiplied.
without : boolean, optional
If True, vectors are multiplied in all modes **except** the
modes specified in ``modes``.
"""
if not isinstance(v, tuple):
v = (v, )
dims, vidx = check_multiplication_dims(modes, self.ndim, len(v), vidx=True, without=without)
for i in range(len(dims)):
if not len(v[vidx[i]]) == self.shape[dims[i]]:
raise ValueError('Multiplicant is wrong size')
remdims = np.setdiff1d(range(self.ndim), dims)
return self._ttv_compute(v, dims, vidx, remdims)
#@abstractmethod
#def ttt(self, other, modes=None):
# pass
评论列表
文章目录