QR Decomposition VI

Owning Palette: Linear Algebra VIs

Requires: Full Development System

Performs the QR decomposition of A with or without column pivoting. Wire data to the A input to determine the polymorphic instance to use or manually select the instance.

Details  

Use the pull-down menu to select an instance of this VI.

 Add to the block diagram  Find on the palette

Real QR Decomposition

A is an m-by-n real matrix, where m is the number of rows in A and n is the number of columns in A. It can be either a square or rectangular matrix.
pivot? specifies whether this VI decomposes A with column pivoting. When pivot? is TRUE, this VI decomposes A according to the following equation: AP=QR. This VI returns the absolute values of the diagonals of R in descending order. When pivot? is FALSE, this VI decomposes A according to the following equation: A=QR. The default is FALSE.
Q option specifies how this VI generates Q. Q option must take one of the following values, where m is the number of rows in A, and n is the number of columns in A.

0Full Size Q (default)—The size of Q is m-by-m, and the size of R is m-by-n.
1Economy Size Q—The size of Q is m-by-min(m, n), and the size of R is min(m, n)-by-n.
2No Q—This VI does not generate Q, and the size of R is min(m, n)-by-n.
Q is the orthogonal matrix.
R is the upper triangular matrix.
P is the n-by-n permutation matrix, where n is the number of columns in A. P is not empty only if pivot? is TRUE.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

Complex QR Decomposition

A is an m-by-n complex matrix, where m is the number of rows in A and n is the number of columns in A. It can be either a square or rectangular matrix.
pivot? specifies whether this VI decomposes A with column pivoting. When pivot? is TRUE, this VI decomposes A according to the following equation: AP=QR. This VI returns the absolute values of the diagonals of R in descending order. When pivot? is FALSE, this VI decomposes A according to the following equation: A=QR. The default is FALSE.
Q option specifies how this VI generates Q. Q option must take one of the following values, where m is the number of rows in A, and n is the number of columns in A.

0Full Size Q (default)—The size of Q is m-by-m, and the size of R is m-by-n.
1Economy Size Q—The size of Q is m-by-min(m, n), and the size of R is min(m, n)-by-n.
2No Q—This VI does not generate Q, and the size of R is min(m, n)-by-n.
Q is the orthogonal matrix.
R is the upper triangular matrix.
P is the n-by-n permutation matrix, where n is the number of columns in A. P is not empty only if pivot? is TRUE.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

QR Decomposition Details

The following equation defines the QR decomposition:

where m is the number of rows and n is the number of columns in A, Q is an m-by-m unitary matrix, R is an m-by-n upper trapezoidal matrix, R1 is a k-by-k upper triangular matrix where k is the minimum of m and n, R2 is an m-by-(n-m) submatrix of R, and 0 is an (m-n)-by-n zero matrix.

You can use QR decomposition to calculate the determinant of a square matrix. For example, consider the following equation: det(A) = det(Q)*det(R). Because Q is orthogonal, the following is true: |det(Q)| = 1. Thus, the following also is true:

You also can use QR decomposition to solve the least-squares problem of a linear equation Ax = b when A is full rank and m n. For example, consider the following equation:

where the following are true:

Because min(||bAx||2) depends on min(||Q1TbR1x||2), you can obtain the solution x by solving the following new linear equation: R1x = Q1Tb.