usearch 2.3.0 → 2.3.2
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 +2 -1
- package/.releaserc +6 -2
- package/CITATION.cff +1 -1
- package/Cargo.toml +1 -1
- package/README.md +1 -1
- package/conanfile.py +1 -1
- package/csharp/nuget/nuget-package.props +1 -1
- package/include/usearch/index.hpp +5 -5
- package/include/usearch/index_dense.hpp +6 -2
- package/include/usearch/index_plugins.hpp +9 -1
- package/package.json +1 -1
- package/python/lib.cpp +2 -2
- package/rust/README.md +17 -18
- package/swift/README.md +11 -7
- package/wasmer.toml +1 -1
|
@@ -219,7 +219,7 @@ jobs:
|
|
|
219
219
|
publish_hashes:
|
|
220
220
|
name: Add hashes to release notes
|
|
221
221
|
runs-on: ubuntu-latest
|
|
222
|
-
needs: [versioning, create_linux_deb_package, create_windows_dll_library, create_macos_library]
|
|
222
|
+
needs: [versioning, create_linux_deb_package, create_windows_dll_library, create_macos_library, deploy_docs_pages]
|
|
223
223
|
steps:
|
|
224
224
|
- name: Get last release ID
|
|
225
225
|
id: last_release
|
|
@@ -266,6 +266,7 @@ jobs:
|
|
|
266
266
|
* ${{ steps.hashes.outputs.asset_name_6 }} : `${{ steps.hashes.outputs.asset_hash_6 }}`
|
|
267
267
|
* ${{ steps.hashes.outputs.asset_name_7 }} : `${{ steps.hashes.outputs.asset_hash_7 }}`
|
|
268
268
|
* ${{ steps.hashes.outputs.asset_name_8 }} : `${{ steps.hashes.outputs.asset_hash_8 }}`
|
|
269
|
+
* ${{ steps.hashes.outputs.asset_name_9 }} : `${{ steps.hashes.outputs.asset_hash_9 }}`
|
|
269
270
|
|
|
270
271
|
|
|
271
272
|
build_wheels:
|
package/.releaserc
CHANGED
|
@@ -77,10 +77,14 @@
|
|
|
77
77
|
"conanfile.py",
|
|
78
78
|
"package.json",
|
|
79
79
|
"Cargo.toml",
|
|
80
|
-
"wasmer.toml"
|
|
80
|
+
"wasmer.toml",
|
|
81
|
+
"./include/usearch/index.hpp",
|
|
82
|
+
"README.md",
|
|
83
|
+
"./csharp/nuget/nuget-package.props",
|
|
84
|
+
"CITATION.cff"
|
|
81
85
|
],
|
|
82
86
|
"message": "Build: Released ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
|
83
87
|
}
|
|
84
88
|
]
|
|
85
89
|
]
|
|
86
|
-
}
|
|
90
|
+
}
|
package/CITATION.cff
CHANGED
package/Cargo.toml
CHANGED
package/README.md
CHANGED
package/conanfile.py
CHANGED
|
@@ -4,7 +4,7 @@ from conans import ConanFile
|
|
|
4
4
|
class USearchConan(ConanFile):
|
|
5
5
|
|
|
6
6
|
name = 'USearch'
|
|
7
|
-
version = '2.3.
|
|
7
|
+
version = '2.3.2'
|
|
8
8
|
license = 'Apache 2.0'
|
|
9
9
|
url = 'https://github.com/unum-cloud/usearch'
|
|
10
10
|
description = 'Smaller & Faster Single-File Vector Search Engine from Unum'
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
#ifndef UNUM_USEARCH_HPP
|
|
10
10
|
#define UNUM_USEARCH_HPP
|
|
11
11
|
|
|
12
|
-
#define USEARCH_VERSION_MAJOR
|
|
13
|
-
#define USEARCH_VERSION_MINOR
|
|
14
|
-
#define USEARCH_VERSION_PATCH
|
|
12
|
+
#define USEARCH_VERSION_MAJOR 2
|
|
13
|
+
#define USEARCH_VERSION_MINOR 3
|
|
14
|
+
#define USEARCH_VERSION_PATCH 2
|
|
15
15
|
|
|
16
16
|
// Inferring C++ version
|
|
17
17
|
// https://stackoverflow.com/a/61552074
|
|
@@ -1362,7 +1362,7 @@ class output_file_t {
|
|
|
1362
1362
|
serialization_result_t result;
|
|
1363
1363
|
std::size_t written = std::fwrite(begin, length, 1, file_);
|
|
1364
1364
|
if (!written)
|
|
1365
|
-
result.failed(std::strerror(errno));
|
|
1365
|
+
return result.failed(std::strerror(errno));
|
|
1366
1366
|
return result;
|
|
1367
1367
|
}
|
|
1368
1368
|
void close() noexcept {
|
|
@@ -1404,7 +1404,7 @@ class input_file_t {
|
|
|
1404
1404
|
serialization_result_t result;
|
|
1405
1405
|
std::size_t read = std::fread(begin, length, 1, file_);
|
|
1406
1406
|
if (!read)
|
|
1407
|
-
result.failed(std::feof(file_) ? "End of file reached!" : std::strerror(errno));
|
|
1407
|
+
return result.failed(std::feof(file_) ? "End of file reached!" : std::strerror(errno));
|
|
1408
1408
|
return result;
|
|
1409
1409
|
}
|
|
1410
1410
|
void close() noexcept {
|
|
@@ -1041,8 +1041,10 @@ class index_dense_gt {
|
|
|
1041
1041
|
},
|
|
1042
1042
|
config, std::forward<progress_at>(progress));
|
|
1043
1043
|
|
|
1044
|
-
if (!stream_result)
|
|
1044
|
+
if (!stream_result) {
|
|
1045
|
+
io_result.error.release();
|
|
1045
1046
|
return stream_result;
|
|
1047
|
+
}
|
|
1046
1048
|
return io_result;
|
|
1047
1049
|
}
|
|
1048
1050
|
|
|
@@ -1093,8 +1095,10 @@ class index_dense_gt {
|
|
|
1093
1095
|
},
|
|
1094
1096
|
config, std::forward<progress_at>(progress));
|
|
1095
1097
|
|
|
1096
|
-
if (!stream_result)
|
|
1098
|
+
if (!stream_result) {
|
|
1099
|
+
io_result.error.release();
|
|
1097
1100
|
return stream_result;
|
|
1101
|
+
}
|
|
1098
1102
|
return io_result;
|
|
1099
1103
|
}
|
|
1100
1104
|
|
|
@@ -41,7 +41,15 @@
|
|
|
41
41
|
#endif
|
|
42
42
|
|
|
43
43
|
#if USEARCH_USE_SIMSIMD
|
|
44
|
-
#if
|
|
44
|
+
#if defined(USEARCH_DEFINED_LINUX)
|
|
45
|
+
#define SIMSIMD_TARGET_X86_AVX2 1
|
|
46
|
+
#define SIMSIMD_TARGET_X86_AVX512 1
|
|
47
|
+
#define SIMSIMD_TARGET_ARM_NEON 1
|
|
48
|
+
#define SIMSIMD_TARGET_ARM_SVE 1
|
|
49
|
+
#include <simsimd/simsimd.h>
|
|
50
|
+
#elif defined(USEARCH_DEFINED_APPLE)
|
|
51
|
+
#define SIMSIMD_TARGET_X86_AVX2 1
|
|
52
|
+
#define SIMSIMD_TARGET_ARM_NEON 1
|
|
45
53
|
#include <simsimd/simsimd.h>
|
|
46
54
|
#endif
|
|
47
55
|
#endif
|
package/package.json
CHANGED
package/python/lib.cpp
CHANGED
|
@@ -1021,8 +1021,8 @@ PYBIND11_MODULE(compiled, m) {
|
|
|
1021
1021
|
|
|
1022
1022
|
m.def(
|
|
1023
1023
|
"hardware_acceleration",
|
|
1024
|
-
[](scalar_kind_t scalar_kind, std::size_t dimensions, metric_kind_t metric_kind) ->
|
|
1025
|
-
return metric_t(dimensions, metric_kind, scalar_kind).isa_kind()
|
|
1024
|
+
[](scalar_kind_t scalar_kind, std::size_t dimensions, metric_kind_t metric_kind) -> py::str {
|
|
1025
|
+
return isa_name(metric_t(dimensions, metric_kind, scalar_kind).isa_kind());
|
|
1026
1026
|
},
|
|
1027
1027
|
py::kw_only(), //
|
|
1028
1028
|
py::arg("dtype") = scalar_kind_t::f32_k, //
|
package/rust/README.md
CHANGED
|
@@ -6,18 +6,20 @@
|
|
|
6
6
|
cargo add usearch
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
You can find [interface documentation on docs.rs](https://docs.rs/usearch/2.3.0/usearch/ffi/struct.Index.html).
|
|
10
|
+
|
|
9
11
|
## Quickstart
|
|
10
12
|
|
|
11
13
|
```rust
|
|
12
14
|
|
|
13
15
|
let options = IndexOptions {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
dimensions: 3,
|
|
17
|
+
metric: MetricKind::IP,
|
|
18
|
+
quantization: ScalarKind::F16,
|
|
19
|
+
connectivity: 0,
|
|
20
|
+
expansion_add: 0,
|
|
21
|
+
expansion_search: 0
|
|
22
|
+
};
|
|
21
23
|
|
|
22
24
|
let index = new_index(&options).unwrap();
|
|
23
25
|
|
|
@@ -39,17 +41,6 @@ let results = index.search(&first, 10).unwrap();
|
|
|
39
41
|
assert_eq!(results.keys.len(), 2);
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
## Multi-Threading
|
|
43
|
-
|
|
44
|
-
```rust
|
|
45
|
-
assert!(index.add_in_thread(42, &first, 0).is_ok());
|
|
46
|
-
assert!(index.add_in_thread(43, &second, 0).is_ok());
|
|
47
|
-
let results = index.search_in_thread(&first, 10, 0).unwrap();
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Being a systems-programming language, Rust has better control over memory management and concurrency but lacks function overloading.
|
|
51
|
-
Aside from the `add` and `search`, USearch Rust binding also provides `add_in_thread` and `search_in_thread`, which let users identify the calling thread to use underlying temporary memory more efficiently.
|
|
52
|
-
|
|
53
44
|
## Serialization
|
|
54
45
|
|
|
55
46
|
```rust
|
|
@@ -58,6 +49,14 @@ assert!(index.load("index.usearch").is_ok());
|
|
|
58
49
|
assert!(index.view("index.usearch").is_ok());
|
|
59
50
|
```
|
|
60
51
|
|
|
52
|
+
Similarly, serializing to/from buffers is supported.
|
|
53
|
+
|
|
54
|
+
```rust
|
|
55
|
+
assert!(index.save_to_buffer(&mut serialization_buffer).is_ok());
|
|
56
|
+
assert!(index.load_from_buffer(&serialization_buffer).is_ok());
|
|
57
|
+
assert!(index.view_from_buffer(&serialization_buffer).is_ok());
|
|
58
|
+
```
|
|
59
|
+
|
|
61
60
|
## Metrics
|
|
62
61
|
|
|
63
62
|
```rust
|
package/swift/README.md
CHANGED
|
@@ -9,13 +9,13 @@ https://github.com/unum-cloud/usearch
|
|
|
9
9
|
## Quickstart
|
|
10
10
|
|
|
11
11
|
```swift
|
|
12
|
-
let index =
|
|
13
|
-
let vectorA: [Float32] = [0.3, 0.5, 1.2]
|
|
14
|
-
let vectorB: [Float32] = [0.4, 0.2, 1.2]
|
|
15
|
-
index.add(key: 42, vector: vectorA
|
|
16
|
-
index.add(key: 43, vector: vectorB
|
|
12
|
+
let index = USearchIndex.make(metric: .Cos, dimensions: 3, connectivity: 8)
|
|
13
|
+
let vectorA: [Float32] = [0.3, 0.5, 1.2] // `Float32` and `Float64` are always supported
|
|
14
|
+
let vectorB: [Float32] = [0.4, 0.2, 1.2] // `Float16` supports on the OS & hardware version
|
|
15
|
+
index.add(key: 42, vector: vectorA) // Pass full arrays or slices
|
|
16
|
+
index.add(key: 43, vector: vectorB)
|
|
17
17
|
|
|
18
|
-
let results = index.search(vector: vectorA
|
|
18
|
+
let results = index.search(vector: vectorA, count: 10)
|
|
19
19
|
assert(results.0[0] == 42)
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -32,7 +32,7 @@ struct USearchMobileApp: App {
|
|
|
32
32
|
let index = USearchIndex.make(metric: .IP, dimensions: 2, connectivity: 16, quantization: .F32)
|
|
33
33
|
let _ = index.reserve(10)
|
|
34
34
|
let coordiantes: Array<Float32> = [40.177200, 44.503490]
|
|
35
|
-
let _ = index.add(key: 10, vector: coordiantes
|
|
35
|
+
let _ = index.add(key: 10, vector: coordiantes)
|
|
36
36
|
VStack {
|
|
37
37
|
Text("USearch index contains \(index.length) vectors")
|
|
38
38
|
Spacer()
|
|
@@ -42,3 +42,7 @@ struct USearchMobileApp: App {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
|
+
|
|
46
|
+
You can find a working example of using USearch with SwiftUI maps at [ashvardanian/SwiftVectorSearch](https://github.com/ashvardanian/SwiftVectorSearch).
|
|
47
|
+
|
|
48
|
+
[](https://github.com/ashvardanian/SwiftVectorSearch)
|