SlideShare a Scribd company logo
1 of 12
Strassen’s Matrix Multiplication
meghav@kannuruniv.ac.in 1
Presented By
Megha V
Research Scholar
Dept. of IT
Kannur University
Strassen’s Matrix Multiplication
› Belongs to Divide and Conquer Paradigm
› How Matrix Multiplication done Normally
› How divide and Conquer strategy applied for matrix
multiplication
› What Strassen had done to improve matrix multiplication
using divide and conquer strategy
meghav@kannuruniv.ac.in 2
Matrix Multiplication
A=
𝑎11 𝑎12
𝑎21 𝑎22
× B
𝑏11 𝑏12
𝑏21 𝑏22
2× 2 2× 2
= C =
𝑐11 𝑐12
𝑐21 𝑐22
2 × 2
Cij = 𝑘=1
𝑛
𝐴𝑖𝑘 × 𝐵𝑖𝑘
meghav@kannuruniv.ac.in 3
Matrix Multiplication (contd.)
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
C[i,j]=0;
C[i,j] = A[i,k] × B[k,j];
}
}
Time Complexity of Matrix multiplication is O(n3)
meghav@kannuruniv.ac.in 4
Divide and Conquer strategy for matrix
multiplication
A=
𝑎11 𝑎12
𝑎21 𝑎22
× B
𝑏11 𝑏12
𝑏21 𝑏22
2× 2 2× 2
= C =
𝑐11 𝑐12
𝑐21 𝑐22
2 × 2
› Multiplying a 2 × 2 matrix is a small problem
› 𝑐11 = 𝑎11 × 𝑏11+𝑎12 × 𝑏21
› 𝑐12 = 𝑎11 × 𝑏12+𝑎12 × 𝑏22
› 𝑐21 = 𝑎21 × 𝑏11+𝑎22 × 𝑏21
› 𝑐22 = 𝑎21 × 𝑏12+𝑎22 × 𝑏22
meghav@kannuruniv.ac.in 5
Divide and Conquer strategy for matrix
multiplication (contd.)
› If each addition term takes one unit of time, then total time is
4 unit, it’s a constant
› If there are 8 multiplications and take 8 unit of time, it is also
a constant.
› These 4 formulas take constant time.
› If we want to reduce the problem into 1x1 matrix
A = [a11], B = [b11]
A x B =C
C= [a11* b11]
meghav@kannuruniv.ac.in 6
Divide and Conquer strategy for matrix
multiplication (contd.)
› If the row/column size is grater than 2, we need to divide
the problem and solve each single problem
› We take the problem or assume the problem as power of
2.
› If the matrix is not power of 2 then we make it as power
of 2 by adding 0’s
meghav@kannuruniv.ac.in 7
Divide and Conquer strategy for matrix
multiplication (contd.)
A11 A12 B11 B12
A=
𝑎11 𝑎12 𝑎13 𝑎14
𝑎21 𝑎22 𝑎23 𝑎24
𝑎31 𝑎32 𝑎33 𝑎34
𝑎41 𝑎42 𝑎43 𝑎44
× B
𝑏11 𝑏12 𝑏13 𝑏14
𝑏21 𝑏22 𝑏23 𝑏24
𝑏31 𝑏32 𝑏33 𝑏34
𝑏41 𝑏42 𝑏43 𝑏44
A21 A22 4/2 × 4/2 B21 B22 4/2 × 4/2
A11 A12
= C =
𝑐11 𝑐12 𝑐13 𝑐14
𝑐21 𝑐22 𝑐23 𝑐24
𝑐31 𝑐32 𝑐33 𝑐34
𝑐41 𝑐42 𝑐43 𝑐44
A11 A12 4/2 × 4/2
Here A and B are divided into four 2x2 matrices
meghav@kannuruniv.ac.in 8
Divide and Conquer strategy for matrix
multiplication (contd.)
› Algorithm of divide and conquer matrix multiplication
Algorithm MM(A,B,n)
{
if(n≤2)
{
𝑐11 = 𝑎11 × 𝑏11+𝑎12 × 𝑏21
𝑐12 = 𝑎11 × 𝑏12+𝑎12 × 𝑏22
𝑐21 = 𝑎21 × 𝑏11+𝑎22 × 𝑏21
𝑐22 = 𝑎21 × 𝑏12+𝑎22 × 𝑏22
}
else
{
MM(A11,B11,n/2)+ MM(A12,B21,n/2)
MM(A11,B12,n/2)+ MM(A12,B22,n/2)
MM(A21,B11,n/2)+ MM(A22,B21,n/2)
MM(A21,B12,n/2)+ MM(A22,B22,n/2)
}
}
meghav@kannuruniv.ac.in 9
Divide and Conquer strategy for matrix
multiplication (contd.)
› Time Complexity
8 times recursive call is required.
T(n)=
1 n≤2
8𝑇
𝑛
2
+ n2 n>2
Time complexity is θ(n3)
› If we reduce the number of multiplication we can make the
algorithm faster
meghav@kannuruniv.ac.in 10
Strassen’s Matrix Multiplication
› Reduce 8 to 7 multiplication
› Different equations are applied on the four formulas
› No. of multiplication is reduced but addition and subtraction increased.
P= (A11+A22)(B11+B22)
Q=(A21+A22)
R= A11(B12-B22)
S=A22(B21-B11)
T=(A11+A12)B22
U=(A21–A11)(B11+B12)
V=(A12-A22)(B21+B22)
meghav@kannuruniv.ac.in
11
Strassen’s Matrix Multiplication(contd)
C11 = P+S-T+V
C12 = R+T
C21 = Q+S
C22 = P+R-Q+U
Recurrence relation
T(n)=
1 n≤2
8𝑇
𝑛
2
+ n2 n>2
Time complexity is O(n2.81)
meghav@kannuruniv.ac.in 12

