Functions | |
template<typename T1 > | |
T1::elem_type | det (const Base< typename T1::elem_type, T1 > &X) |
determinant of mat | |
template<typename T1 > | |
T1::elem_type | det (const Op< T1, op_diagmat > &X) |
determinant of diagmat(mat) | |
template<typename eT > | |
eT | det (const Op< Mat< eT >, op_diagmat_vec > &X) |
determinant of diagmat(colvec or rowvec) | |
template<typename T1 , typename T2 > | |
T1::elem_type | det (const Glue< T1, T2, glue_times > &X) |
determinant of A*B, avoiding the times operation if A and B are square matrices with the same dimensions | |
template<typename T1 > | |
T1::elem_type | det (const Op< T1, op_inv > &in) |
determinant of inv(A), without doing the inverse operation | |
template<typename T1 > | |
T1::elem_type | det (const Op< T1, op_trans > &in) |
determinant of trans(A) |
T1::elem_type det | ( | const Base< typename T1::elem_type, T1 > & | X | ) | [inline] |
determinant of mat
Definition at line 35 of file fn_det.hpp.
References auxlib::det(), and Base< elem_type, derived >::get_ref().
Referenced by det().
00036 { 00037 arma_extra_debug_sigprint(); 00038 00039 typedef typename T1::elem_type eT; 00040 00041 const unwrap<T1> A_tmp(X.get_ref()); 00042 const Mat<eT>& A = A_tmp.M; 00043 00044 arma_debug_check( !A.is_square(), "det(): matrix must be square" ); 00045 00046 return auxlib::det(A); 00047 }
T1::elem_type det | ( | const Op< T1, op_diagmat > & | X | ) | [inline] |
determinant of diagmat(mat)
Definition at line 55 of file fn_det.hpp.
References Mat< eT >::at(), Mat< eT >::is_square(), Op< T1, op_type >::m, Mat< eT >::n_elem, and Mat< eT >::n_rows.
00056 { 00057 arma_extra_debug_sigprint(); 00058 00059 const unwrap<T1> A_tmp(X.m); 00060 00061 typedef typename T1::elem_type eT; 00062 const Mat<eT>& A = A_tmp.M; 00063 00064 arma_debug_check( (A.n_elem == 0), "det(): empty matrix"); 00065 arma_debug_check( !A.is_square(), "det(): incompatible dimensions for diagmat operation" ); 00066 00067 eT val = A.at(0,0); 00068 00069 for(u32 i=1; i<A.n_rows; ++i) 00070 { 00071 val *= A.at(i,i); 00072 } 00073 00074 return val; 00075 }
eT det | ( | const Op< Mat< eT >, op_diagmat_vec > & | X | ) | [inline] |
determinant of diagmat(colvec or rowvec)
Definition at line 83 of file fn_det.hpp.
References Mat< eT >::is_vec(), Mat< eT >::mem, and Mat< eT >::n_elem.
00084 { 00085 arma_extra_debug_sigprint(); 00086 00087 const Mat<eT>& A = X.m; 00088 00089 arma_debug_check( (A.n_elem == 0), "det(): empty matrix"); 00090 arma_debug_check( !A.is_vec(), "det_diagvec(): internal error: can't interpret as a vector" ); 00091 00092 eT val = A.mem[0]; 00093 00094 for(u32 i=1; i<A.n_elem; ++i) 00095 { 00096 val *= A.mem[i]; 00097 } 00098 00099 return val; 00100 }
T1::elem_type det | ( | const Glue< T1, T2, glue_times > & | X | ) | [inline] |
determinant of A*B, avoiding the times operation if A and B are square matrices with the same dimensions
Definition at line 108 of file fn_det.hpp.
References Glue< T1, T2, glue_type >::A, Glue< T1, T2, glue_type >::B, det(), Mat< eT >::n_cols, and Mat< eT >::n_rows.
00109 { 00110 arma_extra_debug_sigprint(); 00111 00112 typedef typename T1::elem_type eT; 00113 00114 const unwrap<T1> tmp1(X.A); 00115 const unwrap<T2> tmp2(X.B); 00116 00117 const Mat<eT>& A = tmp1.M; 00118 const Mat<eT>& B = tmp2.M; 00119 00120 if( (A.n_rows == A.n_cols) && (A.n_rows == B.n_rows) && (A.n_cols == B.n_cols) ) 00121 { 00122 return det(A) * det(B); 00123 } 00124 else 00125 { 00126 return det(Mat<eT>(X)); 00127 } 00128 00129 }
determinant of inv(A), without doing the inverse operation
Definition at line 137 of file fn_det.hpp.
References isnt_fltpt< T1 >::check(), det(), and Op< T1, op_type >::m.
00138 { 00139 arma_extra_debug_sigprint(); 00140 00141 typedef typename T1::elem_type eT; 00142 isnt_fltpt<eT>::check(); 00143 00144 eT tmp = det(in.m); 00145 arma_debug_warn( (tmp == eT(0)), "det(): warning: determinant is zero" ); 00146 00147 return eT(1) / tmp; 00148 }
determinant of trans(A)
Definition at line 156 of file fn_det.hpp.
References det(), and Op< T1, op_type >::m.
00157 { 00158 arma_extra_debug_sigprint(); 00159 00160 typedef typename T1::elem_type eT; 00161 00162 const unwrap<T1> tmp(in.m); 00163 const Mat<eT>& X = tmp.M; 00164 00165 return det(X); 00166 }