Wrote a code to multiply 2 matrices to form a new matrix which will be the product of those matrices. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Wrote a code to multiply 2 matrices to form a new matrix which will be the product of those matrices.

How can we implement this in js. If we have 2 matrices how can we take product of it? Means the 1 value of table1 should only be add with the value 1 of table2.

22nd Oct 2021, 3:04 PM
Muhammad Naeem Jangda
1 Answer
0
First of all you need a way to store the matrix in a variable. You mention table, does that mean the matrix is currently in an html <table> element? A common way to store it in a 1d array is a_ij=array[i*N+j], where N is the number of columns. Afterward you need to calculate the sum using the definition of matrix multiplication
23rd Oct 2021, 2:05 AM
John Doe