Thread Subject: in [Q, R, E] = qr(A), how E is determined ?

Subject: in [Q, R, E] = qr(A), how E is determined ?

From: Marco Pappalepore

Date: 5 May, 2009 17:51:10

Message: 1 of 2

Hi,

   I'm trying to implement qr factorization, as it works in matlab, in another programming language. I've found an algorithm to do the qr factorization (but without ordering abs(diag(R)). That's the part I'm missing. On qr's help page, it is said:

"[Q,R,E] = qr(A) for full matrix A, produces a permutation matrix E, an upper triangular matrix R with decreasing diagonal elements, and a unitary matrix Q so that A*E = Q*R. The column permutation E is chosen so that abs(diag(R)) is decreasing."

I've looked also at the fortran implementation of qr in netlib at this address :

http://www.netlib.org/lapack/double/dgeqp3.f

there I can get the permutation (=pivot) matrix is received as an input parameter:

(...)
* JPVT (input/output) INTEGER array, dimension (N)
* On entry, if JPVT(J).ne.0, the J-th column of A is permuted
* to the front of A*P (a leading column); if JPVT(J)=0,
* the J-th column of A is a free column.
* On exit, if JPVT(J)=K, then the J-th column of A*P was the
* the K-th column of A.
(...)

it seems that the pivot strategy is determined outside of the fortran routine, somewhere in matlab internals. Now I'm able to find the correct permutation matrix by searching it with a brute-force approach, i.e. simply exploring all the permutations until I find one good, that makes abs(diag(R)) decreasing; but that could bring the elaboration time to exponential or even factorial dimensions. I'm guessing if, given a not ordered Q-R factorization, is there some transformation or formula (like the gauss algorithm for finding linear independent columns) that "understands" rapidly how the permutation matrix E must be. So, how is E determined in the qr routine ?

many thanks, Marco

Subject: in [Q, R, E] = qr(A), how E is determined ?

From: Bruno Luong

Date: 5 May, 2009 18:12:01

Message: 2 of 2

QR is essentially a Gram-Smidth orthogonalization procedure. 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. Essentially, this can be easily prove using triangular inequality (norm of the projection <= norm of the vector). This procedure provides a permutation E and warranty the expected property without any extra cost in QR decomposition (certainly not exponential or factorial complexity).

Bruno

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
al Bruno Luong 5 May, 2009 14:14:04
pivot Marco Pappalepore 5 May, 2009 13:54:12
permutation matrix Marco Pappalepore 5 May, 2009 13:54:12
qr decomposition Marco Pappalepore 5 May, 2009 13:54:12
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com