Expectations for a distance calculation class.
More...
#include <distances.hpp>
|
template<typename Output_ , typename DataX_ , typename DataY_ , typename Dim_ > |
static Output_ | raw_distance (const DataX_ *x, const DataY_ *y, Dim_ num_dimensions) |
|
template<typename Output_ > |
static Output_ | normalize (Output_ raw) |
|
template<typename Output_ > |
static Output_ | denormalize (Output_ norm) |
|
Expectations for a distance calculation class.
◆ denormalize()
template<typename Output_ >
static Output_ knncolle::MockDistance::denormalize |
( |
Output_ |
norm | ) |
|
|
inlinestatic |
- Template Parameters
-
Output_ | Floating point type for the output distance. |
- Parameters
-
norm | Normalized distance (i.e., the output of normalize() ). |
- Returns
- The denormalized distance (i.e., the input to
normalize()
).
◆ normalize()
template<typename Output_ >
static Output_ knncolle::MockDistance::normalize |
( |
Output_ |
raw | ) |
|
|
inlinestatic |
- Template Parameters
-
Output_ | Floating point type for the output distance. |
- Parameters
-
- Returns
- The normalized distance.
◆ raw_distance()
template<typename Output_ , typename DataX_ , typename DataY_ , typename Dim_ >
static Output_ knncolle::MockDistance::raw_distance |
( |
const DataX_ * |
x, |
|
|
const DataY_ * |
y, |
|
|
Dim_ |
num_dimensions |
|
) |
| |
|
inlinestatic |
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. |
- Template Parameters
-
Output_ | Floating point type for the output distance. |
DataX_ | Floating point type for the first data vector. |
DataY_ | Floating point type for the second data vector. |
Dim_ | Integer type for the vector length. |
- Returns
- The raw distance between
x
and y
.
The documentation for this struct was generated from the following file: