QR Decomposition VI
- 已更新2025-07-30
- 閱讀時間為 3 分鐘
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.

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:


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