# SVD Decomposition (G Dataflow)

Last Modified: June 25, 2019

Computes the singular value decomposition (SVD) of an m x n matrix.  ## matrix A

An m x n matrix with m rows and n columns.

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

Default: Empty array ## singular values only?

A Boolean specifying whether this node computes only the singular values.

 True Does not compute matrix U and matrix V. False Computes matrix U and matrix V.

Default: False ## SVD option

A value specifying how this node performs the decomposition.

Name Value Description
Thin 0 Decomposes an m x n matrix as the multiplication of matrix U (m x min(m,n)), S (min(m,n) x min(m,n)), and conjugated transpose of V (n x min(m,n)).
Full 1 Decomposes an m x n matrix as the multiplication of matrix U (m x m), S (m x n), and conjugated transpose of V (n x n).

Default: Thin ## 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 ## matrix U

The U matrix of the SVD results.

The columns of this output compose an orthogonal set. ## matrix S

The S matrix of the SVD results.

This output is a diagonal matrix whose diagonal elements are the singular values of matrix A in descending order. These values also compose singular values this node computes. Because the singular values of matrix A are the nonnegative square roots of the eigenvalues of AHA, they all are nonnegative. matrix S is unique for a given matrix A. ## matrix V

The V matrix of the SVD results.

The columns of this output compose an orthogonal set. ## vector s

The singular values of the input matrix in descending order.

The values in this output are the diagonal elements of the S 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 SVD Decomposition

The following equation defines the singular value decomposition of matrix A for real cases:

A = USVT

The following equation defines the singular value decomposition of matrix A for complex cases:

A = USVH

In the previous two equations, the columns in U and V are orthogonal, and S is a diagonal matrix whose diagonal elements are the singular values of A in descending order.

If r represents the rank of A:

• The first r columns in U are the normal orthogonal bases of the column space of A.
• The number of nonzero singular values of A is r.
• The first r columns in V are the normal orthogonal bases of the row space of A.

## Using SVD Decomposition in Linear Algebra and Image Processing

You can use SVD decomposition to solve linear algebra problems, such as the pseudoinverse of a matrix, total least-squares minimization, and matrix approximation. SVD factorization also is useful in image processing applications, such as image compression.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

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