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

DAA ppt-555

Uploaded by

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

DAA ppt-555

Uploaded by

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

Strassens Matrix Multiplication

Method With Example And Its


Complexity

PRESENTED BY –
S.ANJITHA REDDY-
227R1A0555
Introduction to Strassen's Method

• Strassen's algorithm is an efficient method for multiplying


matrices.

• It reduces the number of necessary multiplications


compared to the standard method.

• This algorithm is particularly useful for large matrices.


Background on Matrix Multiplication

Let A and B be two n × n matrices.


The product C = A × B will also be an n × n matrix.
The pseudocode for multiplying two n × n matrices has been given below.
for i := 1 to n do
for j :=1 to n do
c[i, j] := 0;
for K: = 1 to n do
C[i, j] := C[i, j] + A[i, k] * B[k, j];
• Let us consider the matrices of order 2 × 2.

• The matrix C elements will be computed as follows.


 C11 = A11 B11 + A12 B21
 C12 = A11B12 + A12 B22
 C21 = A21 B11 + A22 B21
 C22 = A21 B12 + A22 B22
• The above computation process needs 8 multiplications of n/2 × n/2
matrices and 4 additions of n/2 × n/2 matrices.
• The two n/2 × n/2 matrices can be added in time cn 2 for some constant c.
• The over all computing time T(n) will be

 b if n 2
T (n)  2
8T ( n / 2)  cn if n  2

• Since the matrix multiplications are more expensive than the matrix additions we
can reformulate the equations for Cij that will have fewer multiplications and
possibly more additions.

• Volkar Strassen has discovered a way to compute C ij using 7 multiplications and


18 additions or subtractions.
• Let us consider the matrices of order 2 × 2.

• His method involves first computation of seven n/2 × n/2 matrices P,


Q, R, S, T, U and V.
• Then the Cij’s will be computed using the below formulae.

• C11 = P+S-T+V
• C12 = R+T
• C21 = Q+S
• C22 = P+R-Q+U
• The values for P, Q, R, S, T, U and V will be computed as follows.

• P = (A11 + A22)(B11 + B22)

• Q = (A21 + A22)B11

• R = A11(B12 - B22)

• S = A22(B21 - B11)

• T = (A11 + A12)B22

• U = (A21 - A11)(B11 + B12)

• V = (A12 - A22)(B21 + B22)


 b , n 2
• The T(n) =
resulting recurrence
7T(n/2)+cn , n > 2 for
relation
2
Strassen ’s matrix multiplication is given by
• TIME COMPLEXITY ANALYSIS

T ( n) 7T(n/2) + cn 2 1

T(n/2) = 7T(n/4)+c2

T(n/4) = 7T(n/8)+c 3

sub eq 2 in eq 1

T(n) = 7(7T(n/4)+cc4

sub eq 3 in eq 4

T(n) = 7[7(7T(n/8)+cc]+ c
= T(n/8)+ c + c

= T(n/ )+ c[+

T(n/ )+ c[ let n =
k=
= T(/ )+ c[

= T(1)+ c[

= T(1)+ c[

= T(1)+ c[
= T(1)+ c[

= T(1)+ c[

Substituting the value of a and b we have

= n2.81

T(n) = O (n2.81)
The number 2.81 may not seem much smaller than 3, but because
the difference is in the exponent, the impact on running time is
significant.

In fact, Strassen’s algorithm beats the ordinary algorithm on today’s


machines for n 30 or so.
Solution

C11 = P+S-T+V = 26
C12 = R+T=14
C21 = Q+S = 33
C22 = P+R-Q+U = 19
Practical Applications

• Strassen's method is used in various applications requiring


matrix multiplication.

• It is particularly beneficial in computer graphics and


scientific computing.

• The algorithm's efficiency makes it suitable for large data


sets.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy