qr
QR decomposition.
Syntax
Section titled “Syntax”[Q, R] = qr(A)[Q, R, E] = qr(A) % with column pivotingY = qr(A) % packed formDescription
Section titled “Description”Decomposes A into an orthogonal/unitary Q and upper-triangular R such that A = Q*R. With three outputs, applies column pivoting and returns the permutation E such that A*E = Q*R with R having descending diagonal magnitudes — useful for rank-revealing QR.
For non-square A: with two outputs, Q is full size (m×m); pass an additional 0 argument or use the economy form for the thinner m×n Q.
Examples
Section titled “Examples”[Q, R] = qr(magic(4));norm(Q*R - magic(4)) % near-zeroQ' * Q % I (within eps)