$search
00001 // Copyright (C) 2009-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2009-2011 Conrad Sanderson 00003 // Copyright (C) 2009-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 00020 template<typename T1> 00021 inline 00022 const Op<T1, op_pinv> 00023 pinv 00024 ( 00025 const Base<typename T1::elem_type,T1>& X, 00026 const typename T1::elem_type tol = 0.0, 00027 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 00028 ) 00029 { 00030 arma_extra_debug_sigprint(); 00031 arma_ignore(junk); 00032 00033 return Op<T1, op_pinv>(X.get_ref(), tol); 00034 } 00035 00036 00037 00038 template<typename T1> 00039 inline 00040 bool 00041 pinv 00042 ( 00043 Mat<typename T1::elem_type>& out, 00044 const Base<typename T1::elem_type,T1>& X, 00045 const typename T1::elem_type tol = 0.0, 00046 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 00047 ) 00048 { 00049 arma_extra_debug_sigprint(); 00050 arma_ignore(junk); 00051 00052 try 00053 { 00054 out = pinv(X,tol); 00055 } 00056 catch(std::runtime_error&) 00057 { 00058 return false; 00059 } 00060 00061 return true; 00062 } 00063 00064 00065