Matrix Math

 

DADiSP supports operations on both real and complex matrices. All calculations are performed with double precision floating point arithmetic.

 

The *^ operator or the MMULT function perform matrix multiplication. The MMULT function has the following format:

 

MMULT(matrix1, matrix2)

 

where

 

matrix1 is a matrix with dimension m1 x n1.

matrix2 is a matrix with dimension m2 x n2.

 

The number of columns in matrix1 (n1) must equal the number of rows in matrix2 (m2). the resultant matrix will have dimensions of (m1 x n2).

 

A *^ x is equivalent to mmult(A, x).

 

The \^ operator or the MDIV function will solve a matrix system. If A, b, and x are matrices, such that A *^ x = b, then A \^ b returns the matrix x.

 

A \^ b is equivalent to mdiv(A, b).

 

For A \^ b, where A is square, the system is solved using LU decomposition. This is usually numerically more stable than directly calculating the inverse matrix, i.e.

 

x = inv(A) *^ b.

 

If matrix A is not square, the system is considered a least squares problem and is solved by QR decomposition. The resulting matrix is the best solution in the least squares sense.