QR decomposition of matrix.
Syntax: @qr(M, R[, P])
M: matrix
R: matrix
P: (optional) matrix
Return: matrix
Decomposes an
![](../content/images/matrixref.098.103.02.jpg)
matrix
![](../content/images/matrixref.098.103.03.jpg)
into an
![](../content/images/matrixref.098.103.04.jpg)
orthogonal matrix
![](../content/images/matrixref.098.103.05.jpg)
and an
![](../content/images/matrixref.098.103.06.jpg)
upper triangular matrix
![](../content/images/matrixref.098.103.07.jpg)
such that
![](../content/images/matrixref.098.103.08.jpg)
, where
![](../content/images/matrixref.098.103.09.jpg)
.
If permutation matrix
![](../content/images/matrixref.098.103.10.jpg)
is provided, the decomposition produces
![](../content/images/matrixref.098.103.11.jpg)
and
![](../content/images/matrixref.098.103.12.jpg)
such that
![](../content/images/matrixref.098.103.13.jpg)
.
Examples
matrix m1 = @mnrnd(7, 5)
matrix r
matrix q = @qr(m1, r)
generates a random matrix M1, then decomposes it into the orthogonal matrix Q, and the upper triangular matrix R.
The following illustrate the properties of the decomposition:
sym i1 = @inner(q)
matrix m2 = q * r
where I1 is the identity matrix, and M2 is equal to M1.
Cross-references