QR and permutation matrix - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: QR and permutation matrix (/thread-5012.html) |
QR and permutation matrix - Han - 10-26-2015 03:04 PM The QR() command returns the QR factorization of a matrix and includes a permutation matrix. I cannot seem to find an example of a matrix for which the QR factorization returns a permutation matrix that is non-identity. Is anyone able to find such a case? From the looks of it, the QR() command does not appear to do any pivoting (the diagonals of R are not in non-increasing order). For example: M2:=[[1,2],[3,5],[-1,7],[2,-1]] QR(M2); returns Code: [ So is there no pivoting? And if not, then it appears the P matrix is superfluous. RE: QR and permutation matrix - parisse - 10-26-2015 05:04 PM There is indeed no need to have a permutation matrix, you can check that in giac in vecteur.cc in qr_ortho, the idn matrix is here for compatibility. There is pivoting in the sense that to reduce a given column the line with highest absolute value is choosen. Can you explain what is the reason behind having a permutation matrix? RE: QR and permutation matrix - Han - 10-26-2015 05:16 PM I actually do not need the permutation matrix. I was asking because I wanted to use the QR factorization for solving a system and if the permutation matrix is non-identity then it would have required a few extra lines of code. Is this the same case for LU factorizations (I.e safe to ignore the permutation matrix)? RE: QR and permutation matrix - Han - 10-26-2015 07:24 PM (10-26-2015 05:04 PM)parisse Wrote: There is indeed no need to have a permutation matrix, you can check that in giac in vecteur.cc in qr_ortho, the idn matrix is here for compatibility. There is pivoting in the sense that to reduce a given column the line with highest absolute value is choosen. I am not sure what you mean by this. If \[ A = \begin{bmatrix} a_{1} & a_{2} & \dotsm & a_{n} \\ \end{bmatrix} \] then the first step is to swap columns (if necessary) so that the column column \( a_1 \) is replaced with the column having largest norm? And then a Householder reflection is applied? (And similarly for submatrices) Is that what you meant by pivoting? Quote:Can you explain what is the reason behind having a permutation matrix? QR factorization with pivoting gives R with diagonal terms in non-decreasing order. This is useful for factoring rank-deficient matrices. RE: QR and permutation matrix - parisse - 10-27-2015 06:48 AM I see, it is probably like total pivoting vs partial pivoting. Partial pivoting is used in LU and QR, but in the LU case this adds a generically non trivial permutation matrix (PA=LU, P^-1*L would not be triangular) while in the QR case the permutation is absorbed by Q. |