---
name: "matrix_mul"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/matrix_mul/3alleg4"
---

# matrix\_mul(3alleg4)

Multiplies two matrices. Allegro game programming library.

## NAME

matrix\_mul, matrix\_mul\_f - Multiplies two matrices. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**void matrix\_mul(const MATRIX \*m1, const MATRIX \*m2, MATRIX \*out);**

**void matrix\_mul\_f(const MATRIX\_f \*m1, const MATRIX\_f \*m2, MATRIX\_f \*out);**

## DESCRIPTION

Multiplies two matrices, storing the result in out (this may be a  duplicate of one of the input matrices, but it is faster when the inputs  and output are all different). The resulting matrix will have the same  effect as the combination of m1 and m2, ie. when applied to a point p, (p  \* out) = ((p \* m1) \* m2). Any number of transformations can be  concatenated in this way. Note that matrix multiplication is not  commutative, ie. matrix\_mul(m1, m2) != matrix\_mul(m2, m1).

## SEE ALSO

**apply\_matrix**(3alleg4), **exquat**(3alleg4), **exscn3d**(3alleg4)
