Simple templated classes for Metric Space representation.
The main class is template <class T, size_t SIZE> class MetricSpace::TMetricSpace.
It has two parameters:
- used numeric type
- space dimension
and 2 nested classes:
and four static functions, each returns one of predefined metrics:
- MetricSpace::TMetricSpace<>::Euclidian() - returns Euclidean distance.
- MetricSpace::TMetricSpace<>::SquaredEuclidian() - returns squared Euclidean distance.
- MetricSpace::TMetricSpace<>::Manhattan() - returns Manhattan or taxicab.
- MetricSpace::TMetricSpace<>::Chebyshev() - returns Chebyshev distance.
The main program (main.cpp) contains a "custom" metric "Weighted", parameterized by vector of "weights" of dimensions. The distance is calculated as a weighted sum of absolute dimensions differences.
The class MetricSpace::TMetricSpace was used to study cluster analysis.