Admin Production ni-theme
Current Publication

GenInvMatrix

LabWindows/CVI

GenInvMatrix

Advanced Analysis Library Only

AnalysisLibErrType GenInvMatrix (void *inputMatrix, ssize_t matrixSize, int matrixType, void *matrixInverse);

Purpose

Calculates the inverse of the real, square input matrix.

If B denotes the inverse of the matrix A, then

AB = I

where I is the identity matrix

In contrast to InvMatrix, GenInvMatrix allows you to specify the type of the input matrix with the matrixType parameter. The input matrix can be an upper or lower triangular matrix, a general square matrix, or a positive definite matrix. You can save significant computation time if you properly specify the type of the matrix.

Note Note  If you use this function on an ill-conditioned matrix, the result may be inaccurate due to a loss of precision from arithmetic calculations. The results could also vary between machines because National Instruments uses different optimizations based on processor type.

Parameters

Input
Name Type Description
inputMatrix void * Input square matrix. This matrix must be an array of doubles.
matrixSize ssize_t Number of elements in one dimension of the input matrix.
matrixType int Type of the matrix. Choose the matrix type correctly because it significantly affects the speed of computation. matrixType must be one of the following values:

Matrix Type Value
General matrix 0
Positive definite 1
Lower triangular 2
Upper triangular 3
Output
Name Type Description
matrixInverse void * Calculated inverse matrix, as an array of doubles.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later