# Strassen算法

Strassen算法是一种递归的矩阵乘法方法，它用七次半尺寸子矩阵的乘法代替常规方法的八次乘法，将两个\( n \times n \)矩阵相乘的算术代价从\( O(n^{3}) \)降至\( O(n^{\log_{2} 7}) \)，约合\( O(n^{2.807}) \)。Volker Strassen于1969年在论文《高斯消元法并非最优》（*Gaussian elimination is not optimal*，Numerische Mathematik 13, pp. 354–356）中发表了该算法，这是第一个渐近复杂度低于三次方的矩阵乘法算法。<sup>[1](https://cir.nii.ac.jp/crid/1362825893342127872)</sup><sup> • </sup><sup>[2](https://epubs.siam.org/doi/10.1137/1.9780898718027.ch23)</sup>

| 关键事实 | 详情 |
|---|---|
| 发表 | Volker Strassen，《高斯消元法并非最优》，Numerische Mathematik 13(4): 354–356，1969年8月，DOI 10.1007/BF02165411<sup>[1](https://cir.nii.ac.jp/crid/1362825893342127872)</sup> |
| 基本情况 | 一对2×2矩阵用7次乘法和18次加减法相乘，而非通常的8次乘法和4次加法<sup>[2](https://epubs.siam.org/doi/10.1137/1.9780898718027.ch23)</sup> |
| 复杂度 | \( n \times n \)矩阵需要\( O(n^{\log_{2} 7}) \approx O(n^{2.807}) \)次算术运算<sup>[2](https://epubs.siam.org/doi/10.1137/1.9780898718027.ch23)</sup> |
| 基本情况的最优性 | Hopcroft与Kerr合作给出证明，Winograd则独立证明了2×2乘法至少需要7次乘法，因此\( R(\langle 2,2,2 \rangle) = 7 \)<sup>[3](https://github.com/solven-eu/matmulcatalog/blob/master/REFERENCES.md)</sup> |
| Winograd变体 | Winograd（1971）将递归步骤从18次子矩阵加法减至15次，降低了隐藏常数<sup>[4](https://jianyuhuang.com/papers/thesis.pdf)</sup> |
| 并行通信 | CAPS并行化达到了已证明的通信下界，在Cray XT4上以\( n = 94080 \)、49至7203个节点运行时，比此前的算法快24%至184%<sup>[5](https://arxiv.org/abs/1202.3173)</sup> |
| 数值稳定性 | Brent给出的Strassen算法误差界为\( O(n^{\log_{2} 12}) \)，大于经典算法的\( O(n^{3}) \)型误差界<sup>[6](https://www.digizeitschriften.de/download/pdf/362160546_0036/log9.pdf)</sup> |

## 2×2恒等式与递归

Strassen方法将矩阵\( A \)、\( B \)和\( C = AB \)各划分为四个等大小的块，用七次半尺寸子矩阵乘法而非分块公式所需的八次乘法来构成乘积。这七个乘积是各块的线性组合，因此节省的一次乘法以额外的加法为代价：基本情况使用7次乘法和18次加减法，而非8次乘法和4次加法。<sup>[2](https://epubs.siam.org/doi/10.1137/1.9780898718027.ch23)</sup>这些公式对一般的分块2×2矩阵均成立，而不限于标量元素，这正是递归得以实现的原因。<sup>[2](https://epubs.siam.org/doi/10.1137/1.9780898718027.ch23)</sup>

递归地应用该步骤得到递推式\( T(n) = 7 \cdot T(n/2) + O(n^{2}) \)，其解为\( O(n^{\log_{2} 7}) \)。一层Strassen将乘法工作量从\( 2mnk \)次浮点运算降至约\( (7/8) \cdot 2mnk \)次浮点运算，代价是低阶数量的额外加法。<sup>[7](https://arxiv.org/abs/1605.01078)</sup>公式中的系数仅为\( \pm 1 \)，因此该算法适用于任何域，且不要求交换律。<sup>[3](https://github.com/solven-eu/matmulcatalog/blob/master/REFERENCES.md)</sup>

在这一尺寸上，节省无法进一步推进。Hopcroft与Kerr（康奈尔技术报告TR 69-44，1969年9月，1971年发表于SIAM Journal on Applied Mathematics）以及Shmuel Winograd（1971）证明了两个2×2矩阵相乘至少需要7次乘法，即使假定交换律也是如此，因此Strassen的计数恰好是紧的。<sup>[3](https://github.com/solven-eu/matmulcatalog/blob/master/REFERENCES.md)</sup><sup> • </sup><sup>[8](https://epubs.siam.org/doi/10.1137/0120004)</sup>

## Winograd变体与后续算法

Winograd将基本情况改进为7次乘法和15次加法，降低了渐近界中的隐藏常数；由此得到的Strassen–Winograd算法是大多数实际实现所采用的。<sup>[4](https://jianyuhuang.com/papers/thesis.pdf)</sup><sup> • </sup><sup>[9](https://doi.org/10.1145/3364504)</sup>许多后续算法改进了渐近指数，但大多带有非常大、往往是巨大的隐藏常数。因此，Strassen–Winograd的\( O(n^{\log_{2} 7}) \)算法在所有可行的矩阵维度上往往优于其他快速矩阵乘法算法。<sup>[9](https://doi.org/10.1145/3364504)</sup>

矩阵乘法的指数，记作\( \omega \)，是使\( n \times n \)乘法需要\( n^{\omega + o(1)} \)次算术运算的最小值。Strassen的结果给出\( \omega \le \log_{2} 7 \approx 2.807 \)。后来的界包括Pan的三线性聚合（1978，\( \omega \le 2.78 \)）、Bini的边界秩方法（1979，\( \omega \le 2.7799 \)）、Schönhage的τ定理（1981，\( \omega \le 2.522 \)）以及Coppersmith–Winograd框架（1990，\( \omega \le 2.376 \)）；研究文献中引用的最新结果取\( \omega < 2.371339 \)。<sup>[3](https://github.com/solven-eu/matmulcatalog/blob/master/REFERENCES.md)</sup><sup> • </sup><sup>[10](https://www.sciencedirect.com/science/article/abs/pii/S0747717125001051)</sup>这些Strassen之后的改进被形容为银河级的：它们与朴素算法的交叉点位于远超任何物理可实现尺寸的规模上。<sup>[11](https://github.com/solven-eu/matmulcatalog/blob/master/paper/theory/REVIEW.md)</sup>

## 通信代价与并行化

仅凭算术运算次数已无法预测现代机器上的运行时间，因为数据在存储层次结构中移动以及在处理器之间传输所耗费的时间和能量超过计算本身。Grey Ballard（当时在加州大学伯克利分校）、James Demmel（加州大学伯克利分校）、Olga Holtz（加州大学伯克利分校与柏林工业大学）和Oded Schwartz（耶路撒冷希伯来大学）利用Strassen算法计算图的膨胀性质，证明了该算法通信代价的首批下界；在分布式存储机器上，带宽代价为\( \Omega\left(\left(\frac{n}{M^{1/2}}\right)^{\omega_{0}} \cdot \frac{M}{P}\right) \)，其中\( \omega_{0} = \log_{2} 7 \)，\( P \)为处理器数，\( M \)为本地存储大小。<sup>[12](https://doi.org/10.1145/2556647.2556660)</sup><sup> • </sup><sup>[5](https://arxiv.org/abs/1202.3173)</sup>在串行情形下，自然的递归实现已经达到这些界，因此是通信最优的；此前的并行算法则不是。<sup>[5](https://arxiv.org/abs/1202.3173)</sup>

Ballard、Demmel、Holtz、Benjamin Lipshitz和Schwartz提出的通信避免并行Strassen（CAPS）算法达到了这些下界，因此是通信最优的。它以交替的广度优先步骤和深度优先步骤遍历递归树：前者将七个子问题分配给不相交的处理器组，后者依次在每个子问题上使用所有处理器。在Cray XT4上以固定维度\( n = 94080 \)进行基准测试，当节点数从49增至7203时，它比此前的经典算法和基于Strassen的算法快24%至184%，并在最大可能范围内展现出完美的强扩展性。<sup>[5](https://arxiv.org/abs/1202.3173)</sup><sup> • </sup><sup>[13](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2012/EECS-2012-90.html)</sup>在调优运行中，Strassen步骤的最优数目始终为5或6。<sup>[5](https://arxiv.org/abs/1202.3173)</sup>

## 实际实现

Strassen算法以访存局部性下降为代价，降低了算术复杂度，这使得在具有深层存储层次的机器上高效实现颇具挑战。<sup>[14](https://users.cs.duke.edu/~alvy/papers/sc98/index.htm)</sup>实际实现会应用若干层Strassen递归，一旦子矩阵变小便切换到优化的经典内核，例如高性能DGEMM。在此前的实现中，单核x86上双精度方阵的切换点通常高达2000；基于BLIS的实现将切换点降至500。<sup>[7](https://arxiv.org/abs/1605.01078)</sup>

BLIS的工作还推翻了若干传统观念：Strassen即使对小方阵也能胜过经典gemm；对于内维较小的秩为k的更新（一种对LAPACK重要的形状）也能达到高性能；它不需要常规DGEMM实现中已有缓冲区之外的额外工作空间；并且可以与标准BLAS gemm接口即插即用，同时纳入现有的多线程机制。<sup>[7](https://arxiv.org/abs/1605.01078)</sup>曼彻斯特大学数值分析教授Nicholas J. Higham此前在研究快速三级BLAS例程的工作中得出结论：一旦矩阵维度超过约100，Strassen方法便是一种实用的技术，快速例程足够稳定，值得在许多应用中认真考虑，尽管它们不如常规实现那样强稳定。<sup>[15](https://research.manchester.ac.uk/en/publications/exploiting-fast-matrix-multiplication-within-the-level-3-blas/)</sup>

## 数值稳定性

额外的加减法，尤其是大而近乎相等的量之间的减法，使误差表现变差。Brent得到了Strassen算法的误差界\( O(n^{\log_{2} 12}) \)，而对该算法的改进只能以显著增大误差界为代价来进一步降低指数。<sup>[6](https://www.digizeitschriften.de/download/pdf/362160546_0036/log9.pdf)</sup><sup> • </sup><sup>[16](https://www.cs.utsa.edu/~atc/pub/J42.pdf)</sup>后来的分析表明，一大类快速递归算法（包括Strassen算法）在范数意义上是稳定的。<sup>[17](https://arxiv.org/abs/math/0612264)</sup>为提高稳定性而提出的技术包括输入缩放、在递归树的不同节点上应用不同算法以及旋转方案；将Strassen与精确内积（EDP）相结合已被证明能同时实现更高的速度和更好的精度。<sup>[18](https://www.comp.nus.edu.sg/~wongwf/papers/HiPC-2018.pdf)</sup>

## References

1. [Volker Strassen (1969). Gaussian elimination is not optimal. Numerische Mathematik 13(4), 354–356.](https://cir.nii.ac.jp/crid/1362825893342127872)
2. [Nicholas J. Higham. Accuracy and Stability of Numerical Algorithms, Chapter 23: Fast Matrix Multiplication, SIAM.](https://epubs.siam.org/doi/10.1137/1.9780898718027.ch23)
3. [matmulcatalog REFERENCES.md, solven-eu GitHub repository.](https://github.com/solven-eu/matmulcatalog/blob/master/REFERENCES.md)
4. [Jianyu Huang, thesis, Section 2.2.1 Theory.](https://jianyuhuang.com/papers/thesis.pdf)
5. [Grey Ballard, James Demmel, Olga Holtz, Benjamin Lipshitz, Oded Schwartz. Communication-Optimal Parallel Algorithm for Strassen's Matrix Multiplication, arXiv:1202.3173.](https://arxiv.org/abs/1202.3173)
6. [Stability of Fast Algorithms, Numerische Mathematik volume PDF.](https://www.digizeitschriften.de/download/pdf/362160546_0036/log9.pdf)
7. [Jianyu Huang, Tyler M. Smith, Greg M. Henry, Robert A. van de Geijn. Implementing Strassen's Algorithm with BLIS, arXiv:1605.01078.](https://arxiv.org/abs/1605.01078)
8. [J. E. Hopcroft, L. R. Kerr. On minimizing the number of multiplications necessary for matrix multiplication, SIAM J. Appl. Math. 20(1):30–36, 1971.](https://epubs.siam.org/doi/10.1137/0120004)
9. [Elaye Karstadt, Oded Schwartz. Matrix Multiplication, a Little Faster, Journal of the ACM 67(1), 2020.](https://doi.org/10.1145/3364504)
10. [Fast in-place accumulation, Journal of Symbolic Computation, ScienceDirect.](https://www.sciencedirect.com/science/article/abs/pii/S0747717125001051)
11. [matmulcatalog paper/theory REVIEW.md, solven-eu GitHub repository.](https://github.com/solven-eu/matmulcatalog/blob/master/paper/theory/REVIEW.md)
12. [Grey Ballard, James Demmel, Olga Holtz, Oded Schwartz. Communication costs of Strassen's matrix multiplication, Communications of the ACM 57(2):107–114, 2014.](https://doi.org/10.1145/2556647.2556660)
13. [Benjamin Lipshitz, Grey Ballard, Oded Schwartz, James Demmel. Communication-Avoiding Parallel Strassen: Implementation and Performance, UCB/EECS-2012-90.](https://www2.eecs.berkeley.edu/Pubs/TechRpts/2012/EECS-2012-90.html)
14. [Mithuna Thottethodi, Siddhartha Chatterjee, Alvin R. Lebeck. Tuning Strassen's Matrix Multiplication for Memory Efficiency, SC98.](https://users.cs.duke.edu/~alvy/papers/sc98/index.htm)
15. [Nicholas J. Higham. Exploiting fast matrix multiplication within the level 3 BLAS, ACM Transactions on Mathematical Software 16(4), 1990.](https://research.manchester.ac.uk/en/publications/exploiting-fast-matrix-multiplication-within-the-level-3-blas/)
16. [Error-bound discussion of Strassen's algorithm and refinements, UTSA technical report PDF.](https://www.cs.utsa.edu/~atc/pub/J42.pdf)
17. [Fast linear algebra is stable, arXiv:math/0612264.](https://arxiv.org/abs/math/0612264)
18. [Making Strassen Matrix Multiplication Safe, HiPC 2018.](https://www.comp.nus.edu.sg/~wongwf/papers/HiPC-2018.pdf)

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

Topic: 物质世界与数学 › 数学与统计学 › 数与代数 › Linear and multilinear algebra › Numerical linear algebra › Complexity of matrix computations

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/strassen-algorithm

English original: https://www.edgepedia.org/strassen-algorithm
