In multilinear algebra, a reshaping of tensors is any bijection between the set of indices of an order-
tensor and the set of indices of an order-
The use of indices presupposes tensors in coordinate representation with respect to a basis.
The coordinate representation of a tensor can be regarded as a multi-dimensional array, and a bijection from one set of indices to another therefore amounts to a rearrangement of the array elements into an array of a different shape.
Such a rearrangement constitutes a particular kind of linear map between the vector space of order-
tensors and the vector space of order-
Then there are vector space isomorphisms (linear maps)
Via these (and other) vector space isomorphisms, a tensor can be interpreted in several ways as an order-
The first vector space isomorphism on the list above,
, gives the coordinate representation of an abstract tensor.
The expression of a tensor with respect to this basis has the form
This can be regarded as a M-way array whose elements are the coefficients
there is a canonical isomorphism between the two tensor products of vector spaces
Parentheses are usually omitted from such products due to the natural isomorphism between
, but may, of course, be reintroduced to emphasize a particular grouping of factors.
, is obtained by applying the two processes above within each of the
group of factors is obtained using the isomorphism
, which requires specifying bases for all of the vector spaces
The result is then vectorized using a bijection
, the product of the dimensions of the vector spaces in the
The result of applying these isomorphisms within each group of factors is an element of
denotes the ith standard basis vector of
In such a reshaping, the tensor is simply interpreted as a vector in
A standard choice of bijection
which is consistent with the way in which the colon operator in Matlab and GNU Octave reshapes a higher-order tensor into a vector.
be the coordinate representation of an abstract tensor with respect to a basis.
This reshaping is sometimes called matrixizing, matricizing, flattening or unfolding in the literature.
A standard choice for the bijections
is the one that is consistent with the reshape function in Matlab and GNU Octave, namely
As the parenthetical ordering indicates, the mode-m column vectors are arranged by sweeping all the other mode indices through their ranges, with smaller mode indexes varying more rapidly than larger ones; thus