usearch 2.10.2 → 2.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/binding.gyp +101 -0
- package/c/CMakeLists.txt +27 -0
- package/c/README.md +34 -0
- package/c/lib.cpp +362 -0
- package/c/test.c +382 -0
- package/c/usearch.h +356 -0
- package/cmake/clipp.cmake +7 -0
- package/cmake/config.cmake.in +15 -0
- package/cmake/emscripten.cmake +8 -0
- package/cmake/jemalloc.cmake +62 -0
- package/cmake/pkg-config.pc.in +4 -0
- package/cmake/usearchConfigVersion.cmake.in +20 -0
- package/cpp/CMakeLists.txt +14 -0
- package/cpp/README.md +161 -0
- package/cpp/bench.cpp +616 -0
- package/cpp/test.cpp +324 -0
- package/fp16/CMakeLists.txt +176 -0
- package/fp16/LICENSE +11 -0
- package/fp16/README.md +20 -0
- package/fp16/bench/alt-element.cc +89 -0
- package/fp16/bench/from-alt-array.cc +175 -0
- package/fp16/bench/from-ieee-array.cc +399 -0
- package/fp16/bench/ieee-element.cc +272 -0
- package/fp16/bench/to-alt-array.cc +91 -0
- package/fp16/bench/to-ieee-array.cc +303 -0
- package/fp16/cmake/DownloadGoogleBenchmark.cmake +15 -0
- package/fp16/cmake/DownloadGoogleTest.cmake +15 -0
- package/fp16/cmake/DownloadPSimd.cmake +15 -0
- package/fp16/configure.py +65 -0
- package/fp16/confu.yaml +8 -0
- package/fp16/include/fp16/__init__.py +0 -0
- package/fp16/include/fp16/avx.py +50 -0
- package/fp16/include/fp16/avx2.py +53 -0
- package/fp16/include/fp16/bitcasts.h +92 -0
- package/fp16/include/fp16/fp16.h +451 -0
- package/fp16/include/fp16/psimd.h +131 -0
- package/fp16/include/fp16.h +11 -0
- package/fp16/jni/Android.mk +6 -0
- package/fp16/jni/Application.mk +4 -0
- package/fp16/test/alt-from-fp32-value.cc +498 -0
- package/fp16/test/alt-to-fp32-bits.cc +263 -0
- package/fp16/test/alt-to-fp32-psimd.cc +145 -0
- package/fp16/test/alt-to-fp32-value.cc +348 -0
- package/fp16/test/alt-to-fp32x2-psimd.cc +245 -0
- package/fp16/test/bitcasts.cc +56 -0
- package/fp16/test/ieee-from-fp32-value.cc +523 -0
- package/fp16/test/ieee-to-fp32-bits.cc +333 -0
- package/fp16/test/ieee-to-fp32-psimd.cc +312 -0
- package/fp16/test/ieee-to-fp32-value.cc +420 -0
- package/fp16/test/ieee-to-fp32x2-psimd.cc +541 -0
- package/fp16/test/peachpy/alt-xmm-to-fp32-xmm-avx.cc +96 -0
- package/fp16/test/peachpy/alt-xmm-to-fp32-ymm-avx2.cc +96 -0
- package/fp16/test/peachpy/stubs.py +38 -0
- package/fp16/test/tables.cc +530 -0
- package/fp16/test/tables.h +13 -0
- package/fp16/third-party/THHalf.h +92 -0
- package/fp16/third-party/eigen-half.h +170 -0
- package/fp16/third-party/float16-compressor.h +80 -0
- package/fp16/third-party/half.hpp +2916 -0
- package/fp16/third-party/npy-halffloat.h +328 -0
- package/include/usearch/index.hpp +3838 -0
- package/include/usearch/index_dense.hpp +2004 -0
- package/include/usearch/index_plugins.hpp +2255 -0
- package/javascript/dist-package-cjs.json +3 -0
- package/javascript/dist-package-esm.json +3 -0
- package/javascript/lib.cpp +350 -0
- package/javascript/node-gyp-build.d.ts +1 -0
- package/javascript/tsconfig-base.json +25 -0
- package/javascript/tsconfig-cjs.json +8 -0
- package/javascript/tsconfig-esm.json +8 -0
- package/javascript/usearch.test.js +84 -0
- package/javascript/usearch.ts +640 -0
- package/package.json +10 -3
- package/prebuilds/darwin-arm64+x64/usearch.node +0 -0
- package/prebuilds/linux-arm64/usearch.node +0 -0
- package/prebuilds/linux-x64/usearch.node +0 -0
- package/prebuilds/win32-ia32/usearch.node +0 -0
- package/prebuilds/win32-x64/usearch.node +0 -0
- package/simsimd/.releaserc +87 -0
- package/simsimd/CONTRIBUTING.md +114 -0
- package/simsimd/Cargo.lock +709 -0
- package/simsimd/Cargo.toml +44 -0
- package/simsimd/LICENSE +201 -0
- package/simsimd/README.md +708 -0
- package/simsimd/binding.gyp +36 -0
- package/simsimd/build.rs +51 -0
- package/simsimd/c/lib.c +110 -0
- package/simsimd/include/simsimd/binary.h +258 -0
- package/simsimd/include/simsimd/dot.h +1237 -0
- package/simsimd/include/simsimd/geospatial.h +37 -0
- package/simsimd/include/simsimd/probability.h +563 -0
- package/simsimd/include/simsimd/simsimd.h +1129 -0
- package/simsimd/include/simsimd/spatial.h +1019 -0
- package/simsimd/include/simsimd/types.h +309 -0
- package/simsimd/javascript/bench.js +127 -0
- package/simsimd/javascript/dist-package-cjs.json +3 -0
- package/simsimd/javascript/dist-package-esm.json +3 -0
- package/simsimd/javascript/fallback.ts +203 -0
- package/simsimd/javascript/lib.c +107 -0
- package/simsimd/javascript/node-gyp-build.d.ts +1 -0
- package/simsimd/javascript/simsimd.ts +135 -0
- package/simsimd/javascript/test.mjs +179 -0
- package/simsimd/javascript/tsconfig-base.json +37 -0
- package/simsimd/javascript/tsconfig-cjs.json +8 -0
- package/simsimd/javascript/tsconfig-esm.json +8 -0
- package/simsimd/package-lock.json +1709 -0
- package/simsimd/package.json +61 -0
- package/simsimd/rust/benches/cosine.rs +27 -0
- package/simsimd/rust/benches/native.rs +30 -0
- package/simsimd/rust/benches/sqeuclidean.rs +27 -0
- package/simsimd/rust/lib.rs +778 -0
package/c/usearch.h
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
#ifndef UNUM_USEARCH_H
|
|
2
|
+
#define UNUM_USEARCH_H
|
|
3
|
+
|
|
4
|
+
#ifdef __cplusplus
|
|
5
|
+
extern "C" {
|
|
6
|
+
#endif
|
|
7
|
+
|
|
8
|
+
#ifndef USEARCH_EXPORT
|
|
9
|
+
#if defined(_WIN32) && !defined(__MINGW32__)
|
|
10
|
+
#define USEARCH_EXPORT __declspec(dllexport)
|
|
11
|
+
#else
|
|
12
|
+
#define USEARCH_EXPORT
|
|
13
|
+
#endif
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#include <stdbool.h> // `bool`
|
|
17
|
+
#include <stddef.h> // `size_t`
|
|
18
|
+
#include <stdint.h> // `uint64_t`
|
|
19
|
+
|
|
20
|
+
USEARCH_EXPORT typedef void* usearch_index_t;
|
|
21
|
+
USEARCH_EXPORT typedef uint64_t usearch_key_t;
|
|
22
|
+
USEARCH_EXPORT typedef float usearch_distance_t;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @brief Pointer to a null-terminated error message.
|
|
26
|
+
* Returned error messages @b don't need to be deallocated.
|
|
27
|
+
*/
|
|
28
|
+
USEARCH_EXPORT typedef char const* usearch_error_t;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @brief Type-punned callback for "metrics" or "distance functions",
|
|
32
|
+
* that accepts pointers to two vectors and measures their @b dis-similarity.
|
|
33
|
+
*/
|
|
34
|
+
USEARCH_EXPORT typedef usearch_distance_t (*usearch_metric_t)(void const*, void const*);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @brief Enumerator for the most common kinds of `usearch_metric_t`.
|
|
38
|
+
* Those are supported out of the box, with SIMD-optimizations for most common hardware.
|
|
39
|
+
*/
|
|
40
|
+
USEARCH_EXPORT typedef enum usearch_metric_kind_t {
|
|
41
|
+
usearch_metric_unknown_k = 0,
|
|
42
|
+
usearch_metric_cos_k = 1,
|
|
43
|
+
usearch_metric_ip_k = 2,
|
|
44
|
+
usearch_metric_l2sq_k = 3,
|
|
45
|
+
usearch_metric_haversine_k = 4,
|
|
46
|
+
usearch_metric_divergence_k = 5,
|
|
47
|
+
usearch_metric_pearson_k = 6,
|
|
48
|
+
usearch_metric_jaccard_k = 7,
|
|
49
|
+
usearch_metric_hamming_k = 8,
|
|
50
|
+
usearch_metric_tanimoto_k = 9,
|
|
51
|
+
usearch_metric_sorensen_k = 10,
|
|
52
|
+
} usearch_metric_kind_t;
|
|
53
|
+
|
|
54
|
+
USEARCH_EXPORT typedef enum usearch_scalar_kind_t {
|
|
55
|
+
usearch_scalar_unknown_k = 0,
|
|
56
|
+
usearch_scalar_f32_k = 1,
|
|
57
|
+
usearch_scalar_f64_k = 2,
|
|
58
|
+
usearch_scalar_f16_k = 3,
|
|
59
|
+
usearch_scalar_i8_k = 4,
|
|
60
|
+
usearch_scalar_b1_k = 5,
|
|
61
|
+
} usearch_scalar_kind_t;
|
|
62
|
+
|
|
63
|
+
USEARCH_EXPORT typedef struct usearch_init_options_t {
|
|
64
|
+
/**
|
|
65
|
+
* @brief The metric kind used for distance calculation between vectors.
|
|
66
|
+
*/
|
|
67
|
+
usearch_metric_kind_t metric_kind;
|
|
68
|
+
/**
|
|
69
|
+
* @brief The @b optional custom distance metric function used for distance calculation between vectors.
|
|
70
|
+
* If the `metric_kind` is set to `usearch_metric_unknown_k`, this function pointer mustn't be `NULL`.
|
|
71
|
+
*/
|
|
72
|
+
usearch_metric_t metric;
|
|
73
|
+
/**
|
|
74
|
+
* @brief The scalar kind used for quantization of vector data during indexing.
|
|
75
|
+
*/
|
|
76
|
+
usearch_scalar_kind_t quantization;
|
|
77
|
+
/**
|
|
78
|
+
* @brief The number of dimensions in the vectors to be indexed.
|
|
79
|
+
* Must be defined for most metrics, but can be avoided for `usearch_metric_haversine_k`.
|
|
80
|
+
*/
|
|
81
|
+
size_t dimensions;
|
|
82
|
+
/**
|
|
83
|
+
* @brief The @b optional connectivity parameter that limits connections-per-node in graph.
|
|
84
|
+
*/
|
|
85
|
+
size_t connectivity;
|
|
86
|
+
/**
|
|
87
|
+
* @brief The @b optional expansion factor used for index construction when adding vectors.
|
|
88
|
+
*/
|
|
89
|
+
size_t expansion_add;
|
|
90
|
+
/**
|
|
91
|
+
* @brief The @b optional expansion factor used for index construction during search operations.
|
|
92
|
+
*/
|
|
93
|
+
size_t expansion_search;
|
|
94
|
+
/**
|
|
95
|
+
* @brief When set allows multiple vectors to map to the same key.
|
|
96
|
+
*/
|
|
97
|
+
bool multi;
|
|
98
|
+
} usearch_init_options_t;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @brief Initializes a new instance of the index.
|
|
102
|
+
* @param options Pointer to the `usearch_init_options_t` structure containing initialization options.
|
|
103
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
104
|
+
* @return A handle to the initialized USearch index, or `NULL` on failure.
|
|
105
|
+
*/
|
|
106
|
+
USEARCH_EXPORT usearch_index_t usearch_init(usearch_init_options_t* options, usearch_error_t* error);
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @brief Frees the resources associated with the index.
|
|
110
|
+
* @param[inout] index The handle to the USearch index to be freed.
|
|
111
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
112
|
+
*/
|
|
113
|
+
USEARCH_EXPORT void usearch_free(usearch_index_t index, usearch_error_t* error);
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @brief Reports expected file size after serialization.
|
|
117
|
+
* @param[in] index The handle to the USearch index to be serialized.
|
|
118
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
119
|
+
*/
|
|
120
|
+
USEARCH_EXPORT size_t usearch_serialized_length(usearch_index_t index, usearch_error_t* error);
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @brief Saves the index to a file.
|
|
124
|
+
* @param[in] index The handle to the USearch index to be serialized.
|
|
125
|
+
* @param[in] path The file path where the index will be saved.
|
|
126
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
127
|
+
*/
|
|
128
|
+
USEARCH_EXPORT void usearch_save(usearch_index_t index, char const* path, usearch_error_t* error);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @brief Loads the index from a file.
|
|
132
|
+
* @param[inout] index The handle to the USearch index to be populated from path.
|
|
133
|
+
* @param[in] path The file path from where the index will be loaded.
|
|
134
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
135
|
+
*/
|
|
136
|
+
USEARCH_EXPORT void usearch_load(usearch_index_t index, char const* path, usearch_error_t* error);
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @brief Creates a view of the index from a file without copying it into memory.
|
|
140
|
+
* @param[inout] index The handle to the USearch index to be populated with a file view.
|
|
141
|
+
* @param[in] path The file path from where the view will be created.
|
|
142
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
143
|
+
*/
|
|
144
|
+
USEARCH_EXPORT void usearch_view(usearch_index_t index, char const* path, usearch_error_t* error);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @brief Loads index metadata from a file.
|
|
148
|
+
* @param[in] path The file path from where the index will be loaded.
|
|
149
|
+
* @param[out] options Pointer to the `usearch_init_options_t` structure to be populated.
|
|
150
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
151
|
+
* @return A handle to the initialized USearch index, or `NULL` on failure.
|
|
152
|
+
*/
|
|
153
|
+
USEARCH_EXPORT void usearch_metadata(char const* path, usearch_init_options_t* options, usearch_error_t* error);
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @brief Saves the index to an in-memory buffer.
|
|
157
|
+
* @param[in] index The handle to the USearch index to be serialized.
|
|
158
|
+
* @param[in] buffer The in-memory continuous buffer where the index will be saved.
|
|
159
|
+
* @param[in] length The length of the buffer in bytes.
|
|
160
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
161
|
+
*/
|
|
162
|
+
USEARCH_EXPORT void usearch_save_buffer(usearch_index_t index, void* buffer, size_t length, usearch_error_t* error);
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @brief Loads the index from an in-memory buffer.
|
|
166
|
+
* @param[inout] index The handle to the USearch index to be populated from buffer.
|
|
167
|
+
* @param[in] buffer The in-memory continuous buffer from where the index will be loaded.
|
|
168
|
+
* @param[in] length The length of the buffer in bytes.
|
|
169
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
170
|
+
*/
|
|
171
|
+
USEARCH_EXPORT void usearch_load_buffer(usearch_index_t index, void const* buffer, size_t length,
|
|
172
|
+
usearch_error_t* error);
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @brief Creates a view of the index from an in-memory buffer without copying it into memory.
|
|
176
|
+
* @param[inout] index The handle to the USearch index to be populated with a buffer view.
|
|
177
|
+
* @param[in] buffer The in-memory continuous buffer from where the view will be created.
|
|
178
|
+
* @param[in] length The length of the buffer in bytes.
|
|
179
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
180
|
+
*/
|
|
181
|
+
USEARCH_EXPORT void usearch_view_buffer(usearch_index_t index, void const* buffer, size_t length,
|
|
182
|
+
usearch_error_t* error);
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @brief Loads index metadata from an in-memory buffer.
|
|
186
|
+
* @param[in] buffer The in-memory continuous buffer from where the view will be created.
|
|
187
|
+
* @param[out] options Pointer to the `usearch_init_options_t` structure to be populated.
|
|
188
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
189
|
+
* @return A handle to the initialized USearch index, or `NULL` on failure.
|
|
190
|
+
*/
|
|
191
|
+
USEARCH_EXPORT void usearch_metadata_buffer(void const* buffer, size_t length, usearch_init_options_t* options,
|
|
192
|
+
usearch_error_t* error);
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @brief Reports the current size (number of vectors) of the index.
|
|
196
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
197
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
198
|
+
*/
|
|
199
|
+
USEARCH_EXPORT size_t usearch_size(usearch_index_t index, usearch_error_t* error);
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @brief Reports the current capacity (number of vectors) of the index.
|
|
203
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
204
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
205
|
+
*/
|
|
206
|
+
USEARCH_EXPORT size_t usearch_capacity(usearch_index_t index, usearch_error_t* error);
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @brief Reports the current dimensions of the vectors in the index.
|
|
210
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
211
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
212
|
+
*/
|
|
213
|
+
USEARCH_EXPORT size_t usearch_dimensions(usearch_index_t index, usearch_error_t* error);
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @brief Reports the current connectivity of the index.
|
|
217
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
218
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
219
|
+
*/
|
|
220
|
+
USEARCH_EXPORT size_t usearch_connectivity(usearch_index_t index, usearch_error_t* error);
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @brief Reserves memory for a specified number of incoming vectors.
|
|
224
|
+
* @param[inout] index The handle to the USearch index to be resized.
|
|
225
|
+
* @param[in] capacity The desired total capacity including current size.
|
|
226
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
227
|
+
*/
|
|
228
|
+
USEARCH_EXPORT void usearch_reserve(usearch_index_t index, size_t capacity, usearch_error_t* error);
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @brief Adds a vector with a key to the index.
|
|
232
|
+
* @param[inout] index The handle to the USearch index to be populated.
|
|
233
|
+
* @param[in] key The key associated with the vector.
|
|
234
|
+
* @param[in] vector Pointer to the vector data.
|
|
235
|
+
* @param[in] vector_kind The scalar type used in the vector data.
|
|
236
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
237
|
+
*/
|
|
238
|
+
USEARCH_EXPORT void usearch_add( //
|
|
239
|
+
usearch_index_t index, usearch_key_t key, //
|
|
240
|
+
void const* vector, usearch_scalar_kind_t vector_kind, usearch_error_t* error);
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @brief Checks if the index contains a vector with a specific key.
|
|
244
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
245
|
+
* @param[in] key The key to be checked.
|
|
246
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
247
|
+
* @return `true` if the index contains the vector with the given key, `false` otherwise.
|
|
248
|
+
*/
|
|
249
|
+
USEARCH_EXPORT bool usearch_contains(usearch_index_t index, usearch_key_t key, usearch_error_t* error);
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @brief Counts the number of entries in the index under a specific key.
|
|
253
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
254
|
+
* @param[in] key The key to be checked.
|
|
255
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
256
|
+
* @return Number of vectors found under that key.
|
|
257
|
+
*/
|
|
258
|
+
USEARCH_EXPORT size_t usearch_count(usearch_index_t index, usearch_key_t, usearch_error_t* error);
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @brief Performs k-Approximate Nearest Neighbors (kANN) Search for closest vectors to query.
|
|
262
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
263
|
+
* @param[in] query_vector Pointer to the query vector data.
|
|
264
|
+
* @param[in] query_kind The scalar type used in the query vector data.
|
|
265
|
+
* @param[in] count Upper bound on the number of neighbors to search, the "k" in "kANN".
|
|
266
|
+
* @param[out] keys Output buffer for up to `count` nearest neighbors keys.
|
|
267
|
+
* @param[out] distances Output buffer for up to `count` distances to nearest neighbors.
|
|
268
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
269
|
+
* @return Number of found matches.
|
|
270
|
+
*/
|
|
271
|
+
USEARCH_EXPORT size_t usearch_search( //
|
|
272
|
+
usearch_index_t index, //
|
|
273
|
+
void const* query_vector, usearch_scalar_kind_t query_kind, //
|
|
274
|
+
size_t count, usearch_key_t* keys, usearch_distance_t* distances, usearch_error_t* error);
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* @brief Retrieves the vector associated with the given key from the index.
|
|
278
|
+
* @param[in] index The handle to the USearch index to be queried.
|
|
279
|
+
* @param[in] key The key of the vector to retrieve.
|
|
280
|
+
* @param[out] vector Pointer to the memory where the vector data will be copied.
|
|
281
|
+
* @param[in] count Number of vectors that can be fitted into `vector` for multi-vector entries.
|
|
282
|
+
* @param[in] vector_kind The scalar type used in the vector data.
|
|
283
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
284
|
+
* @return Number of vectors found under that name and exported to `vector`.
|
|
285
|
+
*/
|
|
286
|
+
USEARCH_EXPORT size_t usearch_get( //
|
|
287
|
+
usearch_index_t index, usearch_key_t key, size_t count, //
|
|
288
|
+
void* vector, usearch_scalar_kind_t vector_kind, usearch_error_t* error);
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @brief Removes the vector associated with the given key from the index.
|
|
292
|
+
* @param[inout] index The handle to the USearch index to be modified.
|
|
293
|
+
* @param[in] key The key of the vector to be removed.
|
|
294
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
295
|
+
* @return Number of vectors found under that name and dropped from the index.
|
|
296
|
+
*/
|
|
297
|
+
USEARCH_EXPORT size_t usearch_remove(usearch_index_t index, usearch_key_t key, usearch_error_t* error);
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @brief Renames the vector to map to a different key.
|
|
301
|
+
* @param[inout] index The handle to the USearch index to be modified.
|
|
302
|
+
* @param[in] from The key of the vector to be renamed.
|
|
303
|
+
* @param[in] to New key for found entry.
|
|
304
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
305
|
+
* @return Number of vectors found under that name and renamed.
|
|
306
|
+
*/
|
|
307
|
+
USEARCH_EXPORT size_t usearch_rename(usearch_index_t index, usearch_key_t from, usearch_key_t to,
|
|
308
|
+
usearch_error_t* error);
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* @brief Computes the distance between two equi-dimensional vectors.
|
|
312
|
+
* @param[in] vector_first The first vector for comparison.
|
|
313
|
+
* @param[in] vector_second The second vector for comparison.
|
|
314
|
+
* @param[in] scalar_kind The scalar type used in the vectors.
|
|
315
|
+
* @param[in] dimensions The number of dimensions in each vector.
|
|
316
|
+
* @param[in] metric_kind The metric kind used for distance calculation between vectors.
|
|
317
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
318
|
+
* @return Distance between given vectors.
|
|
319
|
+
*/
|
|
320
|
+
USEARCH_EXPORT usearch_distance_t usearch_distance( //
|
|
321
|
+
void const* vector_first, void const* vector_second, //
|
|
322
|
+
usearch_scalar_kind_t scalar_kind, size_t dimensions, //
|
|
323
|
+
usearch_metric_kind_t metric_kind, usearch_error_t* error);
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @brief Multi-threaded exact nearest neighbors search for equi-dimensional vectors.
|
|
327
|
+
* @param[in] dataset Pointer to the first scalar of the dataset matrix.
|
|
328
|
+
* @param[in] queries Pointer to the first scalar of the queries matrix.
|
|
329
|
+
* @param[in] dataset_size Number of vectors in the `dataset`.
|
|
330
|
+
* @param[in] queries_size Number of vectors in the `queries` set.
|
|
331
|
+
* @param[in] dataset_stride Number of bytes between starts of consecutive vectors in `dataset`.
|
|
332
|
+
* @param[in] queries_stride Number of bytes between starts of consecutive vectors in `queries`.
|
|
333
|
+
* @param[in] scalar_kind The scalar type used in the vectors.
|
|
334
|
+
* @param[in] dimensions The number of dimensions in each vector.
|
|
335
|
+
* @param[in] metric_kind The metric kind used for distance calculation between vectors.
|
|
336
|
+
* @param[in] count Upper bound on the number of neighbors to search, the "k" in "kANN".
|
|
337
|
+
* @param[in] threads Upper bound for the number of CPU threads to use.
|
|
338
|
+
* @param[out] keys Output buffer for up to `count` nearest neighbors keys.
|
|
339
|
+
* @param[out] distances Output buffer for up to `count` distances to nearest neighbors.
|
|
340
|
+
* @param[out] error Pointer to a string where the error message will be stored, if an error occurs.
|
|
341
|
+
* @return Number of found matches.
|
|
342
|
+
*/
|
|
343
|
+
USEARCH_EXPORT void usearch_exact_search( //
|
|
344
|
+
void const* dataset, size_t dataset_size, size_t dataset_stride, //
|
|
345
|
+
void const* queries, size_t queries_size, size_t queries_stride, //
|
|
346
|
+
usearch_scalar_kind_t scalar_kind, size_t dimensions, //
|
|
347
|
+
usearch_metric_kind_t metric_kind, size_t count, size_t threads, //
|
|
348
|
+
usearch_key_t* keys, size_t keys_stride, //
|
|
349
|
+
usearch_distance_t* distances, size_t distances_stride, //
|
|
350
|
+
usearch_error_t* error);
|
|
351
|
+
|
|
352
|
+
#ifdef __cplusplus
|
|
353
|
+
}
|
|
354
|
+
#endif
|
|
355
|
+
|
|
356
|
+
#endif // UNUM_USEARCH_H
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
include(FindPackageHandleStandardArgs)
|
|
2
|
+
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG ${CMAKE_CURRENT_LIST_FILE})
|
|
3
|
+
find_package_handle_standard_args(@PROJECT_NAME@ CONFIG_MODE)
|
|
4
|
+
|
|
5
|
+
if(NOT TARGET @PROJECT_NAME@::@USEARCH_TARGET_NAME@)
|
|
6
|
+
include("${CMAKE_CURRENT_LIST_DIR}/@USEARCH_TARGETS_EXPORT_NAME@.cmake")
|
|
7
|
+
if((NOT TARGET @USEARCH_TARGET_NAME@) AND
|
|
8
|
+
(NOT @PROJECT_NAME@_FIND_VERSION OR
|
|
9
|
+
@PROJECT_NAME@_FIND_VERSION VERSION_LESS 3.2.0))
|
|
10
|
+
add_library(@USEARCH_TARGET_NAME@ INTERFACE IMPORTED)
|
|
11
|
+
set_target_properties(@USEARCH_TARGET_NAME@ PROPERTIES
|
|
12
|
+
INTERFACE_LINK_LIBRARIES @PROJECT_NAME@::@USEARCH_TARGET_NAME@
|
|
13
|
+
)
|
|
14
|
+
endif()
|
|
15
|
+
endif()
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
include(ExternalProject)
|
|
2
|
+
set(JEMALLOC_DISABLE_TLS)
|
|
3
|
+
|
|
4
|
+
if (${USTORE_BUILD_SDK_PYTHON})
|
|
5
|
+
set(JEMALLOC_DISABLE_TLS --disable-initial-exec-tls)
|
|
6
|
+
endif ()
|
|
7
|
+
|
|
8
|
+
if (${USTORE_REBUILD_JEMALLOC})
|
|
9
|
+
set(JEMALLOC_PREFIX_DIR ${CMAKE_BINARY_DIR}/_deps/jemalloc)
|
|
10
|
+
set(JEMALLOC_SRC_DIR ${JEMALLOC_PREFIX_DIR}/src/jemalloc)
|
|
11
|
+
set(JEMALLOC_INSTALL_DIR ${JEMALLOC_PREFIX_DIR}/install)
|
|
12
|
+
set(JEMALLOC_DEPENDENCY jemalloc)
|
|
13
|
+
|
|
14
|
+
ExternalProject_Add(
|
|
15
|
+
jemalloc
|
|
16
|
+
GIT_REPOSITORY https://github.com/jemalloc/jemalloc.git
|
|
17
|
+
GIT_TAG 5.3.0
|
|
18
|
+
PREFIX ${JEMALLOC_PREFIX_DIR}
|
|
19
|
+
CONFIGURE_COMMAND
|
|
20
|
+
echo Configuring jemalloc && cd ${JEMALLOC_SRC_DIR} && ./autogen.sh && ./configure
|
|
21
|
+
--prefix=${JEMALLOC_INSTALL_DIR} --enable-prof ${JEMALLOC_DISABLE_TLS} # --with-jemalloc-prefix=je_
|
|
22
|
+
BUILD_COMMAND echo Building jemalloc && cd ${JEMALLOC_SRC_DIR} && make install_lib_static install_include
|
|
23
|
+
INSTALL_COMMAND ""
|
|
24
|
+
UPDATE_COMMAND ""
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
# Create libjemalloc and libjemalloc_pic targets to be used as dependencies
|
|
28
|
+
add_library(libjemalloc STATIC IMPORTED GLOBAL)
|
|
29
|
+
add_library(libjemalloc_pic STATIC IMPORTED GLOBAL)
|
|
30
|
+
|
|
31
|
+
set_property(TARGET libjemalloc PROPERTY IMPORTED_LOCATION ${JEMALLOC_INSTALL_DIR}/lib/libjemalloc.a)
|
|
32
|
+
set_property(TARGET libjemalloc_pic PROPERTY IMPORTED_LOCATION ${JEMALLOC_INSTALL_DIR}/lib/libjemalloc_pic.a)
|
|
33
|
+
|
|
34
|
+
link_libraries(-Wl,--no-as-needed)
|
|
35
|
+
link_libraries(dl ${libjemalloc_pic})
|
|
36
|
+
|
|
37
|
+
# Export the include directory path.
|
|
38
|
+
set(JEMALLOC_SOURCE_DIR ${JEMALLOC_INSTALL_DIR})
|
|
39
|
+
set(JEMALLOC_LIBRARIES ${JEMALLOC_INSTALL_DIR}/lib/libjemalloc_pic.a ${JEMALLOC_INSTALL_DIR}/lib/libjemalloc.a)
|
|
40
|
+
|
|
41
|
+
include_directories(${JEMALLOC_SOURCE_DIR}/include)
|
|
42
|
+
|
|
43
|
+
else ()
|
|
44
|
+
find_path(JEMALLOC_ROOT_DIR NAMES include/jemalloc/jemalloc.h)
|
|
45
|
+
|
|
46
|
+
find_library(
|
|
47
|
+
JEMALLOC_LIBRARIES
|
|
48
|
+
NAMES jemalloc
|
|
49
|
+
HINTS ${JEMALLOC_ROOT_DIR}/lib
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
find_path(
|
|
53
|
+
JEMALLOC_INCLUDE_DIR
|
|
54
|
+
NAMES jemalloc/jemalloc.h
|
|
55
|
+
HINTS ${JEMALLOC_ROOT_DIR}/include
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
include(FindPackageHandleStandardArgs)
|
|
59
|
+
find_package_handle_standard_args(JeMalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
|
|
60
|
+
|
|
61
|
+
mark_as_advanced(JEMALLOC_ROOT_DIR JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR)
|
|
62
|
+
endif ()
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This is essentially cmake's BasicConfigVersion-SameMajorVersion.cmake.in but
|
|
2
|
+
# without the 32/64-bit check. Since USearch is a header-only library, it doesn't
|
|
3
|
+
# matter if it was built on a different platform than what it is used on (see
|
|
4
|
+
# https://github.com/nlohmann/json/issues/1697).
|
|
5
|
+
set(PACKAGE_VERSION "@PROJECT_VERSION@")
|
|
6
|
+
|
|
7
|
+
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
8
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
9
|
+
else()
|
|
10
|
+
|
|
11
|
+
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL "@PROJECT_VERSION_MAJOR@")
|
|
12
|
+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
13
|
+
else()
|
|
14
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
15
|
+
endif()
|
|
16
|
+
|
|
17
|
+
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
|
18
|
+
set(PACKAGE_VERSION_EXACT TRUE)
|
|
19
|
+
endif()
|
|
20
|
+
endif()
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
if (USEARCH_BUILD_TEST_CPP)
|
|
2
|
+
add_executable(test_cpp test.cpp)
|
|
3
|
+
setup_target(test_cpp)
|
|
4
|
+
include(CTest)
|
|
5
|
+
enable_testing()
|
|
6
|
+
add_test(NAME test_cpp COMMAND test_cpp)
|
|
7
|
+
endif ()
|
|
8
|
+
|
|
9
|
+
if (USEARCH_BUILD_BENCH_CPP)
|
|
10
|
+
include(clipp)
|
|
11
|
+
add_executable(bench_cpp bench.cpp)
|
|
12
|
+
setup_target(bench_cpp)
|
|
13
|
+
target_include_directories(bench_cpp PRIVATE ${clipp_SOURCE_DIR}/include)
|
|
14
|
+
endif ()
|
package/cpp/README.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# USearch for C++
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
To use in a C++ project, copy the `include/usearch/*` headers into your project.
|
|
6
|
+
Alternatively, fetch it with CMake:
|
|
7
|
+
|
|
8
|
+
```cmake
|
|
9
|
+
FetchContent_Declare(usearch GIT_REPOSITORY https://github.com/unum-cloud/usearch.git)
|
|
10
|
+
FetchContent_MakeAvailable(usearch)
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quickstart
|
|
14
|
+
|
|
15
|
+
Once included, the high-level C++11 interface is as simple as it gets: `reserve()`, `add()`, `search()`, `size()`, `capacity()`, `save()`, `load()`, `view()`.
|
|
16
|
+
This covers 90% of use cases.
|
|
17
|
+
|
|
18
|
+
```cpp
|
|
19
|
+
using namespace unum::usearch;
|
|
20
|
+
|
|
21
|
+
metric_punned_t metric(256, metric_kind_t::l2sq_k, scalar_kind_t::f32_k);
|
|
22
|
+
|
|
23
|
+
// If you plan to store more than 4 Billion entries - use `index_dense_big_t`.
|
|
24
|
+
// Or directly instantiate the template variant you need - `index_dense_gt<vector_key_t, internal_id_t>`.
|
|
25
|
+
index_dense_t index = index_dense_t::make(metric);
|
|
26
|
+
float vec[3] = {0.1, 0.3, 0.2};
|
|
27
|
+
|
|
28
|
+
index.reserve(10); // Pre-allocate memory for 10 vectors
|
|
29
|
+
index.add(42, &vec[0]); // Pass a key and a vector
|
|
30
|
+
auto results = index.search(&vec[0], 5); // Pass a query and limit number of results
|
|
31
|
+
|
|
32
|
+
for (std::size_t i = 0; i != results.size(); ++i)
|
|
33
|
+
results[i].element.key, results[i].element.vector, results[i].distance;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Here we:
|
|
37
|
+
|
|
38
|
+
- define a metric of kind [`metric_kind_t::l2sq_k`](https://unum-cloud.github.io/usearch/cpp/reference.html#_CPPv413metric_kind_t),
|
|
39
|
+
- to be applied to [`scalar_kind_t::f32_k`](https://unum-cloud.github.io/usearch/cpp/reference.html#_CPPv413scalar_kind_t) floating-point vectors,
|
|
40
|
+
- instantiate an [`index_dense_t`](https://unum-cloud.github.io/usearch/cpp/reference.html#_CPPv4I00EN4unum7usearch14index_dense_gtE) index.
|
|
41
|
+
|
|
42
|
+
The `add` is thread-safe for concurrent index construction.
|
|
43
|
+
It also has an overload for different vector types, casting them under the hood.
|
|
44
|
+
The same applies to the `search`, `get`, `cluster`, and `distance_between` functions.
|
|
45
|
+
|
|
46
|
+
```cpp
|
|
47
|
+
double vec_double[3] = {0.1, 0.3, 0.2};
|
|
48
|
+
_Float16 vec_half[3] = {0.1, 0.3, 0.2};
|
|
49
|
+
index.add(43, {&vec_double[0], 3});
|
|
50
|
+
index.add(44, {&vec_half[0], 3});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Serialization
|
|
54
|
+
|
|
55
|
+
```cpp
|
|
56
|
+
index.save("index.usearch");
|
|
57
|
+
index.load("index.usearch"); // Copying from disk
|
|
58
|
+
index.view("index.usearch"); // Memory-mapping from disk
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Multi-Threading
|
|
62
|
+
|
|
63
|
+
Most AI, HPC, or Big Data packages use some form of a thread pool.
|
|
64
|
+
Instead of spawning additional threads within USearch, we focus on the thread safety of `add()` function, simplifying resource management.
|
|
65
|
+
|
|
66
|
+
```cpp
|
|
67
|
+
#pragma omp parallel for
|
|
68
|
+
for (std::size_t i = 0; i < n; ++i)
|
|
69
|
+
native.add(key, span_t{vector, dims});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
During initialization, we allocate enough temporary memory for all the cores on the machine.
|
|
73
|
+
On the call, the user can supply the identifier of the current thread, making this library easy to integrate with OpenMP and similar tools.
|
|
74
|
+
|
|
75
|
+
Moreover, you can take advantage of one of the provided "executors" to parallelize the search:
|
|
76
|
+
|
|
77
|
+
- `executor_openmp_t`, that would use OpenMP under the hood.
|
|
78
|
+
- `executor_stl_t`, that will spawn `std::thread` instances.
|
|
79
|
+
- `dummy_executor_t`, that will run everything sequentially.
|
|
80
|
+
|
|
81
|
+
## Clustering
|
|
82
|
+
|
|
83
|
+
Aside from basic Create-Read-Update-Delete (CRUD) operations and search, USearch also supports clustering.
|
|
84
|
+
Once the index is constructed, you can either:
|
|
85
|
+
|
|
86
|
+
- Identify a cluster to which any external vector belongs, once mapped onto the index.
|
|
87
|
+
- Split the entire index into a set of clusters, each with its own centroid.
|
|
88
|
+
|
|
89
|
+
For the first, the interface accepts a vector and a "clustering level", which is essentially the index of the HNSW graph layer, in which to search.
|
|
90
|
+
If you pass zero, the traversal will happen in every level except the bottom one.
|
|
91
|
+
Otherwise, the search will be limited to the specified level.
|
|
92
|
+
|
|
93
|
+
```cpp
|
|
94
|
+
some_scalar_t vector[3] = {0.1, 0.3, 0.2};
|
|
95
|
+
cluster_result_t result = index.cluster(&vector, index.max_level() / 2);
|
|
96
|
+
match_t cluster = result.cluster;
|
|
97
|
+
member_cref_t member = cluster.member;
|
|
98
|
+
distance_t distance = cluster.distance;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If you wish to split the whole structure into clusters, you must provide an iterator over a range of vectors, that will be processed in parallel using the previously described function.
|
|
102
|
+
Unlike the previous function, you don't have to manually specify the level, as the algorithm will pick the best one for you, depending on the number of clusters you want to highlight.
|
|
103
|
+
Aside from that auto-tuning, this function will regroup some of the clusters, if they are too small, and return the final number of clusters.
|
|
104
|
+
|
|
105
|
+
```cpp
|
|
106
|
+
std::size_t queries_count = queries_end - queries_begin;
|
|
107
|
+
index_dense_clustering_config_t config;
|
|
108
|
+
config.min_clusters = 1000;
|
|
109
|
+
config.max_clusters = 2000;
|
|
110
|
+
config.mode = index_dense_clustering_config_t::merge_smallest_k;
|
|
111
|
+
|
|
112
|
+
// Outputs:
|
|
113
|
+
vector_key_t cluster_centroids_keys[queries_count];
|
|
114
|
+
distance_t distances_to_cluster_centroids[queries_count];
|
|
115
|
+
executor_default_t thread_pool;
|
|
116
|
+
dummy_progress_t progress_bar;
|
|
117
|
+
|
|
118
|
+
clustering_result_t result = cluster(
|
|
119
|
+
queries_begin, queries_end,
|
|
120
|
+
config,
|
|
121
|
+
&cluster_centroids_keys, &distances_to_cluster_centroids,
|
|
122
|
+
thread_pool, progress_bar);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This approach requires basic understanding of templates meta-programming to implement the `queries_begin` and `queries_end` smart-iterators.
|
|
126
|
+
On the bright side, it allows iteratively deepening into a specific cluster.
|
|
127
|
+
|
|
128
|
+
As in many other bulk-processing APIs, the `executor` and `progress` are optional.
|
|
129
|
+
|
|
130
|
+
## User-Defined Metrics
|
|
131
|
+
|
|
132
|
+
In its high-level interface, USearch supports a variety of metrics, including the most popular ones:
|
|
133
|
+
|
|
134
|
+
- `metric_cos_gt<scalar_t>` for "Cosine" or "Angular" distance.
|
|
135
|
+
- `metric_ip_gt<scalar_t>` for "Inner Product" or "Dot Product" distance.
|
|
136
|
+
- `metric_l2sq_gt<scalar_t>` for the squared "L2" or "Euclidean" distance.
|
|
137
|
+
- `metric_jaccard_gt<scalar_t>` for "Jaccard" distance between two ordered sets of unique elements.
|
|
138
|
+
- `metric_hamming_gt<scalar_t>` for "Hamming" distance, as the number of shared bits in hashes.
|
|
139
|
+
- `metric_tanimoto_gt<scalar_t>` for "Tanimoto" coefficient for bit-strings.
|
|
140
|
+
- `metric_sorensen_gt<scalar_t>` for "Dice-Sorensen" coefficient for bit-strings.
|
|
141
|
+
- `metric_pearson_gt<scalar_t>` for "Pearson" correlation between probability distributions.
|
|
142
|
+
- `metric_haversine_gt<scalar_t>` for "Haversine" or "Great Circle" distance between coordinates used in GIS applications.
|
|
143
|
+
- `metric_divergence_gt<scalar_t>` for the "Jensen Shannon" similarity between probability distributions.
|
|
144
|
+
|
|
145
|
+
In reality, for most common types, one of the [SimSIMD](https://github.com/ashvardanian/SimSIMD) backends will be triggered, providing hardware-acceleration for most common CPUs.
|
|
146
|
+
|
|
147
|
+
If you need a different metric, you can implement it yourself and wrap it into a `metric_punned_t`, which is our alternative to the `std::function`.
|
|
148
|
+
Unlike the `std::function`, it is a trivial type, which is important for performance.
|
|
149
|
+
|
|
150
|
+
## Advanced Interface
|
|
151
|
+
|
|
152
|
+
If you are proficient in C++ and ready to get your hands dirty, you can use the low-level interface.
|
|
153
|
+
|
|
154
|
+
```cpp
|
|
155
|
+
template <typename distance_at = default_distance_t, // `float`
|
|
156
|
+
typename key_at = default_key_t, // `int64_t`, `uuid_t`
|
|
157
|
+
typename compressed_slot_at = default_slot_t, // `uint32_t`, `uint40_t`
|
|
158
|
+
typename dynamic_allocator_at = std::allocator<byte_t>, //
|
|
159
|
+
typename tape_allocator_at = dynamic_allocator_at> //
|
|
160
|
+
class index_gt;
|
|
161
|
+
```
|