Registered Member
|
Hi!
I would like to use std::isnan() and std::isinf() or equivalent to check for NaNs and Infs in a Eigen::Matrix<>. Ideally, I would like to be able to do something like: Matrix< ... > m ; ... std::cout << "Number of NaNs : " << ( isnan( m.array() ) ).count ) << std::endl ; Or, to use something like MATLAB's synatx: m( isnan( m ) ) = 0 ; Is the best approach to add a new function/functor like the support for the math functions cos, sin, etc.? I did RTFM but didn't find anything relevant. Thanks! |
Moderator
|
yes, the best approach is to:
1 - write the respective functor (if you are familiar with STL you can build it using STL mechanism, or have a look at the Eigen/src/Cor/Functors.h file for the examples) 2 - add such functions just like abs() |
Registered users: Bing [Bot], Evergrowing, Google [Bot], rockscient