Implement matrix multiplication
Since matrix multiplication is a nice mathematical feature, I would like to see it implemented in RocketLang.
For the definition of matrix multiplications, see here: https://en.wikipedia.org/wiki/Matrix_multiplication
Condition: all entries have to be numbers (ints, doubles etc.)
Example:
[[1,2],[3,4]]*[[8,7],[6,5]] = [ (1*8+2*6), (1*7+2*5)], [(3*8+4*6) ,(3*7+4*5) ] = [[20 , 17 ] , [48, 41]]
More general: If size(A) =[m,n] and size(B) = [n,p] (the n is important!), then C=A*B with
C[i,j]=0
for k in [1, n]:
C[i,j]+= A[i,k]*B[k,j]
I am open to write the test cases :)
Thanks for the input, indeed test cases as an example would be great!
The testcases were added to the branch https://github.com/Flipez/rocket-lang/tree/feat/matrix_multiplication.