diff options
Diffstat (limited to 'src/common/include/gudhi/distance_functions.h')
-rw-r--r-- | src/common/include/gudhi/distance_functions.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h index 22747637..7f33a804 100644 --- a/src/common/include/gudhi/distance_functions.h +++ b/src/common/include/gudhi/distance_functions.h @@ -35,7 +35,7 @@ * have the same dimension. */ class Euclidean_distance { public: - template< typename Point > + template< typename Point > auto operator()(const Point& p1, const Point& p2) const -> typename std::decay<decltype(*std::begin(p1))>::type { auto it1 = p1.begin(); auto it2 = p2.begin(); @@ -46,6 +46,11 @@ class Euclidean_distance { } return std::sqrt(dist); } + template< typename T > + T operator() ( const std::pair< T,T >& f , const std::pair< T,T >& s ) + { + return sqrt( (f.first-s.first)*(f.first-s.first) + (f.second-s.second)*(f.second-s.second) ); + } }; #endif // DISTANCE_FUNCTIONS_H_ |