1.
Stassen’s Matrix multiplication
Direct Method:Suppose we want to multiply two n x n matrices, A and B.Their product,
C=AB, will be an n by n matrix and will therefore have n2 elements. The number of
multiplications involved in producing the product in this way is Θ(n3)
Divide and Conquermethod: Using the divide and conquer matrix multiplication is
achieved through multiplying the submatrices recursively.
In the above method, we do
8 multiplications for matrices of size n/2 x n/2 and 4 additions.
Addition of two matrices takes O(n2) time. So the time complexity can be written asT(n) =
8T(n/2) + O(n2) which happe nto be O(n3); same as the direct method
Divide and Conquer through Strassen’s Method:By using divide-and-conquer approach
proposed by Strassen in 1969, we can reduce thenumber of multiplications.
Multiplication of 2×2 matrices:The principal insightof the algorithm lies in the discovery
that we can find the product C of two 2 × 2 matricesA and B with just 7 multiplications as
opposed to the eight requiredby the brute-force algorithm. This is accomplishedby using the
following formulas:
where
Thus, to multiply two 2×2 matrices, Strassen’s algorithm makes seven multiplications and
18 additions/subtractions, whereas the brute-force algorithm requires eight multiplications
and four additions.
Multiplication of n×n matrices: Let A and B be two n × n matrices where n is a power of
2. (If n is not a powerof 2, matrices can be padded with rows and columns of zeros.) We can
divide A,B, and their product C into four n/2 × n/2 submatrices each as follows:
It is not difficult to verify that one can treat these submatrices as numbers toget the correct
product. For example, C00 can be computed as M1 + M4– M5 + M7 where M1, M4, M5, and M7
are found byStrassen’s formulas, with the numbers replaced by the corresponding
submatrices.If the seven products of n/2 × n/2 matrices are computed recursively by the
samemethod, we have Strassen’s algorithm for matrix multiplication.
Analysis( fromtext book T1: Levtin et al )
Here the basic operation is multiplication. If M(n) is thenumber of multiplications
made by Strassen’s algorithm in multiplying two n × nmatrices (where n is a power of
2), we get the following recurrence relation for it:
This implies M(n) = Θ(n2.807)which is smaller than n3 required by the brute-force algorithm.
Analysis( From T2: Horowitz et al )
Suppose if we consider both multiplication and addition. The resulting recurrence
ration T(n) is
Note: No. of addition/ subtraction
Operations18(n/2)2= an2