|
|
simdX86Inverse of Matrix 4x4 using partitioningSubmitted by markos on Fri, 04/18/2008 - 17:31.
We tackle the 4x4 matrix inversion using the matrix partitioning method, as described in the "Numerical Recipes in C" book (2nd ed., though I guess it will be similar in the 3rd edition). Using the AltiVec SIMD unit, we achieve almost 300% increase in performance, making the routine the fastest -at least known to us, matrix inversion method! ( categories: )
Matrix 4x4 Translation of a vectorSubmitted by markos on Sat, 03/01/2008 - 20:56.
Getting the translation matrix of a vector is essential to do movements of a vector in 3D space. For the theory behind translation matrices please see [url=http://en.wikipedia.org/wiki/Translation_(geometry)]here[/url]. ( categories: )
Matrix 4x4 Identity matrixSubmitted by markos on Sat, 03/01/2008 - 20:54.
The nice thing about the identity matrix, is that we don't have to do any reading of the matrix. And since the form of the identity matrix is already known: ( categories: )
Matrix 4x4 Multiply with Vector (floats)Submitted by markos on Sat, 03/01/2008 - 20:45.
(Please see Matrix 4x4 addition/subtraction (floats) for the typedefs and definitions used.) void Mat44MulVec(Vec3f vout, Mat44 mat, Vec4f vin) { vector float vm_1, vm_2, vm_3, vm_4, vec, vec_1, vec_2, vec_3, vr, vr_1, vr_2, vr_3, v0; // Load matrix and vector LOAD_ALIGNED_MATRIX(mat, vm_1, vm_2, vm_3, vm_4); LOAD_ALIGNED_VECTOR(vec, vin); v0 = (vector float) vec_splat_u32(0); vec = vec_ld(0, (float *)vec); vec_1 = vec_splat(vec, 0); vec_2 = vec_splat(vec, 1); vec_3 = vec_splat(ve0, 2); // Do the vector x matrix multiplication vr_1 = vec_madd(vm_1, vec_1, v0); vr_2 = vec_madd(vm_2, vec_2, vr_1); vr_3 = vec_madd(vm_3, vec_3, vr_2); vr = vec_add(vr_3, vm_4); // Store back the result STORE_ALIGNED_VECTOR(vr, vout); } ( categories: )
Matrix 4x4 Transpose (floats)Submitted by markos on Sat, 03/01/2008 - 20:13.
For the theory behind matrix transposition, please see here. So, the 4x4 transpose would be: ( categories: )
|
SIMDUser login |