usearch 0.22.2 → 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.
Files changed (96) hide show
  1. package/.github/workflows/prerelease.yml +3 -3
  2. package/.releaserc +9 -0
  3. package/.vscode/launch.json +15 -11
  4. package/.vscode/settings.json +12 -2
  5. package/.vscode/tasks.json +4 -4
  6. package/CMakeLists.txt +6 -1
  7. package/Cargo.toml +2 -2
  8. package/README.md +39 -46
  9. package/build.rs +2 -2
  10. package/c/CMakeLists.txt +48 -0
  11. package/c/README.md +34 -0
  12. package/c/lib.cpp +83 -72
  13. package/c/test.c +20 -20
  14. package/c/usearch.h +132 -32
  15. package/conanfile.py +1 -1
  16. package/cpp/CMakeLists.txt +3 -1
  17. package/cpp/README.md +16 -16
  18. package/cpp/bench.cpp +50 -126
  19. package/cpp/test.cpp +164 -77
  20. package/docs/benchmarks.md +26 -5
  21. package/docs/c/reference.rst +3 -3
  22. package/docs/compilation.md +49 -45
  23. package/docs/cpp/index.rst +2 -2
  24. package/docs/cpp/reference.rst +13 -3
  25. package/docs/index.rst +8 -8
  26. package/docs/java/reference.rst +1 -1
  27. package/golang/lib.go +275 -141
  28. package/golang/lib_test.go +105 -0
  29. package/include/usearch/index.hpp +1733 -1659
  30. package/include/usearch/index_dense.hpp +1400 -0
  31. package/include/usearch/index_plugins.hpp +1263 -0
  32. package/java/README.md +1 -1
  33. package/java/cloud/unum/usearch/Index.java +10 -10
  34. package/java/cloud/unum/usearch/cloud_unum_usearch_Index.cpp +34 -37
  35. package/java/test/IndexTest.java +1 -1
  36. package/javascript/README.md +7 -7
  37. package/javascript/lib.cpp +94 -55
  38. package/javascript/test.js +25 -11
  39. package/javascript/usearch.d.ts +87 -0
  40. package/javascript/usearch.js +2 -118
  41. package/objc/USearchObjective.mm +57 -31
  42. package/objc/include/USearchObjective.h +32 -22
  43. package/package.json +5 -3
  44. package/pyproject.toml +3 -3
  45. package/python/README.md +23 -14
  46. package/python/lib.cpp +472 -444
  47. package/python/scripts/bench.ipynb +3 -2
  48. package/python/scripts/bench.py +4 -4
  49. package/python/scripts/index_faiss.py +5 -5
  50. package/python/scripts/join.py +4 -4
  51. package/python/scripts/test.py +152 -61
  52. package/python/scripts/test_jit.py +10 -12
  53. package/python/scripts/test_sparse.py +32 -0
  54. package/python/usearch/client.py +26 -28
  55. package/python/usearch/eval.py +73 -23
  56. package/python/usearch/index.py +520 -228
  57. package/python/usearch/io.py +57 -25
  58. package/python/usearch/numba.py +4 -4
  59. package/python/usearch/server.py +10 -10
  60. package/rust/lib.cpp +22 -27
  61. package/rust/lib.hpp +11 -12
  62. package/rust/lib.rs +3 -3
  63. package/setup.py +5 -2
  64. package/simsimd/.github/workflows/prerelease.yml +73 -0
  65. package/simsimd/.github/workflows/release.yml +110 -0
  66. package/simsimd/.github/workflows/update_version.sh +3 -0
  67. package/simsimd/.releaserc +77 -0
  68. package/simsimd/.vscode/launch.json +27 -1
  69. package/simsimd/.vscode/settings.json +22 -1
  70. package/simsimd/.vscode/tasks.json +6 -0
  71. package/simsimd/CMakeLists.txt +3 -2
  72. package/simsimd/README.md +82 -46
  73. package/simsimd/bench.cxx +63 -24
  74. package/simsimd/include/simsimd/simsimd.h +88 -66
  75. package/simsimd/include/simsimd/simsimd_chem.h +126 -0
  76. package/simsimd/package.json +8 -0
  77. package/simsimd/pyproject.toml +42 -0
  78. package/simsimd/python/python.c +81 -0
  79. package/simsimd/python/run.sh +1 -0
  80. package/simsimd/python/test.c +109 -0
  81. package/simsimd/python/test.py +23 -0
  82. package/simsimd/setup.py +44 -0
  83. package/swift/Index+Sugar.swift +75 -23
  84. package/swift/README.md +26 -2
  85. package/swift/Test.swift +19 -7
  86. package/swift/USearch.swift +2 -2
  87. package/tsconfig.json +8 -0
  88. package/wasm/CMakeLists.txt +1 -0
  89. package/wasmer.toml +5 -1
  90. package/wolfram/CMakeLists.txt +1 -0
  91. package/wolfram/lib.cpp +11 -13
  92. package/golang/usearch.h +0 -9
  93. package/golang/usearch_par_test.go +0 -40
  94. package/golang/usearch_test.go +0 -82
  95. package/include/usearch/index_punned_dense.hpp +0 -871
  96. package/include/usearch/index_punned_helpers.hpp +0 -566
@@ -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
- }