Distance metrics¶
Implementations of common distance metrics.
- Author
Simone Balducci
-
namespace clue¶
Typedefs¶
-
template<std::size_t Ndim, std::floating_point TData = float>
class ChebyshevMetric¶ - #include <DistanceMetrics.hpp>
Chebyshev distance metric This class implements the Chebyshev distance metric in Ndim dimensions.
- Template Parameters:¶
Public Functions¶
-
ALPAKA_FN_HOST_ACC inline constexpr ChebyshevMetric()¶
Default constructor.
-
ALPAKA_FN_HOST_ACC inline constexpr auto operator()(const Point<Ndim, value_type> &lhs, const Point<Ndim, value_type> &rhs) const¶
Compute the Chebyshev distance between two points.
- Parameters:¶
- const Point<Ndim, value_type> &lhs¶
First point
- const Point<Ndim, value_type> &rhs¶
Second point
- Returns:¶
Chebyshev distance between the two points
-
template<std::size_t Ndim, std::floating_point TData = float>
class EuclideanMetric¶ - #include <DistanceMetrics.hpp>
Euclidean distance metric.
This class implements the Euclidean distance metric in Ndim dimensions.
- Template Parameters:¶
Public Functions¶
-
ALPAKA_FN_HOST_ACC inline constexpr EuclideanMetric()¶
Default constructor.
- Returns:¶
EuclideanMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr auto operator()(const Point<Ndim, value_type> &lhs, const Point<Ndim, value_type> &rhs) const¶
Compute the Euclidean distance between two points.
- Parameters:¶
- const Point<Ndim, value_type> &lhs¶
First point
- const Point<Ndim, value_type> &rhs¶
Second point
- Returns:¶
Euclidean distance between the two points
-
template<std::size_t Ndim, std::floating_point TData = float>
class ManhattanMetric¶ - #include <DistanceMetrics.hpp>
Manhattan distance metric This class implements the Manhattan distance metric in Ndim dimensions.
- Template Parameters:¶
Public Functions¶
-
ALPAKA_FN_HOST_ACC inline constexpr ManhattanMetric()¶
Default constructor.
-
ALPAKA_FN_HOST_ACC inline constexpr auto operator()(const Point<Ndim, value_type> &lhs, const Point<Ndim, value_type> &rhs) const¶
Compute the Manhattan distance between two points.
- Parameters:¶
- const Point<Ndim, value_type> &lhs¶
First point
- const Point<Ndim, value_type> &rhs¶
Second point
- Returns:¶
Manhattan distance between the two points
-
template<std::size_t Ndim, std::floating_point TData = float>
class PeriodicEuclideanMetric¶ - #include <DistanceMetrics.hpp>
Periodic Euclidean distance metric This class implements the Euclidean distance metric in Ndim dimensions for coordinate systems where one or more coordinates are defined in a periodic domain. The distance is then computed by treating the coordinates as euclidean.. This metric expects a period for each dimension, where a period equal to 0 means that the coordinate is not periodic. The periodic coordinates are expected to be defined in the range [0, period).
- Template Parameters:¶
Public Functions¶
-
ALPAKA_FN_HOST_ACC inline constexpr PeriodicEuclideanMetric(const std::array<value_type, Ndim> &periods)¶
Constructor periodic euclidian metric with periods.
- Parameters:¶
- const std::array<value_type, Ndim> &periods¶
Periods for each dimension If a coordinate is not periodic, the corresponding period should be set to 0.f
- Returns:¶
PeriodicEuclideanMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr PeriodicEuclideanMetric(std::array<value_type, Ndim> &&periods)¶
Move constructor periodic euclidian metric with periods.
- Parameters:¶
- std::array<value_type, Ndim> &&periods¶
Periods for each dimension If a coordinate is not periodic, the corresponding period should be set to 0.f
- Returns:¶
PeriodicEuclideanMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr auto operator()(const Point<Ndim, value_type> &lhs, const Point<Ndim, value_type> &rhs) const¶
Compute the Periodic Euclidean distance between two points.
- Parameters:¶
- const Point<Ndim, value_type> &lhs¶
First point
- const Point<Ndim, value_type> &rhs¶
Second point
- Returns:¶
Periodic Euclidean distance between the two points
Private Members¶
-
std::array<value_type, Ndim> m_periods¶
-
template<std::size_t Ndim, std::floating_point TData = float>
class WeightedChebyshevMetric¶ - #include <DistanceMetrics.hpp>
Weighted Chebyshev distance metric This class implements the weighted Chebyshev distance metric in Ndim dimensions.
- Template Parameters:¶
Public Functions¶
-
template<std::floating_point... TValues>
ALPAKA_FN_HOST_ACC inline constexpr WeightedChebyshevMetric(TValues... weights)¶ Constructor weighted chebyshev metric with weights.
- Parameters:¶
- Returns:¶
WeightedChebyshevMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr WeightedChebyshevMetric(const std::array<value_type, Ndim> &weights)¶
Constructor weighted chebyshev metric with weights.
- Parameters:¶
- const std::array<value_type, Ndim> &weights¶
Weights for each dimension
- Returns:¶
WeightedChebyshevMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr WeightedChebyshevMetric(std::array<value_type, Ndim> &&weights)¶
Move constructor weighted chebyshev metric with weights.
- Parameters:¶
- std::array<value_type, Ndim> &&weights¶
Weights for each dimension
- Returns:¶
WeightedChebyshevMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr auto operator()(const Point<Ndim, value_type> &lhs, const Point<Ndim, value_type> &rhs) const¶
Compute the Weighted Chebyshev distance between two points.
- Parameters:¶
- const Point<Ndim, value_type> &lhs¶
First point
- const Point<Ndim, value_type> &rhs¶
Second point
- Returns:¶
Weighted Chebyshev distance between the two points
Private Members¶
-
std::array<value_type, Ndim> m_weights¶
-
template<std::size_t Ndim, std::floating_point TData = float>
class WeightedEuclideanMetric¶ - #include <DistanceMetrics.hpp>
Weighted Euclidean distance metric This class implements the Weighted Euclidean distance metric in Ndim dimensions.
- Template Parameters:¶
Public Functions¶
-
template<std::floating_point... TValues>
ALPAKA_FN_HOST_ACC inline constexpr WeightedEuclideanMetric(TValues... weights)¶ Constructor euclidian metric with weights.
- Parameters:¶
- Returns:¶
WeightedEuclideanMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr WeightedEuclideanMetric(const std::array<value_type, Ndim> &weights)¶
Constructor euclidian metric with weights.
- Parameters:¶
- const std::array<value_type, Ndim> &weights¶
Weights for each dimension
- Returns:¶
WeightedEuclideanMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr WeightedEuclideanMetric(std::array<value_type, Ndim> &&weights)¶
Move constructor euclidian metric with weights.
- Parameters:¶
- std::array<value_type, Ndim> &&weights¶
Weights for each dimension
- Returns:¶
WeightedEuclideanMetric object
-
ALPAKA_FN_HOST_ACC inline constexpr auto operator()(const Point<Ndim, value_type> &lhs, const Point<Ndim, value_type> &rhs) const¶
Compute the Weighted Euclidean distance between two points.
- Parameters:¶
- const Point<Ndim, value_type> &lhs¶
First point
- const Point<Ndim, value_type> &rhs¶
Second point
- Returns:¶
Weighted Euclidean distance between the two points
Private Members¶
-
std::array<value_type, Ndim> m_weights¶
-
namespace concepts¶
-
namespace metrics¶
Typedefs¶
-
template<std::size_t Ndim, std::floating_point TData = float>
using Euclidean = clue::EuclideanMetric<Ndim, TData>¶ Alias for Euclidean distance metric.
@tparam Ndim Number of dimensions @tparam TData Point coordinates and weights data type
-
template<std::size_t Ndim, std::floating_point TData = float>
using WeightedEuclidean = clue::WeightedEuclideanMetric<Ndim, TData>¶ Alias for Weighted Euclidean distance metric.
@tparam Ndim Number of dimensions @tparam TData Point coordinates and weights data type
-
template<std::size_t Ndim, std::floating_point TData = float>
using PeriodicEuclidean = clue::PeriodicEuclideanMetric<Ndim, TData>¶ Alias for Periodic Euclidean distance metric.
@tparam Ndim Number of dimensions @tparam TData Point coordinates and weights data type
-
template<std::size_t Ndim, std::floating_point TData = float>
using Manhattan = clue::ManhattanMetric<Ndim, TData>¶ Alias for Manhattan distance metric.
@tparam Ndim Number of dimensions @tparam TData Point coordinates and weights data type
-
template<std::size_t Ndim, std::floating_point TData = float>
-
template<std::size_t Ndim, std::floating_point TData = float>