Strassens
Strassens
18
where
The value C00 can be computed either as A00 * B00 + A01 * B10 or as M1 + M4 − M5 + M7
where M1, M4, M5, and M7 are found by Strassen’s formulas, with the numbers replaced by the
corresponding submatrices. The seven products of n/2 × n/2 matrices are computed recursively by
Strassen’s matrix multiplication algorithm.
Since n = 2k,
M(2k) = 7M(2k−1)
= 7[7M(2k−2)]
= 72M(2k−2)
=...
CS6402 __ Design and Analysis of Algorithms _ Unit II _____2.19
= 7iM(2k−i)
=...
= 7kM(2k−k) = 7kM(20) = 7kM(1) = 7k(1) (Since M(1)=1)
M(2k) = 7k.
Since k = log2 n,
M(n) = 7log2 n
= nlog2 7
≈ n2.807
which is smaller than n3 required by the brute-force algorithm.
Since this savings in the number of multiplications was achieved at the expense of making
extra additions, we must check the number of additions A(n) made by Strassen’s algorithm. To
multiply two matrices of order n>1, the algorithm needs to multiply seven matrices of order n/2
and make 18 additions/subtractions of matrices of size n/2; when n = 1, no additions are made since
two numbers are simply multiplied. These observations yield the following recurrence relation:
A(n) = 7A(n/2) + 18(n/2)2 for n > 1, A(1) = 0.
By closed-form solution to this recurrence and the Master Theorem, A(n) ∈ Θ(nlog2 7). which is a
better efficiency class than Θ(n3)of the brute-force method.
Example: Multiply the following two matrices by Strassen’s matrix multiplication algorithm.
A=[ ] B=[ ]
Answer:
C=[ ]= [ ]x[ ]
− − −
M2 = [ ], M3= [ ], M4= [ ], M5= [ ], M6= [ ], M7= [ ]
− − − − −
−
C00= [ ], C01= [ ], C10= [ ], C11= [ ]
C=[ ] =[ ]