Table Of Contents

QR Decomposition (G Dataflow)

Version:
    Last Modified: March 15, 2017

    Performs the QR decomposition of a matrix with the option of column pivoting.

    connector_pane_image
    datatype_icon

    matrix A

    An m-by-n matrix, where m is the number of rows in the matrix and n is the number of columns in the matrix.

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

    The matrix can be either a square or rectangular matrix.

    datatype_icon

    pivot?

    A Boolean that specifies whether the node uses column pivoting to decompose the input matrix.

    True Uses column pivoting. The following equation decomposes the matrix A: AP = QR. The node returns the absolute values of the diagonals of matrix R in descending order.
    False Does not use column pivoting. The following equation decomposes the matrix A: A = QR.

    Default: False

    datatype_icon

    Q option

    A value that specifies how the node generates the Q matrix.

    This input must take one of the following values, where m is the number of rows in matrix A, and n is the number of columns in matrix A.

    Name Value Description
    Full Size Q 0 The size of matrix Q is m-by-m, and the size of matrix R is m-by-n.
    Economy Size Q 1 The size of matrix Q is m-by-min(m, n), and the size of matrix R is min(m, n)-by-n.
    No Q 2 The node does not generate matrix Q, and the size of matrix R is min(m, n)-by-n.

    Default: Full Size Q

    datatype_icon

    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

    datatype_icon

    matrix Q

    The orthogonal matrix.

    datatype_icon

    matrix R

    The upper triangular matrix.

    datatype_icon

    matrix P

    The n-by-n permutation matrix, where n is the number of columns in the input matrix.

    If pivot? is False, this output is an empty array.

    datatype_icon

    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 Performing QR Decomposition

    The following equation defines the QR decomposition:

    A = Q R = { Q ( R 1 0 ) m n Q ( R 1 R 2 ) m < n

    where

    • m is the number of rows and n is the number of columns in matrix A
    • matrix Q is an m-by-m unitary matrix
    • matrix R is an m-by-n upper trapezoidal matrix
    • 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 matrix R
    • 0 is an (m-n)-by-m 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:

    | det ( A ) | = | det ( R ) | = | i r i i |

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

    b A x 2 = Q T ( b A x ) 2 = Q 1 T b R 1 x Q 2 T b 2

    where the following are true:

    • Q T = ( Q 1 T Q 2 T )
    • R = ( R 1 0 )
    • The size of Q1 is m-by-n
    • The size of Q2 is m-by-(m - n)
    • The size of R1 is n-by-n

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

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics