Loading...
Interactively observe computation of M1..M7 and how they recombine to form the result matrix.
-2 | -1 |
-4 | 1 |
0 | -2 |
-4 | -1 |
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 C
Eight naive sub-matrix multiplications become seven via pre-combined sums/differences forming M1..M7; additional additions/subtractions are offset for large n. This visualization limits recursion depth for clarity (4x4 performs one split then 2x2 base).