Group: | Linear Algebra |
See also: | qrmat |
Function: | qr | |
Description: |
computes QR decomposition of a n x p matrix. Column pivoting based on the l_2-norms of the reduced columns may be performed at the users option.
|
Usage: | {y,aux,jpvt} = qr(x,{pvt}) | |
Input: | ||
x | n x p matrix | |
pvt | p x 1 vector. The vector of integers that control the selection of the pivot columns. The k-th column of x is placed in one of three classes according to the value of jpvt[k]: if pvt[k]> 0, then k-th column is an initial column, if pvt[k]= 0, then k-th column is a free column, if pvt[k] < 0, then k-th column is a final column. Before the decomposition is computed, initial columns are moved to the beginning of the matrix x and final columns to the end. Both initial and final columns are frozen in place during the computation and only free columns are moved. At the k-th stage of the reduction, if k-th column is occupied by a free column it is interchanged with the free column of largest reduced l_2-norm. | |
Output: | ||
y | n x p matrix. y contains in its upper triangle the upper triangular matrix R of the QR factorization. Below its diagonal x contains information from which the orthogonal part of the decomposition can be recovered. | |
aux | p x 1 vector. aux contains further information required to recover the orthogonal part of the decomposition. | |
jpvt | n x 1 vector. jpvt contains the index of the column of y that has been interchanged into the k-th column of the original matrix, if pivoting was requested. |
of the original matrix y but that of y
with its columns permuted as described by jpvt
randomize(123) x=normal(3,4) pvt = 0.0*(1:4) {y,aux,jpvt}=qr(x,pvt) y aux jpvt
Contents of y [1,] -2.1492 0.34232 0.5023 -1.5094 [2,] 0.88459 -1.9599 -0.22529 0.030903 [3,] -0.40188 0.96651 -1.4159 0.43305 Contents of aux [1,] 1.2366 [2,] 1.2566 [3,] 0 [4,] 0.43305 Contents of jpvt [1,] 4 [2,] 2 [3,] 1 [4,] 3
Group: | Linear Algebra |
See also: | qrmat |