4.4.6 MatrixInvert

The result of inverting a non-singular, square, fractional matrix is another square matrix (of the same dimension) whose element values are not necessarily constrained to the discrete fractional set {-1, ..., ~1}. Thus, no matrix inversion operation is provided for fractional matrices.

However, since matrix inversion is a very useful operation, an implementation based on floating-point number representation and arithmetic is provided within the DSP Library.

Description

MatrixInverse computes the inverse of the source matrix and places the result in the destination matrix.

Prototype

float* MatrixInvert (int numRowsCols, float* dstM, float* srcM, float* pivotFlag, int* swappedRows, int* swappedCols);

Arguments

Parameters

Description

numRowsCols

Number of rows/columns in the source (square) matrix

dstM

Pointer to the destination matrix

srcM

Pointer to the source matrix

pivotFlag

Pointer to a length numRowsCols vector

swappedRows

Pointer to a length numRowsCols vector

swappedCols

Pointer to a length numRowsCols vector

Returns

Pointer to the base address of the destination matrix, or NULL if the source matrix is singular.

Remarks

Even though the vectors pivotFlag, swappedRows and swappedCols are for internal use only, they must be allocated prior to calling this function.

If the source matrix is singular (determinant equal to zero), the matrix does not have an inverse. In this case, the function returns NULL.

This function can be computed in place.

Source File

  • minv.c (assembled from C-code)