More Related Content

What's hot

Optimal binary search tree
Optimal binary search treeOptimal binary search tree
Optimal binary search treeKavya P
 
Lecture optimal binary search tree
Lecture optimal binary search tree Lecture optimal binary search tree
Lecture optimal binary search tree Divya Ks
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using BacktrackingAbhishek Singh
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
The Maximum Subarray Problem
The Maximum Subarray ProblemThe Maximum Subarray Problem
The Maximum Subarray ProblemKamran Ashraf
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy methodhodcsencet
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemMadhu Bala
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithmMohd Arif
 
5.2 divide and conquer
5.2 divide and conquer5.2 divide and conquer
5.2 divide and conquerKrish_ver2
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencySaranya Natarajan
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1Amrinder Arora
 

What's hot (20)

Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
 
Divide and Conquer
Divide and ConquerDivide and Conquer
Divide and Conquer
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
Time andspacecomplexity
Time andspacecomplexityTime andspacecomplexity
Time andspacecomplexity
 
Optimal binary search tree
Optimal binary search treeOptimal binary search tree
Optimal binary search tree
 
Lecture optimal binary search tree
Lecture optimal binary search tree Lecture optimal binary search tree
Lecture optimal binary search tree
 
Time complexity
Time complexityTime complexity
Time complexity
 
sum of subset problem using Backtracking
sum of subset problem using Backtrackingsum of subset problem using Backtracking
sum of subset problem using Backtracking
 
Time and Space Complexity
Time and Space ComplexityTime and Space Complexity
Time and Space Complexity
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
The Maximum Subarray Problem
The Maximum Subarray ProblemThe Maximum Subarray Problem
The Maximum Subarray Problem
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
daa-unit-3-greedy method
daa-unit-3-greedy methoddaa-unit-3-greedy method
daa-unit-3-greedy method
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithm
 
5.2 divide and conquer
5.2 divide and conquer5.2 divide and conquer
5.2 divide and conquer
 
Fundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm EfficiencyFundamentals of the Analysis of Algorithm Efficiency
Fundamentals of the Analysis of Algorithm Efficiency
 
Divide and Conquer - Part 1
Divide and Conquer - Part 1Divide and Conquer - Part 1
Divide and Conquer - Part 1
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 

Similar to Strassen's matrix multiplication

Optimisation.pptx
Optimisation.pptxOptimisation.pptx
Optimisation.pptxguru1561
 
Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)Pramit Kumar
 
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's ClassesIIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's ClassesSOURAV DAS
 
Deep learning paper review ppt sourece -Direct clr
Deep learning paper review ppt sourece -Direct clr Deep learning paper review ppt sourece -Direct clr
Deep learning paper review ppt sourece -Direct clr taeseon ryu
 
Dynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain MultiplicationDynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain MultiplicationKrishnakoumarC
 
Diapositivas yahir villamizar
Diapositivas yahir villamizarDiapositivas yahir villamizar
Diapositivas yahir villamizarYahirVillamizar
 
IIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's ClassesIIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's ClassesSOURAV DAS
 
1.6 Other Types of Equations
1.6 Other Types of Equations1.6 Other Types of Equations
1.6 Other Types of Equationssmiller5
 
