Kotlin / multik

Multidimensional array library for Kotlin
https://kotlin.github.io/multik/
Apache License 2.0
646 stars 39 forks source link

Document matrix multiplication/dotMMs behavior #141

Open 9SMTM6 opened 2 years ago

9SMTM6 commented 2 years ago

First of all, it doesnt seem there is a purposebuilt matrix multiplication, youre supposed to use dot?

I'm still investigating that, but as far as I can tell, your "matrix multiplication" (dot /dotMM) does things differently from np.matmul.

I understand this is in alpha, and excellent documentation should not be expected, but because of the indirections eg via API Layer that may use different implementations, its difficult to find out yourself what its doing, and I'd imagine matrix multiplication to be relevant enough to warrant being documented.

devcrocod commented 2 years ago

Due to the design of the language, dotMM methods must be public, although they are not meant to be, and therefore not documented.

9SMTM6 commented 2 years ago

This isnt about the dotMM metod specifically. Its more that at least I would just want a way to do matrix multiplikations, and until I can find out what its doing differently from the matrix multiplikation I know from math, which is how numpy implements it too, dot isnt very helpful for me, indeed it gives the wrong impression.

Unless I fucked something up, I had to solve a number of issues and was tired at that point.

What I want to say with this isnt to document dotMM, but to document somehow how you intend people to do Matrix multiplication. Wether you do this in dot, explaining the need to perhaps transpose some things or similar to adhere to math matrix multiplikation, or by offering a public matMul function/method, I dont really care.