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

MetricKnn provides a set of pre-defined indexes identified. More...

#include "../metricknn_c.h"

Go to the source code of this file.

Functions

Help functions.
void mknn_predefIndex_helpListIndexes ()
 Lists to standard output all pre-defined indexes.
 
void mknn_predefIndex_helpPrintIndex (const char *id_index)
 Prints to standard output the help for a index. More...
 
bool mknn_predefIndex_testIndexId (const char *id_index)
 Tests whether the given string references a valid pre-defined index. More...
 
Linear Scan.
MknnIndexParamsmknn_predefIndex_LinearScan_indexParams ()
 Resolves searches using the linear scan algorithm. More...
 
MknnResolverParamsmknn_predefIndex_LinearScan_resolverExactNearestNeighbors (int64_t knn, double range, int64_t max_threads)
 Creates a new resolver for exact search of the K nearest neighbors using the linear scan index. More...
 
MknnResolverParamsmknn_predefIndex_LinearScan_resolverExactFarthestNeighbors (int64_t knn, int64_t max_threads)
 Creates a new resolver for exact search of the K farthest neighbors using the linear scan index. More...
 
LAESA.
MknnIndexParamsmknn_predefIndex_Laesa_indexParams (int64_t num_pivots)
 Resolves searches using the LAESA algorithm. More...
 
MknnResolverParamsmknn_predefIndex_Laesa_resolverExactNearestNeighbors (int64_t knn, double range, int64_t max_threads)
 Creates a new resolver for exact search using the LAESA index. More...
 
MknnResolverParamsmknn_predefIndex_Laesa_resolverApproximateNearestNeighbors (int64_t knn, double range, int64_t max_threads, double approximation_percentage)
 
Snake Table.
MknnIndexParamsmknn_predefIndex_SnakeTable_indexParams (int64_t num_pivots)
 Resolves searches using a Snake Table. More...
 
MknnResolverParamsmknn_predefIndex_SnakeTable_resolverExactNearestNeighbors (int64_t knn, double range, int64_t max_threads)
 Creates a new resolver for exact search using the SnakeTable index. More...
 
FLANN Indexes.
MknnIndexParamsmknn_predefIndex_FlannLinearScan_indexParams ()
 Resolves searches using the FLANN's implementation of linear scan algorithm. More...
 
MknnIndexParamsmknn_predefIndex_FlannKdTree_indexParams (int64_t num_trees)
 Resolves searches using FLANN's implementation of kd-tree. More...
 
MknnIndexParamsmknn_predefIndex_FlannKmeansTree_indexParams (int64_t branching, int64_t iterations)
 Resolves searches using FLANN's implementation of k-means tree. More...
 
MknnIndexParamsmknn_predefIndex_FlannLSH_indexParams (int64_t table_number, int64_t key_size, int64_t multi_probe_level)
 Resolves searches using FLANN's implementation of Local Sensitive Hashing. More...
 
MknnIndexParamsmknn_predefIndex_FlannAutoIndex_indexParams (double target_precision, double build_weight, double memory_weight, double sample_fraction)
 Resolves searches using FLANN's automatic selection of the best algorithm. More...
 
MknnResolverParamsmknn_predefIndex_Flann_resolverExactNearestNeighbors (int64_t knn, int64_t max_threads)
 Creates a new resolver for exact searches using FLANN's indexes. More...
 
MknnResolverParamsmknn_predefIndex_Flann_resolverApproximateNearestNeighbors (int64_t knn, int64_t max_threads, int64_t num_checks)
 Creates a new resolver for approximate searches using FLANN's indexes. More...
 

Detailed Description

MetricKnn provides a set of pre-defined indexes identified.

The complete list of pre-defined indexes provided by MetricKnn can be printed by calling mknn_predefIndex_helpListIndexes. The parameters supported by each index can be printed by calling mknn_predefIndex_helpPrintIndex.

Function Documentation

MknnResolverParams* mknn_predefIndex_Flann_resolverApproximateNearestNeighbors ( int64_t  knn,
int64_t  max_threads,
int64_t  num_checks 
)

Creates a new resolver for approximate searches using FLANN's indexes.

Parameters
knnnumber of nearest neighbors to return. A value < 1 means 1.
max_threadsthe maximum number of threads to be used.
num_checkshow many leafs to check in one search. A value >= 1, where a value closer to 1 means faster (but lower quality) search.
Returns
parameters to create a resolver for the given similarity search (it must be released with mknn_resolverParams_release or bound to the new resolver)
MknnResolverParams* mknn_predefIndex_Flann_resolverExactNearestNeighbors ( int64_t  knn,
int64_t  max_threads 
)

Creates a new resolver for exact searches using FLANN's indexes.

Parameters
knnnumber of nearest neighbors to return. A value < 1 means 1.
max_threadsthe maximum number of threads to be used.
Returns
parameters to create a resolver for the given similarity search (it must be released with mknn_resolverParams_release or bound to the new resolver)
MknnIndexParams* mknn_predefIndex_FlannAutoIndex_indexParams ( double  target_precision,
double  build_weight,
double  memory_weight,
double  sample_fraction 
)

Resolves searches using FLANN's automatic selection of the best algorithm.

This method is just an interface to FLANN library. See FLANN's documentation http://www.cs.ubc.ca/research/flann/ .

Parameters
target_precisionprecision desired
build_weightbuild tree time weighting factor
memory_weightindex memory weigthing factor
sample_fractionwhat fraction of the dataset to use for autotuning
Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
MknnIndexParams* mknn_predefIndex_FlannKdTree_indexParams ( int64_t  num_trees)

Resolves searches using FLANN's implementation of kd-tree.

