tensorly.tenalg.mode_dot

mode_dot(tensor, matrix_or_vector, mode)[source]

n-mode product of a tensor and a matrix or vector at the specified mode

Mathematically: \text{tensor} \times_{\text{mode}} \text{matrix or vector}

Parameters:

tensor : ndarray

tensor of shape (i_1, ..., i_k, ..., i_N)

matrix_or_vector : ndarray

1D or 2D array of shape (J, i_k) or (i_k, ) matrix or vectors to which to n-mode multiply the tensor

mode : int

Returns:

ndarray

mode-mode product of tensor by matrix_or_vector * of shape (i_1, ..., i_{k-1}, J, i_{k+1}, ..., i_N) if matrix_or_vector is a matrix * of shape (i_1, ..., i_{k-1}, i_{k+1}, ..., i_N) if matrix_or_vector is a vector

See also

multi_mode_dot
chaining several mode_dot in one call