Skip to content

tensorprod

linear-algebra · scripts/linear-algebra/tensorprod.m

: c = tensorprod (a, b)
: c = tensorprod (a, b, dim)
: c = tensorprod (a, b, dima, dimb)
: c = tensorprod (a, b, "all")
: c = tensorprod (…, "NumDimensionsA", na, "NumDimensionsB", nb)

Tensor product of two arrays, summing over selected pairs of dimensions.

Without dimensions the outer product is returned. With dima and dimb (or a common dim) the listed dimensions are contracted pairwise. The result holds the remaining dimensions of a followed by those of b. "all" contracts every dimension of two equally sized arrays to a scalar. No complex conjugation is applied.