1.5 Quadratic Equations.pdf
1.5 Quadratic Equations.pdf1.5 Quadratic Equations.pdf
1.5 Quadratic Equations.pdfsmiller5
 
matrices and determinantes
matrices and determinantes matrices and determinantes
matrices and determinantes gandhinagar
 
Image segmentation using normalized graph cut
Image segmentation using normalized graph cutImage segmentation using normalized graph cut
Image segmentation using normalized graph cutMahesh Dananjaya
 
2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الثالث - تطبيقات التفاضل
 2022 ملزمة الرياضيات للصف السادس التطبيقي   الفصل الثالث - تطبيقات التفاضل 2022 ملزمة الرياضيات للصف السادس التطبيقي   الفصل الثالث - تطبيقات التفاضل
2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الثالث - تطبيقات التفاضلanasKhalaf4
 
Evaluating algebraic expression
Evaluating algebraic expressionEvaluating algebraic expression
Evaluating algebraic expressionMarites Ablay
 
Fractions-Multiplying-Dividing-Demonstration.pptx
Fractions-Multiplying-Dividing-Demonstration.pptxFractions-Multiplying-Dividing-Demonstration.pptx
Fractions-Multiplying-Dividing-Demonstration.pptxJoy Dizon
 
2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث تطبيقات التفاضل
2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث   تطبيقات التفاضل2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث   تطبيقات التفاضل
2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث تطبيقات التفاضلanasKhalaf4
 

Similar to Strassen's matrix multiplication (20)

Optimisation.pptx
Optimisation.pptxOptimisation.pptx
Optimisation.pptx
 
Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)
 
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's ClassesIIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
 
Deep learning paper review ppt sourece -Direct clr
Deep learning paper review ppt sourece -Direct clr Deep learning paper review ppt sourece -Direct clr
Deep learning paper review ppt sourece -Direct clr
 
Dynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain MultiplicationDynamic Programming Matrix Chain Multiplication
Dynamic Programming Matrix Chain Multiplication
 
Diapositivas yahir villamizar
Diapositivas yahir villamizarDiapositivas yahir villamizar
Diapositivas yahir villamizar
 
Matrices
Matrices Matrices
Matrices
 
02 basics i-handout
02 basics i-handout02 basics i-handout
02 basics i-handout
 
Mte (1)
Mte (1)Mte (1)
Mte (1)
 
IIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's ClassesIIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
 
1.6 Other Types of Equations
1.6 Other Types of Equations1.6 Other Types of Equations
1.6 Other Types of Equations
 
1.5 Quadratic Equations.pdf
1.5 Quadratic Equations.pdf1.5 Quadratic Equations.pdf
1.5 Quadratic Equations.pdf
 
matrices and determinantes
matrices and determinantes matrices and determinantes
matrices and determinantes
 
Image segmentation using normalized graph cut
Image segmentation using normalized graph cutImage segmentation using normalized graph cut
Image segmentation using normalized graph cut
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
 
2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الثالث - تطبيقات التفاضل
 2022 ملزمة الرياضيات للصف السادس التطبيقي   الفصل الثالث - تطبيقات التفاضل 2022 ملزمة الرياضيات للصف السادس التطبيقي   الفصل الثالث - تطبيقات التفاضل
2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الثالث - تطبيقات التفاضل
 
Evaluating algebraic expression
Evaluating algebraic expressionEvaluating algebraic expression
Evaluating algebraic expression
 
Fractions-Multiplying-Dividing-Demonstration.pptx
Fractions-Multiplying-Dividing-Demonstration.pptxFractions-Multiplying-Dividing-Demonstration.pptx
Fractions-Multiplying-Dividing-Demonstration.pptx
 
2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث تطبيقات التفاضل
2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث   تطبيقات التفاضل2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث   تطبيقات التفاضل
2022 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث تطبيقات التفاضل
 
Sec 3 A Maths Notes Indices
Sec 3 A Maths Notes IndicesSec 3 A Maths Notes Indices
Sec 3 A Maths Notes Indices
 

More from Megha V

Soft Computing Techniques_Part 1.pptx
Soft Computing Techniques_Part 1.pptxSoft Computing Techniques_Part 1.pptx
Soft Computing Techniques_Part 1.pptxMegha V
 
JavaScript- Functions and arrays.pptx
JavaScript- Functions and arrays.pptxJavaScript- Functions and arrays.pptx
JavaScript- Functions and arrays.pptxMegha V
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScriptMegha V
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception HandlingMegha V
 
