Published on *freevec.org* (http://www.freevec.org)

Submitted by markos on Sat, 01/03/2008 - 20:08

Matrix multiplication is done on a column x row basis. Given two input matrices m2, m3 we do the multiplication and store the result back to an output matrix m1. Hence the function prototype:

void Mat44MulTo(Mat44 m1, Mat44 m2, Mat44 m3);

Submitted by markos on Sat, 01/03/2008 - 19:16

Scaling a matrix implies multiplying each element with a float. Assume the following prototype:

void Mat44ScaleTo(Mat44 m1, Mat44 m2, float f);

where we multiply matrix m2 with the float f and store the result into m1.

Submitted by markos on Sat, 02/02/2008 - 03:54

Let's assume we want to do addition or substraction of 2 4x4 32-bit float matrices. First step is to load the arrays. We will assume that the arrays are 16-byte aligned (all/most SIMD engines require this) which will also give a nice boost. Let's assume we have the following typedef:

Tags:

**Links**

[1] http://www.freevec.org/function/matrix_4x4_multiply_with_vector_floats

[2] http://www.freevec.org/function/matrix_4x4_additionsubtraction_floats

[3] http://www.freevec.org/category/simd/architecture/altivec

[4] http://www.freevec.org/category/simd/algorithms/algebra/matrix

[5] http://www.freevec.org/category/simd/multiply

[6] http://www.freevec.org/category/simd/vector

[7] http://www.freevec.org/category/simd/float

[8] http://www.freevec.org/function/matrix_4x4_transpose_floats

[9] http://en.wikipedia.org/wiki/Transpose

[10] http://www.freevec.org/category/simd/transpose

[11] http://www.freevec.org/function/matrix_4x4_multiplication_floats

[12] http://www.freevec.org/function/matrix_4x4_scaling_floats

[13] http://www.freevec.org/category/simd/scale

[14] http://www.freevec.org/category/simd/addition

[15] http://www.freevec.org/category/simd/subtraction