summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/include/gudhi/distance_functions.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h
index b2726ba8..006df275 100644
--- a/src/common/include/gudhi/distance_functions.h
+++ b/src/common/include/gudhi/distance_functions.h
@@ -28,13 +28,13 @@
/* Compute the Euclidean distance between two Points given
* by a range of coordinates. The points are assumed to have
* the same dimension. */
-template< typename Point >
-double euclidean_distance(const Point &p1,const Point &p2) {
- double dist = 0.;
+template< typename Filtration_value, typename Point >
+Filtration_value euclidean_distance(const Point &p1,const Point &p2) {
+ Filtration_value dist = 0.;
auto it1 = p1.begin();
auto it2 = p2.begin();
for (; it1 != p1.end(); ++it1, ++it2) {
- double tmp = *it1 - *it2;
+ Filtration_value tmp = (double)(*it1) - (double)(*it2);
dist += tmp*tmp;
}
return std::sqrt(dist);