9 #ifndef METRICKNN_IMPL_H_
10 #define METRICKNN_IMPL_H_
16 #include "../metricknn_c.h"
17 #include <myutils/myutils_c.h>
30 #include "impl/macros_util.h"
31 #include "impl/heap.h"
32 #include "impl/histogram.h"
33 #include "impl/mevaluation_wrapper.h"
37 MknnDatatype mknn_datatype_convertMy2Mknn(
const MyDatatype my_datatype);
38 MyDatatype mknn_datatype_convertMknn2My(
const MknnDatatype mknn_datatype);
40 void mknn_dataset_setCompactVectors(
MknnDataset *dataset,
41 void *compactVectors_pointer,
bool free_compactVectors_on_release);
43 void mknn_dataset_computeStatsVectors(
MknnDataset *dataset,
44 struct MyDataStatsCompute *stats);
46 struct MyDataStatsCompute *mknn_dataset_computeDataStats(
MknnDataset *dataset);
49 void mknn_dataset_printObjectsRaw(
MknnDataset *dataset, FILE *out);
51 void mknn_dataset_printObjectsText(
MknnDataset *dataset, FILE *out);
55 typedef void (*mknn_function_printHelp)(
const char *id);
59 int64_t num_instances,
MknnDomain *domain_left,
62 int64_t num_instances);
75 typedef void (*mknn_function_distance_build)(
void *state_distance,
78 typedef void (*mknn_function_distance_load)(
void *state_distance,
80 const char *filename_read);
82 typedef void (*mknn_function_distance_save)(
void *state_distance,
84 const char *filename_write);
86 typedef void (*mknn_function_distance_release)(
void *state_distance);
94 mknn_function_distance_build func_distance_build;
95 mknn_function_distance_load func_distance_load;
96 mknn_function_distance_save func_distance_save;
97 mknn_function_distance_release func_distance_release;
98 mknn_function_distanceEval_new func_distanceEval_new;
101 void mknn_register_default_distances();
104 const char *id_dist,
const char *help_line,
105 mknn_function_printHelp func_printHelp,
106 mknn_function_distance_new func_distance_new);
114 typedef void (*mknn_function_index_build)(
void *state_index,
117 typedef void (*mknn_function_index_load)(
void *state_index,
119 const char *filename_read);
121 typedef void (*mknn_function_index_save)(
void *state_index,
123 const char *filename_write);
125 typedef void (*mknn_function_index_release)(
void *state_index);
130 void *state_index,
const char *id_index,
133 typedef MknnResult *(*mknn_function_resolver_search)(
void *state_resolver,
136 typedef void (*mknn_function_resolver_release)(
void *state_resolver);
140 mknn_function_index_build func_index_build;
141 mknn_function_index_load func_index_load;
142 mknn_function_index_save func_index_save;
143 mknn_function_index_release func_index_release;
146 void *state_resolver;
147 mknn_function_resolver_search func_resolver_search;
148 mknn_function_resolver_release func_resolver_release;
151 void mknn_register_default_indexes();
153 void metricknn_register_index(
const char *id_index,
const char *help_build,
154 const char *help_search, mknn_function_printHelp func_printHelp,
155 mknn_function_index_new func_index_new,
156 mknn_function_resolver_new func_resolver_new);
161 bool free_parameters_on_resolver_release);
165 MknnResult *mknn_result_newEmpty(int64_t num_queries, int64_t num_nn_max);
167 void mknn_result_updateTotalDistanceEvaluations(
MknnResult *result);
168 void mknn_result_setTotalSearchTime(
MknnResult *result,
169 double total_search_time);
170 void mknn_result_setResolverQueryDataset(
MknnResult *result,
172 bool free_resolver_on_release,
173 bool free_query_dataset_on_release);
174 void mknn_result_storeMatchesInResultQuery(
MknnResult *result,
175 int64_t num_query,
MknnHeap *heap, int64_t cont_evaluations);
177 void mknn_sample_distances_multithread(
MknnDataset *dataset_src,
179 int64_t num_threads,
double *out_distances, int64_t *out_position_src,
180 int64_t *out_position_dst);
183 int64_t num_samples,
MknnDistance *distance, int64_t max_threads);
193 double *distance_matrix, int64_t max_threads);
198 int64_t num_pivots, int64_t num_sets_eval, int64_t max_threads,
199 int64_t *selected_positions);
204 #include <opencv2/core/core_c.h>
205 IplImage *mknn_dataset_convertToIplImage(
MknnDataset *dataset);
Definition: parameters.c:18
Definition: distance.c:17
Definition: metricknn_impl.h:66
Definition: parameters.c:23
Definition: metricknn_impl.h:138
void(* mknn_function_distanceEval_releaseState)(void *state_distEval)
The function of a custom distance that releases a state.
Definition: mknn_distance.h:92
Definition: histogram.c:11
Represents a broad type of objects, like strings, vectors, etc.
Definition: metricknn_c.h:28
Definition: parameters.c:28
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
Definition: resolver.c:11
Represents a constant for a datatype, like integer 8bits, float 32 bits, etc.
Definition: metricknn_c.h:35
Definition: metricknn_impl.h:145
Definition: metricknn_impl.h:92
Definition: distance.c:241