Admin Production ni-theme
Current Publication

GenLinEqs

LabWindows/CVI

GenLinEqs

Advanced Analysis Library Only

AnalysisLibErrType GenLinEqs (void *inputArray, ssize_t numberOfRows, ssize_t numberOfColumns, double rightHandSide[], int matrixType, double outputArray[]);

Purpose

Note Note  This function has been superseded by SolveEqs.

Solves for the unknown vector x in the linear system of equations:

Ax = y

where inputArray is the real input matrix
rightHandSide is the known vector on the right side

The input matrix can be square or rectangular. The number of elements in rightHandSide must equal the number of rows in the matrix inputArray.

GenLinEqs calculates the solution using the Singular Value Decomposition technique.

In the case of non-singular, square matrices, in which no row or column is a linear combination of any other row or column, GenLinEqs solves for the unique solution x.

Two possibilities exist in the case of rectangular matrices. If the number of rows is greater than the number of columns, the system has more equations than unknowns and is an overdetermined system. Because the solution that satisfies the previous equation might not exist, this procedure finds the least square solution x, which minimizes ||Ax - y||2. If the number of rows is less than the number of columns, the system has more unknowns than equations and is an underdetermined system. It might have infinite solutions that satisfy the previous equation. This procedure calculates the minimum 2-norm solution.

If the input matrix is rank-deficient, GenLinEqs returns a warning.

The matrixType parameter specifies the type of the input matrix. The input matrix can be an upper or lower triangular matrix, a general matrix, or a positive definite matrix.

Parameters

Input
Name Type Description
inputArray void * Input matrix. The matrix can be square or rectangular.This matrix must be an array of doubles.
numberOfRows ssize_t The number of rows in inputArray.
numberOfColumns ssize_t The number of columns in inputArray.
rightHandSide double [] Complex array that contains the set of known vector coefficients.
matrixType int The type of matrix inputArray. The following list shows valid matrix type values.
  • 0: inputArray is a general matrix. The SVD algorithm is used to find the least squares solution of AX=b.
  • 1: inputArray is symmetrix and positive definite. The Cholesky algorithm is used. colA is not referenced.
  • 2: inputArray is a lower triangular matrix. colA is not referenced.
  • 3: inputArray is an upper triangular matrix. colA is not referenced.
Output
Name Type Description
outputArray double [] Solution to the linear system of equations.

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