# 矩阵乘法

矩阵乘法是把两个矩阵——一个 \( m \times k \) 矩阵 \( A \) 和一个 \( k \times n \) 矩阵 \( B \)——结合成一个 \( m \times n \) 矩阵 \( C \) 的运算，其中 \( C \) 的元素 \( C_{ij} \) 等于乘积之和 \( \sum_{r=1}^{k} A_{ir} B_{rj} \)。它是线性变换复合的代数表达，也是科学计算和人工智能中执行最频繁的算术运算之一。

| 关键事实 | 详情 |
|---|---|
| 定义 | 对大小为 \( m \times k \) 的 \( A \) 和大小为 \( k \times n \) 的 \( B \)，乘积 \( C = AB \) 满足 \( C_{ij} = \sum_{r=1}^{k} A_{ir} B_{rj} \)；内部维度必须一致<sup>[1](https://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f_source.html)</sup> |
| 经典代价 | 两个 \( n \times n \) 矩阵的常规算法使用 \( O(n^{3}) \) 次算术运算<sup>[2](https://arxiv.org/abs/1507.00687)</sup> |
| 首个次立方算法 | 施特拉森1969年的算法以 \( O(n^{\log_{2} 7}) \approx O(n^{2.81}) \) 时间相乘 \( n \times n \) 矩阵，使用7次而非8次2×2块的乘法<sup>[3](https://arxiv.org/abs/2404.16349)</sup> |
| 已知最佳指数 | \( \omega < 2.371177 \)，于2026年通过结合组合损失分析、机器学习辅助优化与AlphaEvolve创下<sup>[4](https://arxiv.org/abs/2608.16884)</sup> |
| 历史起源 | “矩阵”一词由西尔维斯特于1850年创造；凯莱1858年的《矩阵理论回忆录》给出了第一个抽象定义并定义了矩阵乘法<sup>[5](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)</sup> |
| 软件标准 | BLAS第3级例程GEMM计算 \( C := \alpha \cdot \mathrm{op}(A) \cdot \mathrm{op}(B) + \beta \cdot C \)，可选对 \( A \) 和 \( B \) 转置<sup>[1](https://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f_source.html)</sup> |
| 硬件角色 | GPU和新的CPU扩展围绕矩阵乘法构建；英特尔和AMD的ACE扩展对相同输入向量执行的操作数是AVX10的16倍<sup>[6](https://www.tomshardware.com/pc-components/cpus/intel-and-amds-new-ace-cpu-extensions-bring-an-efficient-ai-oriented-instruction-set-to-x86-a-new-design-makes-matrix-multiplication-more-power-and-density-efficient)</sup> |

## 运算及其代数

乘积仅当第一个因子的列数等于第二个因子的行数时才有定义。每个输出元素是 \( A \) 的一行与 \( B \) 的一列的点积，因此用直接法相乘两个 \( n \times n \) 矩阵需要 \( n^{3} \) 次乘法和数量相当的加法。与数的乘法不同，矩阵乘法不满足交换律：一般而言 \( AB \neq BA \)。它满足结合律，单位矩阵充当乘法单位元。

凯莱有意引入这一代数。他于1894年告诉彼得·格思里·泰特，他不是通过四元数得到矩阵概念的，而是直接来自行列式，或作为书写线性方程（如 \( x' = ax + by \)，\( y' = cx + dy \)）的便利方式；用系数的方形阵列来表示变换后，他从 \( n \) 个变量的线性齐次变换的性质出发，建立了由 \( n^{2} \) 个元素构成的矩阵的代数<sup>[7](https://people.math.harvard.edu/~knill/history/matrix/)</sup>。他1858年的回忆录定义了加法、乘法、标量乘法和逆，并给出了用行列式表示的逆的显式构造<sup>[5](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)</sup>。

## 历史

乘法规则早于矩阵概念本身。雅克·菲利普·马里·比内（Jacques Philippe Marie Binet，1786–1856）被公认为第一个推导出矩阵乘法规则的人，时在1812年，同年他还发现了行列式的乘积规则 \( \det(AB) = \det(A)\det(B) \)；柯西同年独立得到了乘法公式<sup>[7](https://people.math.harvard.edu/~knill/history/matrix/)</sup>。行列式出现在1683年关和莱布尼茨的工作中，以及1750年克拉默关于线性系统的规则中，其发展远早于矩阵代数<sup>[7](https://people.math.harvard.edu/~knill/history/matrix/)</sup>。

**西尔维斯特与凯莱。** 詹姆斯·约瑟夫·西尔维斯特（James Joseph Sylvester）于1850年创造了“矩阵”一词，将其定义为一个长方形的项排列，由其内含的方形阵列导出各种行列式；这个词本身来自拉丁语中“子宫”一词，因为矩阵生成行列式<sup>[5](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)</sup><sup> • </sup><sup>[7](https://people.math.harvard.edu/~knill/history/matrix/)</sup>。1851年回到英格兰后，当时做律师的西尔维斯特遇到了阿瑟·凯莱（Arthur Cayley），一位同样对数学感兴趣的律师同行<sup>[5](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)</sup>。凯莱很快看出了这一概念的意义，到1853年发表了一篇给出矩阵逆的短文，并于1858年刊出《矩阵理论回忆录》，其引人注目之处在于包含了矩阵的第一个抽象定义<sup>[5](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)</sup>。数值线性代数的史家把西尔维斯特1851年的论文和凯莱1858年的回忆录视为矩阵历史的起点<sup>[8](https://epubs.siam.org/doi/book/10.1137/1.9781611977233)</sup>。

矩阵理论随后在数十年间逐渐成熟。弗罗贝尼乌斯1878年关于线性代换和双线性型的工作证明了关于标准矩阵的结果，定义了矩阵的秩，并于1878年证明了矩阵满足自身特征方程这一定理的一般形式，即凯莱–哈密顿定理，而凯莱只对2×2矩阵作了证明<sup>[5](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)</sup>。博歇的《高等代数导论》（1907）使矩阵在数学中获得了应有的位置，到二十世纪中叶，矩阵理论已成为本科的核心课题<sup>[5](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)</sup>。

## 算法复杂度

施特拉森1969年的结果之后半个世纪里，降低指数 \( \omega \)——定义为使得对所有 \( \varepsilon > 0 \)，\( n \times n \) 矩阵都能在 \( O(n^{\omega+\varepsilon}) \) 时间内相乘的最小实数——一直是理论计算机科学的核心问题<sup>[3](https://arxiv.org/abs/2404.16349)</sup>。施特拉森的洞见在于2×2矩阵乘法的秩是7而非8，从而给出了第一个真正的次立方算法<sup>[3](https://arxiv.org/abs/2404.16349)</sup>。一层递归把代价从 \( 2mnk \) 次浮点运算降至 \( (7/8) \cdot 2mnk \) 次浮点运算，代价是低阶的额外加法<sup>[9](https://arxiv.org/abs/1605.01078)</sup>。

进展是逐步到来的。库珀史密斯和维诺格拉德将施特拉森的技巧与基于避免等差数列的大集合的分析相结合，得到 \( \omega < 2.376 \)，这一界二十多年保持不变<sup>[10](https://people.csail.mit.edu/virgi/matrixmult-f.pdf)</sup>。他们1982年的复杂度论文还确立了一个结构性事实：给定任何矩阵乘法算法，都存在一个更好的算法，因此 \( \omega \) 是一个极限点，无法由任何单一算法实现<sup>[11](https://epubs.siam.org/doi/10.1137/0211038)</sup>。

**激光方法时代。** 过去40年的所有改进都依赖于激光方法，一种间接设计矩阵乘法算法的技术；其改进形式——组合损失分析——需要作为计算机辅助证明的一部分求解一个非凸优化问题<sup>[4](https://arxiv.org/abs/2608.16884)</sup>。瓦西列夫斯卡·威廉姆斯、徐、徐和周2024年的论文将界推进到 \( \omega \le 2.371552 \)<sup>[12](https://arxiv.org/abs/2307.07970)</sup>，而阿尔曼、段、瓦西列夫斯卡·威廉姆斯、徐、徐和周于2024年通过在分析中引入更多不对称性，绕开了先前工作要求三个矩阵维度中有两个被同等对待的工具，将其改进为 \( \omega < 2.371339 \)<sup>[3](https://arxiv.org/abs/2404.16349)</sup>。2026年，一个使用现代优化和AlphaEvolve系统的团队将同一分析精化到 \( \omega < 2.371177 \)<sup>[4](https://arxiv.org/abs/2608.16884)</sup>。该指数的下界已知为2，而一大类激光方法变体已被证明不能给出O(n^{2.3078})算法，因此差距仍然存在<sup>[3](https://arxiv.org/abs/2404.16349)</sup><sup> • </sup><sup>[19](https://arxiv.org/abs/1411.5414)</sup>。

指数的改进以常数为代价。若一个秩为 \( t \) 的张量相乘 \( n \times n \) 矩阵，标准递归以 \( O(n^{2} \cdot M^{\log_{n} t}) \) 次运算相乘 \( M \times M \) 矩阵，而渐近最优算法所用的 \( n \) 大到 \( n^{2} \) 超过可见宇宙的原子数<sup>[13](https://arxiv.org/abs/2410.20538)</sup>。这就是为什么奇异的算法只有理论意义，而实际计算使用经典方法，并在大规模时使用几层施特拉森递归。

## 实际计算

稠密矩阵乘法被标准化为基础线性代数子程序（BLAS）的GEMM例程。第3级例程计算 \( C := \alpha \cdot \mathrm{op}(A) \cdot \mathrm{op}(B) + \beta \cdot C \)，其中 \( \mathrm{op}(X) \) 为 \( X \) 或其转置，有单精度、双精度和复数精度变体<sup>[1](https://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f_source.html)</sup>。GotoBLAS及其后继OpenBLAS等高性能实现把计算组织为围绕三级缓存的分块循环，中心是一个调优的微内核<sup>[9](https://arxiv.org/abs/1605.01078)</sup>。

**通信限制。** 孔和洪于1981年证明，在快速存储器大小为 \( M \) 的机器上，对常规 \( O(n^{3}) \) 算法的任何重组都必须在快速与慢速存储器之间移动 \( \Omega(n^{3}/\sqrt{M}) \) 个字，而分块算法达到这一界<sup>[14](https://arxiv.org/abs/0905.2485)</sup>。这一结果决定了实际实现如何围绕缓存层次组织循环。

**库中的施特拉森。** 实际的施特拉森实现递归地应用几层算法，直到子问题小到调优的经典GEMM更快为止；在以前的实现中，单颗x86核心上双精度方阵的切换点通常高达2000，而BLIS实现将其降至低至500<sup>[9](https://arxiv.org/abs/1605.01078)</sup>。快速算法在数值上是稳定的，但其误差界略弱于经典算法，这在历史上阻碍了它们的使用，即使在能带来性能收益的场合也是如此<sup>[2](https://arxiv.org/abs/1507.00687)</sup>。

## 硬件与应用

矩阵乘法是现代计算的算术核心。GPU拥有大量小型高效核心，专为矩阵乘法、图像处理和神经网络计算等并行操作而设计<sup>[15](https://www.itpro.com/hardware/30399/what-is-a-gpu)</sup>。英伟达的CUDA生态通过cuBLAS库以及CUTLASS——一套跨CUDA栈各层的高性能GEMM的C++模板抽象集合——提供GEMM<sup>[16](https://docs.nvidia.com/cuda/cublas/index.html?trk=public_post_comment-text)</sup><sup> • </sup><sup>[17](https://docs.nvidia.com/cutlass/index.html)</sup>。

在CPU上，英特尔和AMD发布了ACE扩展，这一标准复用AVX10寄存器，但增加了专用于矩阵乘法的硅电路，针对的是AVX在设计时并未考虑二维矩阵运算这一事实；对于相同数量的输入向量，ACE执行的操作数可达AVX10的16倍<sup>[6](https://www.tomshardware.com/pc-components/cpus/intel-and-amds-new-ace-cpu-extensions-bring-an-efficient-ai-oriented-instruction-set-to-x86-a-new-design-makes-matrix-multiplication-more-power-and-density-efficient)</sup>。在统计学习中，矩阵乘法出现在线性回归和神经网络中，典型实现通过CUDA在GPU上运行<sup>[18](https://www.sfu.ca/stat-actsci/undergraduate/all-undergrad/research/USRA-projects/USRA-2026/usra-elliott-bmm-2026.html)</sup>。

## References

1. [SGEMM source documentation, Netlib LAPACK](https://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f_source.html)
2. [Improving the numerical stability of fast matrix multiplication, Ballard et al., arXiv](https://arxiv.org/abs/1507.00687)
3. [More Asymmetry Yields Faster Matrix Multiplication, Alman, Duan, Vassilevska Williams, Xu, Xu, Zhou, arXiv](https://arxiv.org/abs/2404.16349)
4. [Improving the matrix multiplication exponent with modern optimization and AlphaEvolve, Dupont et al., arXiv](https://arxiv.org/abs/2608.16884)
5. [Matrices and determinants, MacTutor History of Mathematics, University of St Andrews](https://mathshistory.st-andrews.ac.uk/HistTopics/Matrices_and_determinants/)
6. [Intel and AMD's new ACE CPU extensions bring an efficient AI-oriented instruction set to x86, Tom's Hardware](https://www.tomshardware.com/pc-components/cpus/intel-and-amds-new-ace-cpu-extensions-bring-an-efficient-ai-oriented-instruction-set-to-x86-a-new-design-makes-matrix-multiplication-more-power-and-density-efficient)
7. [When was Matrix Multiplication invented?, O. Knill, Harvard University](https://people.math.harvard.edu/~knill/history/matrix/)
8. [A Journey through the History of Numerical Linear Algebra, SIAM Publications](https://epubs.siam.org/doi/book/10.1137/1.9781611977233)
9. [Implementing Strassen's Algorithm with BLIS, Huang et al., arXiv](https://arxiv.org/abs/1605.01078)
10. [Multiplying matrices in O(n^2.373) time, Vassilevska Williams, MIT CSAIL](https://people.csail.mit.edu/virgi/matrixmult-f.pdf)
11. [On the Asymptotic Complexity of Matrix Multiplication, Coppersmith and Winograd, SIAM Journal on Computing](https://epubs.siam.org/doi/10.1137/0211038)
12. [New Bounds for Matrix Multiplication: from Alpha to Omega, Vassilevska Williams, Xu, Xu, Zhou, arXiv](https://arxiv.org/abs/2307.07970)
13. [Improving the Leading Constant of Matrix Multiplication, arXiv](https://arxiv.org/abs/2410.20538)
14. [Minimizing Communication in Linear Algebra, Ballard, Demmel et al., arXiv](https://arxiv.org/abs/0905.2485)
15. [What is a GPU?, ITPro](https://www.itpro.com/hardware/30399/what-is-a-gpu)
16. [cuBLAS documentation, NVIDIA](https://docs.nvidia.com/cuda/cublas/index.html?trk=public_post_comment-text)
17. [CUTLASS documentation, NVIDIA](https://docs.nvidia.com/cutlass/index.html)
18. [Benchmarking matrix multiplication on the GPU, Simon Fraser University Statistics and Actuarial Science](https://www.sfu.ca/stat-actsci/undergraduate/all-undergrad/research/USRA-projects/USRA-2026/usra-elliott-bmm-2026.html)
19. [Fast Matrix Multiplication: Limitations of the Laser Method](https://arxiv.org/abs/1411.5414)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 17, 2026; Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Linear and multilinear algebra › Matrix theory › Matrix operations and matrix algebra

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/matrix-multiplication

English original: https://www.edgepedia.org/matrix-multiplication
