usearch 2.6.0 → 2.6.1
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/.github/workflows/release.yml +7 -0
- package/CITATION.cff +1 -1
- package/Cargo.toml +1 -1
- package/README.md +1 -1
- package/conanfile.py +1 -1
- package/cpp/README.md +26 -22
- package/csharp/nuget/nuget-package.props +1 -1
- package/include/usearch/index.hpp +1 -1
- package/package.json +1 -1
- package/wasmer.toml +1 -1
|
@@ -418,6 +418,13 @@ jobs:
|
|
|
418
418
|
verbose: true
|
|
419
419
|
print-hash: true
|
|
420
420
|
|
|
421
|
+
- name: Publish to Anaconda
|
|
422
|
+
run: |
|
|
423
|
+
pip install anaconda-client
|
|
424
|
+
export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_API_TOKEN }}
|
|
425
|
+
anaconda login --token $ANACONDA_API_TOKEN
|
|
426
|
+
anaconda upload -u unum-cloud ./dist/artifact/*.tar.bz2
|
|
427
|
+
|
|
421
428
|
publish_javascript:
|
|
422
429
|
name: Publish JavaScript
|
|
423
430
|
needs: versioning
|
package/CITATION.cff
CHANGED
package/Cargo.toml
CHANGED
package/README.md
CHANGED
package/conanfile.py
CHANGED
|
@@ -7,7 +7,7 @@ required_conan_version = ">=1.53.0"
|
|
|
7
7
|
class USearchConan(ConanFile):
|
|
8
8
|
|
|
9
9
|
name = "usearch"
|
|
10
|
-
version = '2.6.
|
|
10
|
+
version = '2.6.1'
|
|
11
11
|
license = "Apache-2.0"
|
|
12
12
|
description = "Smaller & Faster Single-File Vector Search Engine from Unum"
|
|
13
13
|
homepage = "https://github.com/unum-cloud/usearch"
|
package/cpp/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## Installation
|
|
4
4
|
|
|
5
|
-
To use in a C++ project
|
|
6
|
-
Alternatively fetch it with CMake:
|
|
5
|
+
To use in a C++ project, copy the `include/usearch/*` headers into your project.
|
|
6
|
+
Alternatively, fetch it with CMake:
|
|
7
7
|
|
|
8
8
|
```cmake
|
|
9
9
|
FetchContent_Declare(usearch GIT_REPOSITORY https://github.com/unum-cloud/usearch.git)
|
|
@@ -12,13 +12,17 @@ FetchContent_MakeAvailable(usearch)
|
|
|
12
12
|
|
|
13
13
|
## Quickstart
|
|
14
14
|
|
|
15
|
-
Once included, the
|
|
16
|
-
This covers 90% of use
|
|
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
17
|
|
|
18
|
-
```
|
|
18
|
+
```cpp
|
|
19
19
|
using namespace unum::usearch;
|
|
20
20
|
|
|
21
|
-
|
|
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<key_t, internal_id_t>`.
|
|
25
|
+
index_dense_t index = index_dense_t::make(metric);
|
|
22
26
|
float vec[3] = {0.1, 0.3, 0.2};
|
|
23
27
|
|
|
24
28
|
index.reserve(10);
|
|
@@ -30,10 +34,19 @@ for (std::size_t i = 0; i != results.size(); ++i)
|
|
|
30
34
|
```
|
|
31
35
|
|
|
32
36
|
The `add` is thread-safe for concurrent index construction.
|
|
37
|
+
It also has an overload for different vector types, casting them under the hood.
|
|
38
|
+
The same applies to the `search`, `get`, `cluster`, and `distance_between` functions.
|
|
39
|
+
|
|
40
|
+
```cpp
|
|
41
|
+
double vec_double[3] = {0.1, 0.3, 0.2};
|
|
42
|
+
_Float16 vec_half[3] = {0.1, 0.3, 0.2};
|
|
43
|
+
index.add(43, {&vec_double[0], 3});
|
|
44
|
+
index.add(44, {&vec_half[0], 3});
|
|
45
|
+
```
|
|
33
46
|
|
|
34
47
|
## Serialization
|
|
35
48
|
|
|
36
|
-
```
|
|
49
|
+
```cpp
|
|
37
50
|
index.save("index.usearch");
|
|
38
51
|
index.load("index.usearch"); // Copying from disk
|
|
39
52
|
index.view("index.usearch"); // Memory-mapping from disk
|
|
@@ -44,23 +57,14 @@ index.view("index.usearch"); // Memory-mapping from disk
|
|
|
44
57
|
For advanced users, more compile-time abstractions are available.
|
|
45
58
|
|
|
46
59
|
```cpp
|
|
47
|
-
template <typename
|
|
48
|
-
typename key_at =
|
|
49
|
-
typename
|
|
50
|
-
typename
|
|
51
|
-
typename
|
|
60
|
+
template <typename distance_at = default_distance_t, // `float`
|
|
61
|
+
typename key_at = default_key_t, // `int64_t`, `uuid_t`
|
|
62
|
+
typename compressed_slot_at = default_slot_t, // `uint32_t`, `uint40_t`
|
|
63
|
+
typename dynamic_allocator_at = std::allocator<byte_t>, //
|
|
64
|
+
typename tape_allocator_at = dynamic_allocator_at> //
|
|
52
65
|
class index_gt;
|
|
53
66
|
```
|
|
54
67
|
|
|
55
|
-
You may want to use a custom memory allocator or a rare scalar type, but most often, you would start by defining a custom similarity measure.
|
|
56
|
-
The function object should have the following signature to support different-length vectors.
|
|
57
|
-
|
|
58
|
-
```cpp
|
|
59
|
-
struct custom_metric_t {
|
|
60
|
-
T operator()(T const* a, T const* b, std::size_t a_length, std::size_t b_length) const;
|
|
61
|
-
};
|
|
62
|
-
```
|
|
63
|
-
|
|
64
68
|
The following distances are pre-packaged:
|
|
65
69
|
|
|
66
70
|
- `metric_cos_gt<scalar_t>` for "Cosine" or "Angular" distance.
|
|
@@ -81,7 +85,7 @@ Instead of spawning additional threads within USearch, we focus on the thread sa
|
|
|
81
85
|
```cpp
|
|
82
86
|
#pragma omp parallel for
|
|
83
87
|
for (std::size_t i = 0; i < n; ++i)
|
|
84
|
-
native.add(key, span_t{vector, dims}
|
|
88
|
+
native.add(key, span_t{vector, dims});
|
|
85
89
|
```
|
|
86
90
|
|
|
87
91
|
During initialization, we allocate enough temporary memory for all the cores on the machine.
|
package/package.json
CHANGED