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 25 of file fn_qr.hpp.

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

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