We determine the maximum rank of 4×4×4 and k×4×3 multidimensional arrays over the finite field F2. These results are made possible by a new method of enumerating non-isomorphic tensors.
1 Introduction
The rank of a tensor (multidimensional array) is the smallest number of vector outer products that it can be expressed as a sum of. Computing the rank of an arbitrary tensor is NP-hard [3], and looser properties of tensor rank remain difficult to analyze, such as the maximum possible rank for a given shape. Over finite fields, research is especially sparse, as one cannot use tools from algebraic geometry as easily as over the complex numbers.
Our goal is solve maximum rank for new tensor shapes over the finite field F2, focusing on 3-dimensional shapes. Existing work has solved the shapes m×n×2 [5]; 3×3×3 [1]; and 4×3×3, 5×3×3, and 4×4×3: [4]. This work solves 4×4×4 and all remaining k×4×3.
We first describe a recursive method of enumerating non-isomorphic tensors that is exponentially faster than the standard orbit-finding algorithm used in [1]. We then compute the rank of each tensor individually, using an improved version of our rank-finding algorithm in [4]. Surprisingly, we found this method to be faster than a breadth-first search over isomorphism classes.
1.1 Definitions
Let T be a tensor with shape n0×⋯×nD−1. A decomposition of T with rank R is a list of vector tuples (ad(r))0≤d<D, 0≤r<R such that T=∑ra0(r)×⋯×aD−1(r), where × denotes the outer product. Alternatively, it is a list of factor matrices Ad∈Fnd×R such that Ti0,…,iD−1=∑r∏d(Ad)id,r for all indices (i0,…,iD−1). The rank of T, denoted rk(T), is the minimum possible value of R.
The axis-d rank of T is the dimension of the linear span of its axis-d slices. We call T axis-d concise if its axis-d rank equals nd, and concise if T is axis-d concise for all axes d.
1.1.1 Notation
The outer product of two tensors A,B is denoted as (A×B)i0,…,iD−1,j0,…,jE−1=Ai0,…,iD−1Bj0,…,jE−1.
The matrix product of a tensor T with a matrix M along axis d is denoted as
We write M to the left of T, unlike most sources, as it looks more similar to standard matrix multiplication. For brevity, we omit parentheses when applying multiple matrix products to one tensor, i.e. A×0B×1C×2T means A×0(B×1(C×2T)).
If M is a row vector, it is treated like a 1×nd matrix and the d-th axis of the resulting product is discarded.
A tensor decomposition with factor matrices A0,...,AD−1 is also written as [A0,...,AD−1].
A 1-hot vector with a 1 at index i and 0s everywhere else is denoted as ei; the length is implied by context.
We use 0-indexing and NumPy notation to denote elements or slices of a tensor:
writing a:b on an axis denotes the range of indices {a,...,b−1} on that axis; when omitted, a and b are set to 0 and n, respectively, where n is the length of the tensor along the axis;
writing … after an axis denotes the ranges of all indices on all remaining axes.
For example, A:,j is the j-th column of a 2D tensor A, and Ti,… is the i-th slice along axis 0 of an tensor T with one or more dimensions.
Two tensors T,T′ of shape n0×⋯×nD−1 are isomorphic if there exist invertible matrices Q0,...,QD−1 such that Q0×0(Q1×1...T)=T′. We denote this relation as T∼T′. It is clear that isomorphic tensors have equal rank.
Define the canonicalization of a tensor T to be the lexically minimum tensor it is isomorphic to, under row-major ordering of elements. The following are immediate:
Lemma 1. If T=can(T), then for any p, T:p,…=can(T:p,…).
Proof. Suppose can (T:p,…)=Q0×0Q1×1…T:p,…<lexT:p,…: then [Q0In0−p]×0Q1×1…T<lexT: contradiction. □
Lemma 2. Let r=dim(span({Ti,…:0≤i<n0})): then can(T):n0−r,…=0.
Proof. By definition of r, the maximum number of all-zeros axis-0 slices any tensor T′∼T can have is n0−r.
For D=2, we can solve canonicalization immediately. As a consequence, the canonicalization of a matrix only depends on its rank, and lower rank corresponds to lower lexical order.
Lemma 3. For any matrix M∈Fm×n, can (M)=[0(m−r)×(n−r)0r×(n−r)0(m−r)×rH], where r=rk(M) and H=r11⋱.
Proof. From Lemma 2, can (M):m−r,:=0. Then for each 0≤i<r, can (M)m−r+i,: is the lexically smallest row vector not in the row-span of can (M)m−r:m−r+i−1,:. The desired expression for can (M) is then obtained via a standard proof by induction. □
2.1 Enumeration
For the remainder of this section, we focus on D=3. To enumerate canonical n0×n1×n2 tensors, the previous lemmas suggest the following ideas:
generate k×n1×n2 canonicals that are axis-0 concise, for k≤n0, then prefix-pad with all-zeros slices;
to generate n0×n1×n2 canonicals, iterate over cat0(T,M) for canonical T∈F(n0−1)×n1×n2 and arbitrary M∈Fn1×n2, where cat0 denotes concatenation along axis 0 and M is implicitly expanded to 1×n1×n2;
we call cat0(T,M) an augment of T;
use Lemma 3 to enumerate 1×n1×n2 canonicals.
Below is the first version of our algorithm; for brevity, we only return the list of n0×n1×n2 axis-0 concise canonicals. We describe later how to check isomorphism.
L←[]
for each S∈F(n0−1)×n1×n2 that is canonical and axis-0 concise, in lex order:
for each M∈Fn1×n2 in lex order:
T←cat0(S,M)
if T is not axis-0 concise:
continue
if ∀T′∈L:T∼T′:
add T to L
return L
We iterate over ≤ϕ(n0−1,n1,n2)∣Fn1n2 many T and run Θ(ϕ(n0,n1,n2)) many isomorphism checks for each T on average, where ϕ(n0,n1,n2) is the number of n0×n1×n2 canonicals.
The above algorithm does not take advantage of the fact that many canonical tensors share prefixes, so running many individual isomorphism checks may lead to wasted work. To solve this problem, we introduce a new relation between tensors T∈Fn0×n1×n2 and S∈Fn′×n1×n2 for n′≤n0:
(T≥0S):=(∃P∈Fn′×n0 full row-rank,Q1∈GL(n1,F),Q2∈GL(n2,F) s.t. P×0Q1×1Q2×2T=S).
It is clear that T∼T′ implies T≥0Tp,…′ for all p. Taking the contrapositive allows us to modify the algorithm as follows:
for 0≤k<n0:
Lk←[S∈Fk×n1×n2:S canonical and axis-0 concise, in lex order]
Ln0←[]
for (S∈Ln0−1,M∈Fn1×n2) in lex order:
T←cat0(S,M)
if T is not axis-0 concise:
continue
if ∀1≤k≤n0,∀S′∈Lk s.t. S′<lexT:k,…&S:k−1,…′=T:k−1,…:T≥0S′:
add T to Ln0
return Ln0
Essentially, we determine if T is canonical by checking whether it can be ≥0-matched to all canonical prefixes lexically smaller than T, while skipping redundant prefixes. Note that we update Ln0 while it is also being read.
In the innermost if-statement, we iterate over ≤n0∣F∣n1n2 many S′, since for each k all but the last axis-0 slice of S′ is fixed. Thus, we run that many ≥0-checks for each T instead of Θ(ϕ(n0,n1,n2)) many isomorphism checks.
2.1.1 Tensor matching
To efficiently determine whether T≥0S for tensors T∈Fn0×n1×n2, S∈Fn′×n1×n2, we first describe a depth-first search (DFS) over the axis-0 matrix that fixes one row at a time and handles the other axes as a base case:
• // precondition: P has full row-rank, iso12(P×0T,S:p,…) is True
• if p=n′:
• return True
• for v∈Fn0:
• P′←[vP]
• if P′ has full row-rank and iso12( P′×0T,S:p+1,…) and dfs( P′):
• return True
• return False
• return dfs( 00×n0)
Each ≥0 check makes ≤Fn0n′ many iso12 calls in the worst case, but may make significantly fewer in practice due to pruning.
Instead of trying to make iso12 faster, we notice that across all checks T≥0S during tensor enumeration, S has relatively few distinct values; in fact, S is in L0⊔⋯⊔Ln0−1, so it has exactly ϕ(n0−1,n1,n2) possibilities.
We can take advantage of this property if we apply axis-1 and axis-2 operations during the DFS to match prefixes of T to S:
• def dfs( P∈Fp×n0, T∈Fn0×n1×n2):
• // precondition: P×0T=S:p,…
• if p=n′: return True
• for v∈Fn0:
• P′←[vP]
• if P′ has full row-rank and iso12( P′×0T,S:p+1,…):
In this situation, it is feasible to precompute and save all group orbits. It is also straightforward to return a group action sending an arbitrary M to some other M′, by precomputing actions that send every possible M to a consistent orbit representative. Thus, each iso12(U,U′) check can be evaluated in O∗(1) time.
2.1.2 Combined matching
If we use our improved algorithm for T≥0S-checks to determine whether a given tensor T is canonical, there is still wasted work because many of the S-tensors share prefixes with each other. Specifically, two different checks T≥0S and T≥0S′ will visit the exact same tree of (P,T)-states until after some depth. Our fix is to run a unified search over all such S, ultimately removing the ≥0-relation.
• find invertible Q1,Q2 such that Q1×1Q2×2(P′×0T′)=T:k+1,…
• add (P′,Q1×1Q2×2T′) to E′
• E←E′
• // at this point, E must contain (I:k+1,:,T:k+1,:) and therefore be nonempty
• return True
Notice that Sn0−1 is a subset of Ln0, which is updated during the main enumeration procedure. The other lists Sk can be reused across different T.
Another way to understand this procedure is that for each k=0,…,n0−1, we attempt to ≥0-transform T into a k×n1×n2 canonical prefix that is nonstrictly lexically smaller than T, while tracking all possible axis-0 operations P that could be used in such a transformation.
2.1.3 Axis-0 canonicalization
As a final speedup, we check if each T is canonical along axis 0 only before checking if it is truly canonical. Define
can0(T):=lexQ∈GL(n0,F)minQ×0T.
Computing can0(T) can be done in O∗(∣Fn0) time, by iterating over every row vector v∈Fn0 in lexical order of v×0T and greedily finding the next vector v that is linearly independent from previously selected vectors.
3 Tensor rank
We use our depth-first search algorithm from [4] to determine the rank of each canonical tensor, but with stronger pruning. For completeness, we describe the algorithm in full.
Let T∈Fn0×⋯×nD−1, n0≥…≥nD−1 be a concise tensor and R≥n0 be the rank threshold. WLOG rk(T)≤R iff there exist Ad∈Fnd×n0, Bd∈Fnd×(R−n0) s.t. T=[…,[Ad∣Bd],…d] and A0 is invertible. Letting Q:=(A0)−1 and X=QB0, we have Q×0T=[[I,A1,A2,…]]+[[X,B1,B2,…]]. Subtracting both sides by [[X,B1,…]] and splitting the equation by its axis-0 slices yields Qi,:×0T−[[Xi,:,B1,B2,…]]=(A1):,i×(A2):,i×… for all 0≤i<n0.
Consider fixing all (Bd)d≥1: then the system has a solution iff the set
satisfies dim(span({q:(q,x)∈S}))=n0. This can be determined with two methods:
(1) Enumerate all (q,x) such that rk(q×0T−[[x,B1,B2,…]])≤1; This method takes O∗(∣F∣R) time, because checking whether a tensor T has rank ≤1 is equivalent to checking whether its axis-d rank is ≤1 for all d.
(2) For all (a2,…,ad), construct a basis for the linear system q×0T−[[x,B1,B2,…]]=a1×⋯×aD−1 over (q,x,a1); then find the span of the union of these bases. This method takes O∗(∣F∣∑d≥2nd) time.
Repeating for all (Bd)d≥1, the total running time is O∗(∣F∣(R−n0)(∑d≥1nd)+min(R,∑d≥2nd)). In our implementation, we only use (1) as it is simpler and the difference in running time is insignificant for the tensor shapes we are interested in.
3.1 Depth-first search pruning
To convert the aforementioned algorithm into DFS, we partition the variables in (Bd)d≥1 into lists of columns ((Bd):,r)d≥1 for some r, then fix them for each r=0,…,R−n0−1 at a time. Doing so allows us to potentially prune nodes that fail a sufficiency check of our choosing.
Suppose a node has fixed the leftmost p columns of each (Bd)d≥1; note that (B0):,p is still unknown. Isolating the unknown variables as much as possible in the equation T=[[A0∣B0],…] yields T−[[(B0):,p,…]]=[C0,…] for Cd:=[Ad∣(Bd):,p].
Consider multiplying the left hand side of the equation along axis 0 with a vector v∈Fn0, then calculating the rank. Observe that
rk(v×0T−[[v(B0):,p,(B1):,p,…]])≤nnz(vC0),
where nnz ( ⋅) counts the number of nonzero elements.
We then “forget” (B0):,p by replacing v(B0):,p with a free vector w. Because we cannot control how w is related to v, we must take the minimum of the left hand side to make the inequality as loose as possible:
w∈Fpminrk(v×0T−[[w,(B1):,p,…]])≤nnz(vC0).
This condition motivates us to define fT;P1,P2,…(v):=minw∈Fprk(v×0T−[[w,P1,P2,…]]) and gC0(v):=nnz(vC0); then our pruner is
minw∈Fprk(v×0T−[[w,(B1):,p,…]])≤nnz(vC0).
This condition motivates us to define fT;P1,P2,…(v):=minw∈Fprk(v×0T−[[w,P1,P2,…]]) and gC0(v):=nnz(vC0); then our pruner is
We can restrict C0 to have full row-rank because A0 is invertible.
For each p, we precompute gC0 for all C0, up to permutation of columns, and store the maps in a data structure that efficiently supports ≤ptwise-membership queries, treating each gC0 as a list. The number of C0 we enumerate is O(∣F∣n0(R−p)/(R−p)!).
We use one of two data structures:
If memory permits, create a bit-array A with a 1 at each gC0 and 0 elsewhere, then compute the multi-dimensional summed-area table (using boolean ORs of suffixes instead of sums of prefixes);
Else, store all gC0 in a prefix tree, and process each ≤ptwise-membership query by DFS-ing on the tree with pruning.
To reduce memory and computation for the bit-array, we compress the f and g maps:
• omit the v=0 input;
• replace f and g with f′:=max(f−1,0) and g′:=min(g−1,M−1), where M:=n2⋯nD−1;
Doing so does not weaken the original point-wise inequality, because we are guaranteed gC0(v)≥1 for v=0 (since C0 has full row-rank) and fT;(B1):,p,…(v)≤M for all v (since f(v) is the rank of a n1×n2×⋯×nD−1-shaped tensor).
This improves the bit-array memory from O((R+1)∣F∣n0) to O(min(R,M)∣F∣n0−1), e.g. for the tensor shape 4×4×4 and rank threshold R=9 over the field F2, it improves memory from O(1016) to O(415).
When both methods are too costly, we fall back to the following looser methods, each presented with a short proof under the condition that an admissible C0 exists. For brevity, denote R′=R−p. The first two are from our previous work [4] and the rest are new:
For Q:=(A0)−1, we have QC0=[I...]; then for each i, setting v=Qi,: satisfies gC0(v)≤R′−n0+1.
• (“Laskowski”, equivalent to [2]) ∑v∈Fn0(R′−fT;P1,P2,…(v))≥R′∣F∣n0−1.
The left hand side is ≥∑v(R′−gC0(v))=∑v;i∈[R′][v(C0):,i=0]=∑i(#v∣v(C0):,i=0)≥∑i∣F∣n0−1=R′∣F∣n0−1.
• If F=F2 and R′≥n0+2: dim(span({v:fT;P1,P2,…(v)≤R′−n0}))≥n0−1.
Let S:=span({v:nz(vC0)≥n0}), where nz() denotes the number of zeros; then it suffices to prove dim(S)≥n0−1.
WLOG assume R′=n0+2 and C0=[IX]. Let H={i0,i1,…} denote all i such that Xi,:=[11]; then ei0+eij∈S for all j=0, and ei∈S for all i∈/H, which amounts to n0−1 many vectors (unless ∣H∣=0, in which case there are n0 many vectors).
• For any 1≤k<n0: ∑v∈Fn0(kR′−fT;P1,P2,…(v))≥(kR′)∣F∣n0−k.
The left hand side is ≥∑v(kR′−gC0(v))=∑v;I∈((kR′))[v(C0):,I=0]=∑I(#v∣v(C0):,I=0)≥∑I∣F∣n0−k=(kR′)∣F∣n0−k.
For our computation, we used full pruning (bit-array/prefix tree) for 4×4×4 at all rank thresholds we tested, and a mix of all pruning methods for ∗×4×3.
4 Maximum rank
Before finding maximum tensor rank for our desired shapes with the method we have outlined, we establish some bounds to reduce computational work.
Let RF(k,m,n) denote the maximum rank of a k×m×n tensor over a ground field F; we write R(k,m,n) if F is clear from context or when a statement is true over all ground fields.
We recall the method in [4] to construct high-rank tensors, which is itself similar to [6]. We give all proofs here for completeness.
Lemma 4 (Substitution method). For a tensor T∈Fn0×⋯ and nonzero row vector v s.t. v×0T=0, there exists some column vector w s.t. vw=0 and rk((I−w(vw)−1v)×0T)≤rk(T)−1.
Proof. Let T=∑rar×… be an optimal decomposition. Then there must exist some r∗ such that ar∗ satisfies var∗=0. Setting w=ar∗ results in (I−w(vw)−1v)×0T annihilating the r=r∗ term. □
Remark 5. An equivalent way to state the substitution method is that there exists some M∈F(n0−1)×n0 with full row-rank s.t. v∈/rowspace(M) and rk(M×0T)≤rk(T)−1.
The same result applies along any axis. We call this action “subbing out” v. When v is 1-hot at index i, we notate v as a tensor index slice, e.g. (i,…) if along axis 0. Each sub increases the rank lower bound by 1.
Example 6. We prove T=[[11]][11] has rank 3 over any field. The upper bound is obvious. For the lower bound, sub out (1,:) to get [[x1]] for some arbitrary x (i.e. set v=[01], M=[1x], and the axis to 0). By inspection, it is clear this tensor has rank 2 no matter what x is. Alternatively, we can sub out two more times at (:,1,:) and (:,:,1).
Lemma 7 (similar to Proof of Thm. 2 in [6]). For any m,n,m′,n′,k,p with m′≥m, n′≥n and p≤m′n′−mn, we have R(k+p,m′,n′)≥R(k,m,n)+p.
Proof. Let T∈Fk×m×n have maximum rank. Construct T′ by padding T along axes 1 and 2, then adding p many matrices that are 1-hot at distinct (i,j) for each (i,j)∈[m′]×[n′]∖([m]×[n]). Then rk(T′)≥rk(T)+p because we can sub out (h,…) for each h=k+p−1,…,k, then truncate along axes 1 and 2 to get T. □
Lemma 8 (special case of Thm. 2 of [6]). R(mn−1,m,n)=mn−1 for m,n≥1.
Proof. ≥mn−1: clear.
≤mn−1: for any T∈F(mn−1)×m×n, there exists some nonzero M∈Fm×n s.t. span({Ti,…}i)⊆S:={A∈Fm×n:∑i,jAi,jMi,j=0}. WLOG assume M=[IrOOO] for some r≥1. Observe that the set {ei×ej:(i,j)∈[m]×[n]∖{(i,i):0≤i<r}}∪{(e0+ei)×(e0−ei):1≤i<r} consists of mn−1 many rank-1 matrices whose span is precisely S, as (e0+ei)×(e0−ei)+e0×e1−ei×e0=e0×e0−ei×ei. □
Finally, it can be confirmed with our algorithm in Section 3 that the 3×3×2 tensor
11[11][11]
has rank 5 over F2. Combining this with previous lemmas yields the following:
Lemma 9. For all m≥2, n≥2, and (m,n)=(2,2), RF2(mn−3,m,n)=mn−1.
As a consequence, R(k,4,3)=11 for 0≤k≤11, so we only need to run our algorithm on k×4×3 for k≤8. Furthermore, R(k,3,3)=8 for all k≥6, which, combined with prior work, solves max rank for all k×3×3 shapes.
Tables 1 and 2 summarize our results for max rank via computational search. Because the set of canonical tensors of shape n0×n1×n2 naturally includes those of shape (<n0)×n1×n2 up to zero-padding, we list elapsed times only for n0.
To save space, each tensor T is represented as the contraction v×0T where v consists of formal variables.
shape
time to enumerate canonicals (min)
time to compute ranks (min)
4×4×4
80
1900
8×4×3
120
13
Table 1: Elapsed time to enumerate and to compute ranks of all canonical tensors for each shape.
Table 2: Number of canonical tensors, maximum rank, and example maximum-rank tensors for each non-trivial shape.
k
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
R(k,3,3)
0
3
5
6
6
7
8
8
8
9
R(k,4,3)
0
3
5
6
8
8
9
9
10
11
11
11
12
R(k,4,4)
0
4
6
8
9
≥9
≥10
≥11
≥12
≥12
≥13
≥13
≥14
15
15
15
16
Table 3: Table of known maximum ranks over F2 for various tensor shapes. Numbers in bold are new results.
Remark 10. The max-rank 4×4×4 tensor is equal to the Kronecker product of [[1111]] and [[1111]], which are precisely all of the non-isomorphic tensors of shape 2×2×2 and rank 3 over F2.
Remark 11. The max-rank 6×4×3 and 8×4×3 tensors can be constructed by augmenting the max-rank 3×3×3 and 5×3×3 tensors, respectively, to ∗×4×3 via Lemma 7.
For each tensor whose rank is less than its number of nonzero elements, we describe an optimal decomposition.
∙3×4×4:two copies of[v2v1+v2v1v2]=[v2v2v2v2]+[v1+v2]+[v1],plus the 1-hot decompositionof[v0v0]∙4×4×4:three copies of[v2v1+v2v1v2](up to relabeling of variables)∙6×4×3:v5v5v4v4v3v3v5=[v3]+[v4v4v4v4v4v4]+[v4+v5v4v4+v5v4v4]+[v5v5]+[v5v5]+[v3+v4]+[v4+v5],plus the 1-hot decomposition of[v2v1v0]∙8×4×3:[v7v7v6v6]=[v6+v7v6+v7]+[v7v7]+[v6v6],plus the 1-hot decompositionofv6v6v2v5v4v1v0
5.1 Lower bounds for k×4×4
Combining our results for R(k,4,3) with Lemmas 7 and 9 yields the following lower bounds for R(k,4,4):
Table 3 lists the best known lower bounds for R(k,4,4) to our knowledge, as well as max ranks for the other shapes we have analyzed.
References
[1] Murray R. Bremner, Jiaxiong Hu. Canonical forms of small tensors over F2. arXiv:1206.5179, 2012.
[2] Sharon J. Laskowski. Computing lower bounds on tensor rank over finite fields. Journal of Computer and System Sciences, 24(1):1–14, 1982.
[3] Yaroslav Shitov. How hard is the tensor rank? arXiv:1611.01559, 2016.
[4] Jason Yang. New results in canonical polyadic decomposition over finite fields. arXiv:2505.09824, 2025.
[5] Xiaoyu Song, Baodong Zheng, Riguang Huang. Maximal Rank of m×n×2 Tensors over Arbitrary Fields. SIAM Journal on Matrix Analysis and Applications, 43(2):867–881, 2022.
[6] Michael D. Atkinson, Nelson M. Stephens. On the maximal multiplicative complexity of a family of bilinear forms. Linear Algebra and its applications, 27:1–8, 1979.