[libre-riscv-dev] 3D Matrix-style operations / primitives
lkcl
luke.leighton at gmail.com
Wed Sep 18 06:24:27 BST 2019
does anyone know of some mathematics for analysing which would be the best
"primitives" for Matrix operations, suited to transposition and inversion,
determinant and normalisation?
for 3D that generally means just 2x2, 3x3 and 4x4.
i'm looking up how matrix inverses are calculated and, hoo-boy :)
https://integratedmlai.com/matrixinverse/
https://www.wikihow.com/Find-the-Inverse-of-a-3x3-Matrix
normalisation looks to be just "divide by the determinant":
http://mymathforum.com/linear-algebra/18218-how-do-i-normalize-matrix.html
so... i am logically deducing that if you wanted something RISC-like, you'd
have operations for transpose and determinant? or... can determinant be
broken down further into something elegant?
https://en.wikipedia.org/wiki/Determinant
whilst 2x2 looks pretty obvious - 0,0 x 1,1 - 1,0 x 0,1 - it looks like it
goes recursive from there, with permutations:
https://en.wikipedia.org/wiki/Determinant#n_%C3%97_n_matrices
at that point, honestly, i'm scared/alarmed to even recommend a Matrix
Determinant opcode!
likewise, Transpose appears to be a series of MV operations with offsets,
which tends to suggest that there may be some vector primitives that would
be really good to have, that could be added to this:
https://libre-riscv.org/simple_v_extension/specification/mv.x/
a quick search "matrix inverse swizzle" shows this:
https://lxjk.github.io/2017/09/03/Fast-4x4-Matrix-Inverse-with-SSE-SIMD-Explained.html
which mentions __mm_shuffle_epl32, _mm_shuffle_ps, _mm_movelp_ps and that
leads on a merry search to SSE/AVX/AVX-512:
https://software.intel.com/sites/landingpage/IntrinsicsGuide/#text=_mm_shuffle_ps
https://www.cs.uaf.edu/2006/fall/cs301/lecture/11_17_sse.html
looovely :)
at which point i am definitely lost. does anyone have any suggestions?
l.
More information about the libre-riscv-dev
mailing list