MUQ  0.4.3
EigenUtilities.h
Go to the documentation of this file.
1 #ifndef EIGENUTILITIES_H
2 #define EIGENUTILITIES_H
3 
4 #include <Eigen/Core>
5 
6 namespace muq{
7 namespace Utilities{
8 
9  template<typename ScalarType>
11  {
12  bool operator()(Eigen::Matrix<ScalarType, Eigen::Dynamic,1> const& left,
13  Eigen::Matrix<ScalarType, Eigen::Dynamic,1> const& right) const
14  {
15  if(left.size()!=right.size())
16  return left.size()<right.size();
17 
18  for(unsigned int i=0; i<left.size(); ++i){
19  if(left[i]<right[i]-5.0*std::numeric_limits<double>::epsilon()) return true;
20  if(left[i]>right[i]+5.0*std::numeric_limits<double>::epsilon()) return false;
21  }
22 
23  // At this point, they must be equal and therefore not less than
24  return false;
25  }
26  };
27 }
28 }
29 
30 
31 
32 #endif // #ifndef EIGENUTILITIES_H
bool operator()(Eigen::Matrix< ScalarType, Eigen::Dynamic, 1 > const &left, Eigen::Matrix< ScalarType, Eigen::Dynamic, 1 > const &right) const