File indexing completed on 2024-04-06 12:19:19
0001 #ifndef NPSTAT_COMPLEXCOMPARESABS_HH_
0002 #define NPSTAT_COMPLEXCOMPARESABS_HH_
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <cmath>
0015 #include <complex>
0016
0017 namespace npstat {
0018
0019
0020
0021
0022
0023 template <class T>
0024 struct ComplexComparesAbs {
0025 inline static bool less(const T& l, const T& r) { return l < r; }
0026
0027 inline static bool more(const T& l, const T& r) { return l > r; }
0028 };
0029
0030 template <class T>
0031 struct ComplexComparesAbs<std::complex<T> > {
0032 inline static bool less(const std::complex<T>& l, const std::complex<T>& r) { return std::abs(l) < std::abs(r); }
0033
0034 inline static bool more(const std::complex<T>& l, const std::complex<T>& r) { return std::abs(l) > std::abs(l); }
0035 };
0036 }
0037
0038 #endif