simplify 'arma_isfinite(x) == false' to 'arma_isnonfinite(x)'
This commit is contained in:
@@ -328,7 +328,7 @@ BaseCube<elem_type,derived>::is_finite() const
|
||||
for(uword c=0; c<n_c; ++c)
|
||||
for(uword r=0; r<n_r; ++r)
|
||||
{
|
||||
if( arma_isfinite(P.at(r,c,s)) == false ) { return false; }
|
||||
if( arma_isnonfinite(P.at(r,c,s)) ) { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,7 +436,7 @@ BaseCube<elem_type,derived>::has_nonfinite() const
|
||||
for(uword c=0; c<n_c; ++c)
|
||||
for(uword r=0; r<n_r; ++r)
|
||||
{
|
||||
if(arma_isfinite(P.at(r,c,s)) == false) { return true; }
|
||||
if(arma_isnonfinite(P.at(r,c,s))) { return true; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ Base<elem_type,derived>::is_finite() const
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isfinite(Pea[i]) == false) { return false; }
|
||||
if(arma_isnonfinite(Pea[i])) { return false; }
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -696,7 +696,7 @@ Base<elem_type,derived>::is_finite() const
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
{
|
||||
if(arma_isfinite(P.at(row,col)) == false) { return false; }
|
||||
if(arma_isnonfinite(P.at(row,col))) { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -829,7 +829,7 @@ Base<elem_type,derived>::has_nonfinite() const
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isfinite(Pea[i]) == false) { return true; }
|
||||
if(arma_isnonfinite(Pea[i])) { return true; }
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -840,7 +840,7 @@ Base<elem_type,derived>::has_nonfinite() const
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
{
|
||||
if(arma_isfinite(P.at(row,col)) == false) { return true; }
|
||||
if(arma_isnonfinite(P.at(row,col))) { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ SpBase<elem_type,derived>::is_finite() const
|
||||
|
||||
while(it != it_end)
|
||||
{
|
||||
if(arma_isfinite(*it) == false) { return false; }
|
||||
if(arma_isnonfinite(*it)) { return false; }
|
||||
++it;
|
||||
}
|
||||
}
|
||||
@@ -850,7 +850,7 @@ SpBase<elem_type,derived>::has_nonfinite() const
|
||||
|
||||
while(it != it_end)
|
||||
{
|
||||
if(arma_isfinite(*it) == false) { return true; }
|
||||
if(arma_isnonfinite(*it)) { return true; }
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ arma_ostream::modify_stream(std::ostream& o, const eT* data, const uword n_elem)
|
||||
{
|
||||
const eT val = data[i];
|
||||
|
||||
if(arma_isfinite(val) == false) { continue; }
|
||||
if(arma_isnonfinite(val)) { continue; }
|
||||
|
||||
if(
|
||||
( cond_rel< (sizeof(eT) > 4) && (is_same_type<uword,eT>::yes || is_same_type<sword,eT>::yes) >::geq(val, eT(+10000000000)) )
|
||||
@@ -208,7 +208,7 @@ arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator
|
||||
{
|
||||
const eT val = (*it);
|
||||
|
||||
if(arma_isfinite(val) == false) { continue; }
|
||||
if(arma_isnonfinite(val)) { continue; }
|
||||
|
||||
if(
|
||||
val >= eT(+100) ||
|
||||
|
||||
@@ -1050,13 +1050,13 @@ arrayops::is_finite(const eT* src, const uword n_elem)
|
||||
const eT val_i = (*src); src++;
|
||||
const eT val_j = (*src); src++;
|
||||
|
||||
if(arma_isfinite(val_i) == false) { return false; }
|
||||
if(arma_isfinite(val_j) == false) { return false; }
|
||||
if(arma_isnonfinite(val_i)) { return false; }
|
||||
if(arma_isnonfinite(val_j)) { return false; }
|
||||
}
|
||||
|
||||
if((j-1) < n_elem)
|
||||
{
|
||||
if(arma_isfinite(*src) == false) { return false; }
|
||||
if(arma_isnonfinite(*src)) { return false; }
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -437,7 +437,7 @@ find_nonfinite(const SpBase<typename T1::elem_type,T1>& X)
|
||||
|
||||
for(uword i=0; i<n_nz; ++i)
|
||||
{
|
||||
if(arma_isfinite(*it) == false)
|
||||
if(arma_isnonfinite(*it))
|
||||
{
|
||||
const uword index = it.row() + it.col()*n_rows;
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@ namespace priv
|
||||
|
||||
const eT negdelta = log_b - log_a;
|
||||
|
||||
if( (negdelta < Datum<eT>::log_min) || (arma_isfinite(negdelta) == false) )
|
||||
if( (negdelta < Datum<eT>::log_min) || arma_isnonfinite(negdelta) )
|
||||
{
|
||||
return log_a;
|
||||
}
|
||||
|
||||
@@ -139,13 +139,13 @@ glue_mvnrnd::apply_noalias(Mat<eT>& out, const Mat<eT>& M, const Mat<eT>& C, con
|
||||
|
||||
const eT tol = eT(-100) * Datum<eT>::eps * norm(C, "fro");
|
||||
|
||||
if(arma_isfinite(tol) == false) { return false; }
|
||||
if(arma_isnonfinite(tol)) { return false; }
|
||||
|
||||
for(uword i=0; i<eigval_n_elem; ++i)
|
||||
{
|
||||
const eT val = eigval_mem[i];
|
||||
|
||||
if( (val < tol) || (arma_isfinite(val) == false) ) { return false; }
|
||||
if( (val < tol) || arma_isnonfinite(val) ) { return false; }
|
||||
}
|
||||
|
||||
for(uword i=0; i<eigval_n_elem; ++i) { if(eigval_mem[i] < eT(0)) { eigval_mem[i] = eT(0); } }
|
||||
|
||||
@@ -2361,7 +2361,7 @@ gmm_diag<eT>::em_iterate(const Mat<eT>& X, const uword max_iter, const eT var_fl
|
||||
get_cout_stream().flush();
|
||||
}
|
||||
|
||||
if(arma_isfinite(new_avg_log_p) == false) { return false; }
|
||||
if(arma_isnonfinite(new_avg_log_p)) { return false; }
|
||||
|
||||
if(std::abs(old_avg_log_p - new_avg_log_p) <= Datum<eT>::eps) { break; }
|
||||
|
||||
@@ -2473,7 +2473,7 @@ gmm_diag<eT>::em_update_params
|
||||
{
|
||||
const eT acc_norm_lhood = (std::max)( final_acc_norm_lhoods[g], std::numeric_limits<eT>::min() );
|
||||
|
||||
if(arma_isfinite(acc_norm_lhood) == false) { continue; }
|
||||
if(arma_isnonfinite(acc_norm_lhood)) { continue; }
|
||||
|
||||
eT* acc_mean_mem = final_acc_means.colptr(g);
|
||||
eT* acc_dcov_mem = final_acc_dcovs.colptr(g);
|
||||
@@ -2488,7 +2488,7 @@ gmm_diag<eT>::em_update_params
|
||||
acc_mean_mem[d] = tmp1;
|
||||
acc_dcov_mem[d] = tmp2;
|
||||
|
||||
if(arma_isfinite(tmp2) == false) { ok = false; }
|
||||
if(arma_isnonfinite(tmp2)) { ok = false; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2392,7 +2392,7 @@ gmm_full<eT>::em_iterate(const Mat<eT>& X, const uword max_iter, const eT var_fl
|
||||
get_cout_stream().flush();
|
||||
}
|
||||
|
||||
if(arma_isfinite(new_avg_log_p) == false) { return false; }
|
||||
if(arma_isnonfinite(new_avg_log_p)) { return false; }
|
||||
|
||||
if(std::abs(old_avg_log_p - new_avg_log_p) <= Datum<eT>::eps) { break; }
|
||||
|
||||
@@ -2516,7 +2516,7 @@ gmm_full<eT>::em_update_params
|
||||
{
|
||||
const eT acc_norm_lhood = (std::max)( final_acc_norm_lhoods[g], std::numeric_limits<eT>::min() );
|
||||
|
||||
if(arma_isfinite(acc_norm_lhood) == false) { continue; }
|
||||
if(arma_isnonfinite(acc_norm_lhood)) { continue; }
|
||||
|
||||
eT* acc_mean_mem = final_acc_means.colptr(g);
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ op_expmat::apply_direct(Mat<typename T1::elem_type>& out, const Base<typename T1
|
||||
|
||||
const T norm_val = arma::norm(A, "inf");
|
||||
|
||||
if(arma_isfinite(norm_val) == false) { return false; }
|
||||
if(arma_isnonfinite(norm_val)) { return false; }
|
||||
|
||||
int exponent = int(0); std::frexp(norm_val, &exponent);
|
||||
|
||||
|
||||
@@ -585,7 +585,7 @@ op_find_nonfinite::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_nonfinit
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if( arma_isfinite(Pea[i]) == false ) { indices_mem[count] = i; count++; }
|
||||
if( arma_isnonfinite(Pea[i]) ) { indices_mem[count] = i; count++; }
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -598,7 +598,7 @@ op_find_nonfinite::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_nonfinit
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
{
|
||||
if( arma_isfinite(P.at(row,col)) == false ) { indices_mem[count] = i; count++; }
|
||||
if( arma_isnonfinite(P.at(row,col)) ) { indices_mem[count] = i; count++; }
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ op_hist::apply_noalias(Mat<uword>& out, const Mat<eT>& A, const uword n_bins, co
|
||||
max_val += (n_bins/2);
|
||||
}
|
||||
|
||||
if(arma_isfinite(min_val) == false) { min_val = priv::most_neg<eT>(); }
|
||||
if(arma_isfinite(max_val) == false) { max_val = priv::most_pos<eT>(); }
|
||||
if(arma_isnonfinite(min_val)) { min_val = priv::most_neg<eT>(); }
|
||||
if(arma_isnonfinite(max_val)) { max_val = priv::most_pos<eT>(); }
|
||||
|
||||
Col<eT> c(n_bins, arma_nozeros_indicator());
|
||||
eT* c_mem = c.memptr();
|
||||
|
||||
@@ -138,7 +138,7 @@ op_norm2est::norm2est
|
||||
|
||||
T x_norm = op_norm::vec_norm_2( Proxy< Col<eT> >(x) );
|
||||
|
||||
if(x_norm == T(0) || (arma_isfinite(x_norm) == false) || (x.internal_has_nonfinite()))
|
||||
if( (x_norm == T(0)) || arma_isnonfinite(x_norm) || x.internal_has_nonfinite() )
|
||||
{
|
||||
randu_filler.fill(x.memptr(), x.n_elem);
|
||||
|
||||
@@ -155,7 +155,7 @@ op_norm2est::norm2est
|
||||
arma_debug_print(arma_str::format("norm2est(): est_old: %e") % est_old);
|
||||
arma_debug_print(arma_str::format("norm2est(): est_cur: %e") % est_cur);
|
||||
|
||||
if(arma_isfinite(est_cur) == false) { return est_old; }
|
||||
if(arma_isnonfinite(est_cur)) { return est_old; }
|
||||
|
||||
if( ((std::abs)(est_cur - est_old)) <= (tol * (std::max)(est_cur,est_old)) ) { break; }
|
||||
}
|
||||
@@ -218,7 +218,7 @@ op_norm2est::norm2est
|
||||
|
||||
T x_norm = op_norm::vec_norm_2( Proxy< Mat<eT> >(x) );
|
||||
|
||||
if(x_norm == T(0) || (arma_isfinite(x_norm) == false) || (x.internal_has_nonfinite()))
|
||||
if( (x_norm == T(0)) || arma_isnonfinite(x_norm) || x.internal_has_nonfinite() )
|
||||
{
|
||||
randu_filler.fill(x.memptr(), x.n_elem);
|
||||
|
||||
@@ -235,7 +235,7 @@ op_norm2est::norm2est
|
||||
arma_debug_print(arma_str::format("norm2est(): est_old: %e") % est_old);
|
||||
arma_debug_print(arma_str::format("norm2est(): est_cur: %e") % est_cur);
|
||||
|
||||
if(arma_isfinite(est_cur) == false) { return est_old; }
|
||||
if(arma_isnonfinite(est_cur)) { return est_old; }
|
||||
|
||||
if( ((std::abs)(est_cur - est_old)) <= (tol * (std::max)(est_cur,est_old)) ) { break; }
|
||||
}
|
||||
|
||||
@@ -162,9 +162,9 @@ running_stat<eT>::operator() (const typename running_stat<eT>::T sample)
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
|
||||
if( arma_isfinite(sample) == false )
|
||||
if(arma_isnonfinite(sample))
|
||||
{
|
||||
arma_warn(3, "running_stat: sample ignored as it is non-finite" );
|
||||
arma_warn(3, "running_stat: non-finite sample ignored" );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -181,9 +181,9 @@ running_stat<eT>::operator() (const std::complex< typename running_stat<eT>::T >
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
|
||||
if( arma_isfinite(sample) == false )
|
||||
if(arma_isnonfinite(sample))
|
||||
{
|
||||
arma_warn(3, "running_stat: sample ignored as it is non-finite" );
|
||||
arma_warn(3, "running_stat: non-finite sample ignored" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ running_stat_vec<obj_type>::operator() (const Base<typename running_stat_vec<obj
|
||||
|
||||
if( sample.internal_has_nonfinite() )
|
||||
{
|
||||
arma_warn(3, "running_stat_vec: sample ignored as it has non-finite elements");
|
||||
arma_warn(3, "running_stat_vec: non-finite sample ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ running_stat_vec<obj_type>::operator() (const Base< std::complex<typename runnin
|
||||
|
||||
if( sample.internal_has_nonfinite() )
|
||||
{
|
||||
arma_warn(3, "running_stat_vec: sample ignored as it has non-finite elements");
|
||||
arma_warn(3, "running_stat_vec: non-finite sample ignored");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ guess_sympd_worker(const Mat<eT>& A)
|
||||
{
|
||||
const eT A_jj = A_col[j];
|
||||
|
||||
if( A_jj <= eT(0)) { return false; }
|
||||
if(arma_isfinite(A_jj) == false) { return false; }
|
||||
if( A_jj <= eT(0)) { return false; }
|
||||
if(arma_isnonfinite(A_jj)) { return false; }
|
||||
|
||||
if(A_jj >= tol) { diag_below_tol = false; }
|
||||
|
||||
@@ -147,8 +147,8 @@ guess_sympd_worker(const Mat<eT>& A)
|
||||
const T A_jj_rabs = std::abs(A_jj_r);
|
||||
const T A_jj_iabs = std::abs(A_jj_i);
|
||||
|
||||
if( A_jj_r <= T(0) ) { return false; } // real should be positive
|
||||
if(arma_isfinite(A_jj_r) == false) { return false; }
|
||||
if( A_jj_r <= T(0) ) { return false; } // real should be positive
|
||||
if(arma_isnonfinite(A_jj_r)) { return false; }
|
||||
|
||||
if(A_jj_iabs > tol ) { return false; } // imag should be approx zero
|
||||
if(A_jj_iabs > A_jj_rabs) { return false; } // corner case: real and imag are close to zero, and imag is dominant
|
||||
@@ -164,7 +164,7 @@ guess_sympd_worker(const Mat<eT>& A)
|
||||
|
||||
const T square_max_diag = max_diag * max_diag;
|
||||
|
||||
if(arma_isfinite(square_max_diag) == false) { return false; }
|
||||
if(arma_isnonfinite(square_max_diag)) { return false; }
|
||||
|
||||
A_col = A_mem;
|
||||
|
||||
@@ -188,7 +188,7 @@ guess_sympd_worker(const Mat<eT>& A)
|
||||
// avoid using std::abs(), as that is time consuming due to division and std::sqrt()
|
||||
const T square_A_ij_abs = (A_ij_real * A_ij_real) + (A_ij_imag * A_ij_imag);
|
||||
|
||||
if(arma_isfinite(square_A_ij_abs) == false) { return false; }
|
||||
if(arma_isnonfinite(square_A_ij_abs)) { return false; }
|
||||
|
||||
if(square_A_ij_abs >= square_max_diag) { return false; }
|
||||
|
||||
@@ -285,7 +285,7 @@ is_approx_sym_worker(const Mat<eT>& A)
|
||||
{
|
||||
const eT A_jj = A_col[j];
|
||||
|
||||
if(arma_isfinite(A_jj) == false) { return false; }
|
||||
if(arma_isnonfinite(A_jj)) { return false; }
|
||||
|
||||
if(std::abs(A_jj) >= tol) { diag_below_tol = false; }
|
||||
|
||||
@@ -359,7 +359,7 @@ is_approx_sym_worker(const Mat<eT>& A)
|
||||
if(A_jj_iabs > tol ) { return false; } // imag should be approx zero
|
||||
if(A_jj_iabs > A_jj_rabs) { return false; } // corner case: real and imag are close to zero, and imag is dominant
|
||||
|
||||
if(arma_isfinite(A_jj_r) == false) { return false; }
|
||||
if(arma_isnonfinite(A_jj_r)) { return false; }
|
||||
|
||||
if(A_jj_rabs >= tol) { diag_below_tol = false; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user