Python- Regular expression
Python- Regular expressionPython- Regular expression
Python- Regular expressionMegha V
 
File handling in Python
File handling in PythonFile handling in Python
File handling in PythonMegha V
 
Python programming -Tuple and Set Data type
Python programming -Tuple and Set Data typePython programming -Tuple and Set Data type
Python programming -Tuple and Set Data typeMegha V
 
Python programming –part 7
Python programming –part 7Python programming –part 7
Python programming –part 7Megha V
 
Python programming Part -6
Python programming Part -6Python programming Part -6
Python programming Part -6Megha V
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsMegha V
 
Python programming- Part IV(Functions)
Python programming- Part IV(Functions)Python programming- Part IV(Functions)
Python programming- Part IV(Functions)Megha V
 
Python programming –part 3
Python programming –part 3Python programming –part 3
Python programming –part 3Megha V
 
Parts of python programming language
Parts of python programming languageParts of python programming language
Parts of python programming languageMegha V
 
Python programming
Python programmingPython programming
Python programmingMegha V
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrencesMegha V
 
Algorithm Analysis
Algorithm AnalysisAlgorithm Analysis
Algorithm AnalysisMegha V
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and designMegha V
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmMegha V
 
UGC NET Paper 1 ICT Memory and data
UGC NET Paper 1 ICT Memory and data  UGC NET Paper 1 ICT Memory and data
UGC NET Paper 1 ICT Memory and data Megha V
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGLMegha V
 

More from Megha V (20)

Soft Computing Techniques_Part 1.pptx
Soft Computing Techniques_Part 1.pptxSoft Computing Techniques_Part 1.pptx
Soft Computing Techniques_Part 1.pptx
 
JavaScript- Functions and arrays.pptx
JavaScript- Functions and arrays.pptxJavaScript- Functions and arrays.pptx
JavaScript- Functions and arrays.pptx
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception Handling
 
Python- Regular expression
Python- Regular expressionPython- Regular expression
Python- Regular expression
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
 
Python programming -Tuple and Set Data type
Python programming -Tuple and Set Data typePython programming -Tuple and Set Data type
Python programming -Tuple and Set Data type
 
Python programming –part 7
Python programming –part 7Python programming –part 7
Python programming –part 7
 
Python programming Part -6
Python programming Part -6Python programming Part -6
Python programming Part -6
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
 
Python programming- Part IV(Functions)
Python programming- Part IV(Functions)Python programming- Part IV(Functions)
Python programming- Part IV(Functions)
 
Python programming –part 3
Python programming –part 3Python programming –part 3
Python programming –part 3
 
Parts of python programming language
Parts of python programming languageParts of python programming language
Parts of python programming language
 
Python programming
Python programmingPython programming
Python programming
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
 
Algorithm Analysis
Algorithm AnalysisAlgorithm Analysis
Algorithm Analysis
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and design
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
UGC NET Paper 1 ICT Memory and data
UGC NET Paper 1 ICT Memory and data  UGC NET Paper 1 ICT Memory and data
UGC NET Paper 1 ICT Memory and data
 
Seminar presentation on OpenGL
Seminar presentation on OpenGLSeminar presentation on OpenGL
Seminar presentation on OpenGL
 

Recently uploaded

software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

