SlideShare a Scribd company logo
1 of 4
Download to read offline
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1616
Matrix Multiplication Using Strassen’s Method
Yabaluru Deepthi Naga Ramya Sravani1, Syed Auron Meera2
1,2 Undergraduate, Dept. Of Information Technology, Vignan’s Lara Institute of Technology and Science,
Andhra Pradesh, India
---------------------------------------------------------------------***---------------------------------------------------------------------
Abstract - Matrix can be multiplied in different ways by
using different algorithms and gives same result. Matrices are
frequently used while doing programming in solving system
of linear equations and many more. Lot of research is being
done on how to multiply matrices using minimum of
operations. After the research, Strassen’s algorithm takes less
time for the execution. Using this algorithm for n × n matrix
multiplication are investigated and comparedwiththenormal
algorithm.
In this paper, it throws insight on the matrix multiplication in
C language and also implements an algorithm to reduce the
time complexity.
Key Words: Multiplication Algorithms, Same Result,
Programming Structure, Minimum Operations, Reduce
Time Complexity.
1. INTRODUCTION
A matrix is an arrangement of items into set of rows and
columns into the table. Matrix can be represented in a 2-
Dimensional array. Operations that perform on matrix are
addition, subtraction, multiplication, transpose etc.
Matrix also contains important applications in every field
and frequently for large amounts of computer time. An
algorithm is an unambiguous specification of how to solve a
problem, based on a sequence of specified conditions. For
the same problem different types of instructions gives same
result even though the time of execution may differ. Some
may execute fast, some may be slow, other may occupy the
more space etc. Having less execution time and spacearethe
best one.
Small algorithms require a single processortoperformatask
within the record time in an efficient way. But single
processor is not efficient in all cases. So in complex
situations, task will be divided into different number of
processors to solve in an effective manner.
In scientific computing the most prevalent operations are
done in matrix multiplication. Matrix multiplication can be
done between two matrices. To apply an multiplication
method, it should satisfy one condition that is, if and only if”
the number of columns of first matrix should be equal to the
number of rows in the second matrix” Only in this condition
the matrix can be multiplied. In other case ,multiplication is
not possible.
For Example:
If matrix A[m][n] has, m rows and n columns , the matrix
B[p][q] should have its row value q=n.
and this matrix multiplication will generate a new
matrix C[m][q].
where,
m= number of rows in first matrix and
q= number of columns in second matrix
The following program displays the error until the number
of columns of first matrix is equal to the number of rows of
second matrix.
1.1 C Program On Matrix Multiplication:
#include<stdio.h>
int main()
{
int a[10][10],b[10][10],
c[10][10],r1,c1,r2,c2,i,j,k;
printf(“Enter the rows and column for first
matrix:”);
scanf(“%d%d”,&r1,&c1);
printf(“/nEnter the rows and column for second matrix:”);
scanf(“%d%d”,&r2,&c2);
// Column of first matrix should be equal to column of
second matrix
while(c1!=r2)
{
printf("Error! column of first matrix not equal to row of
second.nn");
printf("Enter rows and column for first matrix:");
scanf("%d %d", &r1, &c1);
printf("Enter rows and column for second matrix: ");
scanf("%d %d",&r2, &c2);
}
// Storing elements of first matrix.
printf("nEnter elements of matrix 1:n");
for(i=0; i<r1; ++i)
for(j=0; j<c1; ++j)
{
printf("Enter elements a%d%d: ",i+1, j+1);
scanf("%d", &a[i][j]);
}
// Storing elements of second matrix.
printf("nEnter elements of matrix 2:n");
for(i=0; i<r2; ++i)
for(j=0; j<c2; ++j)
{
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1617
printf("Enter elements b%d%d: ",i+1, j+1);
scanf("%d",&b[i][j]);
}
// Initializing all elements of result matrix to 0
for(i=0; i<r1; ++i)
for(j=0; j<c2; ++j)
{
result[i][j] = 0;
}
// Multiplying matrices a and b & storing result
for(i=0; i<r1; ++i)
for(j=0; j<c2; ++j)
for(k=0; k<c1; ++k)
{
result[i][j]+=a[i][k]*b[k][j];
}
// Displaying the result
printf("nOutput Matrix:n");
for(i=0; i<r1; ++i)
for(j=0; j<c2; ++j)
{
printf("%d ", result[i][j]);
if(j == c2-1)
printf("nn");
}
return 0;
}
Output:
Fig (a): The output shows an error when column of first
matrix is not equal to row of second,for first input matrix
and second input matrix is given as per the rule.
Fig (b): Matrix Multiplication is done and it shows in
output matrix.
[A] Related Works:
The related works of matrix multiplication is done briefly.
In[2], the author proposed a new parallel implementationof
Strassen’s matrix multiplication algorithm. This proposed
algorithm has a special conflict-free routing pattern for
better scalability. And finally, they achieved the speedup
result as nearly 21.7%.
In[3], the authors analyzed the scalability of number of
parallel formulations of the matrix multiplication algorithm
and the performance and predict theconditionsunderwhich
each formulation is better than others.
In[4], the author tells about the main factors of determining
an algorithm how much time it takes to complete its work.
Matrix multiplication is one of the core componentsof many
scientific computations. So to find the best method of matrix
multiplication, the execution time of all methods will be
calculated.
In[5], the author explained about the Strassen’s algorithm
for matrix multiplication to reduce the complexity. To
implement the algorithm efficiently that makes it a
challenging task which is done in the hierarchical memory
system.
In[6], the authors on configurable hardware they develop
new architecturesand algorithmsfor matrixmultiplications.
These algorithms improve the previous design in terms of
area.
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1618
In[7], the author discuss an interesting activity which
involves in the problem in an matrix multiplication. They
are well aware of increasing importance of matrix
applications to several day-to-day real life problems.
2.Why Strassen’s Method?
Matrix multiplication or the matrix product in a binary
operation that producesa matrix from two matrices.Soupto
now, you have seen the code for matrix multiplication and
the brief introduction of algorithms. It is easy to write logic
of multiplication as we have seen before in the C program.
But the time complexity is more in the normal code. Matrix
multiplication contain many algorithmsto perform the task.
But the main aim is to choose the best algorithm which can
reduce the time complexity. So, Strassen’s methodisthebest
method to implement for this purpose.
Generally, in the standard matrix multiplication the time
complexity is O(n3) operations. When we apply the
Strassen’s algorithm the time complexity is O(n2.81). This is
the main feature and advantage of this algorithm.
2.2 Strassen’s Algorithm:
The Strassen’s method of matrix multiplication is a typical
divide and conquer algorithm. We have seen so far some
divide and conquer method as merge sort, karatsuba’s fast
multiplication of large numbers. This method is introduced
to reduce the complexity. Without communications the
addition and subtraction of matrices can be computed in
linear time. So, this method is better than the standard
matrix multiplication. However, let’s again go behind the
divide and conquer approach.
Generally, a product of 2x2 matrices requires 8
multiplications to get resultant matrix. But the main scheme
of this method is, it reduces to 7 multiplications.
Example:
Basic multiplication method,
Using Strassen’s method, the following are the 7 operations
or formula’s for multiplication.
Resultant matrix
Code:
p1= A[0][0]*(B[0][1]-B[1][1]);
p2= (A[0][0]+A[0][1])*B[1][1];
p3= (A[1][0]+A[1][1])*B[0][0];
p4= A[1][1]*(B[1][0]-B[0][0]);
p5= (A[0][0] + A[1][1])*(B[0][0]+B[1][1]);
p6= (A[0][1]-A[1][1])*(B[1][0]+B[1][1]);
p7= (A[1][0]-A[0][0])*(B[0][0]+B[0][1]);
C[0][0]=p5+p4-p2+p6;
C[0][1]=p1+p2;
C[1][0]=p3+p4;
C[1][1]=p1+p5-p3-p7;
This is the main logic of Strassen’s multiplication.
3. CONCLUSIONS
1. To write a program on any concept or to solve any
problem, then try to solve it with less complexity.
2. After some researches we found that Strassen’s
method is the best and the fast method for
multiplication.
3. Approximately, the time complexity of this
algorithm is O(n2.81).
4. But it would be slower than the fastest known
algorithms ‘for extremely large matrices’.
REFERENCES
[1]. V. Yegnanarayanan (2013)” An Application of Matrix
Multiplication”.Indian Academy of Sciences.
[2]. Ohtaki , Y .(2004).” Parallel ImplementationofStrassen’s
Matrix Multiplication AlgorithmforHeterogeneousClusters”.
IEEE. 18th International Parallel and Distributed Processing
Symposium (IPDPS’04).
[3]. Gupta ,A and ICumar ,V.(1993).”Scalability of Parallel
Algorithms for Matrix Multiplication”. 1 993 International
Conference on Parallel Processing.
[4]. Khaled Thabet ,Sumaia AL-Ghuribi(2014).”Matrix
Multiplication Algorithms” IJCSNS International Journal of
Computer Science and Network Security, VOL.12 No.2
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056
Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072
© 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1619
[5]. Drevet , C , Islam , M and Schost , r.(2011).” Optimization
techniques for small matrix multiplication”. ScienceDirect
.Theoretical Computer Science 412 (2011) 2219–2236.
[6]. Thottethodi , M , Chatterjee , S and Lebeck ,
A.(1998).”Tuning Strassen's Matrix Multiplication for
Memory Efficiency”. ACM/IEEE SC98 Conference (SC’98).
[7]. Ju-wook Jang, V.K.K. Prasanna, Seonil Choi ” Area and
time efficient implementations of matrix multiplication on
FPGAs”
[8].Taras Tkachuk(2016) “Two methods to determining the
time complexity of algorithm.IEEE.13th International
Conference.
[9]. S. Huss-Lederman, E.M. Jacobson, J.R. Johnson(1996)
“Implementation of Strassen's Algorithm for Matrix
Multiplication”.IEEE
[10]. Jorge F. Fabeiro, Diego Andrade, Basilio B.
Fraguela(2016)” Writing a performance-portable matrix
multiplication”.Journal Parllel Computing.

More Related Content

What's hot

What's hot (19)

Ijet v5 i6p2
Ijet v5 i6p2Ijet v5 i6p2
Ijet v5 i6p2
 
A Novel Low Complexity Histogram Algorithm for High Performance Image Process...
A Novel Low Complexity Histogram Algorithm for High Performance Image Process...A Novel Low Complexity Histogram Algorithm for High Performance Image Process...
A Novel Low Complexity Histogram Algorithm for High Performance Image Process...
 
IRJET- A Study on Algorithms for FFT Computations
IRJET- A Study on Algorithms for FFT ComputationsIRJET- A Study on Algorithms for FFT Computations
IRJET- A Study on Algorithms for FFT Computations
 
IRJET - Comparison of Vedic, Wallac Tree and Array Multipliers
IRJET -  	  Comparison of Vedic, Wallac Tree and Array MultipliersIRJET -  	  Comparison of Vedic, Wallac Tree and Array Multipliers
IRJET - Comparison of Vedic, Wallac Tree and Array Multipliers
 
Design and Implentation of High Speed 16x16 CMOS Vedic Multiplier
Design and Implentation of High Speed 16x16 CMOS Vedic MultiplierDesign and Implentation of High Speed 16x16 CMOS Vedic Multiplier
Design and Implentation of High Speed 16x16 CMOS Vedic Multiplier
 
A fpga implementation of data hiding using lsb matching method
A fpga implementation of data hiding using lsb matching methodA fpga implementation of data hiding using lsb matching method
A fpga implementation of data hiding using lsb matching method
 
Solving linear equations from an image using ann
Solving linear equations from an image using annSolving linear equations from an image using ann
Solving linear equations from an image using ann
 
A Fast Floating Point Double Precision Implementation on Fpga
A Fast Floating Point Double Precision Implementation on FpgaA Fast Floating Point Double Precision Implementation on Fpga
A Fast Floating Point Double Precision Implementation on Fpga
 
Implementation of 16 x16 bit multiplication algorithm by using vedic mathemat...
Implementation of 16 x16 bit multiplication algorithm by using vedic mathemat...Implementation of 16 x16 bit multiplication algorithm by using vedic mathemat...
Implementation of 16 x16 bit multiplication algorithm by using vedic mathemat...
 
Cf33497503
Cf33497503Cf33497503
Cf33497503
 
Feature Reduction Techniques
Feature Reduction TechniquesFeature Reduction Techniques
Feature Reduction Techniques
 
50120130406008
5012013040600850120130406008
50120130406008
 
Genetic Algorithm for solving Dynamic Supply Chain Problem
Genetic Algorithm for solving Dynamic Supply Chain Problem  Genetic Algorithm for solving Dynamic Supply Chain Problem
Genetic Algorithm for solving Dynamic Supply Chain Problem
 
Fault diagnosis using genetic algorithms and principal curves
Fault diagnosis using genetic algorithms and principal curvesFault diagnosis using genetic algorithms and principal curves
Fault diagnosis using genetic algorithms and principal curves
 
An Efficient Line Clipping Algorithm for Circular Windows Using Vector Calcul...
An Efficient Line Clipping Algorithm for Circular Windows Using Vector Calcul...An Efficient Line Clipping Algorithm for Circular Windows Using Vector Calcul...
An Efficient Line Clipping Algorithm for Circular Windows Using Vector Calcul...
 
AN EFFICIENT LINE CLIPPING ALGORITHM FOR CIRCULAR WINDOWS USING VECTOR CALCUL...
AN EFFICIENT LINE CLIPPING ALGORITHM FOR CIRCULAR WINDOWS USING VECTOR CALCUL...AN EFFICIENT LINE CLIPPING ALGORITHM FOR CIRCULAR WINDOWS USING VECTOR CALCUL...
AN EFFICIENT LINE CLIPPING ALGORITHM FOR CIRCULAR WINDOWS USING VECTOR CALCUL...
 
A mathematical model for integrating product of two functions
A mathematical model for integrating product of two functionsA mathematical model for integrating product of two functions
A mathematical model for integrating product of two functions
 
decision making uncertain environment a queuing theory approach
decision making uncertain environment   a queuing theory approachdecision making uncertain environment   a queuing theory approach
decision making uncertain environment a queuing theory approach
 
Analysis of GF (2m) Multiplication Algorithm: Classic Method v/s Karatsuba-Of...
Analysis of GF (2m) Multiplication Algorithm: Classic Method v/s Karatsuba-Of...Analysis of GF (2m) Multiplication Algorithm: Classic Method v/s Karatsuba-Of...
Analysis of GF (2m) Multiplication Algorithm: Classic Method v/s Karatsuba-Of...
 

Similar to IRJET- Matrix Multiplication using Strassen’s Method

Similar to IRJET- Matrix Multiplication using Strassen’s Method (20)

Machine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with RMachine Learning, K-means Algorithm Implementation with R
Machine Learning, K-means Algorithm Implementation with R
 
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
Optimization Problems Solved by Different Platforms Say Optimum Tool Box (Mat...
 
IRJET- Approximate Multiplier and 8 Bit Dadda Multiplier Implemented through ...
IRJET- Approximate Multiplier and 8 Bit Dadda Multiplier Implemented through ...IRJET- Approximate Multiplier and 8 Bit Dadda Multiplier Implemented through ...
IRJET- Approximate Multiplier and 8 Bit Dadda Multiplier Implemented through ...
 
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
IRJET - Design of a Low Power Serial- Parallel Multiplier with Low Transition...
 
A Firefly based improved clustering algorithm
A Firefly based improved clustering algorithmA Firefly based improved clustering algorithm
A Firefly based improved clustering algorithm
 
IRJET- Implementation of FIR Filter using Self Tested 2n-2k-1 Modulo Adder
IRJET- Implementation of FIR Filter using Self Tested 2n-2k-1 Modulo AdderIRJET- Implementation of FIR Filter using Self Tested 2n-2k-1 Modulo Adder
IRJET- Implementation of FIR Filter using Self Tested 2n-2k-1 Modulo Adder
 
IRJET- Efficient Design of Radix Booth Multiplier
IRJET- Efficient Design of Radix Booth MultiplierIRJET- Efficient Design of Radix Booth Multiplier
IRJET- Efficient Design of Radix Booth Multiplier
 
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
 
IRJET- Implementation of Radix-16 and Binary 64 Division VLSI Realization...
IRJET-  	  Implementation of Radix-16 and Binary 64 Division VLSI Realization...IRJET-  	  Implementation of Radix-16 and Binary 64 Division VLSI Realization...
IRJET- Implementation of Radix-16 and Binary 64 Division VLSI Realization...
 
A comprehensive study on Applications of Vedic Multipliers in signal processing
A comprehensive study on Applications of Vedic Multipliers in signal processingA comprehensive study on Applications of Vedic Multipliers in signal processing
A comprehensive study on Applications of Vedic Multipliers in signal processing
 
AIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONAIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTION
 
IIIRJET-Implementation of Image Compression Algorithm on FPGA
IIIRJET-Implementation of Image Compression Algorithm on FPGAIIIRJET-Implementation of Image Compression Algorithm on FPGA
IIIRJET-Implementation of Image Compression Algorithm on FPGA
 
IRJET- A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
IRJET-  	  A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...IRJET-  	  A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
IRJET- A Novel Gabor Feed Forward Network for Pose Invariant Face Recogni...
 
Design and Implementation of Test Vector Generation using Random Forest Techn...
Design and Implementation of Test Vector Generation using Random Forest Techn...Design and Implementation of Test Vector Generation using Random Forest Techn...
Design and Implementation of Test Vector Generation using Random Forest Techn...
 
IRJET- The Machine Learning: The method of Artificial Intelligence
IRJET- The Machine Learning: The method of Artificial IntelligenceIRJET- The Machine Learning: The method of Artificial Intelligence
IRJET- The Machine Learning: The method of Artificial Intelligence
 
Review of Existing Methods in K-means Clustering Algorithm
Review of Existing Methods in K-means Clustering AlgorithmReview of Existing Methods in K-means Clustering Algorithm
Review of Existing Methods in K-means Clustering Algorithm
 
Data Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix MultiplicationData Structure & Algorithms - Matrix Multiplication
Data Structure & Algorithms - Matrix Multiplication
 
IRJET-Attribute Reduction using Apache Spark
IRJET-Attribute Reduction using Apache SparkIRJET-Attribute Reduction using Apache Spark
IRJET-Attribute Reduction using Apache Spark
 
IRJET - Finger Vein Extraction and Authentication System for ATM
IRJET -  	  Finger Vein Extraction and Authentication System for ATMIRJET -  	  Finger Vein Extraction and Authentication System for ATM
IRJET - Finger Vein Extraction and Authentication System for ATM
 
IRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
IRJET- Radix 8 Booth Encoded Interleaved Modular MultiplicationIRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
IRJET- Radix 8 Booth Encoded Interleaved Modular Multiplication
 

More from IRJET Journal

More from IRJET Journal (20)

TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
TUNNELING IN HIMALAYAS WITH NATM METHOD: A SPECIAL REFERENCES TO SUNGAL TUNNE...
 
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURESTUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
STUDY THE EFFECT OF RESPONSE REDUCTION FACTOR ON RC FRAMED STRUCTURE
 
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
A COMPARATIVE ANALYSIS OF RCC ELEMENT OF SLAB WITH STARK STEEL (HYSD STEEL) A...
 
Effect of Camber and Angles of Attack on Airfoil Characteristics
Effect of Camber and Angles of Attack on Airfoil CharacteristicsEffect of Camber and Angles of Attack on Airfoil Characteristics
Effect of Camber and Angles of Attack on Airfoil Characteristics
 
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
A Review on the Progress and Challenges of Aluminum-Based Metal Matrix Compos...
 
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
Dynamic Urban Transit Optimization: A Graph Neural Network Approach for Real-...
 
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
Structural Analysis and Design of Multi-Storey Symmetric and Asymmetric Shape...
 
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
A Review of “Seismic Response of RC Structures Having Plan and Vertical Irreg...
 
A REVIEW ON MACHINE LEARNING IN ADAS
A REVIEW ON MACHINE LEARNING IN ADASA REVIEW ON MACHINE LEARNING IN ADAS
A REVIEW ON MACHINE LEARNING IN ADAS
 
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
Long Term Trend Analysis of Precipitation and Temperature for Asosa district,...
 
P.E.B. Framed Structure Design and Analysis Using STAAD Pro
P.E.B. Framed Structure Design and Analysis Using STAAD ProP.E.B. Framed Structure Design and Analysis Using STAAD Pro
P.E.B. Framed Structure Design and Analysis Using STAAD Pro
 
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
A Review on Innovative Fiber Integration for Enhanced Reinforcement of Concre...
 
Survey Paper on Cloud-Based Secured Healthcare System
Survey Paper on Cloud-Based Secured Healthcare SystemSurvey Paper on Cloud-Based Secured Healthcare System
Survey Paper on Cloud-Based Secured Healthcare System
 
Review on studies and research on widening of existing concrete bridges
Review on studies and research on widening of existing concrete bridgesReview on studies and research on widening of existing concrete bridges
Review on studies and research on widening of existing concrete bridges
 
React based fullstack edtech web application
React based fullstack edtech web applicationReact based fullstack edtech web application
React based fullstack edtech web application
 
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
A Comprehensive Review of Integrating IoT and Blockchain Technologies in the ...
 
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
A REVIEW ON THE PERFORMANCE OF COCONUT FIBRE REINFORCED CONCRETE.
 
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
Optimizing Business Management Process Workflows: The Dynamic Influence of Mi...
 
Multistoried and Multi Bay Steel Building Frame by using Seismic Design
Multistoried and Multi Bay Steel Building Frame by using Seismic DesignMultistoried and Multi Bay Steel Building Frame by using Seismic Design
Multistoried and Multi Bay Steel Building Frame by using Seismic Design
 
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
Cost Optimization of Construction Using Plastic Waste as a Sustainable Constr...
 

Recently uploaded

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
ssuser89054b
 

Recently uploaded (20)

FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 

IRJET- Matrix Multiplication using Strassen’s Method

  • 1. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1616 Matrix Multiplication Using Strassen’s Method Yabaluru Deepthi Naga Ramya Sravani1, Syed Auron Meera2 1,2 Undergraduate, Dept. Of Information Technology, Vignan’s Lara Institute of Technology and Science, Andhra Pradesh, India ---------------------------------------------------------------------***--------------------------------------------------------------------- Abstract - Matrix can be multiplied in different ways by using different algorithms and gives same result. Matrices are frequently used while doing programming in solving system of linear equations and many more. Lot of research is being done on how to multiply matrices using minimum of operations. After the research, Strassen’s algorithm takes less time for the execution. Using this algorithm for n × n matrix multiplication are investigated and comparedwiththenormal algorithm. In this paper, it throws insight on the matrix multiplication in C language and also implements an algorithm to reduce the time complexity. Key Words: Multiplication Algorithms, Same Result, Programming Structure, Minimum Operations, Reduce Time Complexity. 1. INTRODUCTION A matrix is an arrangement of items into set of rows and columns into the table. Matrix can be represented in a 2- Dimensional array. Operations that perform on matrix are addition, subtraction, multiplication, transpose etc. Matrix also contains important applications in every field and frequently for large amounts of computer time. An algorithm is an unambiguous specification of how to solve a problem, based on a sequence of specified conditions. For the same problem different types of instructions gives same result even though the time of execution may differ. Some may execute fast, some may be slow, other may occupy the more space etc. Having less execution time and spacearethe best one. Small algorithms require a single processortoperformatask within the record time in an efficient way. But single processor is not efficient in all cases. So in complex situations, task will be divided into different number of processors to solve in an effective manner. In scientific computing the most prevalent operations are done in matrix multiplication. Matrix multiplication can be done between two matrices. To apply an multiplication method, it should satisfy one condition that is, if and only if” the number of columns of first matrix should be equal to the number of rows in the second matrix” Only in this condition the matrix can be multiplied. In other case ,multiplication is not possible. For Example: If matrix A[m][n] has, m rows and n columns , the matrix B[p][q] should have its row value q=n. and this matrix multiplication will generate a new matrix C[m][q]. where, m= number of rows in first matrix and q= number of columns in second matrix The following program displays the error until the number of columns of first matrix is equal to the number of rows of second matrix. 1.1 C Program On Matrix Multiplication: #include<stdio.h> int main() { int a[10][10],b[10][10], c[10][10],r1,c1,r2,c2,i,j,k; printf(“Enter the rows and column for first matrix:”); scanf(“%d%d”,&r1,&c1); printf(“/nEnter the rows and column for second matrix:”); scanf(“%d%d”,&r2,&c2); // Column of first matrix should be equal to column of second matrix while(c1!=r2) { printf("Error! column of first matrix not equal to row of second.nn"); printf("Enter rows and column for first matrix:"); scanf("%d %d", &r1, &c1); printf("Enter rows and column for second matrix: "); scanf("%d %d",&r2, &c2); } // Storing elements of first matrix. printf("nEnter elements of matrix 1:n"); for(i=0; i<r1; ++i) for(j=0; j<c1; ++j) { printf("Enter elements a%d%d: ",i+1, j+1); scanf("%d", &a[i][j]); } // Storing elements of second matrix. printf("nEnter elements of matrix 2:n"); for(i=0; i<r2; ++i) for(j=0; j<c2; ++j) {
  • 2. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1617 printf("Enter elements b%d%d: ",i+1, j+1); scanf("%d",&b[i][j]); } // Initializing all elements of result matrix to 0 for(i=0; i<r1; ++i) for(j=0; j<c2; ++j) { result[i][j] = 0; } // Multiplying matrices a and b & storing result for(i=0; i<r1; ++i) for(j=0; j<c2; ++j) for(k=0; k<c1; ++k) { result[i][j]+=a[i][k]*b[k][j]; } // Displaying the result printf("nOutput Matrix:n"); for(i=0; i<r1; ++i) for(j=0; j<c2; ++j) { printf("%d ", result[i][j]); if(j == c2-1) printf("nn"); } return 0; } Output: Fig (a): The output shows an error when column of first matrix is not equal to row of second,for first input matrix and second input matrix is given as per the rule. Fig (b): Matrix Multiplication is done and it shows in output matrix. [A] Related Works: The related works of matrix multiplication is done briefly. In[2], the author proposed a new parallel implementationof Strassen’s matrix multiplication algorithm. This proposed algorithm has a special conflict-free routing pattern for better scalability. And finally, they achieved the speedup result as nearly 21.7%. In[3], the authors analyzed the scalability of number of parallel formulations of the matrix multiplication algorithm and the performance and predict theconditionsunderwhich each formulation is better than others. In[4], the author tells about the main factors of determining an algorithm how much time it takes to complete its work. Matrix multiplication is one of the core componentsof many scientific computations. So to find the best method of matrix multiplication, the execution time of all methods will be calculated. In[5], the author explained about the Strassen’s algorithm for matrix multiplication to reduce the complexity. To implement the algorithm efficiently that makes it a challenging task which is done in the hierarchical memory system. In[6], the authors on configurable hardware they develop new architecturesand algorithmsfor matrixmultiplications. These algorithms improve the previous design in terms of area.
  • 3. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1618 In[7], the author discuss an interesting activity which involves in the problem in an matrix multiplication. They are well aware of increasing importance of matrix applications to several day-to-day real life problems. 2.Why Strassen’s Method? Matrix multiplication or the matrix product in a binary operation that producesa matrix from two matrices.Soupto now, you have seen the code for matrix multiplication and the brief introduction of algorithms. It is easy to write logic of multiplication as we have seen before in the C program. But the time complexity is more in the normal code. Matrix multiplication contain many algorithmsto perform the task. But the main aim is to choose the best algorithm which can reduce the time complexity. So, Strassen’s methodisthebest method to implement for this purpose. Generally, in the standard matrix multiplication the time complexity is O(n3) operations. When we apply the Strassen’s algorithm the time complexity is O(n2.81). This is the main feature and advantage of this algorithm. 2.2 Strassen’s Algorithm: The Strassen’s method of matrix multiplication is a typical divide and conquer algorithm. We have seen so far some divide and conquer method as merge sort, karatsuba’s fast multiplication of large numbers. This method is introduced to reduce the complexity. Without communications the addition and subtraction of matrices can be computed in linear time. So, this method is better than the standard matrix multiplication. However, let’s again go behind the divide and conquer approach. Generally, a product of 2x2 matrices requires 8 multiplications to get resultant matrix. But the main scheme of this method is, it reduces to 7 multiplications. Example: Basic multiplication method, Using Strassen’s method, the following are the 7 operations or formula’s for multiplication. Resultant matrix Code: p1= A[0][0]*(B[0][1]-B[1][1]); p2= (A[0][0]+A[0][1])*B[1][1]; p3= (A[1][0]+A[1][1])*B[0][0]; p4= A[1][1]*(B[1][0]-B[0][0]); p5= (A[0][0] + A[1][1])*(B[0][0]+B[1][1]); p6= (A[0][1]-A[1][1])*(B[1][0]+B[1][1]); p7= (A[1][0]-A[0][0])*(B[0][0]+B[0][1]); C[0][0]=p5+p4-p2+p6; C[0][1]=p1+p2; C[1][0]=p3+p4; C[1][1]=p1+p5-p3-p7; This is the main logic of Strassen’s multiplication. 3. CONCLUSIONS 1. To write a program on any concept or to solve any problem, then try to solve it with less complexity. 2. After some researches we found that Strassen’s method is the best and the fast method for multiplication. 3. Approximately, the time complexity of this algorithm is O(n2.81). 4. But it would be slower than the fastest known algorithms ‘for extremely large matrices’. REFERENCES [1]. V. Yegnanarayanan (2013)” An Application of Matrix Multiplication”.Indian Academy of Sciences. [2]. Ohtaki , Y .(2004).” Parallel ImplementationofStrassen’s Matrix Multiplication AlgorithmforHeterogeneousClusters”. IEEE. 18th International Parallel and Distributed Processing Symposium (IPDPS’04). [3]. Gupta ,A and ICumar ,V.(1993).”Scalability of Parallel Algorithms for Matrix Multiplication”. 1 993 International Conference on Parallel Processing. [4]. Khaled Thabet ,Sumaia AL-Ghuribi(2014).”Matrix Multiplication Algorithms” IJCSNS International Journal of Computer Science and Network Security, VOL.12 No.2
  • 4. International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056 Volume: 05 Issue: 03 | Mar-2018 www.irjet.net p-ISSN: 2395-0072 © 2018, IRJET | Impact Factor value: 6.171 | ISO 9001:2008 Certified Journal | Page 1619 [5]. Drevet , C , Islam , M and Schost , r.(2011).” Optimization techniques for small matrix multiplication”. ScienceDirect .Theoretical Computer Science 412 (2011) 2219–2236. [6]. Thottethodi , M , Chatterjee , S and Lebeck , A.(1998).”Tuning Strassen's Matrix Multiplication for Memory Efficiency”. ACM/IEEE SC98 Conference (SC’98). [7]. Ju-wook Jang, V.K.K. Prasanna, Seonil Choi ” Area and time efficient implementations of matrix multiplication on FPGAs” [8].Taras Tkachuk(2016) “Two methods to determining the time complexity of algorithm.IEEE.13th International Conference. [9]. S. Huss-Lederman, E.M. Jacobson, J.R. Johnson(1996) “Implementation of Strassen's Algorithm for Matrix Multiplication”.IEEE [10]. Jorge F. Fabeiro, Diego Andrade, Basilio B. Fraguela(2016)” Writing a performance-portable matrix multiplication”.Journal Parllel Computing.