Fn_qr

Functions

template<typename T1 >
void qr (Mat< typename T1::elem_type > &Q, Mat< typename T1::elem_type > &R, const Base< typename T1::elem_type, T1 > &X)
 QR decomposition.

Function Documentation

template<typename T1 >
void qr ( Mat< typename T1::elem_type > &  Q,
Mat< typename T1::elem_type > &  R,
const Base< typename T1::elem_type, T1 > &  X 
) [inline]

QR decomposition.

Definition at line 24 of file fn_qr.hpp.

References arma_print(), Base< elem_type, derived >::get_ref(), and auxlib::qr().

00025   {
00026   arma_extra_debug_sigprint();
00027   
00028   typedef typename T1::elem_type eT;
00029 
00030   arma_debug_check( (&Q == &R), "qr(): Q and R are the same object");
00031   
00032   const unwrap_check<T1> tmp1(X.get_ref(), Q);
00033   const Mat<eT>&     A = tmp1.M;
00034   
00035   const unwrap_check< Mat<eT> > tmp2(A, R);
00036   const Mat<eT>&            B = tmp2.M;
00037   
00038   const bool ok = auxlib::qr(Q, R, B);
00039   
00040   if(ok == false)
00041     {
00042     arma_print("qr(): matrix factorisation failed");
00043     }
00044   
00045   }