template<typename Data_, typename Distance_>
class knncolle::DistanceMetric< Data_, Distance_ >
Interface for a distance metric.
- Template Parameters
-
| Distance_ | Floating-point type for the output distance. |
| Data_ | Numeric type for the input data. |
template<typename Data_ , typename Distance_ >
| virtual Distance_ knncolle::DistanceMetric< Data_, Distance_ >::raw |
( |
std::size_t | num_dimensions, |
|
|
const Data_ * | x, |
|
|
const Data_ * | y ) const |
|
pure virtual |
The raw distance r for a distance d is defined so that r(x, y) > r(x, z) iff d(x, y) > d(x, z). r(x, y) is converted to d(x, z) via a monotonic transform in normalize(), and vice versa for denormalize(). We separate out these two steps to avoid, e.g., a costly root operation for a Euclidean distance when only the relative values are of interest.
- Parameters
-
| x | Pointer to the array containing the first vector. |
| y | Pointer to the array containing the second vector. |
| num_dimensions | Length of both vectors. |
- Returns
- The raw distance between
x and y.