fn_princomp.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2010-2011 Conrad Sanderson
00003 // Copyright (C) 2010 Dimitrios Bouzas
00004 // 
00005 // This file is part of the Armadillo C++ library.
00006 // It is provided without any warranty of fitness
00007 // for any purpose. You can redistribute this file
00008 // and/or modify it under the terms of the GNU
00009 // Lesser General Public License (LGPL) as published
00010 // by the Free Software Foundation, either version 3
00011 // of the License or (at your option) any later version.
00012 // (see http://www.opensource.org/licenses for more info)
00013 
00014 
00017 
00018 
00019 
00026 template<typename T1>
00027 inline
00028 bool
00029 princomp
00030   (
00031          Mat<typename T1::elem_type>&    coeff_out,
00032          Mat<typename T1::elem_type>&    score_out,
00033          Col<typename T1::pod_type>&     latent_out,
00034          Col<typename T1::elem_type>&    tsquared_out,
00035   const Base<typename T1::elem_type,T1>& X,
00036   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
00037   )
00038   {
00039   arma_extra_debug_sigprint();
00040   
00041   typedef typename T1::elem_type eT;
00042   
00043   const unwrap<T1>   tmp(X.get_ref());
00044   const Mat<eT>& A = tmp.M;
00045   
00046   const bool status = op_princomp::direct_princomp(coeff_out, score_out, latent_out, tsquared_out, A);
00047   
00048   if(status == false)
00049     {
00050     coeff_out.reset();
00051     score_out.reset();
00052     latent_out.reset();
00053     tsquared_out.reset();
00054     
00055     arma_bad("princomp(): failed to converge", false);
00056     }
00057   
00058   return status;
00059   }
00060 
00061 
00062 
00068 template<typename T1>
00069 inline
00070 bool
00071 princomp
00072   (
00073          Mat<typename T1::elem_type>&    coeff_out,
00074          Mat<typename T1::elem_type>&    score_out,
00075          Col<typename T1::pod_type>&     latent_out,
00076   const Base<typename T1::elem_type,T1>& X,
00077   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
00078   )
00079   {
00080   arma_extra_debug_sigprint();
00081   
00082   typedef typename T1::elem_type eT;
00083   
00084   const unwrap<T1>   tmp(X.get_ref());
00085   const Mat<eT>& A = tmp.M;
00086   
00087   const bool status = op_princomp::direct_princomp(coeff_out, score_out, latent_out, A); 
00088   
00089   if(status == false)
00090     {
00091     coeff_out.reset();
00092     score_out.reset();
00093     latent_out.reset();
00094     
00095     arma_bad("princomp(): failed to converge", false);
00096     }
00097   
00098   return status;
00099   }
00100 
00101 
00102 
00107 template<typename T1>
00108 inline
00109 bool
00110 princomp
00111   (
00112          Mat<typename T1::elem_type>&    coeff_out,
00113          Mat<typename T1::elem_type>&    score_out,
00114   const Base<typename T1::elem_type,T1>& X,
00115   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
00116   )
00117   {
00118   arma_extra_debug_sigprint();
00119   
00120   typedef typename T1::elem_type eT;
00121   
00122   const unwrap<T1>   tmp(X.get_ref());
00123   const Mat<eT>& A = tmp.M;
00124   
00125   const bool status = op_princomp::direct_princomp(coeff_out, score_out, A); 
00126   
00127   if(status == false)
00128     {
00129     coeff_out.reset();
00130     score_out.reset();
00131     
00132     arma_bad("princomp(): failed to converge", false);
00133     }
00134   
00135   return status;
00136   }
00137 
00138 
00139 
00143 template<typename T1>
00144 inline
00145 bool
00146 princomp
00147   (
00148          Mat<typename T1::elem_type>&    coeff_out,
00149   const Base<typename T1::elem_type,T1>& X,
00150   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
00151   )
00152   {
00153   arma_extra_debug_sigprint();
00154   
00155   typedef typename T1::elem_type eT;
00156   
00157   const unwrap<T1>   tmp(X.get_ref());
00158   const Mat<eT>& A = tmp.M;
00159   
00160   const bool status = op_princomp::direct_princomp(coeff_out, A);
00161   
00162   if(status == false)
00163     {
00164     coeff_out.reset();
00165     
00166     arma_bad("princomp(): failed to converge", false);
00167     }
00168   
00169   return status;
00170   }
00171 
00172 
00173 
00174 template<typename T1>
00175 inline
00176 const Op<T1, op_princomp>
00177 princomp
00178   (
00179   const Base<typename T1::elem_type,T1>& X,
00180   const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
00181   )
00182   {
00183   arma_extra_debug_sigprint();
00184 
00185   return Op<T1, op_princomp>(X.get_ref());
00186   }
00187 
00188 
00189 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:04