# QR with column pivoting

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 ?

-
Never mind, I reimplemented based on faculty.nps.edu/borges/Teaching/MA3046/Matlab/qrlsdiary.html and it worked like a charm. –  temporaryuser Jun 8 '11 at 11:25