|
@ -0,0 +1,24 @@ |
|
|
|
|
|
#include "storm/utility/constants.h" |
|
|
|
|
|
#include "storm/utility/macros.h" |
|
|
|
|
|
|
|
|
|
|
|
namespace storm { |
|
|
|
|
|
namespace storage { |
|
|
|
|
|
namespace geometry { |
|
|
|
|
|
|
|
|
|
|
|
template <typename T> |
|
|
|
|
|
T euclideanDistance(std::vector<T> const& p, std::vector<T> const& q) { |
|
|
|
|
|
STORM_LOG_ASSERT(p.size() == q.size(), "Invalid dimensions of input vectors."); |
|
|
|
|
|
T squaredSum = storm::utility::zero<T>(); |
|
|
|
|
|
auto pIt = p.begin(); |
|
|
|
|
|
auto pItE = p.end(); |
|
|
|
|
|
auto qIt = q.begin(); |
|
|
|
|
|
for (; pIt != pItE; ++pIt, ++qIt) { |
|
|
|
|
|
T diff = *pIt - *qIt; |
|
|
|
|
|
squaredSum += diff * diff; |
|
|
|
|
|
} |
|
|
|
|
|
return storm::utility::sqrt(squaredSum); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |