$search
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-2011 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00018 00020 template<typename T1> 00021 arma_inline 00022 const Op<T1, op_inv> 00023 inv 00024 ( 00025 const Base<typename T1::elem_type,T1>& X, 00026 const bool slow = false, 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_inv>(X.get_ref(), ((slow == false) ? 0 : 1), 0); 00034 } 00035 00036 00037 00039 template<typename T1> 00040 arma_inline 00041 const T1& 00042 inv(const Op<T1, op_inv>& X, const bool slow = false) 00043 { 00044 arma_extra_debug_sigprint(); 00045 arma_ignore(slow); 00046 00047 return X.m; 00048 } 00049 00050 00051 00053 template<typename T1> 00054 arma_inline 00055 const Op<T1, op_inv_tr> 00056 inv 00057 ( 00058 const Op<T1, op_trimat>& X, 00059 const bool slow = false, 00060 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 00061 ) 00062 { 00063 arma_extra_debug_sigprint(); 00064 arma_ignore(slow); 00065 arma_ignore(junk); 00066 00067 return Op<T1, op_inv_tr>(X.m, X.aux_uword_a, 0); 00068 } 00069 00070 00071 00073 template<typename T1> 00074 arma_inline 00075 const Op<T1, op_inv_sympd> 00076 inv 00077 ( 00078 const Op<T1, op_sympd>& X, 00079 const bool slow = false, 00080 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 00081 ) 00082 { 00083 arma_extra_debug_sigprint(); 00084 arma_ignore(slow); 00085 arma_ignore(junk); 00086 00087 return Op<T1, op_inv_sympd>(X.m, 0, 0); 00088 } 00089 00090 00091 00092 template<typename T1> 00093 inline 00094 bool 00095 inv 00096 ( 00097 Mat<typename T1::elem_type>& out, 00098 const Base<typename T1::elem_type,T1>& X, 00099 const bool slow = false, 00100 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 00101 ) 00102 { 00103 arma_extra_debug_sigprint(); 00104 arma_ignore(junk); 00105 00106 try 00107 { 00108 out = inv(X,slow); 00109 } 00110 catch(std::runtime_error&) 00111 { 00112 return false; 00113 } 00114 00115 return true; 00116 } 00117 00118 00119