Index: kernel/include/VectorD.h =================================================================== --- kernel/include/VectorD.h (revision 1068) +++ kernel/include/VectorD.h (working copy) @@ -339,7 +339,24 @@ } +//! compute the squared distance between two vectors template +Float get_squared_distance(const VectorD &v1, const VectorD &v2) { + Float d, s = 0; + for (unsigned int i=0; i< D; ++i) { + d = v1[i] - v2[i]; + s += d*d; + } + return s; +} + +// ! compute the distance between two vectors +template +Float get_distance (const VectorD &v1, const VectorD &v2) { + return std::sqrt(get_squared_distance(v1, v2)); +} + +template struct SpacesIO { const VectorD &v_;