MetricKnn API
Fast Similarity Search using the Metric Space Approach
Functions
mknn_distance_eval.h File Reference

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...
 
MknnDistancemknn_distanceEval_getDistance (MknnDistanceEval *distance_eval)
 returns the distance declared for the object. More...
 
MknnDomainmknn_distanceEval_getDomainLeft (MknnDistanceEval *distance_eval)
 returns the domain declared for the object at the left. More...
 
MknnDomainmknn_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...
 

Detailed Description

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.

Function Documentation

double mknn_distanceEval_eval ( MknnDistanceEval distance_eval,
void *  object_left,
void *  object_right 
)

Evaluates the distance between object1 and object2.

Remarks
Note about Multi-threading: this method can be called in parallel by several threads as long as each thread owns a different distance_eval object, i.e. a distance_eval object cannot be used at the same time by different threads.
Parameters
distance_evaldistance object.
object_leftleft object to be evaluated.
object_rightright object to be evaluated.
Returns
the distance value between 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).

Remarks
Note about Multi-threading: this method can be called in parallel by several threads as long as each thread owns a different distance_eval object, i.e. a distance_eval object cannot be used at the same time by different threads.
Parameters
distance_evaldistance object.
object_leftleft object to be evaluated.
object_rightright object to be evaluated.
current_thresholdis 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.
Returns
the distance value between 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.

Parameters
distance_eval
Returns
the distance declared for the object.
MknnDomain* mknn_distanceEval_getDomainLeft ( MknnDistanceEval distance_eval)

returns the domain declared for the object at the left.

Parameters
distance_eval
Returns
the domain declared for the object at the left.
MknnDomain* mknn_distanceEval_getDomainRight ( MknnDistanceEval distance_eval)

returns the domain declared for the object at the right.

Parameters
distance_eval
Returns
the domain declared for the object at the right.
void mknn_distanceEval_release ( MknnDistanceEval distance_eval)

Releases the distance eval.

Parameters
distance_eval
Powered by Download MetricKnn