How to multiply two spare matrices | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to multiply two spare matrices

Multiplication of two spare matrices using c language

22nd Jan 2019, 11:56 AM
vijay
vijay - avatar
1 Answer
0
Hey vijay. Did you mean square matrices? I did never hear of spare matrices. Anyway there are generally two different matrix products: 1. the dot product (or hadermas product), that multiplies the content element wise 2. the cross product that is a bit more confusing. Check out this quite intuitive explanation: https://www.mathsisfun.com/algebra/matrix-multiplying.html This would be the same for all matrices, no matter if squared or not (but beware: both operations are not defined for all dimensions. E.g. for the hadermas product, the matrices must be of same dimension, for the regular matrix product the number of columns for the "first" (left) matrix must equal the number of rows in the second (right) matrix. Unfortunately, the C language does by default not know the type Matrix and thus cannot multiply them. You will need to implement that by your own (or search the web for any implementations). If you do, show us your result ! ;) Hope that helped a bit. Happy calculating !
23rd Jan 2019, 1:04 AM
Felix Pernat
Felix Pernat - avatar