Matrix (Matrix Math)

The Matrix instruction performs matrix math with two-dimensional arrays (matrices).

Syntax

Matrix ( Option, A, B, Result )

Remarks

The maximum size of the matrix is 4 x 4.

A, B, and Result are two-dimensional arrays (matrices). The Option can be:

Alphanumeric Description
1 Result = A + B
2 Result = A - B
3 Result = A * B
4 Result = Transpose(A)
5 Result = Inverse(A)

The dimensions of A(m,n), B(p,q), Result(r,s) are restricted as follows:

  • Transpose and Inverse: m = n = r = s
  • Add and Subtract: m = p = r, n = q = s
  • Multiply: n = p, r = m, s = q

NOTE: Options 4 and 5 (Transpose and Inverse) do not use B.

NOTE: If the determinant of A is 0 for Inverse(A), NAN will result.

Parameters

Option

Specifies the matrix operation to perform with the two-dimensional arrays, A and B. The Option can be:

Alphanumeric Description
1 Result = A + B
2 Result = A - B
3 Result = A * B
4 Result = Transpose(A)
5 Result = Inverse(A)

A, B

Two- dimensional array for matrix math.

Type: Variable array

Result

Two-dimensional array holding the result of matrix math performed with arrays A and B.

Type: Variable array