From: spellucci@mathematik.tu-darmstadt.de (Peter Spellucci) Subject: Re: QR Factorization Date: 23 Nov 2001 15:11:25 GMT Newsgroups: sci.math.num-analysis,sci.math Summary: Computing SVD numerically (with Matlab) In article <7da9efed.0111230552.65163d71@posting.google.com>, MajorSetback@excite.com (PeterOut) writes: snip |> According to ``Matrix Analysis'' by Roger Horn and Charles Johnson, |> the output of the factorization is an m-by-n matrix (Q) with |> orthonormal columns and an n-by-n upper matrix (R). However, the |> output in MATLAB consists of an m-by-m unitary matrix (Q) and an |> m-by-n matrix (R) with the first n rows forming an upper triangular |> matrix. I was wondering if anyone could explain the discrepancy. |> |> Many thanks in advance, |> Peter. this simply depends on convention. you may write A = Q R A is m times n , m>=n, Q is m times n, R is n times n the simplest way to obtain Q is Gram-Schmidt orthonormalization (numerically unstable) or modified Gram-Schmidt orthonormalization (compute R rowwise), much better but again not as fine as Householder transformations. But here you originally have U_n U_{n-1} U_1 A = [ R ] [ O ] where the U_i are Householder reflectors and the "O" is a (m-n) times n zero matrix. Now, setting Q' = U_n U_{n-1} ... U_1 you get A = Q [R] [O] and this is what MATLAB gives you . You can recover (*) by deleting the "O" part and the last m-n columns of Q. Normally Q is _not_ returned by QR-codes, rather the reflection normals which define the U_i (this information suffices anyway). hope that helps peter