freevec.org

  • about
  • benchmarks
Home › Algorithms › Algebra

Matrix

Printer-friendly version

Inverse of Matrix 4x4 using partitioning

markos — Fri, 18/04/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!

  • AltiVec
  • Inverse
  • Matrix
  • Login to post comments
  • Read more
  • 1 attachment

Matrix 4x4 Translation of a vector

markos — Sat, 01/03/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].

  • AltiVec
  • Matrix
  • Translate
  • Login to post comments
  • Read more

Matrix 4x4 Identity matrix

markos — Sat, 01/03/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:

  • AltiVec
  • Identity
  • Matrix
  • Login to post comments
  • Read more

Matrix 4x4 Multiply with Vector (floats)

markos — Sat, 01/03/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);
}

  • AltiVec
  • float
  • Matrix
  • Multiply
  • Vector
  • Login to post comments

Matrix 4x4 Transpose (floats)

markos — Sat, 01/03/2008 - 20:13

For the theory behind matrix transposition, please see here.

So, the 4x4 transpose would be:

  • AltiVec
  • float
  • Matrix
  • Transpose
  • Login to post comments
  • Read more
  • 1
  • 2
  • next ›
  • last »
Syndicate content

Primary links

  • About
    • History of libfreevec
  • Benchmarks
    • libfreevec

Search

User login

  • Request new password

Popular tags

Addition Algorithms AltiVec ARM Benchmarking float Inverse libfreevec Matrix Memory Multiply NEON reference Scale SSE String searching Subtraction Translate Transpose Tutorial
more tags

Please donate to libfreevec to ensure its continuing development! Donations are done via Paypal.





  • about
  • benchmarks

Copyright (c)2008 by CODEX.
Powered by Drupal. Using theme Deco.
All Google charts have been created by the CSV Chart and Chart API Drupal modules.