usearch 0.22.3 → 1.0.0
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/prerelease.yml +3 -3
- package/.releaserc +10 -2
- package/.vscode/launch.json +10 -10
- package/.vscode/settings.json +9 -1
- package/.vscode/tasks.json +4 -4
- package/CMakeLists.txt +6 -1
- package/Cargo.toml +2 -2
- package/README.md +35 -41
- package/build.rs +2 -2
- package/c/CMakeLists.txt +48 -0
- package/c/README.md +34 -0
- package/c/lib.cpp +83 -72
- package/c/test.c +20 -20
- package/c/usearch.h +132 -32
- package/conanfile.py +1 -1
- package/cpp/CMakeLists.txt +3 -1
- package/cpp/README.md +16 -16
- package/cpp/bench.cpp +50 -126
- package/cpp/test.cpp +164 -80
- package/docs/benchmarks.md +26 -5
- package/docs/c/reference.rst +3 -3
- package/docs/compilation.md +31 -49
- package/docs/cpp/index.rst +1 -1
- package/docs/cpp/reference.rst +4 -4
- package/golang/lib.go +275 -141
- package/golang/lib_test.go +105 -0
- package/include/usearch/index.hpp +1681 -1656
- package/include/usearch/index_dense.hpp +1400 -0
- package/include/usearch/index_plugins.hpp +1263 -0
- package/java/README.md +1 -1
- package/java/cloud/unum/usearch/Index.java +10 -10
- package/java/cloud/unum/usearch/cloud_unum_usearch_Index.cpp +34 -37
- package/java/test/IndexTest.java +1 -1
- package/javascript/README.md +6 -6
- package/javascript/lib.cpp +94 -55
- package/javascript/test.js +25 -11
- package/javascript/usearch.d.ts +87 -0
- package/javascript/usearch.js +2 -118
- package/objc/USearchObjective.mm +57 -31
- package/objc/include/USearchObjective.h +32 -22
- package/package.json +5 -3
- package/python/README.md +23 -14
- package/python/lib.cpp +468 -444
- package/python/scripts/bench.ipynb +3 -2
- package/python/scripts/bench.py +4 -4
- package/python/scripts/index_faiss.py +5 -5
- package/python/scripts/join.py +4 -4
- package/python/scripts/test.py +152 -61
- package/python/scripts/test_jit.py +10 -12
- package/python/scripts/test_sparse.py +32 -0
- package/python/usearch/client.py +26 -28
- package/python/usearch/eval.py +73 -23
- package/python/usearch/index.py +520 -228
- package/python/usearch/io.py +57 -25
- package/python/usearch/numba.py +4 -4
- package/python/usearch/server.py +10 -10
- package/rust/lib.cpp +22 -27
- package/rust/lib.hpp +11 -12
- package/rust/lib.rs +3 -3
- package/setup.py +5 -2
- package/simsimd/.github/workflows/prerelease.yml +73 -0
- package/simsimd/.github/workflows/release.yml +110 -0
- package/simsimd/.github/workflows/update_version.sh +3 -0
- package/simsimd/.releaserc +77 -0
- package/simsimd/.vscode/launch.json +27 -1
- package/simsimd/.vscode/settings.json +22 -1
- package/simsimd/.vscode/tasks.json +6 -0
- package/simsimd/CMakeLists.txt +3 -2
- package/simsimd/README.md +82 -46
- package/simsimd/bench.cxx +63 -24
- package/simsimd/include/simsimd/simsimd.h +88 -66
- package/simsimd/include/simsimd/simsimd_chem.h +126 -0
- package/simsimd/package.json +8 -0
- package/simsimd/pyproject.toml +42 -0
- package/simsimd/python/python.c +81 -0
- package/simsimd/python/run.sh +1 -0
- package/simsimd/python/test.c +109 -0
- package/simsimd/python/test.py +23 -0
- package/simsimd/setup.py +44 -0
- package/swift/Index+Sugar.swift +75 -23
- package/swift/README.md +26 -2
- package/swift/Test.swift +19 -7
- package/swift/USearch.swift +2 -2
- package/tsconfig.json +8 -0
- package/wasm/CMakeLists.txt +1 -0
- package/wasmer.toml +1 -1
- package/wolfram/CMakeLists.txt +1 -0
- package/wolfram/lib.cpp +11 -13
- package/golang/usearch.h +0 -9
- package/golang/usearch_par_test.go +0 -40
- package/golang/usearch_test.go +0 -82
- package/include/usearch/index_punned_dense.hpp +0 -1001
- package/include/usearch/index_punned_helpers.hpp +0 -676
package/golang/usearch_test.go
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
package usearch
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"runtime"
|
|
5
|
-
"testing"
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
func Assure(err error) {
|
|
9
|
-
if err != nil {
|
|
10
|
-
panic(err)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
func TestUsearch(t *testing.T) {
|
|
14
|
-
runtime.LockOSThread()
|
|
15
|
-
dim := 128
|
|
16
|
-
conf := DefaultConfig(dim)
|
|
17
|
-
ind := NewIndex(conf)
|
|
18
|
-
defer ind.Destroy()
|
|
19
|
-
if ind.VecDimension() != dim {
|
|
20
|
-
t.Fatalf("expected dimension %d, got %d", dim, ind.VecDimension())
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if ind.Connectivity() != conf.Connectivity {
|
|
24
|
-
t.Fatalf("expected connectivity %d, got %d", conf.Connectivity, ind.Connectivity())
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if ind.Capacity() != conf.InitCapacity {
|
|
28
|
-
t.Fatalf("expected initial capacity %d, got %d", conf.InitCapacity, ind.Capacity())
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if ind.Len() != 0 {
|
|
32
|
-
t.Fatalf("expected empty initial index, got %d", ind.Len())
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
vec := make([]float32, dim)
|
|
36
|
-
vec[0] = 40.0
|
|
37
|
-
vec[1] = 2.0
|
|
38
|
-
Assure(ind.Add(42, vec))
|
|
39
|
-
if ind.Len() != 1 {
|
|
40
|
-
t.Fatalf("expected index size 1, got %d", ind.Len())
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
res := ind.Search(vec, 10)
|
|
44
|
-
if len(res) != 1 {
|
|
45
|
-
t.Fatalf("expected 1 result, got %d", len(res))
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if res[0] != 42 {
|
|
49
|
-
t.Fatalf("expected result 42, got %d", res[0])
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
vec_far := make([]float32, dim)
|
|
53
|
-
Assure(ind.Add(43, vec_far))
|
|
54
|
-
vec_close := make([]float32, dim)
|
|
55
|
-
vec_close[0] = 40.0
|
|
56
|
-
vec_close[1] = 4.0
|
|
57
|
-
res = ind.Search(vec_close, 1)
|
|
58
|
-
if len(res) != 1 {
|
|
59
|
-
t.Fatalf("expected 1 result, got %d", len(res))
|
|
60
|
-
}
|
|
61
|
-
if res[0] != 42 {
|
|
62
|
-
t.Fatalf("expected closest vector label to be 42, got %d", res[0])
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
res = ind.Search(vec_close, 2)
|
|
66
|
-
if len(res) != 2 {
|
|
67
|
-
t.Fatalf("expected 2 results, got %d", len(res))
|
|
68
|
-
}
|
|
69
|
-
if !(res[0] == 42 && res[1] == 43) {
|
|
70
|
-
t.Fatalf("expected closest vector labels to be 42, 43, got %d, %d", res[0], res[1])
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
Assure(ind.Reserve(102))
|
|
74
|
-
for i := 0; i < 100; i++ {
|
|
75
|
-
vec[i] += 10
|
|
76
|
-
Assure(ind.Add(i, vec))
|
|
77
|
-
}
|
|
78
|
-
res = ind.Search(vec, 100)
|
|
79
|
-
if len(res) != 100 {
|
|
80
|
-
t.Fatalf("expected 100 results, got %d", len(res))
|
|
81
|
-
}
|
|
82
|
-
}
|