Computational complexity of matrix multiplication

From testwiki
Revision as of 05:21, 18 February 2025 by imported>Citation bot (Altered journal. Added isbn. | Use this bot. Report bugs. | Suggested by Abductive | Category:Unsolved problems in computer science | #UCB_Category 19/33)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Short description Template:CS1 config Template:Unsolved In theoretical computer science, the computational complexity of matrix multiplication dictates how quickly the operation of matrix multiplication can be performed. Matrix multiplication algorithms are a central subroutine in theoretical and numerical algorithms for numerical linear algebra and optimization, so finding the fastest algorithm for matrix multiplication is of major practical relevance.

Directly applying the mathematical definition of matrix multiplication gives an algorithm that requires Template:Math field operations to multiply two Template:Math matrices over that field (Template:Math in big O notation). Surprisingly, algorithms exist that provide better running times than this straightforward "schoolbook algorithm". The first to be discovered was Strassen's algorithm, devised by Volker Strassen in 1969 and often referred to as "fast matrix multiplication".[1] The optimal number of field operations needed to multiply two square Template:Math matrices up to constant factors is still unknown. This is a major open question in theoretical computer science.

Template:As of, the best bound on the asymptotic complexity of a matrix multiplication algorithm is Template:Math.[2] However, this and similar improvements to Strassen are not used in practice, because they are galactic algorithms: the constant coefficient hidden by the big O notation is so large that they are only worthwhile for matrices that are too large to handle on present-day computers.[3][4]

Simple algorithms

If A, B are Template:Math matrices over a field, then their product AB is also an Template:Math matrix over that field, defined entrywise as

(AB)ij=k=1nAikBkj.

Schoolbook algorithm

Template:For

The simplest approach to computing the product of two Template:Math matrices A and B is to compute the arithmetic expressions coming from the definition of matrix multiplication. In pseudocode:

input A and B, both n by n matrices
initialize C to be an n by n matrix of all zeros
for i from 1 to n:
    for j from 1 to n:
        for k from 1 to n:
            C[i][j] = C[i][j] + A[i][k]*B[k][j]
output C (as A*B)

This algorithm requires, in the worst case, Template:Tmath multiplications of scalars and Template:Tmath additions for computing the product of two square Template:Math matrices. Its computational complexity is therefore Template:Tmath, in a model of computation where field operations (addition and multiplication) take constant time (in practice, this is the case for floating point numbers, but not necessarily for integers).

Strassen's algorithm

Template:Main Strassen's algorithm improves on naive matrix multiplication through a divide-and-conquer approach. The key observation is that multiplying two Template:Math matrices can be done with only 7 multiplications, instead of the usual 8 (at the expense of 11 additional addition and subtraction operations). This means that, treating the input Template:Math matrices as block Template:Math matrices, the task of multiplying Template:Math matrices can be reduced to 7 subproblems of multiplying Template:Math matrices. Applying this recursively gives an algorithm needing O(nlog27)O(n2.807) field operations.

Unlike algorithms with faster asymptotic complexity, Strassen's algorithm is used in practice. The numerical stability is reduced compared to the naive algorithm,[5] but it is faster in cases where Template:Math or so[6] and appears in several libraries, such as BLAS.[7] Fast matrix multiplication algorithms cannot achieve component-wise stability, but some can be shown to exhibit norm-wise stability.[8] It is very useful for large matrices over exact domains such as finite fields, where numerical stability is not an issue.

Matrix multiplication exponent

Improvement of estimates of exponent Template:Math over time for the computational complexity of matrix multiplication O(nω)
Closeup of 1990–2024
Timeline of matrix multiplication exponent
Year Bound on omega Authors
1969 2.8074 Strassen[1]
1978 2.796 Pan[9]
1979 2.780 Bini, Template:Ill, Romani[10]
1981 2.522 Schönhage[11]
1981 2.517 Romani[12]
1981 2.496 Coppersmith, Winograd[13]
1986 2.479 Strassen[14]
1990 2.3755 Coppersmith, Winograd[15]
2010 2.3737 Stothers[16]
2012 2.3729 Williams[17][18]
2014 2.3728639 Le Gall[19]
2020 2.3728596 Alman, Williams[20][21]
2022 2.371866 Duan, Wu, Zhou[22]
2024 2.371552 Williams, Xu, Xu, and Zhou[23]
2024 2.371339 Alman, Duan, Williams, Xu, Xu, and Zhou[2]

The matrix multiplication exponent, usually denoted Template:Math, is the smallest real number for which any two n×n matrices over a field can be multiplied together using nω+o(1) field operations. This notation is commonly used in algorithms research, so that algorithms using matrix multiplication as a subroutine have bounds on running time that can update as bounds on Template:Math improve.

Using a naive lower bound and schoolbook matrix multiplication for the upper bound, one can straightforwardly conclude that Template:Math. Whether Template:Math is a major open question in theoretical computer science, and there is a line of research developing matrix multiplication algorithms to get improved bounds on Template:Math.

All recent algorithms in this line of research use the laser method, a generalization of the Coppersmith–Winograd algorithm, which was given by Don Coppersmith and Shmuel Winograd in 1990 and was the best matrix multiplication algorithm until 2010.[24] The conceptual idea of these algorithms is similar to Strassen's algorithm: a method is devised for multiplying two Template:Math-matrices with fewer than Template:Math multiplications, and this technique is applied recursively. The laser method has limitations to its power: Ambainis, Filmus and Le Gall prove that it cannot be used to show that Template:Math by analyzing higher and higher tensor powers of a certain identity of Coppersmith and Winograd and neither Template:Math for a wide class of variants of this approach.[25] In 2022 Duan, Wu and Zhou devised a variant breaking the first of the two barriers with Template:Math,[22] they do so by identifying a source of potential optimization in the laser method termed combination loss for which they compensate using an asymmetric version of the hashing method in the Coppersmith–Winograd algorithm.

Nonetheless, the above are classical examples of galactic algorithms. On the opposite, the above Strassen's algorithm of 1969 and Pan's algorithm of 1978, whose respective exponents are slightly above and below 2.78, have constant coefficients that make them feasible.[26][27]

Group theory reformulation of matrix multiplication algorithms

Henry Cohn, Robert Kleinberg, Balázs Szegedy and Chris Umans put methods such as the Strassen and Coppersmith–Winograd algorithms in an entirely different group-theoretic context, by utilising triples of subsets of finite groups which satisfy a disjointness property called the triple product property (TPP). They also give conjectures that, if true, would imply that there are matrix multiplication algorithms with essentially quadratic complexity. This implies that the optimal exponent of matrix multiplication is 2, which most researchers believe is indeed the case.[4] One such conjecture is that families of wreath products of Abelian groups with symmetric groups realise families of subset triples with a simultaneous version of the TPP.[28][29] Several of their conjectures have since been disproven by Blasiak, Cohn, Church, Grochow, Naslund, Sawin, and Umans using the Slice Rank method.[30] Further, Alon, Shpilka and Chris Umans have recently shown that some of these conjectures implying fast matrix multiplication are incompatible with another plausible conjecture, the sunflower conjecture,[31] which in turn is related to the cap set problem.[30]

Lower bounds for ω

There is a trivial lower bound of Template:Tmath. Since any algorithm for multiplying two Template:Math-matrices has to process all Template:Math entries, there is a trivial asymptotic lower bound of Template:Math operations for any matrix multiplication algorithm. Thus Template:Tmath. It is unknown whether Template:Tmath. The best known lower bound for matrix-multiplication complexity is Template:Math, for bounded coefficient arithmetic circuits over the real or complex numbers, and is due to Ran Raz.[32]

The exponent ω is defined to be a limit point, in that it is the infimum of the exponent over all matrix multiplication algorithms. It is known that this limit point is not achieved. In other words, under the model of computation typically studied, there is no matrix multiplication algorithm that uses precisely Template:Math operations; there must be an additional factor of Template:Math.[13]

Rectangular matrix multiplication

Similar techniques also apply to rectangular matrix multiplication. The central object of study is ω(k), which is the smallest c such that one can multiply a matrix of size n×nk with a matrix of size nk×n with O(nc+o(1)) arithmetic operations. A result in algebraic complexity states that multiplying matrices of size n×nk and nk×n requires the same number of arithmetic operations as multiplying matrices of size n×nk and n×n and of size n×n and n×nk, so this encompasses the complexity of rectangular matrix multiplication.[33] This generalizes the square matrix multiplication exponent, since ω(1)=ω.

Since the output of the matrix multiplication problem is size n2, we have ω(k)2 for all values of k. If one can prove for some values of k between 0 and 1 that ω(k)2, then such a result shows that ω(k)=2 for those k. The largest k such that ω(k)=2 is known as the dual matrix multiplication exponent, usually denoted α. α is referred to as the "dual" because showing that α=1 is equivalent to showing that ω=2. Like the matrix multiplication exponent, the dual matrix multiplication exponent sometimes appears in the complexity of algorithms in numerical linear algebra and optimization.[34]

The first bound on α is by Coppersmith in 1982, who showed that α>0.17227.[35] The current best peer-reviewed bound on α is α0.321334, given by Williams, Xu, Xu, and Zhou.[23]

Template:Further

Problems that have the same asymptotic complexity as matrix multiplication include determinant, matrix inversion, Gaussian elimination (see next section). Problems with complexity that is expressible in terms of ω include characteristic polynomial, eigenvalues (but not eigenvectors), Hermite normal form, and Smith normal form.Template:Citation needed

Matrix inversion, determinant and Gaussian elimination

In his 1969 paper, where he proved the complexity O(nlog27)O(n2.807) for matrix computation, Strassen proved also that matrix inversion, determinant and Gaussian elimination have, up to a multiplicative constant, the same computational complexity as matrix multiplication. The proof does not make any assumptions on matrix multiplication that is used, except that its complexity is O(nω) for some ω2

The starting point of Strassen's proof is using block matrix multiplication. Specifically, a matrix of even dimension Template:Math may be partitioned in four Template:Math blocks

[ABCD].

Under this form, its inverse is

[ABCD]1=[A1+A1B(DCA1B)1CA1A1B(DCA1B)1(DCA1B)1CA1(DCA1B)1],

provided that Template:Mvar and DCA1B are invertible.

Thus, the inverse of a Template:Math matrix may be computed with two inversions, six multiplications and four additions or additive inverses of Template:Math matrices. It follows that, denoting respectively by Template:Math, Template:Math and Template:Math the number of operations needed for inverting, multiplying and adding Template:Math matrices, one has

I(2n)2I(n)+6M(n)+4A(n).

If n=2k, one may apply this formula recursively:

I(2k)2I(2k1)+6M(2k1)+4A(2k1)22I(2k2)+6(M(2k1)+2M(2k2))+4(A(2k1)+2A(2k2))

If M(n)cnω, and α=2ω4, one gets eventually

I(2k)2kI(1)+6c(αk1+2αk2++2k1α0)+k2k+12k+6cαk2kα2+k2k+1d(2k)ω

for some constant Template:Mvar.

For matrices whose dimension is not a power of two, the same complexity is reached by increasing the dimension of the matrix to a power of two, by padding the matrix with rows and columns whose entries are 1 on the diagonal and 0 elsewhere.

This proves the asserted complexity for matrices such that all submatrices that have to be inverted are indeed invertible. This complexity is thus proved for almost all matrices, as a matrix with randomly chosen entries is invertible with probability one.

The same argument applies to LU decomposition, as, if the matrix Template:Mvar is invertible, the equality

[ABCD]=[I0CA1I][AB0DCA1B]

defines a block LU decomposition that may be applied recursively to A and DCA1B, for getting eventually a true LU decomposition of the original matrix.

The argument applies also for the determinant, since it results from the block LU decomposition that

det[ABCD]=det(A)det(DCA1B).

Minimizing number of multiplications

Related to the problem of minimizing the number of arithmetic operations is minimizing the number of multiplications, which is typically a more costly operation than addition. A O(nω) algorithm for matrix multiplication must necessarily only use O(nω) multiplication operations, but these algorithms are impractical. Improving from the naive n3 multiplications for schoolbook multiplication, 4×4 matrices in /2 can be done with 47 multiplications,[36] 3×3 matrix multiplication over a commutative ring can be done in 21 multiplications[37][38] (23 if non-commutative[39]). The lower bound of multiplications needed is 2mn+2nm−2 (multiplication of n×m-matrices with m×n-matrices using the substitution method, mn⩾3), which means n=3 case requires at least 19 multiplications and n=4 at least 34.[40] For n=2 optimal 7 multiplications 15 additions are minimal, compared to only 4 additions for 8 multiplications.[41][42]

See also

References

Template:Reflist