Contents Previous Next Subchapters

Simple Syntax for QR factorization
Syntax [QR] = qr(X)
[QR] = qr(Xfull)
[QRE] = qr(X)
[QRE] = qr(Xfull)
See Also qred , lu , svd , schur

Description
Computes matrices Q and R, such that
     X = Q * R 
where X is a real, double-precision or complex matrix.

Q
If the argument full is not present, or if it is true, Q is a unitary matrix with the same type and row dimension as X. (See below for a discussion of the case where full is false.)

R
is an upper triangular matrix with the same type and dimension as X.

E
If both E and full are present, E is a row vector with the same type and column dimension as X such that
     X(:,E) = Q * R
(if E is complex, you will have to first convert it to integer, real or double-precision before using it in the expression above). If E is present and full is not present, E is a permutation matrix with the same column dimension as X such that
     X = Q * R * E


full
The argument full if a logical scalar If it is false and the column dimension of X is less than its row dimension, the output value of Q has the same dimension as X and contains only the initial columns of a unitary matrix. Otherwise the entire unitary matrix is returned in Q.

Example
If you enter
     x = {[.5, 1.], [1., .5]}
     [q, r, e] = qr(x)
     print q' * q
O-Matrix will respond
     {
     [ 1 , 0 ]
     [ 0 , 1 ]
     }
If you continue
     q * r * e
O-Matrix will respond
     {
     [ 0.5 , 1 ]
     [ 1 , 0.5 ]
     }

Mlmode
In Mlmode , the argument full can be integer, real, or double-precision in which case non-zero corresponds to true and zero corresponds to false.