15 #ifndef PAAL_BASIC_METRICS_HPP
16 #define PAAL_BASIC_METRICS_HPP
20 #include <boost/multi_array.hpp>
21 #include <boost/range/iterator_range.hpp>
26 namespace data_structures {
40 typedef DistanceTypeParam DistanceType;
41 typedef int VertexType;
59 DistanceType
operator()(
const VertexType &v,
const VertexType &w)
const {
71 DistanceType &
operator()(
const VertexType &v,
const VertexType &w) {
83 template <
typename OtherMetrics,
typename XRange,
typename YRange>
87 boost::distance(yrange)) {
89 for (
auto && v : xrange) {
91 for (
auto && w : yrange) {
108 std::vector<std::size_t> dim(shape, shape +
DIM_NR);
124 typedef boost::multi_array<DistanceType, DIM_NR> matrix_type;
136 template <
typename DistanceTypeParam>
163 template <
typename OtherMetrics,
typename Items>
165 :
base(other, items, items) {}
169 #endif // PAAL_BASIC_METRICS_HPP
array_metric(const OtherMetrics &other, Items &&items)
constructor from another metric
rectangle_array_metric(const OtherMetrics &other, XRange &&xrange, YRange &&yrange)
constructor from another metric
static const int DIM_NR
dimention of multi array
Metric implementation on 2 dimensional array distance calls on this metric are valid opnly when x < N...
DistanceType & operator()(const VertexType &v, const VertexType &w)
operator(), valid only when v < N and w < M, nonconst version
matrix_type m_matrix
matrix with data
array_metric(int N=0)
constructor
DistanceType operator()(const VertexType &v, const VertexType &w) const
operator(), valid only when v < N and w < M
rectangle_array_metric(int N=0, int M=0)
constructor
this metric is rectangle_array_metric with N == M.
rectangle_array_metric & operator=(const rectangle_array_metric &am)
operator=
bool operator==(const rectangle_array_metric &other) const
operator==
int size() const
returns N