MetricKnn API
Fast Similarity Search using the Metric Space Approach
mknn_distance.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015, Juan Manuel Barrios <juanmanuel@barrios.cl>
3  * All rights reserved.
4  *
5  * This file is part of MetricKnn.
6  * MetricKnn is made available under the terms of the BSD 2-Clause License.
7  */
8 
9 #ifndef MKNN_DISTANCE_H_
10 #define MKNN_DISTANCE_H_
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include "../metricknn_c.h"
17 
62 typedef void* (*mknn_function_distanceEval_createState)(MknnDomain *domain_left,
63  MknnDomain *domain_right);
64 
80 typedef double (*mknn_function_distanceEval_eval)(void *state_distEval,
81  void *object_left, void *object_right, double current_threshold);
82 
92 typedef void (*mknn_function_distanceEval_releaseState)(void *state_distEval);
93 
105  void *state_factory, MknnDomain *domain_left, MknnDomain *domain_right,
106  void **out_state_distEval,
107  mknn_function_distanceEval_eval *out_func_eval,
108  mknn_function_distanceEval_releaseState *out_func_releaseState);
115  void *state_factory);
116 
127 bool free_parameters_on_distance_release);
128 
153  mknn_function_distanceEval_releaseState func_releaseState);
154 
162 MknnDistance *mknn_distance_newCustomFactory(void *state_factory,
165 
172 
179 
191 void mknn_distance_save(MknnDistance *distance, const char *filename_write);
192 
203 MknnDistance *mknn_distance_restore(const char *filename_read,
204  MknnDistanceParams *more_parameters, bool free_parameters_on_distance_release);
205 
219  MknnDomain *domain_left, MknnDomain *domain_right);
220 
226 void mknn_distance_release(MknnDistance *distance);
227 
228 #ifdef __cplusplus
229 }
230 #endif
231 
232 #endif
const char * mknn_distance_getIdPredefinedDistance(MknnDistance *distance)
The id of the predefined distance.
Definition: distance.c:230
Definition: parameters.c:18
void *(* mknn_function_distanceEval_createState)(MknnDomain *domain_left, MknnDomain *domain_right)
The function of a custom distance that creates a new state.
Definition: mknn_distance.h:62
Definition: distance.c:17
MknnDistanceParams * mknn_distance_getParameters(MknnDistance *distance)
Return the parameters used to create the predefined distance.
Definition: distance.c:235
MknnDistance * mknn_distance_newCustom(mknn_function_distanceEval_createState func_createState, mknn_function_distanceEval_eval func_eval, mknn_function_distanceEval_releaseState func_releaseState)
Creates a new custom distance.
Definition: distance.c:150
void mknn_distance_release(MknnDistance *distance)
Releases the distance.
Definition: distance.c:215
void(* mknn_function_distanceEval_releaseState)(void *state_distEval)
The function of a custom distance that releases a state.
Definition: mknn_distance.h:92
void(* mknn_function_distanceFactory_releaseFactory)(void *state_factory)
The function to release the state of the distance factory.
Definition: mknn_distance.h:114
void(* mknn_function_distanceFactory_createDistEval)(void *state_factory, MknnDomain *domain_left, MknnDomain *domain_right, void **out_state_distEval, mknn_function_distanceEval_eval *out_func_eval, mknn_function_distanceEval_releaseState *out_func_releaseState)
The function of a custom distance factory.
Definition: mknn_distance.h:104
MknnDistance * mknn_distance_newPredefined(MknnDistanceParams *parameters, bool free_parameters_on_distance_release)
Creates a new distance for the given parameters.
Definition: distance.c:139
double(* mknn_function_distanceEval_eval)(void *state_distEval, void *object_left, void *object_right, double current_threshold)
Computes the distance between two objects.
Definition: mknn_distance.h:80
void mknn_distance_save(MknnDistance *distance, const char *filename_write)
The distance is saved to a file.
Definition: distance.c:171
MknnDistanceEval * mknn_distance_newDistanceEval(MknnDistance *distance, MknnDomain *domain_left, MknnDomain *domain_right)
Creates a distance for computing distances between objects of the given domains.
Definition: distance.c:256
MknnDistance * mknn_distance_newCustomFactory(void *state_factory, mknn_function_distanceFactory_createDistEval func_factory, mknn_function_distanceFactory_releaseFactory func_release)
Creates a new custom distance, using a factory method.
Definition: distance.c:161
Definition: domain.c:11
Definition: distance.c:241
MknnDistance * mknn_distance_restore(const char *filename_read, MknnDistanceParams *more_parameters, bool free_parameters_on_distance_release)
Loads a distance from a file.
Definition: distance.c:188
Powered by Download MetricKnn