Advanced maths

Tensor mode unfolding and multilinear rank calculator

A three-way tensor has several matrix unfoldings, each exposing a different index as the row coordinate.

Your numbers

Exactly three integers, each 1–4.
Exactly I×J×K rational values; then advance j, then i.
Finite value from 10^-14 through 10^-3.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

A three-way tensor has several matrix unfoldings, each exposing a different index as the row coordinate. Their ranks form a multilinear rank tuple, which is different from a tensor CP rank. This calculator constructs all three unfoldings under explicit indexing rules, reports their singular values and tolerance-based ranks, and separately computes exact rational matrix ranks. That distinction makes near-dependence visible instead of hiding it in a single rank label.

THE FORMULAr_n=rank(A_(n)); numeric rank counts σ_i>tolerance×σ_max separately for each mode unfolding.

A worked example

The default 2×2×2 tensor is the outer product (1,2)⊗(1,3)⊗(1,4). Its row-major values are 1,4,3,12,2,8,6,24, with the third index varying fastest. Every mode unfolding has proportional rows, so both its exact and numerical multilinear ranks are (1,1,1). The values are a fixed demonstration tensor, not an inferred property of uploaded data.

Good to know

Three dimensions from one through four, at most sixty-four exact rational entries. Input order is k fastest, then j, then i. Mode-one columns use (j,k), mode two (i,k), mode three (i,j). Numerical singular values use one-sided Jacobi iteration, with relative rank tolerance 10^-14…10^-3. Exact ranks use rational elimination. This is not CP decomposition, Tucker factor estimation or a certified high-precision singular-value solver.

Flattening conventions affect the displayed matrices

For dimensions I,J,K, the flat position is (iJ+j)K+k using zero-based indices. Mode one places i on rows and flattens (j,k) into columns. Mode two places j on rows and flattens (i,k); mode three places k on rows and flattens (i,j). The complete table makes these choices explicit rather than relying on a library default.

Another reference may order the other two indices differently, producing a column-permuted unfolding. A column permutation changes the displayed matrix but not its rank or singular values. Comparing raw entries therefore requires matching the convention first, while comparing the rank tuple is invariant under these index-order permutations.

The first unfolding of the rank-one tensor has proportional rows1, 4, 3, 122, 8, 6, 24row 2 = 2 × row 1mode rank 1Three unfoldings → (1,1,1)
The 2×2×2 default is (1,2) outer (1,3) outer (1,4), flattened with k fastest. Mode-one rows are [1,4,3,12] and [2,8,6,24]. The other two mode ranks are also one, so the tuple is (1,1,1).

The Kronecker product and sum calculator for matrices builds products of two matrices, while this page unfolds a given three-way tensor and compares its exact and tolerance-based mode ranks.

Numerical rank is a tolerance-dependent decision

Floating-point computations cannot treat every tiny singular value as a reliable nonzero direction. The numerical rank counts a value only if it exceeds the entered tolerance times the largest singular value of that mode. Changing that tolerance can change the tuple without changing any tensor entry.

Exact rational rank asks a different question: whether a determinant or linear dependency is algebraically zero for the exact entered fractions. A nearly dependent matrix can have full exact rank and smaller numerical rank at a chosen tolerance. Both outputs are shown and neither is silently used to overwrite the other. The all-zero tensor has rank zero in every mode.

Mode ranks do not determine the number of rank-one tensor terms

Each unfolding is an ordinary matrix, but tensor CP rank concerns the smallest number of outer products needed to express the entire tensor simultaneously. That rank is not generally the maximum or sum of the three matrix ranks. Labeling a multilinear rank tuple as tensor rank without qualification would misstate the calculation.

Independent validation uses NumPy’s separate reshape/transpose and SVD routines, plus exact matrix ranks from symbolic arithmetic. Rank-one outer products, sparse tensors, full-rank examples and near-dependent rational values test both the index mapping and tolerance behavior. A numerical convergence failure rejects the request instead of returning an unchecked singular spectrum.

A few questions, answered

Why can the exact and numerical ranks differ?

An exactly nonzero singular direction can lie below the selected relative tolerance. The exact rank measures algebraic dependence, while numerical rank measures resolved scale at that tolerance.

Is (r1,r2,r3) the CP rank?

No. It is the tuple of the three mode-matrix ranks. Computing a minimal rank-one tensor decomposition is a different problem.

Find your calculator

Start typing to explore the library.