This method is just an interface to FLANN library. See FLANN's documentation http://www.cs.ubc.ca/research/flann/ .

Parameters
num_treesAmount of trees to build.
Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
MknnIndexParams* mknn_predefIndex_FlannKmeansTree_indexParams ( int64_t  branching,
int64_t  iterations 
)

Resolves searches using FLANN's implementation of k-means tree.

This method is just an interface to FLANN library. See FLANN's documentation http://www.cs.ubc.ca/research/flann/ .

Parameters
branchingbranching factor. Number of centroids at each level.
iterationsmax iterations to perform in one kmeans clustering.
Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
MknnIndexParams* mknn_predefIndex_FlannLinearScan_indexParams ( )

Resolves searches using the FLANN's implementation of linear scan algorithm.

This method is just an interface to FLANN library. See FLANN's documentation http://www.cs.ubc.ca/research/flann/ .

Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
MknnIndexParams* mknn_predefIndex_FlannLSH_indexParams ( int64_t  table_number,
int64_t  key_size,
int64_t  multi_probe_level 
)

Resolves searches using FLANN's implementation of Local Sensitive Hashing.

This method is just an interface to FLANN library. See FLANN's documentation http://www.cs.ubc.ca/research/flann/ .

Parameters
table_numberThe number of hash tables to use
key_sizeThe length of the key in the hash tables
multi_probe_levelNumber of levels to use in multi-probe LSH, 0 for standard LSH
Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
void mknn_predefIndex_helpPrintIndex ( const char *  id_index)

Prints to standard output the help for a index.

Parameters
id_indexthe unique identifier of a pre-defined index.
MknnIndexParams* mknn_predefIndex_Laesa_indexParams ( int64_t  num_pivots)

Resolves searches using the LAESA algorithm.

In order to obtain the exact nearest neighbors, the distance distance must satisfy the metric properties, otherwise the exact search will be incorrect.

Parameters
num_pivotsAmount of pivots to compute and store in memory.
Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
MknnResolverParams* mknn_predefIndex_Laesa_resolverApproximateNearestNeighbors ( int64_t  knn,
double  range,
int64_t  max_threads,
double  approximation_percentage 
)
Parameters
knnnumber of nearest neighbors to return. A value < 1 means 1.
rangethe search range. A value <= 0 or the constant DBL_MAX mean maximum range.
max_threadsthe maximum number of threads to be used.
approximation_percentageThe amount of distance evaluation to compute. A value between 0 and 1, where a value closer to 0 means faster (but lower quality) search.
Returns
parameters to create a resolver for the given similarity search (it must be released with mknn_resolverParams_release or bound to the new resolver)
MknnResolverParams* mknn_predefIndex_Laesa_resolverExactNearestNeighbors ( int64_t  knn,
double  range,
int64_t  max_threads 
)

Creates a new resolver for exact search using the LAESA index.

Parameters
knnnumber of nearest neighbors to return. A value < 1 means 1.
rangethe search range. A value <= 0 or constant DBL_MAX mean maximum range.
max_threadsthe maximum number of threads to be used.
Returns
parameters to create a resolver for the given similarity search (it must be released with mknn_resolverParams_release or bound to the new resolver)
MknnIndexParams* mknn_predefIndex_LinearScan_indexParams ( )

Resolves searches using the linear scan algorithm.

The algorithm compares each query object to each object in search_dataset sequentially and retrieves the nearest objects.

Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
MknnResolverParams* mknn_predefIndex_LinearScan_resolverExactFarthestNeighbors ( int64_t  knn,
int64_t  max_threads 
)

Creates a new resolver for exact search of the K farthest neighbors using the linear scan index.

Parameters
knnnumber of farthest neighbors to return. A value < 1 means 1.
max_threadsthe maximum number of threads to be used.
Returns
parameters to create a resolver for the given similarity search (it must be released with mknn_resolverParams_release or bound to the new resolver)
MknnResolverParams* mknn_predefIndex_LinearScan_resolverExactNearestNeighbors ( int64_t  knn,
double  range,
int64_t  max_threads 
)

Creates a new resolver for exact search of the K nearest neighbors using the linear scan index.

Parameters
knnnumber of nearest neighbors to return. A value < 1 means 1.
rangethe search range. A value <= 0 or constant DBL_MAX (defined in float.h) mean maximum range.
max_threadsthe maximum number of threads to be used.
Returns
parameters to create a resolver for the given similarity search (it must be released with mknn_resolverParams_release or bound to the new resolver)
MknnIndexParams* mknn_predefIndex_SnakeTable_indexParams ( int64_t  num_pivots)

Resolves searches using a Snake Table.

In order to obtain the exact nearest neighbors, the distance distance must satisfy the metric properties, otherwise the exact search will be incorrect.

Parameters
num_pivotsAmount of pivots to store in memory.
Returns
parameters to create an index (it must be released with mknn_indexParams_release or bound to the new index)
MknnResolverParams* mknn_predefIndex_SnakeTable_resolverExactNearestNeighbors ( int64_t  knn,
double  range,
int64_t  max_threads 
)

Creates a new resolver for exact search using the SnakeTable index.

Parameters
knnnumber of nearest neighbors to return. A value < 1 means 1.
rangethe search range. A value <= 0 or constant DBL_MAX mean maximum range.
max_threadsthe maximum number of threads to be used.
Returns
parameters to create a resolver for the given similarity search (it must be released with mknn_resolverParams_release or bound to the new resolver)
bool mknn_predefIndex_testIndexId ( const char *  id_index)

Tests whether the given string references a valid pre-defined index.

Parameters
id_indexthe unique identifier of a pre-defined index.
Returns
true whether id_index corresponds to a pre-defined index, and false otherwise.
Powered by Download MetricKnn