LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

CxGenLinEqs

Advanced Analysis Library Only

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

Purpose

Note Note  This function has been superseded by CxSolveEqs.

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.

CxGenLinEqs 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, CxGenLinEqs 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, CxGenLinEqs 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 complex matrix. The matrix can be square or rectangular. This matrix must be an array of ComplexNum. The following C typedef statement defines the ComplexNum structure:

typedef struct {

double real;

double imaginary;

} ComplexNum;

numberOfRows ssize_t The number of rows in inputArray.
numberOfColumns ssize_t The number of columns in inputArray.
rightHandSide NIComplexNumber [] The right-hand known vector.
matrixType int Type of the input matrix. Choose the matrix type correctly because it significantly affects the speed of computation.

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. 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 NIComplexNumber [] The answer vector.

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

Was this information helpful?

Log in to get a better experience

Help us improve your future ni.com experience.

Did you find the documentation you were looking for?

Submit