# CxPseudoInverse

Advanced Analysis Library Only

AnalysisLibErrType CxPseudoInverse (void *inputMatrix, int numberOfRows, int numberOfColumns, double tolerance, void *matrixPseudoInverse);

## Purpose

Calculates the generalized inverse of the complex input matrix A.The dimensions of the input matrix A are numberOfRows-by-numberOfColumns. The dimensions of the output matrix (inverse) are numberOfColumns-by-numberOfRows.

CxPseudoInverse uses the Singular Value Decomposition (SVD) technique. Define the pseudoinverse of a scalar s to be 1/s if s does not equal zero, and zero otherwise. Similarly, define the pseudoinverse of a diagonal matrix by transposing the matrix and then taking the scalar pseudoinverse of each entry. If A+ denotes the pseudoinverse of a matrix A whose singular value decomposition is given by

A = USVT

then:

A+ = US+VT

where S+ is the pseudoinverse of the diagonal matrix S that contains the singular values of A

The pseudoinverse exists for both square and rectangular matrices. If the input matrix is square and nonsingular, the pseudoinverse is the same as the general matrix inverse.

| Note Do not use CxPseudoInverse to calculate the inverse of a square matrix because it takes more time. Use CxGenInvMatrix instead.

The tolerance parameter must be a small positive number close to machine precision. CxPseudoInverse sets all singular values of the input matrix smaller than tolerance equal to zero.

## Parameters

Input
Name | Type | Description
inputMatrix | numeric array | Input complex matrix. The input matrix can be either 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 | integer | Number of rows in inputMatrix.
numberOfColumns | integer | Number of columns in inputMatrix.
tolerance | double-precision | Tolerance value. All the singular values below this tolerance value are set equal to zero. The value of tolerance determines the level of accuracy in your final solution. Set tolerance close to eps, which is the smallest possible double-precision, floating-point number.
Output
Name | Type | Description
matrixPseudoInverse | numeric array | Calculated pseudoinverse matrix, as an array of ComplexNum. It is numberOfColumns-by-numberOfRows. The following C typedef statement defines the ComplexNum structure: typedef struct { double real; double imaginary; } ComplexNum;

## 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.