41inline bool compare(
const T & a,
const T & b, std::false_type)
47inline bool compare(
const T & a,
const T & b, std::true_type)
52 if(a == b)
return true;
53 else return ( std::abs(a - b) <
EPSILON || (std::abs(a - b) / std::max(std::abs(a), std::abs(b))) <
EPSILON ) ;
58struct ErrorTolerantEqual:
59 public std::binary_function< T, T, bool >
63 return compare(a,b, std::is_floating_point<T>());
67template <
typename T >
68struct absdiff : std::binary_function<T, T, T>
78template<
class IT,
class NT>
80 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
82 inline bool operator()(
const std::tuple<IT, IT, NT> &
lhs,
const std::tuple<IT, IT, NT> &
rhs)
const
84 return ( (std::get<0>(
lhs) == std::get<0>(
rhs)) && (std::get<1>(
lhs) == std::get<1>(
rhs)) );
94template <
class IT,
class NT>
96 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
98 inline bool operator()(
const std::tuple<IT, IT, NT> &
lhs,
const std::tuple<IT, IT, NT> &
rhs)
const
100 if(std::get<1>(
lhs) == std::get<1>(
rhs))
102 return std::get<0>(
lhs) < std::get<0>(
rhs);
106 return std::get<1>(
lhs) < std::get<1>(
rhs);
111template <
class IT,
class NT>
112struct RowLexiCompare:
113 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
115 inline bool operator()(
const std::tuple<IT, IT, NT> &
lhs,
const std::tuple<IT, IT, NT> &
rhs)
const
117 if(std::get<0>(
lhs) == std::get<0>(
rhs))
119 return std::get<1>(
lhs) < std::get<1>(
rhs);
123 return std::get<0>(
lhs) < std::get<0>(
rhs);
130template <
class IT,
class NT>
132 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
134 inline bool operator()(
const std::tuple<IT, IT, NT> &
lhs,
const std::tuple<IT, IT, NT> &
rhs)
const
136 return std::get<1>(
lhs) < std::get<1>(
rhs);
141template <
class IT,
class NT>
143 public std::binary_function< std::tuple<IT, IT, NT>, std::tuple<IT, IT, NT>, bool >
145 inline bool operator()(
const std::tuple<IT, IT, NT> &
lhs,
const std::tuple<IT, IT, NT> &
rhs)
const
147 return std::get<0>(
lhs) < std::get<0>(
rhs);
151template <
class IT,
class NT>
152struct ColLexiCompareWithID:
153 public std::binary_function< std::pair< std::tuple<IT, IT, NT> , int > , std::pair< std::tuple<IT, IT, NT> , int>, bool >
155 inline bool operator()(
const std::pair< std::tuple<IT, IT, NT> ,
int > &
lhs,
const std::pair< std::tuple<IT, IT, NT> ,
int > &
rhs)
const
157 if(std::get<1>(
lhs.first) == std::get<1>(
rhs.first))
159 return std::get<0>(
lhs.first) < std::get<0>(
rhs.first);
163 return std::get<1>(
lhs.first) < std::get<1>(
rhs.first);
bool compare(const T &a, const T &b, std::false_type)
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const std::pair< std::tuple< IT, IT, NT >, int > &lhs, const std::pair< std::tuple< IT, IT, NT >, int > &rhs) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const T &a, const T &b) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
bool operator()(const std::tuple< IT, IT, NT > &lhs, const std::tuple< IT, IT, NT > &rhs) const
T operator()(T const &arg1, T const &arg2) const