diff options
author | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-04-06 15:36:53 +0000 |
---|---|---|
committer | pdlotko <pdlotko@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-04-06 15:36:53 +0000 |
commit | 8252d6eb78c9fe355a2167ad68e9106fcaa8fcdb (patch) | |
tree | f925ae2c44c5c84d7f3d1d9ba6821cc5953d7e36 /src/common | |
parent | 39cd1e8ab33bd069236649edc10459925cea83f4 (diff) |
Answering MG3 comments.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/gudhi_stat@2313 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 3bae7a55d05831af55a5b1c3e0d2695383af325f
Diffstat (limited to 'src/common')
-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_ |