Strassen's matrix multiplication

  • 1. Strassen’s Matrix Multiplication meghav@kannuruniv.ac.in 1 Presented By Megha V Research Scholar Dept. of IT Kannur University
  • 2. Strassen’s Matrix Multiplication › Belongs to Divide and Conquer Paradigm › How Matrix Multiplication done Normally › How divide and Conquer strategy applied for matrix multiplication › What Strassen had done to improve matrix multiplication using divide and conquer strategy meghav@kannuruniv.ac.in 2
  • 3. Matrix Multiplication A= 𝑎11 𝑎12 𝑎21 𝑎22 × B 𝑏11 𝑏12 𝑏21 𝑏22 2× 2 2× 2 = C = 𝑐11 𝑐12 𝑐21 𝑐22 2 × 2 Cij = 𝑘=1 𝑛 𝐴𝑖𝑘 × 𝐵𝑖𝑘 meghav@kannuruniv.ac.in 3
  • 4. Matrix Multiplication (contd.) for(i=0;i<n;i++) { for(j=0;j<n;j++) { C[i,j]=0; C[i,j] = A[i,k] × B[k,j]; } } Time Complexity of Matrix multiplication is O(n3) meghav@kannuruniv.ac.in 4
  • 5. Divide and Conquer strategy for matrix multiplication A= 𝑎11 𝑎12 𝑎21 𝑎22 × B 𝑏11 𝑏12 𝑏21 𝑏22 2× 2 2× 2 = C = 𝑐11 𝑐12 𝑐21 𝑐22 2 × 2 › Multiplying a 2 × 2 matrix is a small problem › 𝑐11 = 𝑎11 × 𝑏11+𝑎12 × 𝑏21 › 𝑐12 = 𝑎11 × 𝑏12+𝑎12 × 𝑏22 › 𝑐21 = 𝑎21 × 𝑏11+𝑎22 × 𝑏21 › 𝑐22 = 𝑎21 × 𝑏12+𝑎22 × 𝑏22 meghav@kannuruniv.ac.in 5
  • 6. Divide and Conquer strategy for matrix multiplication (contd.) › If each addition term takes one unit of time, then total time is 4 unit, it’s a constant › If there are 8 multiplications and take 8 unit of time, it is also a constant. › These 4 formulas take constant time. › If we want to reduce the problem into 1x1 matrix A = [a11], B = [b11] A x B =C C= [a11* b11] meghav@kannuruniv.ac.in 6
  • 7. Divide and Conquer strategy for matrix multiplication (contd.) › If the row/column size is grater than 2, we need to divide the problem and solve each single problem › We take the problem or assume the problem as power of 2. › If the matrix is not power of 2 then we make it as power of 2 by adding 0’s meghav@kannuruniv.ac.in 7
  • 8. Divide and Conquer strategy for matrix multiplication (contd.) A11 A12 B11 B12 A= 𝑎11 𝑎12 𝑎13 𝑎14 𝑎21 𝑎22 𝑎23 𝑎24 𝑎31 𝑎32 𝑎33 𝑎34 𝑎41 𝑎42 𝑎43 𝑎44 × B 𝑏11 𝑏12 𝑏13 𝑏14 𝑏21 𝑏22 𝑏23 𝑏24 𝑏31 𝑏32 𝑏33 𝑏34 𝑏41 𝑏42 𝑏43 𝑏44 A21 A22 4/2 × 4/2 B21 B22 4/2 × 4/2 A11 A12 = C = 𝑐11 𝑐12 𝑐13 𝑐14 𝑐21 𝑐22 𝑐23 𝑐24 𝑐31 𝑐32 𝑐33 𝑐34 𝑐41 𝑐42 𝑐43 𝑐44 A11 A12 4/2 × 4/2 Here A and B are divided into four 2x2 matrices meghav@kannuruniv.ac.in 8
  • 9. Divide and Conquer strategy for matrix multiplication (contd.) › Algorithm of divide and conquer matrix multiplication Algorithm MM(A,B,n) { if(n≤2) { 𝑐11 = 𝑎11 × 𝑏11+𝑎12 × 𝑏21 𝑐12 = 𝑎11 × 𝑏12+𝑎12 × 𝑏22 𝑐21 = 𝑎21 × 𝑏11+𝑎22 × 𝑏21 𝑐22 = 𝑎21 × 𝑏12+𝑎22 × 𝑏22 } else { MM(A11,B11,n/2)+ MM(A12,B21,n/2) MM(A11,B12,n/2)+ MM(A12,B22,n/2) MM(A21,B11,n/2)+ MM(A22,B21,n/2) MM(A21,B12,n/2)+ MM(A22,B22,n/2) } } meghav@kannuruniv.ac.in 9
  • 10. Divide and Conquer strategy for matrix multiplication (contd.) › Time Complexity 8 times recursive call is required. T(n)= 1 n≤2 8𝑇 𝑛 2 + n2 n>2 Time complexity is θ(n3) › If we reduce the number of multiplication we can make the algorithm faster meghav@kannuruniv.ac.in 10
  • 11. Strassen’s Matrix Multiplication › Reduce 8 to 7 multiplication › Different equations are applied on the four formulas › No. of multiplication is reduced but addition and subtraction increased. P= (A11+A22)(B11+B22) Q=(A21+A22) R= A11(B12-B22) S=A22(B21-B11) T=(A11+A12)B22 U=(A21–A11)(B11+B12) V=(A12-A22)(B21+B22) meghav@kannuruniv.ac.in 11
  • 12. Strassen’s Matrix Multiplication(contd) C11 = P+S-T+V C12 = R+T C21 = Q+S C22 = P+R-Q+U Recurrence relation T(n)= 1 n≤2 8𝑇 𝑛 2 + n2 n>2 Time complexity is O(n2.81) meghav@kannuruniv.ac.in 12