Skip to content

Documentation / @interstellar-tools/equations / matMul3

Function: matMul3() ​

ts
function matMul3(A: Matrix3x3Type, B: Matrix3x3Type): Matrix3x3Type;

Defined in: helpers/mat-mul3.ts:46

Multiply two 3×3 matrices (row-major).

Computes:

C=AB

Using standard matrix multiplication:

Cr,c=∑k=02Ar,kBk,c

Layout:

  • Matrices are treated as row-major: M[row][col].

Common usage:

  • Compose rotations / direction cosine matrices (DCMs), e.g. R = R3 * R1 * R3.
  • Compose linear transforms in 3D geometry and mapping pipelines.

Parameters ​

ParameterTypeDescription
AMatrix3x3TypeLeft matrix (3×3, row-major).
BMatrix3x3TypeRight matrix (3×3, row-major).

Returns ​

Matrix3x3Type

The product matrix A * B (3×3, row-major).

Example ​

ts
const A: Matrix3x3Type = [
  [1, 2, 3],
  [0, 1, 4],
  [5, 6, 0]
];

const B: Matrix3x3Type = [
  [-2, 1, 0],
  [3, 0, 0],
  [4, 5, 1]
];

const C = matMul3(A, B);
// C is A*B