3
$\begingroup$

Golub and van Loan's algorithm 5.4.1 for QR factorization is suitable as a rank revealing algorithm. The results are R, Q with the subdiagonal elements stored in "factored form" and the column ordering. Now can anyone help in the technique to take the Q from factored form to complete matrix. To give some additional information.

I used the following data (in Matlab style)

 data= [ 1     2     3         4     5     6         7     8     9        10    11    12        13    14    15        16    17    18]; 

Matlab call [Q R P]=qr(data,0)

produces

 Q =    -0.1048   -0.7161    0.6559    -0.2097   -0.5013   -0.5460    -0.3145   -0.2864   -0.4138    -0.4193   -0.0716   -0.0753    -0.5241    0.1432    0.2966    -0.6290    0.3581    0.0827  R =   -28.6182  -24.2154  -26.4168          0    2.1483    1.0742          0         0    0.0000  p = 3     1     2 

but my own attempt to implement this produces

 Q=  0.10483        0              0 0.209657       0.0025         0 0.314485       0.184241       0.81162 0.419314       0.365981       0.398879 0.524142       0.54772       -0.0138585 0.628971       0.729459      -0.426595 

while the R matches

 -28.6182    -24.2154    -26.4168   0           2.1483      1.0742   0           0           0 

The 2nd and 3rd columns of my Q seem to show a linear relationship with those from Matlab. Is there a way the Q results can be transformed to match those of Matlab ?

  • 2
    Never mind, $I$ reimplemented based on http://faculty.nps.edu/borges/Teaching/MA3046/Matlab/qrlsdiary.html and it worked like a charm.2011-06-08

1 Answers 1

1

The LAPACK documentation of the QR algorithm (without pivoting) says the following:

The matrix Q is not formed explicitly, but is represented as a product of elementary reflectors, as described in section 5.4. Users need not be aware of the details of this representation, because associated routines are provided to work with Q: xORGQR (or xUNGQR in the complex case) can generate all or part of Q, while xORMQR (or xUNMQR) can pre- or post-multiply a given matrix by Q or QT (QH if complex).

I think that you can check against those routines.