Loading...
| 1 | 2 |
| 0 | 3 |
| 4 | 2 |
| -4 | -3 |
1function strassen(A, B):2 if n == 1: return A*B3 partition A,B into 4 submatrices4 compute 7 products P1..P75 combine into result matrix C6 return CStrassen's algorithm is only efficient for very large matrices. For smaller ones, the overhead of extra additions and memory allocation for submatrices makes it slower than the standard $O(n^3)$ triple-loop.