armadillo how to get rid of error message -


running following code still produces error message goes stdout (not stderr) although exception caught:

mat<double> matrix_quantiles(const vector<double> & quantiles,                          const mat<double> & m) {   mat<double> sorted_matrix;   try {     sorted_matrix = arma::sort(arma::cor(m));   } catch(std::logic_error & e) {   /*    col constant, causing correlation    infinite. if happens, add normal random jitter    values , retry.   */   const mat<double> jitter = mat<double>(     m.n_rows, m.n_cols, arma::fill::randn);   return matrix_quantiles(quantiles, 1.e-3 * jitter + m); }  etc. 

the error message is:

error: sort(): given object has non-finite elements 

the code runs fine, , jittering strategy enough do, have filter out error message if write output stdout.

thank you.

to disable printing of error messagaes, define macro named arma_dont_print_errors before including armadillo header. example:

#define arma_dont_print_errors #include <armadillo> 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -