File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,24 @@ namespace clue {
4949 friend class internal ::MetricInterface<WeightedEuclidianMetric<Ndim>, Ndim>;
5050 };
5151
52+ template <std::size_t Ndim>
53+ requires (Ndim == 2 )
54+ class PolarEuclidianMetric : public internal ::MetricInterface<PolarEuclidianMetric<Ndim>, Ndim> {
55+ public:
56+ ALPAKA_FN_HOST_ACC constexpr PolarEuclidianMetric () = default;
57+
58+ private:
59+ ALPAKA_FN_HOST_ACC constexpr auto distance (const std::array<float , Ndim>& lhs,
60+ const std::array<float , Ndim>& rhs) const {
61+ const auto distance2 = meta::accumulate<Ndim>(
62+ [&]<std::size_t Dim>() { return (lhs[Dim] - rhs[Dim]) * (lhs[Dim] - rhs[Dim]); });
63+ return math::sqrt (distance2);
64+ }
65+
66+ friend class internal ::MetricInterface<PolarEuclidianMetric<Ndim>, Ndim>;
67+ };
68+
69+
5270 template <std::size_t Ndim>
5371 class ManhattanMetric : public internal ::MetricInterface<ManhattanMetric<Ndim>, Ndim> {
5472 public:
You can’t perform that action at this time.
0 commit comments