tensorly.tenalg.mode_dot

mode_dot(tensor, matrix_or_vector, mode, transpose=False)[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
tensorndarray

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

matrix_or_vectorndarray

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

modeint
transposebool, default is False

If True, the matrix is transposed. For complex tensors, the conjugate transpose is used.

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