Contents Previous Next Subchapters

Alternate Syntax for Computing the QR Factorization
Syntax [QREdet] = qred(Xfull)
qred(XQREdet)
See Also qr , lu , svd , schur

Description
Computes matrices Q, R, such that
     X = Q * R 
where X is a real, double-precision or complex matrix. Because there are so many forms for the syntax, only the two types of return forms are listed above and the arguments E, det, and full are optional. The argument Q, R, E, and det are outputs and their input values do not matter.

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, the output value of 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

det
is a scalar with the same type as X and equal to the determinant of X.

full
The argument full if a logical scalar. If the argument full 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, d] = qred(x)
     print d
O-Matrix will respond
     -.75
which is the determinant of x. If you continue by entering
     q * r * e
O-Matrix will respond
     {
     [ 0.5 , 1 ]
     [ 1 , 0.5 ]
     }