Community
cancel
Showing results for
Did you mean:
Highlighted
Beginner
9 Views

## Any sample code that includes QRDecomp?

Dear Folks,

I need to obtain a QR factorization of a matrix. The results of the IPP QRDecomp function appear to be many steps removed from an actual QR decomposition. (See p. 239 of the small matrices manual). Is there any sample code available that demonstrates how to compute the Q matrix from the Householder vectors that are actually returned by QRDecomp? The code in Example 7-1 ippmQRFactorization_32f does not actually extract a separate Q and R but instead immediately uses the Householder vector results in a back-substitution to solve a linear system.

Thank you,

Alan Peters

2 Replies
Highlighted
Beginner
9 Views
Quoting - lamoid

Of course if there are no zeros on the main diagonal of R, then R is invertible and you can get Q by post-multiplying the input matrix by the inverse of R. That is, if A = QR and R is invertible then Q = A*inv. If R has a zero on the main diagonal then the question still stands.

Dear Folks,

I need to obtain a QR factorization of a matrix. The results of the IPP QRDecomp function appear to be many steps removed from an actual QR decomposition. (See p. 239 of the small matrices manual). Is there any sample code available that demonstrates how to compute the Q matrix from the Householder vectors that are actually returned by QRDecomp? The code in Example 7-1 ippmQRFactorization_32f does not actually extract a separate Q and R but instead immediately uses the Householder vector results in a back-substitution to solve a linear system.

Thank you,

Alan Peters

Highlighted
Employee
9 Views

Hi Lamoid,

What's the purpose for you to get the exact Q matrix? The QR decom in small matrix domain ismainly forsolve the least squares (LS) small-sizeproblem, so no explicit Q generated. But sure, you can caculate it by Q=A*inv.
If you are developing somemath compuation application, there are another library named MKL (math kernal library, http://software.intel.com/en-us/intel-mkl/, which provide more routines to support math compuation. You may try it.

For example, it includes some routines like *geqrf() and *orggr()
To compute the elements of Q explicitly, call
SGEQRF()
then
sorgqr (for real matrices)
(one fortransample code is under MKL install folder)

Regards,
Ying