SlideShare a Scribd company logo
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

8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
Abhimanyu Mishra
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
Mohammad Vaseem Akaram
 
Time complexity
Time complexityTime complexity
Time complexity
Katang Isip
 
Merge Sort
Merge SortMerge Sort
Merge Sort
Nikhil Sonkamble
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsNikhil Sharma
 
Master theorem
Master theoremMaster theorem
Master theorem
fika sweety
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
Muhammad Amjad Rana
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
Ratnakar Mikkili
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
Madhu Bala
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
Shubham Dwivedi
 
8 queen problem
8 queen problem8 queen problem
8 queen problem
NagajothiN1
 
Bruteforce algorithm
Bruteforce algorithmBruteforce algorithm
Bruteforce algorithm
Rezwan Siam
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
Jayesh Chauhan
 
Optimal binary search tree dynamic programming
Optimal binary search tree   dynamic programmingOptimal binary search tree   dynamic programming
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
Animesh Chaturvedi
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
Rabia Khalid
 
Master method
Master method Master method
Master method
Rajendran
 

What's hot (20)

8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
 
Time complexity
Time complexityTime complexity
Time complexity
 
Merge Sort
Merge SortMerge Sort
Merge Sort
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Master theorem
Master theoremMaster theorem
Master theorem
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
Greedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack ProblemGreedy Algorithm - Knapsack Problem
Greedy Algorithm - Knapsack Problem
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
 
8 queen problem
8 queen problem8 queen problem
8 queen problem
 
Bruteforce algorithm
Bruteforce algorithmBruteforce algorithm
Bruteforce algorithm
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
 
Optimal binary search tree dynamic programming
Optimal binary search tree   dynamic programmingOptimal binary search tree   dynamic programming
Optimal binary search tree dynamic programming
 
Merge sort
Merge sortMerge sort
Merge sort
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Master method
Master method Master method
Master method
 

Similar to Strassen's matrix multiplication

Optimisation.pptx
Optimisation.pptxOptimisation.pptx
Optimisation.pptx
guru1561
 
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
 
CP1-Chp6-Matrices (2).pptx used for revision
CP1-Chp6-Matrices (2).pptx used for revisionCP1-Chp6-Matrices (2).pptx used for revision
CP1-Chp6-Matrices (2).pptx used for revision
rachaelgiwa11
 
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
SOURAV 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 Multiplication
KrishnakoumarC
 
Diapositivas yahir villamizar
Diapositivas yahir villamizarDiapositivas yahir villamizar
Diapositivas yahir villamizar
YahirVillamizar
 
Matrices
Matrices Matrices
Matrices
Jaissy John
 
02 basics i-handout
02 basics i-handout02 basics i-handout
02 basics i-handout
sheetslibrary
 
Mte (1)
Mte (1)Mte (1)
Mte (1)
ankitmehra59
 
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
SOURAV DAS
 
1.6 Other Types of Equations
1.6 Other Types of Equations1.6 Other Types of Equations
1.6 Other Types of Equations
smiller5
 
1.5 Quadratic Equations.pdf
1.5 Quadratic Equations.pdf1.5 Quadratic Equations.pdf
1.5 Quadratic Equations.pdf
smiller5
 
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 cut
Mahesh Dananjaya
 
Numerical Methods
Numerical MethodsNumerical Methods
Numerical Methods
tesfahun meshesha
 
2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الثالث - تطبيقات التفاضل
 2022 ملزمة الرياضيات للصف السادس التطبيقي   الفصل الثالث - تطبيقات التفاضل 2022 ملزمة الرياضيات للصف السادس التطبيقي   الفصل الثالث - تطبيقات التفاضل
2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الثالث - تطبيقات التفاضل
anasKhalaf4
 
Evaluating algebraic expression
Evaluating algebraic expressionEvaluating algebraic expression
Evaluating algebraic expression
Marites Ablay
 
Fractions-Multiplying-Dividing-Demonstration.pptx
Fractions-Multiplying-Dividing-Demonstration.pptxFractions-Multiplying-Dividing-Demonstration.pptx
Fractions-Multiplying-Dividing-Demonstration.pptx
Joy 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)
 
CP1-Chp6-Matrices (2).pptx used for revision
CP1-Chp6-Matrices (2).pptx used for revisionCP1-Chp6-Matrices (2).pptx used for revision
CP1-Chp6-Matrices (2).pptx used for revision
 
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 ملزمة الرياضيات للصف السادس الاحيائي الفصل الثالث تطبيقات التفاضل
 

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.pptx
Megha V
 
JavaScript- Functions and arrays.pptx
JavaScript- Functions and arrays.pptxJavaScript- Functions and arrays.pptx
JavaScript- Functions and arrays.pptx
Megha V
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Megha V
 
Python Exception Handling
Python Exception HandlingPython Exception Handling
Python Exception Handling
Megha V
 
Python- Regular expression
Python- Regular expressionPython- Regular expression
Python- Regular expression
Megha V
 
File handling in Python
File handling in PythonFile handling in Python
File handling in Python
Megha 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 type
Megha V
 
Python programming –part 7
Python programming –part 7Python programming –part 7
Python programming –part 7
Megha V
 
Python programming Part -6
Python programming Part -6Python programming Part -6
Python programming Part -6
Megha V
 
Python programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operationsPython programming: Anonymous functions, String operations
Python programming: Anonymous functions, String operations
Megha 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 3
Megha V
 
Parts of python programming language
Parts of python programming languageParts of python programming language
Parts of python programming language
Megha V
 
Python programming
Python programmingPython programming
Python programming
Megha V
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
Megha V
 
Algorithm Analysis
Algorithm AnalysisAlgorithm Analysis
Algorithm Analysis
Megha V
 
Algorithm analysis and design
Algorithm analysis and designAlgorithm analysis and design
Algorithm analysis and design
Megha V
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
Megha 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 OpenGL
Megha 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

First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Shahin Sheidaei
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
Sharepoint Designs
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 

Recently uploaded (20)

First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024Explore Modern SharePoint Templates for 2024
Explore Modern SharePoint Templates for 2024
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 

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