Multiply matrix without NumPy - Would you let me know the code logic ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Multiply matrix without NumPy - Would you let me know the code logic ?

Would you please let me know the reason of writing lines 8 ,15 and 16 ? I mean the exact logic behind this 3 lines https://code.sololearn.com/c0wxdzUmSbtD/#py

21st Mar 2018, 8:28 PM
NIMA
NIMA - avatar
1 Answer
+ 4
Line 8 -- initializes the first row of the final output matrix with all zeros. Line 15 -- calculates the product at the intersection of the k-th row and k-th column and adds the element to the output matrix (element-wise multiplication) Line 16 -- actually assigns the result of line 15 to the respective cell of the matrix
21st Mar 2018, 9:29 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar