About qr decomposition function : qr

X = qr(A) return a matrix X such that triu(X) is the upper triangualr factor R .
Could tell me how to calculate X ? (what is the algorithm to calculate X ?)
Also, why triu(X) is equal to R ?

4 comentarios

Matt J
Matt J el 17 de Dic. de 2014
That is only true if A is type sparse. If A is not sparse, then qr(A) will return the orthogonal factor Q.
Titus Edelhofer
Titus Edelhofer el 17 de Dic. de 2014
Why not? Also for full matrices X = qr(A) returns a matrix x, where the upper triangular part coincides with the matrix R that is returned when you ask for two output arguments [Q,R]=qr(A).
Titus
Matt J
Matt J el 17 de Dic. de 2014
Whoops, that's right. I forgot how that calling syntax worked. However, like the OP, I find it non-intuitive that qr() would return an output of that form. If triu(X) is R, then what is useful about the lower triangular part of the output? Why not just return R instead of forcing the user to call triu(X)?
Good question. The example at the bottom of the doc makes exactly this distinction between sparse and full:
if issparse(A)
R = qr(A);
else
R = triu(qr(A));
end
The values in the lower triangle describe the elementary reflectors for computing the qr decomposition, although I admit I'm not sure what you can use them for ;-).
Titus

Iniciar sesión para comentar.

Respuestas (1)

Titus Edelhofer
Titus Edelhofer el 17 de Dic. de 2014

0 votos

Hi,
regarding the algorithm: the help for qr states
% X = QR(A) and X = QR(A,0) return the output of LAPACK's *GEQRF routine. % TRIU(X) is the upper triangular factor R.
So take a look at the GEQRF documentation about the algorithm. It looks as if the algorithm is based on Householder reflections.
Titus

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Preguntada:

el 17 de Dic. de 2014

Comentada:

el 17 de Dic. de 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by