MetricKnn API
Fast Similarity Search using the Metric Space Approach
|
MknnDistanceEval is the function used for comparing objects. More...
#include "../metricknn_c.h"
Go to the source code of this file.
Functions | |
double | mknn_distanceEval_evalTh (MknnDistanceEval *distance_eval, void *object_left, void *object_right, double current_threshold) |
Evaluates the distance between object1 and object2 . More... | |
double | mknn_distanceEval_eval (MknnDistanceEval *distance_eval, void *object_left, void *object_right) |
Evaluates the distance between object1 and object2 . More... | |
MknnDistance * | mknn_distanceEval_getDistance (MknnDistanceEval *distance_eval) |
returns the distance declared for the object. More... | |
MknnDomain * | mknn_distanceEval_getDomainLeft (MknnDistanceEval *distance_eval) |
returns the domain declared for the object at the left. More... | |
MknnDomain * | mknn_distanceEval_getDomainRight (MknnDistanceEval *distance_eval) |
returns the domain declared for the object at the right. More... | |
void | mknn_distanceEval_release (MknnDistanceEval *distance_eval) |
Releases the distance eval. More... | |
MknnDistanceEval is the function used for comparing objects.
In order to compare objects, a MknnDistance is used to instantiate one or more MknnDistanceEval objects (one for each parallel thread). The MknnDistanceEval object computes the distance between two objects of a given domain.
The MknnDistanceEval is created by the method mknn_distance_newDistanceEval, which requires the actual domain of the objects to be compared.
A search method uses the MknnDistance to create as many MknnDistanceEval as threads will be used to solve the search. During the search, each thread uses a single MknnDistanceEval.
double mknn_distanceEval_eval | ( | MknnDistanceEval * | distance_eval, |
void * | object_left, | ||
void * | object_right | ||
) |
Evaluates the distance between object1
and object2
.
distance_eval
object, i.e. a distance_eval
object cannot be used at the same time by different threads.distance_eval | distance object. |
object_left | left object to be evaluated. |
object_right | right object to be evaluated. |
object_left
and object_right
which must be a number >= 0. double mknn_distanceEval_evalTh | ( | MknnDistanceEval * | distance_eval, |
void * | object_left, | ||
void * | object_right, | ||
double | current_threshold | ||
) |
Evaluates the distance between object1
and object2
.
The parameter current_threshold
can be used to save some computation: if during the computation it is known that the value of the distance will surpass current_threshold
, the computation is terminated and return some value greater than current_threshold
. Note that this can only be fulfilled by distances whose computation produces increasing partial results (as the euclidean distance).
distance_eval
object, i.e. a distance_eval
object cannot be used at the same time by different threads.distance_eval | distance object. |
object_left | left object to be evaluated. |
object_right | right object to be evaluated. |
current_threshold | is the value of the current k-th candidate in a search. This value may be used to trigger an early termination of the distance computation. |
object_left
and object_right
which must be a number >= 0. MknnDistance* mknn_distanceEval_getDistance | ( | MknnDistanceEval * | distance_eval | ) |
returns the distance declared for the object.
distance_eval |
MknnDomain* mknn_distanceEval_getDomainLeft | ( | MknnDistanceEval * | distance_eval | ) |
returns the domain declared for the object at the left.
distance_eval |
MknnDomain* mknn_distanceEval_getDomainRight | ( | MknnDistanceEval * | distance_eval | ) |
returns the domain declared for the object at the right.
distance_eval |
void mknn_distanceEval_release | ( | MknnDistanceEval * | distance_eval | ) |
Releases the distance eval.
distance_eval |