Closed Ruhrpottpatriot closed 5 months ago
Matrix multiplication isn't commutative. If switching the order makes your result correct, that usually means you have something transposed. I don't know numpy or MATLAB, and you haven't shared the exact nalgebra code you used, but you should make certain that you haven't inadvertently swapped rows with columns when constructing a matrix in one case or the other.
Closing since it's not reproducible without example code. Matrix multiplication is very well-tested in nalgebra
, so unless we have some code I'm inclined to think it's an issue of accidental transposition or similar user error, as @Ralith suggested.
Feel free to get back to us with a code example that shows the issue, however, and I will re-open.
Take the following two matrices
and
Multiplying the two matrices by calculating yields different results than both numpy and MATLAB, i.e. the operation
F * pkk
in MATLAB, respectivelyF.dot(pkk)
in numpy, both returnwhereas the same operation in nalgebra yields
However, flipping the arguments, i.e. calculating
pkk * F
yields the correct result, even in nalgebra.Is this the intended behaviour? Doing calculations different that two of the most widespread linalg tools seems very counter-intuitive to me.