Skip to content

Implement matrix multiplication #64

@juuljuul

Description

@juuljuul

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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions