Browse Source

added coordinate utility file

tempestpy_adaptions
TimQu 7 years ago
parent
commit
5f8af5a38a
  1. 24
      src/storm/storage/geometry/coordinates.h

24
src/storm/storage/geometry/coordinates.h

@ -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);
}
}
}
}
Loading…
Cancel
Save