op_inv_gen_meat.hpp (armadillo-11.1.0.tar.xz) | : | op_inv_gen_meat.hpp (armadillo-11.1.1.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 106 | skipping to change at line 106 | |||
arma_debug_check( (no_sympd && likely_sympd), "inv(): options 'no_sympd' and 'likely_sympd' are mutually exclusive" ); | arma_debug_check( (no_sympd && likely_sympd), "inv(): options 'no_sympd' and 'likely_sympd' are mutually exclusive" ); | |||
arma_debug_check( (no_ugly && allow_approx), "inv(): options 'no_ugly' and 'allow_approx' are mutually exclusive" ); | arma_debug_check( (no_ugly && allow_approx), "inv(): options 'no_ugly' and 'allow_approx' are mutually exclusive" ); | |||
} | } | |||
if(no_ugly) | if(no_ugly) | |||
{ | { | |||
op_inv_gen_state<T> inv_state; | op_inv_gen_state<T> inv_state; | |||
const bool status = op_inv_gen_rcond::apply_direct(out, inv_state, expr); | const bool status = op_inv_gen_rcond::apply_direct(out, inv_state, expr); | |||
if((status == false) || (inv_state.rcond < std::numeric_limits<T>::epsilon() | const T local_rcond = inv_state.rcond; // workaround for bug in gcc 4.8 | |||
) || arma_isnan(inv_state.rcond)) { return false; } | ||||
if((status == false) || (local_rcond < std::numeric_limits<T>::epsilon()) || | ||||
arma_isnan(local_rcond)) { return false; } | ||||
return true; | return true; | |||
} | } | |||
if(allow_approx) | if(allow_approx) | |||
{ | { | |||
op_inv_gen_state<T> inv_state; | op_inv_gen_state<T> inv_state; | |||
Mat<eT> tmp; | Mat<eT> tmp; | |||
const bool status = op_inv_gen_rcond::apply_direct(tmp, inv_state, expr); | const bool status = op_inv_gen_rcond::apply_direct(tmp, inv_state, expr); | |||
if((status == false) || (inv_state.rcond < std::numeric_limits<T>::epsilon() | const T local_rcond = inv_state.rcond; // workaround for bug in gcc 4.8 | |||
) || arma_isnan(inv_state.rcond)) | ||||
if((status == false) || (local_rcond < std::numeric_limits<T>::epsilon()) || | ||||
arma_isnan(local_rcond)) | ||||
{ | { | |||
Mat<eT> A = expr.get_ref(); | Mat<eT> A = expr.get_ref(); | |||
if(inv_state.is_diag) { return op_pinv::apply_diag(out, A, T(0) ); } | if(inv_state.is_diag) { return op_pinv::apply_diag(out, A, T(0) ); } | |||
if(inv_state.is_sym ) { return op_pinv::apply_sym (out, A, T(0), uword(0) ); } | if(inv_state.is_sym ) { return op_pinv::apply_sym (out, A, T(0), uword(0) ); } | |||
return op_pinv::apply_gen(out, A, T(0), uword(0)); | return op_pinv::apply_gen(out, A, T(0), uword(0)); | |||
} | } | |||
out.steal_mem(tmp); | out.steal_mem(tmp); | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 8 lines changed or added |