$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 inline 00022 arma_warn_unused 00023 typename T1::elem_type 00024 det 00025 ( 00026 const Base<typename T1::elem_type,T1>& X, 00027 const bool slow = false, 00028 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 00029 ) 00030 { 00031 arma_extra_debug_sigprint(); 00032 00033 arma_ignore(junk); 00034 00035 return auxlib::det(X, slow); 00036 } 00037 00038 00039 00041 template<typename T1> 00042 inline 00043 arma_warn_unused 00044 typename T1::elem_type 00045 det 00046 ( 00047 const Op<T1, op_diagmat>& X, 00048 const bool slow = false 00049 ) 00050 { 00051 arma_extra_debug_sigprint(); 00052 arma_ignore(slow); 00053 00054 typedef typename T1::elem_type eT; 00055 00056 const diagmat_proxy<T1> A(X.m); 00057 00058 const uword A_n_elem = A.n_elem; 00059 00060 eT val = eT(1); 00061 00062 for(uword i=0; i<A_n_elem; ++i) 00063 { 00064 val *= A[i]; 00065 } 00066 00067 return val; 00068 } 00069 00070 00071 00073 template<typename T1> 00074 inline 00075 arma_warn_unused 00076 typename T1::elem_type 00077 det 00078 ( 00079 const Op<T1,op_inv>& in, 00080 const bool slow = false, 00081 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 00082 ) 00083 { 00084 arma_extra_debug_sigprint(); 00085 arma_ignore(junk); 00086 00087 typedef typename T1::elem_type eT; 00088 00089 eT tmp = det(in.m, slow); 00090 arma_warn( (tmp == eT(0)), "det(): warning: denominator is zero" ); 00091 00092 return eT(1) / tmp; 00093 } 00094 00095 00096 00098 template<typename T1> 00099 inline 00100 arma_warn_unused 00101 typename T1::elem_type 00102 det 00103 ( 00104 const Op<T1,op_htrans>& in, 00105 const bool slow = false, 00106 const typename arma_blas_type_only<typename T1::elem_type>::result* junk1 = 0, 00107 const typename arma_not_cx<typename T1::elem_type>::result* junk2 = 0 00108 ) 00109 { 00110 arma_extra_debug_sigprint(); 00111 arma_ignore(junk1); 00112 arma_ignore(junk2); 00113 00114 typedef typename T1::elem_type eT; 00115 00116 const unwrap<T1> tmp(in.m); 00117 const Mat<eT>& X = tmp.M; 00118 00119 return det(X, slow); 00120 } 00121 00122 00123