MetricKnn API
Fast Similarity Search using the Metric Space Approach
|
A parameters object stores parameters in an internal map, which associates a names with its value. More...
#include "../metricknn_c.h"
Go to the source code of this file.
Functions | |
MknnDistanceParams | |
MknnDistanceParams * | mknn_distanceParams_newEmpty () |
Creates an empty object. More... | |
MknnDistanceParams * | mknn_distanceParams_newParseString (const char *parameters_string) |
Creates an empty object and set parameters by calling method mknn_distanceParams_parseString. More... | |
void | mknn_distanceParams_parseString (MknnDistanceParams *params, const char *parameters_string) |
Parses a string in the format: ID_DISTANCE,parameter1=value1,parameter2=value2 More... | |
void | mknn_distanceParams_copyAll (MknnDistanceParams *params_to, MknnDistanceParams *params_from) |
Copies all the key-values pairs in params_from and adds them to params_to . More... | |
void | mknn_distanceParams_release (MknnDistanceParams *params) |
Releases the parameters object. More... | |
const char * | mknn_distanceParams_toString (MknnDistanceParams *params) |
Returns a string with the parameters which can be parsed. More... | |
MknnDistanceParams Add Methods | |
void | mknn_distanceParams_addString (MknnDistanceParams *params, const char *name, const char *value) |
Adds a string to the parameters. More... | |
void | mknn_distanceParams_addDouble (MknnDistanceParams *params, const char *name, double value) |
Adds a floating point number to the parameters. More... | |
void | mknn_distanceParams_addInt (MknnDistanceParams *params, const char *name, int64_t value) |
Adds an integer number to the parameters. More... | |
void | mknn_distanceParams_addBool (MknnDistanceParams *params, const char *name, bool value) |
Adds an boolean value to the parameters. More... | |
void | mknn_distanceParams_addObject (MknnDistanceParams *params, const char *name, void *value) |
Adds an object number to the parameters. More... | |
MknnDistanceParams Get Methods | |
const char * | mknn_distanceParams_getString (MknnDistanceParams *params, const char *name) |
Returns a string value. More... | |
double | mknn_distanceParams_getDouble (MknnDistanceParams *params, const char *name) |
Returns a floating-point number. More... | |
int64_t | mknn_distanceParams_getInt (MknnDistanceParams *params, const char *name) |
Returns an integer number. More... | |
bool | mknn_distanceParams_getBool (MknnDistanceParams *params, const char *name) |
Returns a boolean value. More... | |
void * | mknn_distanceParams_getObject (MknnDistanceParams *params, const char *name) |
Returns a object reference. More... | |
MknnDistanceParams Other Methods | |
void | mknn_distanceParams_setDistanceId (MknnDistanceParams *p, const char *id_dist) |
const char * | mknn_distanceParams_getDistanceId (MknnDistanceParams *p) |
MknnIndexParams | |
MknnIndexParams * | mknn_indexParams_newEmpty () |
Creates an empty object. More... | |
MknnIndexParams * | mknn_indexParams_newParseString (const char *parameters_string) |
Creates an empty object and set parameters by calling method mknn_indexParams_parseString. More... | |
void | mknn_indexParams_parseString (MknnIndexParams *params, const char *parameters_string) |
Parses a string in the format: ID_INDEX,parameter1=value1,parameter2=value2 More... | |
void | mknn_indexParams_copyAll (MknnIndexParams *params_to, MknnIndexParams *params_from) |
Copies all the key-values pairs in params_from and adds them to params_to . More... | |
void | mknn_indexParams_release (MknnIndexParams *params) |
Releases the parameters object. More... | |
const char * | mknn_indexParams_toString (MknnIndexParams *params) |
Returns a string with the parameters which can be parsed. More... | |
MknnIndexParams Add Methods | |
void | mknn_indexParams_addString (MknnIndexParams *params, const char *name, const char *value) |
Adds a string to the parameters. More... | |
void | mknn_indexParams_addDouble (MknnIndexParams *params, const char *name, double value) |
Adds a floating point number to the parameters. More... | |
void | mknn_indexParams_addInt (MknnIndexParams *params, const char *name, int64_t value) |
Adds an integer number to the parameters. More... | |
void | mknn_indexParams_addBool (MknnIndexParams *params, const char *name, bool value) |
Adds an boolean value to the parameters. More... | |
void | mknn_indexParams_addObject (MknnIndexParams *params, const char *name, void *value) |
Adds an object number to the parameters. More... | |
MknnIndexParams Get Methods | |
const char * | mknn_indexParams_getString (MknnIndexParams *params, const char *name) |
Returns a string value. More... | |
double | mknn_indexParams_getDouble (MknnIndexParams *params, const char *name) |
Returns a floating-point number. More... | |
int64_t | mknn_indexParams_getInt (MknnIndexParams *params, const char *name) |
Returns an integer number. More... | |
bool | mknn_indexParams_getBool (MknnIndexParams *params, const char *name) |
Returns a boolean value. More... | |
void * | mknn_indexParams_getObject (MknnIndexParams *params, const char *name) |
Returns a object reference. More... | |
MknnIndexParams Other Methods | |
void | mknn_indexParams_setIndexId (MknnIndexParams *p, const char *id_index) |
const char * | mknn_indexParams_getIndexId (MknnIndexParams *p) |
MknnResolverParams | |
MknnResolverParams * | mknn_resolverParams_newEmpty () |
Creates an empty object. More... | |
MknnResolverParams * | mknn_resolverParams_newParseString (int64_t knn, double range, int64_t max_threads, const char *parameters_string) |
Creates an empty object and set parameters by calling methods: mknn_resolverParams_setKnn, mknn_resolverParams_setRange, mknn_resolverParams_setMaxThreads, mknn_resolverParams_parseString. More... | |
void | mknn_resolverParams_parseString (MknnResolverParams *params, const char *parameters_string) |
Parses a string in the format: parameter1=value1,parameter2=value2 More... | |
void | mknn_resolverParams_copyAll (MknnResolverParams *params_to, MknnResolverParams *params_from) |
Copies all the key-values pairs in params_from and adds them to params_to . More... | |
void | mknn_resolverParams_release (MknnResolverParams *params) |
Releases the parameters object. More... | |
const char * | mknn_resolverParams_toString (MknnResolverParams *params) |
Returns a string with the parameters which can be parsed. More... | |
MknnResolverParams Add Methods | |
void | mknn_resolverParams_addString (MknnResolverParams *params, const char *name, const char *value) |
Adds a string to the parameters. More... | |
void | mknn_resolverParams_addDouble (MknnResolverParams *params, const char *name, double value) |
Adds a floating point number to the parameters. More... | |
void | mknn_resolverParams_addInt (MknnResolverParams *params, const char *name, int64_t value) |
Adds an integer number to the parameters. More... | |
void | mknn_resolverParams_addBool (MknnResolverParams *params, const char *name, bool value) |
Adds an boolean value to the parameters. More... | |
void | mknn_resolverParams_addObject (MknnResolverParams *params, const char *name, void *value) |
Adds an object number to the parameters. More... | |
MknnResolverParams Get Methods | |
const char * | mknn_resolverParams_getString (MknnResolverParams *params, const char *name) |
Returns a string value. More... | |
double | mknn_resolverParams_getDouble (MknnResolverParams *params, const char *name) |
Returns a floating-point number. More... | |
int64_t | mknn_resolverParams_getInt (MknnResolverParams *params, const char *name) |
Returns an integer number. More... | |
bool | mknn_resolverParams_getBool (MknnResolverParams *params, const char *name) |
Returns a boolean value. More... | |
void * | mknn_resolverParams_getObject (MknnResolverParams *params, const char *name) |
Returns a object reference. More... | |
MknnResolverParams Other Methods | |
void | mknn_resolverParams_setKnn (MknnResolverParams *params, int64_t knn) |
Sets the K parameter for resolvers in k-NN searches. More... | |
void | mknn_resolverParams_setRange (MknnResolverParams *params, double range) |
Sets the range parameter for resolvers in range searches. More... | |
void | mknn_resolverParams_setMaxThreads (MknnResolverParams *params, int64_t max_threads) |
Sets the maximum number of threads to be used by a resolver. More... | |
int64_t | mknn_resolverParams_getKnn (MknnResolverParams *params) |
double | mknn_resolverParams_getRange (MknnResolverParams *params) |
int64_t | mknn_resolverParams_getMaxThreads (MknnResolverParams *params) |
A parameters object stores parameters in an internal map, which associates a names with its value.
The internal map only stores two type of objects: strings and void pointers. The getter and setter methods that use integer/double/boolean actually convert them to/from a string.
void mknn_distanceParams_addBool | ( | MknnDistanceParams * | params, |
const char * | name, | ||
bool | value | ||
) |
Adds an boolean value to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_distanceParams_addDouble | ( | MknnDistanceParams * | params, |
const char * | name, | ||
double | value | ||
) |
Adds a floating point number to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_distanceParams_addInt | ( | MknnDistanceParams * | params, |
const char * | name, | ||
int64_t | value | ||
) |
Adds an integer number to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_distanceParams_addObject | ( | MknnDistanceParams * | params, |
const char * | name, | ||
void * | value | ||
) |
Adds an object number to the parameters.
A copy of name
is stored in params
but the value pointer itself is stored in params
. Therefore the value
pointer must remain valid during all the lifetime of params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_distanceParams_addString | ( | MknnDistanceParams * | params, |
const char * | name, | ||
const char * | value | ||
) |
Adds a string to the parameters.
A copy of name
and value
are stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_distanceParams_copyAll | ( | MknnDistanceParams * | params_to, |
MknnDistanceParams * | params_from | ||
) |
Copies all the key-values pairs in params_from
and adds them to params_to
.
params_to | the parameters where the values are copies to |
params_from | the parameters from which the values are read. |
bool mknn_distanceParams_getBool | ( | MknnDistanceParams * | params, |
const char * | name | ||
) |
Returns a boolean value.
params | parameters |
name | the name of the parameter. |
const char* mknn_distanceParams_getDistanceId | ( | MknnDistanceParams * | p | ) |
p |
double mknn_distanceParams_getDouble | ( | MknnDistanceParams * | params, |
const char * | name | ||
) |
Returns a floating-point number.
params | parameters |
name | the name of the parameter. |
int64_t mknn_distanceParams_getInt | ( | MknnDistanceParams * | params, |
const char * | name | ||
) |
Returns an integer number.
params | parameters |
name | the name of the parameter. |
void* mknn_distanceParams_getObject | ( | MknnDistanceParams * | params, |
const char * | name | ||
) |
Returns a object reference.
params | parameters |
name | the name of the parameter. |
const char* mknn_distanceParams_getString | ( | MknnDistanceParams * | params, |
const char * | name | ||
) |
Returns a string value.
params | parameters |
name | the name of the parameter. |
MknnDistanceParams* mknn_distanceParams_newEmpty | ( | ) |
Creates an empty object.
MknnDistanceParams* mknn_distanceParams_newParseString | ( | const char * | parameters_string | ) |
Creates an empty object and set parameters by calling method mknn_distanceParams_parseString.
parameters_string | the string with parameters. |
void mknn_distanceParams_parseString | ( | MknnDistanceParams * | params, |
const char * | parameters_string | ||
) |
Parses a string in the format: ID_DISTANCE,parameter1=value1,parameter2=value2
Each parsed parameter is added to params
.
For example:
LP,order=0.5
DPF,order=1,pct_discard=0.1
The list of valid IDs can be listed by invoking mknn_predefDistance_helpListDistances.
params | the parameters object |
parameters_string | the string with parameters. |
void mknn_distanceParams_release | ( | MknnDistanceParams * | params | ) |
Releases the parameters object.
params | the parameters object to be released. |
void mknn_distanceParams_setDistanceId | ( | MknnDistanceParams * | p, |
const char * | id_dist | ||
) |
p | |
id_dist |
const char* mknn_distanceParams_toString | ( | MknnDistanceParams * | params | ) |
Returns a string with the parameters which can be parsed.
params | the parameters object |
void mknn_indexParams_addBool | ( | MknnIndexParams * | params, |
const char * | name, | ||
bool | value | ||
) |
Adds an boolean value to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_indexParams_addDouble | ( | MknnIndexParams * | params, |
const char * | name, | ||
double | value | ||
) |
Adds a floating point number to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_indexParams_addInt | ( | MknnIndexParams * | params, |
const char * | name, | ||
int64_t | value | ||
) |
Adds an integer number to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_indexParams_addObject | ( | MknnIndexParams * | params, |
const char * | name, | ||
void * | value | ||
) |
Adds an object number to the parameters.
A copy of name
is stored in params
but the value pointer itself is stored in params
. Therefore the value
pointer must remain valid during all the lifetime of params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_indexParams_addString | ( | MknnIndexParams * | params, |
const char * | name, | ||
const char * | value | ||
) |
Adds a string to the parameters.
A copy of name
and value
are stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_indexParams_copyAll | ( | MknnIndexParams * | params_to, |
MknnIndexParams * | params_from | ||
) |
Copies all the key-values pairs in params_from
and adds them to params_to
.
params_to | the parameters where the values are copies to |
params_from | the parameters from which the values are read. |
bool mknn_indexParams_getBool | ( | MknnIndexParams * | params, |
const char * | name | ||
) |
Returns a boolean value.
params | parameters |
name | the name of the parameter. |
double mknn_indexParams_getDouble | ( | MknnIndexParams * | params, |
const char * | name | ||
) |
Returns a floating-point number.
params | parameters |
name | the name of the parameter. |
const char* mknn_indexParams_getIndexId | ( | MknnIndexParams * | p | ) |
p |
int64_t mknn_indexParams_getInt | ( | MknnIndexParams * | params, |
const char * | name | ||
) |
Returns an integer number.
params | parameters |
name | the name of the parameter. |
void* mknn_indexParams_getObject | ( | MknnIndexParams * | params, |
const char * | name | ||
) |
Returns a object reference.
params | parameters |
name | the name of the parameter. |
const char* mknn_indexParams_getString | ( | MknnIndexParams * | params, |
const char * | name | ||
) |
Returns a string value.
params | parameters |
name | the name of the parameter. |
MknnIndexParams* mknn_indexParams_newEmpty | ( | ) |
Creates an empty object.
MknnIndexParams* mknn_indexParams_newParseString | ( | const char * | parameters_string | ) |
Creates an empty object and set parameters by calling method mknn_indexParams_parseString.
parameters_string | the string in the given format. |
void mknn_indexParams_parseString | ( | MknnIndexParams * | params, |
const char * | parameters_string | ||
) |
Parses a string in the format: ID_INDEX,parameter1=value1,parameter2=value2
Each parsed parameters is added to params
.
The list of valid indexes and their IDs can be listed by invoking mknn_predefIndex_helpListIndexes.
params | the parameters object |
parameters_string | the string in the given format. |
void mknn_indexParams_release | ( | MknnIndexParams * | params | ) |
Releases the parameters object.
params | the parameters object to be released. |
void mknn_indexParams_setIndexId | ( | MknnIndexParams * | p, |
const char * | id_index | ||
) |
p | |
id_index |
const char* mknn_indexParams_toString | ( | MknnIndexParams * | params | ) |
Returns a string with the parameters which can be parsed.
params | the parameters object |
void mknn_resolverParams_addBool | ( | MknnResolverParams * | params, |
const char * | name, | ||
bool | value | ||
) |
Adds an boolean value to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_resolverParams_addDouble | ( | MknnResolverParams * | params, |
const char * | name, | ||
double | value | ||
) |
Adds a floating point number to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_resolverParams_addInt | ( | MknnResolverParams * | params, |
const char * | name, | ||
int64_t | value | ||
) |
Adds an integer number to the parameters.
A copy of name
is stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_resolverParams_addObject | ( | MknnResolverParams * | params, |
const char * | name, | ||
void * | value | ||
) |
Adds an object number to the parameters.
A copy of name
is stored in params
but the value pointer itself is stored in params
. Therefore the value
pointer must remain valid during all the lifetime of params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_resolverParams_addString | ( | MknnResolverParams * | params, |
const char * | name, | ||
const char * | value | ||
) |
Adds a string to the parameters.
A copy of name
and value
are stored in params
.
params | parameters |
name | the name of the parameter. |
value | the value of the parameter. |
void mknn_resolverParams_copyAll | ( | MknnResolverParams * | params_to, |
MknnResolverParams * | params_from | ||
) |
Copies all the key-values pairs in params_from
and adds them to params_to
.
params_to | the parameters where the values are copies to |
params_from | the parameters from which the values are read. |
bool mknn_resolverParams_getBool | ( | MknnResolverParams * | params, |
const char * | name | ||
) |
Returns a boolean value.
params | parameters |
name | the name of the parameter. |
double mknn_resolverParams_getDouble | ( | MknnResolverParams * | params, |
const char * | name | ||
) |
Returns a floating-point number.
params | parameters |
name | the name of the parameter. |
int64_t mknn_resolverParams_getInt | ( | MknnResolverParams * | params, |
const char * | name | ||
) |
Returns an integer number.
params | parameters |
name | the name of the parameter. |
int64_t mknn_resolverParams_getKnn | ( | MknnResolverParams * | params | ) |
params |
int64_t mknn_resolverParams_getMaxThreads | ( | MknnResolverParams * | params | ) |
params |
void* mknn_resolverParams_getObject | ( | MknnResolverParams * | params, |
const char * | name | ||
) |
Returns a object reference.
params | parameters |
name | the name of the parameter. |
double mknn_resolverParams_getRange | ( | MknnResolverParams * | params | ) |
params |
const char* mknn_resolverParams_getString | ( | MknnResolverParams * | params, |
const char * | name | ||
) |
Returns a string value.
params | parameters |
name | the name of the parameter. |
MknnResolverParams* mknn_resolverParams_newEmpty | ( | ) |
Creates an empty object.
MknnResolverParams* mknn_resolverParams_newParseString | ( | int64_t | knn, |
double | range, | ||
int64_t | max_threads, | ||
const char * | parameters_string | ||
) |
Creates an empty object and set parameters by calling methods: mknn_resolverParams_setKnn, mknn_resolverParams_setRange, mknn_resolverParams_setMaxThreads, mknn_resolverParams_parseString.
knn | |
range | |
max_threads | |
parameters_string | the string in the format parameter1=value1,... |
void mknn_resolverParams_parseString | ( | MknnResolverParams * | params, |
const char * | parameters_string | ||
) |
Parses a string in the format: parameter1=value1,parameter2=value2
Each parsed parameters is added to params
params | the parameters object |
parameters_string | the string in the format parameter1=value1,... |
void mknn_resolverParams_release | ( | MknnResolverParams * | params | ) |
Releases the parameters object.
params | the parameters object to be released. |
void mknn_resolverParams_setKnn | ( | MknnResolverParams * | params, |
int64_t | knn | ||
) |
Sets the K parameter for resolvers in k-NN searches.
params | parameters |
knn |
void mknn_resolverParams_setMaxThreads | ( | MknnResolverParams * | params, |
int64_t | max_threads | ||
) |
Sets the maximum number of threads to be used by a resolver.
params | parameters |
max_threads |
void mknn_resolverParams_setRange | ( | MknnResolverParams * | params, |
double | range | ||
) |
Sets the range parameter for resolvers in range searches.
params | parameters |
range |
const char* mknn_resolverParams_toString | ( | MknnResolverParams * | params | ) |
Returns a string with the parameters which can be parsed.
params | the parameters object |