0% found this document useful (0 votes)
20 views15 pages

Slide 04b

This document discusses divide and conquer algorithms for matrix multiplication. It introduces Strassen's algorithm, which improves on the standard O(n^3) matrix multiplication algorithm by multiplying 2x2 matrices using only 7 multiplications instead of 8. This reduction allows Strassen's algorithm to multiply nxn matrices in O(n^lg7) time using recursion and partitioning the matrices. The document explains the recursive steps and uses the master method to analyze the time complexity.

Uploaded by

basit faisal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views15 pages

Slide 04b

This document discusses divide and conquer algorithms for matrix multiplication. It introduces Strassen's algorithm, which improves on the standard O(n^3) matrix multiplication algorithm by multiplying 2x2 matrices using only 7 multiplications instead of 8. This reduction allows Strassen's algorithm to multiply nxn matrices in O(n^lg7) time using recursion and partitioning the matrices. The document explains the recursive steps and uses the master method to analyze the time complexity.

Uploaded by

basit faisal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

Chapter 4 Divide and Conquer

Masroor Hussain
Professor
Faculty of Computer Science and Engineering

1
2
Recursion
• Whenever a recurrence is stated without an explicit base case, we assume that the
recurrence is algorithmic.

3
Strassen’s algorithm

for matrix multiplication

4
Standard Matrix Multiplication
Recap

5
Strassen’s Matrix Multiplication

• The standard matrix multiplication algorithm of two n × n


matrices takes O(n3) operations.
• Strassen’s algorithm is a Divide-and-Conquer algorithm that
is asymptotically faster, i.e. O(nlg 7).
• The usual multiplication of two 2 × 2 matrices takes 8
multiplications and 4 additions.
• Strassen showed how two 2 × 2 matrices can be multiplied
using only 7 multiplications and 18 additions.

6
Motivation
• For 2 × 2 matrices, there is no benefit in using the method.
• To see where this is of help, think about multiplication two
(2k) × (2k) matrices.
• For this problem, the scalar multiplications and additions
become matrix multiplications and additions.
• An addition of two matrices requires O(k2) time, a
multiplication requires O(k3).
• Hence, multiplications are much more expensive and it
makes sense to trade one multiplication operation for 18
additions.

7
Recursive Matrix Multiplication

• Suppose that we partition each of A, B, and C into four n/2 x n/2


matrices

• Here

8
Recursive Matrix
Multiplication..

T(n)=?

9
Time complexities
• Recursive Matrix Multiplication

• Strassen’s Matrix Multiplication

10
Strassen’s Algorithm

11
OR …

12
Show?

13
Complexity
• T(n) = 7 T(n/2) +cn2
• The solution works out to be: T(n) = (nlg 7) = O(n2.81) by
applying master’s method.
• Currently, the best known algorithm was given by
Coppersmith and Winograd and has time complexity
O(n2.376).

14
?

15

You might also like