# float

## Matrix 4x4 Multiply with Vector (floats)

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

(Please see Matrix 4x4 addition/subtraction (floats) for the typedefs and definitions used.)

## Matrix 4x4 Transpose (floats)

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

For the theory behind matrix transposition, please see here.

So, the 4x4 transpose would be:

## Matrix 4x4 multiplication (floats)

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);

## Matrix 4x4 scaling (floats)

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.

## Matrix 4x4 addition/subtraction (floats)

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: