"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/armadillo_bits/op_log_det_meat.hpp" between
armadillo-10.8.2.tar.xz and armadillo-11.0.0.tar.xz

About: Armadillo is a C++ linear algebra library (matrix maths) aiming towards a good balance between speed and ease of use.

op_log_det_meat.hpp  (armadillo-10.8.2.tar.xz):op_log_det_meat.hpp  (armadillo-11.0.0.tar.xz)
skipping to change at line 29 skipping to change at line 29
//! @{ //! @{
template<typename T1> template<typename T1>
inline inline
bool bool
op_log_det::apply_direct(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base<typename T1::elem_type,T1>& expr) op_log_det::apply_direct(typename T1::elem_type& out_val, typename T1::pod_type& out_sign, const Base<typename T1::elem_type,T1>& expr)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
// typedef typename T1::pod_type T;
if(strip_diagmat<T1>::do_diagmat) if(strip_diagmat<T1>::do_diagmat)
{ {
const strip_diagmat<T1> strip(expr.get_ref()); const strip_diagmat<T1> strip(expr.get_ref());
return op_log_det::apply_diagmat(out_val, out_sign, strip.M); return op_log_det::apply_diagmat(out_val, out_sign, strip.M);
} }
if(strip_trimat<T1>::do_trimat) if(strip_trimat<T1>::do_trimat)
{ {
skipping to change at line 55 skipping to change at line 56
arma_debug_check( (A.is_square() == false), "log_det(): given matrix must be s quare sized" ); arma_debug_check( (A.is_square() == false), "log_det(): given matrix must be s quare sized" );
if(A.is_diagmat()) { return op_log_det::apply_diagmat(out_val, out_sign, A); } if(A.is_diagmat()) { return op_log_det::apply_diagmat(out_val, out_sign, A); }
const bool is_triu = trimat_helper::is_triu(A); const bool is_triu = trimat_helper::is_triu(A);
const bool is_tril = is_triu ? false : trimat_helper::is_tril(A); const bool is_tril = is_triu ? false : trimat_helper::is_tril(A);
if(is_triu || is_tril) { return op_log_det::apply_trimat(out_val, out_sign, A ); } if(is_triu || is_tril) { return op_log_det::apply_trimat(out_val, out_sign, A ); }
// const bool try_sympd = arma_config::optimise_sympd && sympd_helper::guess_s
ympd(A);
//
// if(try_sympd)
// {
// arma_extra_debug_print("op_log_det: attempting sympd optimisation");
//
// T out_val_real = T(0);
//
// const bool status = auxlib::log_det_sympd(out_val_real, A);
//
// if(status)
// {
// out_val = eT(out_val_real);
// out_sign = T(1);
//
// return true;
// }
//
// arma_extra_debug_print("op_log_det: sympd optimisation failed");
//
// // restore A as it's destroyed by auxlib::log_det_sympd()
// A = expr.get_ref();
//
// // fallthrough to the next return statement
// }
return auxlib::log_det(out_val, out_sign, A); return auxlib::log_det(out_val, out_sign, A);
} }
template<typename T1> template<typename T1>
inline inline
bool bool
op_log_det::apply_diagmat(typename T1::elem_type& out_val, typename T1::pod_type & out_sign, const Base<typename T1::elem_type,T1>& expr) op_log_det::apply_diagmat(typename T1::elem_type& out_val, typename T1::pod_type & out_sign, const Base<typename T1::elem_type,T1>& expr)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 154 skipping to change at line 181
// //
template<typename T1> template<typename T1>
inline inline
bool bool
op_log_det_sympd::apply_direct(typename T1::pod_type& out_val, const Base<typena me T1::elem_type,T1>& expr) op_log_det_sympd::apply_direct(typename T1::pod_type& out_val, const Base<typena me T1::elem_type,T1>& expr)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
Mat<eT> A(expr.get_ref()); Mat<eT> A(expr.get_ref());
arma_debug_check( (A.is_square() == false), "log_det_sympd(): given matrix mus t be square sized" ); arma_debug_check( (A.is_square() == false), "log_det_sympd(): given matrix mus t be square sized" );
if((arma_config::debug) && (arma_config::warn_level > 0) && (is_cx<eT>::yes) &
& (sympd_helper::check_diag_imag(A) == false))
{
arma_debug_warn_level(1, "log_det_sympd(): imaginary components on diagonal
are non-zero");
}
if(is_op_diagmat<T1>::value || A.is_diagmat())
{
arma_extra_debug_print("op_log_det_sympd: detected diagonal matrix");
eT* colmem = A.memptr();
out_val = T(0);
const uword N = A.n_rows;
for(uword i=0; i<N; ++i)
{
const eT& A_ii = colmem[i];
const T A_ii_real = access::tmp_real(A_ii);
if(A_ii_real <= T(0)) { return false; }
out_val += std::log(A_ii_real);
colmem += N;
}
return true;
}
if((arma_config::debug) && (auxlib::rudimentary_sym_check(A) == false)) if((arma_config::debug) && (auxlib::rudimentary_sym_check(A) == false))
{ {
if(is_cx<eT>::no ) { arma_debug_warn_level(1, "log_det_sympd(): given matri x is not symmetric"); } if(is_cx<eT>::no ) { arma_debug_warn_level(1, "log_det_sympd(): given matri x is not symmetric"); }
if(is_cx<eT>::yes) { arma_debug_warn_level(1, "log_det_sympd(): given matri x is not hermitian"); } if(is_cx<eT>::yes) { arma_debug_warn_level(1, "log_det_sympd(): given matri x is not hermitian"); }
} }
return auxlib::log_det_sympd(out_val, A); return auxlib::log_det_sympd(out_val, A);
} }
//! @} //! @}
 End of changes. 4 change blocks. 
0 lines changed or deleted 61 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)