MetricKnn API
Fast Similarity Search using the Metric Space Approach
mknn_dataset_loader.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_DATASET_LOADER_H_
10 #define MKNN_DATASET_LOADER_H_
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include "../metricknn_c.h"
17 
35 typedef int64_t (*mknn_function_dataset_getNumObjects)(void *data_pointer);
44 typedef void *(*mknn_function_dataset_getObject)(void *data_pointer,
45  int64_t pos);
46 
54 typedef void (*mknn_function_dataset_pushObject)(void *data_pointer,
55  void *object);
56 
63 typedef void (*mknn_function_dataset_releaseDataPointer)(void *data_pointer);
64 
71 typedef void (*mknn_function_dataset_releaseObject)(void *object_pointer);
72 
96 MknnDataset *mknn_datasetLoader_Custom(void *data_pointer,
97  mknn_function_dataset_getNumObjects func_getNumObjects,
98  mknn_function_dataset_getObject func_getObject,
99  mknn_function_dataset_pushObject func_pushObject,
100  mknn_function_dataset_releaseDataPointer func_releaseDataPointer,
101  MknnDomain *domain, bool free_domain_on_dataset_release);
102 
122 MknnDataset *mknn_datasetLoader_PointerArray(void **object_array,
123  int64_t num_objects, MknnDomain *domain,
124  bool free_each_object_on_dataset_release,
125  bool free_object_array_on_dataset_release,
126  bool free_domain_on_dataset_release);
127 
148 bool free_vectors_header_on_dataset_release, int64_t num_vectors,
149  int64_t vector_dimensions, MknnDatatype vector_dimension_datatype);
150 
172 bool free_vectors_header_on_dataset_release, int64_t num_vectors,
173  MknnDomain *domain, bool free_domain_on_dataset_release);
183 MknnDataset *mknn_datasetLoader_ParseVectorFile(const char *filename,
184  MknnDatatype datatype);
185 
193 MknnDataset *mknn_datasetLoader_ParseStringsFile(const char *filename);
194 
204 MknnDataset *mknn_datasetLoader_Concatenate(int64_t num_subdatasets,
205  MknnDataset **subdatasets, bool free_subdatasets_on_dataset_release);
206 
216  int64_t position_start, int64_t length,
217  bool free_superdataset_on_release);
218 
228  int64_t *positions, int64_t num_positions,
229  bool free_superdataset_on_release);
230 
240  double sample_size_or_fraction, bool free_superdataset_on_release);
241 
254  int64_t dimension, double dimension_minValueIncluded,
255  double dimension_maxValueNotIncluded,
256  MknnDatatype vectors_dimension_datatype);
257 
270 MknnDataset *mknn_datasetLoader_MultiObject(int64_t num_subdatasets,
271  MknnDataset **subdatasets, bool free_subdatasets_on_dataset_release);
272 
282 bool free_domain_on_dataset_release);
283 
291  MknnDataset *superdataset,
292  bool free_superdataset_on_release);
293 
303  MknnDataset *superdataset, MknnDistance *distance,
304  int64_t start_position,
305  bool free_superdataset_on_release);
306 
307 #ifdef __cplusplus
308 }
309 #endif
310 
311 #endif
MknnDataset * mknn_datasetLoader_SubsetRandomSample(MknnDataset *superdataset, double sample_size_or_fraction, bool free_superdataset_on_release)
Creates a new dataset as a random sample of superdataset.
Definition: dataset_subset_positions.c:48
void(* mknn_function_dataset_releaseDataPointer)(void *data_pointer)
Function parameter for mknn_datasetLoader_Custom.
Definition: mknn_dataset_loader.h:63
MknnDataset * mknn_datasetLoader_SubsetSegment(MknnDataset *superdataset, int64_t position_start, int64_t length, bool free_superdataset_on_release)
Creates a new dataset which is a subset of a bigger dataset.
Definition: dataset_subset_segment.c:31
Definition: distance.c:17
MknnDataset * mknn_datasetLoader_PointerArray(void **object_array, int64_t num_objects, MknnDomain *domain, bool free_each_object_on_dataset_release, bool free_object_array_on_dataset_release, bool free_domain_on_dataset_release)
Creates a new dataset from an array of objects.
Definition: dataset_pointersArray.c:39
MknnDataset * mknn_datasetLoader_SubsetPositions(MknnDataset *superdataset, int64_t *positions, int64_t num_positions, bool free_superdataset_on_release)
Creates a new dataset which is a subset of a bigger dataset.
Definition: dataset_subset_positions.c:33
void(* mknn_function_dataset_pushObject)(void *data_pointer, void *object)
Function parameter for mknn_datasetLoader_Custom.
Definition: mknn_dataset_loader.h:54
MknnDataset * mknn_datasetLoader_reorderNearestNeighbor(MknnDataset *superdataset, MknnDistance *distance, int64_t start_position, bool free_superdataset_on_release)
Creates a new dataset which is a permutation of superdataset, where the first position is given by st...
Definition: dataset_reorder.c:48
int64_t(* mknn_function_dataset_getNumObjects)(void *data_pointer)
Function parameter for mknn_datasetLoader_Custom.
Definition: mknn_dataset_loader.h:35
MknnDataset * mknn_datasetLoader_ParseStringsFile(const char *filename)
Creates a new dataset by reading a text file with strings.
Definition: dataset_parse.c:64
MknnDataset * mknn_datasetLoader_UniformRandomVectors(int64_t num_objects, int64_t dimension, double dimension_minValueIncluded, double dimension_maxValueNotIncluded, MknnDatatype vectors_dimension_datatype)
Creates a new dataset with random vectors of the given datatype.
Definition: dataset_random.c:79
Definition: dataset.c:11
MknnDataset * mknn_datasetLoader_MultiObject(int64_t num_subdatasets, MknnDataset **subdatasets, bool free_subdatasets_on_dataset_release)
Creates a new dataset where each object is a multi-object.
Definition: dataset_multiobject.c:40
MknnDataset * mknn_datasetLoader_PointerCompactVectors_alt(void *vectors_header, bool free_vectors_header_on_dataset_release, int64_t num_vectors, MknnDomain *domain, bool free_domain_on_dataset_release)
Creates a new dataset from a data array.
Definition: dataset_compactVectors.c:34
void(* mknn_function_dataset_releaseObject)(void *object_pointer)
Function parameter for mknn_dataset_pushObject Releases the storage of the object.
Definition: mknn_dataset_loader.h:71
MknnDataset * mknn_datasetLoader_Empty(MknnDomain *domain, bool free_domain_on_dataset_release)
Creates a new empty dataset that can dynamically grow as new objects are added.
Definition: dataset_dynamic.c:35
MknnDataset * mknn_datasetLoader_ParseVectorFile(const char *filename, MknnDatatype datatype)
Creates a new dataset by reading a text file with vectors.
Definition: dataset_parse.c:11
MknnDataset * mknn_datasetLoader_PointerCompactVectors(void *vectors_header, bool free_vectors_header_on_dataset_release, int64_t num_vectors, int64_t vector_dimensions, MknnDatatype vector_dimension_datatype)
Creates a new dataset from a data array.
Definition: dataset_compactVectors.c:54
MknnDataset * mknn_datasetLoader_Concatenate(int64_t num_subdatasets, MknnDataset **subdatasets, bool free_subdatasets_on_dataset_release)
Creates a new dataset which is the concatenation of one or more datasets.
Definition: dataset_concatenate.c:40
Represents a constant for a datatype, like integer 8bits, float 32 bits, etc.
Definition: metricknn_c.h:35
void *(* mknn_function_dataset_getObject)(void *data_pointer, int64_t pos)
Function parameter for mknn_datasetLoader_Custom.
Definition: mknn_dataset_loader.h:44
MknnDataset * mknn_datasetLoader_reorderRandomPermutation(MknnDataset *superdataset, bool free_superdataset_on_release)
Creates a new dataset as a random permutation of superdataset.
Definition: dataset_reorder.c:11
Definition: domain.c:11
MknnDataset * mknn_datasetLoader_Custom(void *data_pointer, mknn_function_dataset_getNumObjects func_getNumObjects, mknn_function_dataset_getObject func_getObject, mknn_function_dataset_pushObject func_pushObject, mknn_function_dataset_releaseDataPointer func_releaseDataPointer, MknnDomain *domain, bool free_domain_on_dataset_release)
Creates a new custom dataset.
Definition: dataset.c:24
Powered by Download MetricKnn