You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It takes 72 multiplication to calculate 4x4 matrix determinant as one can see.
Meanwhile, accordinly to this Wikipedia's article https://en.wikipedia.org/wiki/Laplace_expansion , this calculation can be reduced to (4 + 4 * (3 + 3 * 2)) = 40 multiplication by decreasing matrix size from 4x4 to 2x2 using minors.
I wrote some simple test application to check perfomance boost. New or "blender style" function is more then twice faster, then current "raylib style".
Issue Screenshot
P.S. I am crab-handed and can not provide a PR :)
The text was updated successfully, but these errors were encountered:
More then 2.0x faster Matrix determinant calculation can be achieved
In raymath.h line 1467 we have such realisation:
It takes 72 multiplication to calculate 4x4 matrix determinant as one can see.
Meanwhile, accordinly to this Wikipedia's article https://en.wikipedia.org/wiki/Laplace_expansion , this calculation can be reduced to (4 + 4 * (3 + 3 * 2)) = 40 multiplication by decreasing matrix size from 4x4 to 2x2 using minors.
Such algorithm is used in blender 3d application source code as for example: https://github.com/blender/blender/blob/main/source/blender/blenlib/intern/math_matrix_c.cc from LINE 1837
So we can replace those existing code fragment from above by something like this (using raylib function naming convention):
I wrote some simple test application to check perfomance boost. New or "blender style" function is more then twice faster, then current "raylib style".
Issue Screenshot
P.S. I am crab-handed and can not provide a PR :)
The text was updated successfully, but these errors were encountered: