# PseudoInverse Matrix (G Dataflow)

Finds the pseudoinverse matrix of an input matrix by using singular value decomposition.

Use this node when the Inverse Matrix node cannot compute the inverse of a matrix, such as for rectangular or singular matrices.

## matrix

A rectangular matrix.

This input accepts a 2D array of double-precision, floating point numbers or 2D array of complex double-precision, floating point numbers.

This input also accepts square matrices, but Inverse Matrix can more efficiently calculate the actual inverse of a square matrix as long as the matrix is nonsingular.

Default: Empty array

## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

## tolerance

A level such that the number of singular values greater than this level is the rank of the input matrix.

If this input is negative, this node uses the following equation to determine the actual tolerance:

$\text{tolerance}=\text{\hspace{0.17em}}\text{max(}m,\text{\hspace{0.17em}}n\right)*‖A‖*\epsilon$

where

• A represents the input matrix
• m represents the number of rows in A
• n represents the number of columns in A
• $‖A‖$ is the 2-norm of A
• $\epsilon$ is the smallest floating point number that can be represented by type double

Default: -1

## pseudoinverse matrix

The pseudoinverse matrix of the input matrix.

## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## Algorithm for Calculating the PseudoInverse Matrix

The m-by-n matrix A+ is called the pseudoinverse of matrix A if A+ satisfies the following four Moore-Penrose conditions:

• A A+ A = A
• A+ A A+ = A+
• A A+ is a symmetric matrix
• A+ A is a symmetric matrix

This node computes the pseudoinverse matrix A+ using the SVD algorithm. For example, assume the singular value decomposition of A equals USV*. Then A+ = VS+U*. You can calculate the pseudoinverse matrix of a diagonal matrix S by taking the reciprocal of each element on the diagonal. When the elements are smaller than the tolerance, this node sets the reciprocals to zero.

## Using the Pseudoinverse Matrix to Provide a Least-Squares Solution for a Linear System

You can use the pseudoinverse matrix to provide a least-squares solution of a linear system. For example, for a linear system Ax = b, the following equation is the least-squares solution: x = A+b.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application