In multilinear algebra, a reshaping of tensors is any bijective map between an order-
tensor and an order-
tensor, where
.
Definition
For each integer
where
for a positive integer
, let Vk denote an nk-dimensional vector space over a field
. Then there isomorphisms of vector spaces
where
is any permutation and
is the symmetric group on
elements.
Given a positive integer
, the notation
refers to the set
of the first d positive integers. Given a set
, the notation
refers to the cardinality of
, i.e. the number of its elements.
Via the following (and other) vector space isomorphisms, a tensor can be interpreted in several ways as an order-
tensor where
.
For each subset
of
, let
denote the projection with
, i.e.
denote the elements of the subset
.
Let
be a partition. Then, the
-flattening of a simple tensor
is defined as
which may be interpreted as a tensor of order
by ignoring for each positive integer
with
the tensor product structure on
.
The standard way to ignore the tensor product structure consists of looking at
through vector space isomorphisms, which for each positive integer
allow identifying
and
. Using these identifications,
is viewed as an element of
, where for each positive integer
we define
, the product of the integers
.
For general tensors
the above definition is extended linearly as follows. Since every temsor admits a tensor rank decomposition, we can define the
-flattening of an arbitrary tensor
as follows:
Example
For example, assume that, for each natural number
such that
, a basis of
is
, and assume that the tensor is expressed with respect to this basis as
where for each positive integer
such that
, the notation
is meant to denote another positive integer
, where
denotes the dimension of the vector space
, or equivalently the number of elements in the basis
for
.
Via the first vector space isomorphism, namely
, we can represent
as
where, for each positive integer
such that
,
is the jth standard basis vector of
.
Taking
and a bijective map
, we can construct a vector space isomorphism between
and
by mapping
where for every natural number
such that
, including in particular
for every
, the vector
denotes the jth standard basis vector of
. Via this identification[disambiguation needed], we have
.
Vectorization
Let
be the coordinate representation of an abstract tensor with respect to a basis.
A vectorization of
is an
-reshaping wherein
, so that the tensor is simply interpreted as a vector in
. A standard choice of bijection
is such that

which is consistent with the way in which the colon operator in Matlab and GNU Octave reshapes a higher-order tensor into a vector.
Flattenings
Let
be the coordinate representation of an abstract tensor with respect to a basis.
A standard factor-k flattening of
is an
-reshaping in which
and
. Usually, a standard flattening is denoted by

These reshapings are sometimes called matricizations or unfoldings in the literature. A standard choice for the bijection
is the one that is consistent with the reshape function in Matlab and GNU Octave, namely
