Hi,
I'm attempting to implement a QR factorization with column pivoting so that the returned R matrix has decreasing diagonal elements (that is, $r\_{i,i} \leq r\_{i-1,i-1}$ for all $i\geq 2$). Mathematically, it would involve finding the matrix $P$ so that $AP=QR$, or $A=QRP^T$.
I'm using Gram-Schmidt to compute QR.


One source I found was this: <http://www.mathworks.de/matlabcentral/newsreader/view_thread/250632>


Quote from the answer:
"During the iteration #k, it is easy to show that if we pick among the set of remaining vectors (i.e., not yet included in the span) the vector that has the *largest* orthogonal component to the current subspace (generated by k first vectors), then the diagonal of R must decrease."


Sounds simple enough, but HOW do I determine which vector of the remaining ones that have the largest orthogonal component to the subspace that's already been found? 


Thanks a lot in advance for any help on this matter!


Best regards
Hallgeir



QR factorization: How to get decreasing r_ii
At each step $k$, choose the column of the "reduced" working matrix $A(k:n,k:n)$ with largest Euclidean norm and bring it in front with a permutation. Notice that $r\_{11}$ is the Euclidean norm of the first column...


