usearch 2.8.7 → 2.8.9
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/CITATION.cff +1 -1
- package/CMakeLists.txt +3 -3
- package/CONTRIBUTING.md +26 -3
- package/Cargo.toml +1 -1
- package/Dockerfile +16 -0
- package/README.md +41 -38
- package/VERSION +1 -0
- package/binding.gyp +57 -8
- package/conanfile.py +1 -1
- package/include/usearch/index.hpp +1 -1
- package/include/usearch/index_plugins.hpp +28 -24
- package/javascript/README.md +64 -12
- package/javascript/lib.cpp +11 -3
- package/javascript/usearch.js +4 -2
- package/javascript/usearch.test.js +15 -0
- package/package.json +1 -2
- package/setup.py +76 -15
- package/simsimd/README.md +14 -13
- package/simsimd/include/simsimd/probability.h +2 -2
- package/simsimd/package.json +1 -1
- package/wasmer.toml +1 -1
- package/. npmignore +0 -14
- package/.gitignore +0 -95
- package/.vscode/launch.json +0 -181
- package/.vscode/settings.json +0 -180
- package/.vscode/tasks.json +0 -71
- package/Package.swift +0 -41
- package/csharp/.editorconfig +0 -361
- package/csharp/Cloud.Unum.USearch.sln +0 -34
- package/csharp/DEV_SETUP.md +0 -51
- package/csharp/Directory.Build.props +0 -29
- package/csharp/README.md +0 -74
- package/csharp/build_and_test.cmd +0 -31
- package/csharp/build_and_test.sh +0 -30
- package/csharp/nuget/nuget-package.props +0 -33
- package/csharp/pack.sh +0 -56
- package/csharp/src/Cloud.Unum.USearch.Tests/Cloud.Unum.USearch.Tests.csproj +0 -39
- package/csharp/src/Cloud.Unum.USearch.Tests/USearchIndexTests.cs +0 -1013
- package/csharp/src/Cloud.Unum.USearch.Tests/Usings.cs +0 -1
- package/docs/_static/custom.css +0 -26
- package/docs/_static/custom.js +0 -7
- package/docs/benchmarks.md +0 -245
- package/docs/benchmarks.rst +0 -5
- package/docs/c/index.rst +0 -11
- package/docs/c/reference.rst +0 -7
- package/docs/conf.dox +0 -2668
- package/docs/conf.py +0 -53
- package/docs/contributing.rst +0 -5
- package/docs/cpp/index.rst +0 -11
- package/docs/cpp/reference.rst +0 -17
- package/docs/csharp/index.rst +0 -6
- package/docs/format.md +0 -86
- package/docs/format.rst +0 -5
- package/docs/golang/index.rst +0 -6
- package/docs/index.rst +0 -33
- package/docs/java/index.rst +0 -11
- package/docs/java/reference.rst +0 -7
- package/docs/javascript/index.rst +0 -11
- package/docs/javascript/reference.rst +0 -12
- package/docs/python/index.rst +0 -11
- package/docs/python/reference.rst +0 -42
- package/docs/rust/index.rst +0 -6
- package/docs/swift/index.rst +0 -6
- package/docs/wolfram/index.rst +0 -6
- package/golang/README.md +0 -95
- package/golang/go.mod +0 -3
- package/golang/lib.go +0 -379
- package/golang/lib_test.go +0 -108
- package/java/README.md +0 -22
- package/java/cloud/unum/usearch/Index.java +0 -337
- package/java/cloud/unum/usearch/cloud_unum_usearch_Index.cpp +0 -197
- package/java/cloud/unum/usearch/cloud_unum_usearch_Index.h +0 -125
- package/java/test/IndexTest.java +0 -30
- package/objc/USearchObjective.mm +0 -299
- package/objc/include/USearchObjective.h +0 -154
- package/python/README.md +0 -292
- package/python/lib.cpp +0 -1216
- package/python/scripts/bench.ipynb +0 -193
- package/python/scripts/bench.py +0 -137
- package/python/scripts/bench_exact.py +0 -44
- package/python/scripts/cluster.ipynb +0 -160
- package/python/scripts/index_faiss.py +0 -100
- package/python/scripts/join.py +0 -155
- package/python/scripts/test_index.py +0 -247
- package/python/scripts/test_jit.py +0 -231
- package/python/scripts/test_sparse.py +0 -32
- package/python/scripts/test_tooling.py +0 -133
- package/python/usearch/__init__.py +0 -0
- package/python/usearch/client.py +0 -124
- package/python/usearch/eval.py +0 -470
- package/python/usearch/index.py +0 -1401
- package/python/usearch/io.py +0 -113
- package/python/usearch/numba.py +0 -121
- package/python/usearch/server.py +0 -137
- package/rust/README.md +0 -66
- package/rust/lib.cpp +0 -136
- package/rust/lib.hpp +0 -69
- package/rust/lib.rs +0 -610
- package/simsimd/CMakeLists.txt +0 -67
- package/simsimd/cpp/bench.cxx +0 -206
- package/simsimd/package-ci.json +0 -10
- package/simsimd/setup.py +0 -86
- package/swift/Index+Sugar.swift +0 -153
- package/swift/README.md +0 -48
- package/swift/Test.swift +0 -37
- package/swift/USearch.swift +0 -8
- package/wasm/CMakeLists.txt +0 -7
- package/wasm/README.md +0 -13
- package/wasm/lib.cpp +0 -5
- package/wolfram/CMakeLists.txt +0 -18
- package/wolfram/README.md +0 -13
- package/wolfram/lib.cpp +0 -160
- package/wolfram/test.wls +0 -27
package/docs/conf.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Configuration file for the Sphinx documentation builder.
|
|
2
|
-
#
|
|
3
|
-
# For the full list of built-in configuration values, see the documentation:
|
|
4
|
-
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
5
|
-
|
|
6
|
-
# -- Project information -----------------------------------------------------
|
|
7
|
-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
8
|
-
|
|
9
|
-
project = "Unum · USearch"
|
|
10
|
-
copyright = "2023, Unum"
|
|
11
|
-
author = "Unum"
|
|
12
|
-
release = open("../VERSION", "r").read().strip()
|
|
13
|
-
with open("_static/custom.js", "r+") as js:
|
|
14
|
-
content = js.read()
|
|
15
|
-
js.seek(0)
|
|
16
|
-
js.truncate()
|
|
17
|
-
js.write(content.replace("$(VERSION)", release))
|
|
18
|
-
|
|
19
|
-
# -- General configuration ---------------------------------------------------
|
|
20
|
-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
21
|
-
|
|
22
|
-
extensions = [
|
|
23
|
-
"breathe",
|
|
24
|
-
"m2r2",
|
|
25
|
-
"sphinx.ext.autodoc",
|
|
26
|
-
"sphinx_js",
|
|
27
|
-
"sphinx.ext.autosummary",
|
|
28
|
-
"sphinx.ext.intersphinx",
|
|
29
|
-
"sphinx.ext.napoleon",
|
|
30
|
-
"sphinxcontrib.jquery",
|
|
31
|
-
"sphinxcontrib.googleanalytics",
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "*.md"]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
googleanalytics_id = "341385789"
|
|
38
|
-
googleanalytics_enabled = True
|
|
39
|
-
|
|
40
|
-
# -- Options for HTML output -------------------------------------------------
|
|
41
|
-
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
42
|
-
|
|
43
|
-
html_logo = "../assets/unum.png"
|
|
44
|
-
html_theme = "furo"
|
|
45
|
-
html_static_path = ["_static"]
|
|
46
|
-
html_css_files = ["custom.css"]
|
|
47
|
-
html_js_files = ["custom.js"]
|
|
48
|
-
html_baseurl = "/docs/usearch/"
|
|
49
|
-
|
|
50
|
-
breathe_projects = {"USearch": "../build/xml"}
|
|
51
|
-
breathe_default_project = "USearch"
|
|
52
|
-
|
|
53
|
-
js_source_path = "../javascript/usearch.js"
|
package/docs/contributing.rst
DELETED
package/docs/cpp/index.rst
DELETED
package/docs/cpp/reference.rst
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
API Reference
|
|
2
|
-
===============
|
|
3
|
-
|
|
4
|
-
=================================
|
|
5
|
-
usearch/index.hpp
|
|
6
|
-
=================================
|
|
7
|
-
.. doxygenfile:: index.hpp
|
|
8
|
-
|
|
9
|
-
=================================
|
|
10
|
-
usearch/index_plugins.hpp
|
|
11
|
-
=================================
|
|
12
|
-
.. doxygenfile:: index_plugins.hpp
|
|
13
|
-
|
|
14
|
-
=================================
|
|
15
|
-
usearch/index_dense.hpp
|
|
16
|
-
=================================
|
|
17
|
-
.. doxygenfile:: index_dense.hpp
|
package/docs/csharp/index.rst
DELETED
package/docs/format.md
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# USearch File Format Specification
|
|
2
|
-
|
|
3
|
-
> ⚠️ __Important Note__: The file format is slated for updates in the upcoming 3.0 release. These changes aim to support sparse indexes and enhance startup performance when loading large indexes from disk using the `view` command.
|
|
4
|
-
|
|
5
|
-
## Upcoming Version: v3
|
|
6
|
-
|
|
7
|
-
The v3 file format is designed for compatibility with Apache Arrow arrays and consists of an array of variable-length binary strings. The structure for a file with `N` entries is as follows:
|
|
8
|
-
|
|
9
|
-
### File Structure
|
|
10
|
-
|
|
11
|
-
1. __File Header__: Metadata and other essential information.
|
|
12
|
-
2. __Offset Array__: An array of `N+1` eight-byte unsigned integers (`uint64_t`).
|
|
13
|
-
- The entry at index `0 <= i < N` indicates the byte-level offset of the `i-th` vector in the file.
|
|
14
|
-
- The entry at index `N` specifies the total length of the binary file.
|
|
15
|
-
3. __Data Chunks__: `N` binary data chunks, each starting with the vector itself, followed by index system data.
|
|
16
|
-
|
|
17
|
-
### Data Retrieval
|
|
18
|
-
|
|
19
|
-
To retrieve the Binary Large Object (BLOB) corresponding to a specific vector, subtract the consecutive offsets indicated in the Offset Array.
|
|
20
|
-
|
|
21
|
-
### Advantages of the v3 Format
|
|
22
|
-
|
|
23
|
-
The v3 format offers several benefits, making it more future-proof:
|
|
24
|
-
|
|
25
|
-
- __Flexibility__: Easily accommodates variable-length strings.
|
|
26
|
-
- __Performance__: Co-locates vectors with proximity graph entries for optimized data access.
|
|
27
|
-
- __Compatibility__: Simplifies memory-mapping and casting to an Apache Arrow array of vectors or strings.
|
|
28
|
-
- __Extensibility__: Enables external storage systems to reuse the underlying `index_gt` more extensively, particularly in database systems.
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Current: v2
|
|
33
|
-
|
|
34
|
-
### Dense Indexes
|
|
35
|
-
|
|
36
|
-
Dense index files consist of two main parts: [a binary matrix of all vectors](#matrix-blob) and the [index](#index-blob) itself.
|
|
37
|
-
|
|
38
|
-
#### Matrix BLOB
|
|
39
|
-
|
|
40
|
-
The matrix BLOB is optionally prepended to the index file. It starts with the number of `rows` and `columns`, which can be either 32-bit or 64-bit unsigned integers.
|
|
41
|
-
|
|
42
|
-
- The number of `rows` corresponds to the number of vectors in the index.
|
|
43
|
-
- The number of `columns` corresponds to the number of bytes in a single vector.
|
|
44
|
-
|
|
45
|
-
#### Index BLOB
|
|
46
|
-
|
|
47
|
-
The index BLOB is composed of three main sections:
|
|
48
|
-
|
|
49
|
-
1. __Metadata__: Occupies 64 bytes and contains the following fields:
|
|
50
|
-
1. 7-byte magic string `usearch` to infer the MIME type of the file.
|
|
51
|
-
2. 3-byte version number, containing the `major`, `minor`, and `patch` release numbers.
|
|
52
|
-
3. 1-byte enums for `metric`, `scalar`, `key`, and `compressed_slot` types.
|
|
53
|
-
4. 8-byte integers for the number of present vectors, number of deleted vectors, and number of dimensions.
|
|
54
|
-
5. 1-byte flags for multi-vector support.
|
|
55
|
-
|
|
56
|
-
2. __Levels__: Contains 1-byte integers representing the level each node occupies. This information is used to estimate memory requirements and to enable memory-mapping of the entire file.
|
|
57
|
-
|
|
58
|
-
3. __Core__: Detailed in the [Core section](#core). This format is consistent across all types of indexes.
|
|
59
|
-
|
|
60
|
-
### Fragmented Storage
|
|
61
|
-
|
|
62
|
-
The matrix BLOB can be stored separately and is not required to successfully open the file.
|
|
63
|
-
|
|
64
|
-
### Core
|
|
65
|
-
|
|
66
|
-
The core section of the index is serialized as a sequence of nodes, each representing a point in the index. This section immediately follows the `levels` block in the serialized format.
|
|
67
|
-
|
|
68
|
-
#### Header
|
|
69
|
-
|
|
70
|
-
The core section begins with a header containing the following fields:
|
|
71
|
-
|
|
72
|
-
- `uint64_t size`: Number of nodes in the index.
|
|
73
|
-
- `uint64_t connectivity`: Maximum number of edges for a node.
|
|
74
|
-
- `uint64_t connectivity_base`: Base connectivity value.
|
|
75
|
-
- `uint64_t max_level`: Maximum level in the multi-level graph.
|
|
76
|
-
- `uint64_t entry_slot`: Entry slot for the graph.
|
|
77
|
-
|
|
78
|
-
These fields are serialized in a contiguous block of bytes, in the order listed.
|
|
79
|
-
|
|
80
|
-
#### Levels
|
|
81
|
-
|
|
82
|
-
Following the header, the `levels` block contains a sequence of 1-byte integers. Each integer represents the level of a node in the index. The number of levels is equal to the `size` field in the header.
|
|
83
|
-
|
|
84
|
-
#### Nodes
|
|
85
|
-
|
|
86
|
-
After the `levels` block, the nodes are serialized. Each node is represented as a contiguous block of bytes. The size and format of these blocks are implementation-specific. Nodes are serialized in the same order as their corresponding levels in the `levels` block.
|
package/docs/format.rst
DELETED
package/docs/golang/index.rst
DELETED
package/docs/index.rst
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
==========
|
|
2
|
-
Overview
|
|
3
|
-
==========
|
|
4
|
-
.. mdinclude:: ../README.md
|
|
5
|
-
|
|
6
|
-
.. toctree::
|
|
7
|
-
:hidden:
|
|
8
|
-
:caption: �
|
|
9
|
-
|
|
10
|
-
cpp/index
|
|
11
|
-
python/index
|
|
12
|
-
rust/index
|
|
13
|
-
javascript/index
|
|
14
|
-
java/index
|
|
15
|
-
c/index
|
|
16
|
-
swift/index
|
|
17
|
-
csharp/index
|
|
18
|
-
golang/index
|
|
19
|
-
wolfram/index
|
|
20
|
-
|
|
21
|
-
.. toctree::
|
|
22
|
-
:hidden:
|
|
23
|
-
:caption: �
|
|
24
|
-
|
|
25
|
-
contributing
|
|
26
|
-
benchmarks
|
|
27
|
-
format
|
|
28
|
-
|
|
29
|
-
.. toctree::
|
|
30
|
-
:hidden:
|
|
31
|
-
:caption: �
|
|
32
|
-
|
|
33
|
-
genindex
|
package/docs/java/index.rst
DELETED
package/docs/java/reference.rst
DELETED
package/docs/python/index.rst
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
API Reference
|
|
2
|
-
===============
|
|
3
|
-
|
|
4
|
-
======
|
|
5
|
-
Index
|
|
6
|
-
======
|
|
7
|
-
|
|
8
|
-
.. automodule:: usearch.index
|
|
9
|
-
:members:
|
|
10
|
-
:undoc-members:
|
|
11
|
-
|
|
12
|
-
======
|
|
13
|
-
IO
|
|
14
|
-
======
|
|
15
|
-
|
|
16
|
-
.. automodule:: usearch.io
|
|
17
|
-
:members:
|
|
18
|
-
:undoc-members:
|
|
19
|
-
|
|
20
|
-
==========
|
|
21
|
-
Evaluation
|
|
22
|
-
==========
|
|
23
|
-
|
|
24
|
-
.. automodule:: usearch.eval
|
|
25
|
-
:members:
|
|
26
|
-
:undoc-members:
|
|
27
|
-
|
|
28
|
-
======
|
|
29
|
-
Client
|
|
30
|
-
======
|
|
31
|
-
|
|
32
|
-
.. automodule:: usearch.client
|
|
33
|
-
:members:
|
|
34
|
-
:undoc-members:
|
|
35
|
-
|
|
36
|
-
======
|
|
37
|
-
Server
|
|
38
|
-
======
|
|
39
|
-
|
|
40
|
-
.. automodule:: usearch.server
|
|
41
|
-
:members:
|
|
42
|
-
:undoc-members:
|
package/docs/rust/index.rst
DELETED
package/docs/swift/index.rst
DELETED
package/docs/wolfram/index.rst
DELETED
package/golang/README.md
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# USearch for GoLang
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
|
|
5
|
-
### Linux
|
|
6
|
-
|
|
7
|
-
Download and install from the Debian package from the latest release.
|
|
8
|
-
Substitute `<release_tag>`, `<arch>`, and `<usearch_version>` with your settings.
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
wget https://github.com/unum-cloud/usearch/releases/download/<release_tag>/usearch_linux_<arch>_<usearch_version>.deb
|
|
12
|
-
dpkg -i usearch_<arch>_<usearch_version>.deb
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### Windows
|
|
16
|
-
|
|
17
|
-
Run a `winlibinstaller.bat` script from the main repository in the folder where you will run `go run`.
|
|
18
|
-
That will install the USearch library and include in the same folder` where the script was run.
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
.\usearch\winlibinstaller.bat
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### MacOS
|
|
25
|
-
|
|
26
|
-
Download and unpack a zip archive from the latest release.
|
|
27
|
-
Move the USearch library and the include file to their respective folders.
|
|
28
|
-
|
|
29
|
-
```sh
|
|
30
|
-
wget https://github.com/unum-cloud/usearch/releases/download/<release_tag>/usearch_macOS_<arch>_<usearch_version>.zip
|
|
31
|
-
unzip usearch_macOS_<arch>_<usearch_version>.zip
|
|
32
|
-
sudo mv libusearch_c.so /usr/local/lib && sudo mv usearch.h /usr/local/include
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Quickstart
|
|
36
|
-
|
|
37
|
-
1. Create a `go.mod` file:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
module usearch_example
|
|
41
|
-
|
|
42
|
-
go <go_version>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
2. Create an `example.go`:
|
|
46
|
-
|
|
47
|
-
```golang
|
|
48
|
-
package main
|
|
49
|
-
|
|
50
|
-
import (
|
|
51
|
-
"fmt"
|
|
52
|
-
usearch "github.com/unum-cloud/usearch/golang"
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
func main() {
|
|
56
|
-
|
|
57
|
-
// Create Index
|
|
58
|
-
vector_size := 3
|
|
59
|
-
vectors_count := 100
|
|
60
|
-
conf := usearch.DefaultConfig(uint(vector_size))
|
|
61
|
-
index,err := usearch.NewIndex(conf)
|
|
62
|
-
if err != nil {
|
|
63
|
-
panic("Failed to create Index")
|
|
64
|
-
}
|
|
65
|
-
defer index.Destroy()
|
|
66
|
-
|
|
67
|
-
// Add to Index
|
|
68
|
-
err = index.Reserve(uint(vectors_count))
|
|
69
|
-
for i := 0; i < vectors_count; i++ {
|
|
70
|
-
err = index.Add(usearch.Key(i), []float32{float32(i), float32(i+1), float32(i+2)})
|
|
71
|
-
if err != nil {
|
|
72
|
-
panic("Failed to add")
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Search
|
|
77
|
-
keys, distances, err := index.Search([]float32{0.0, 1.0, 2.0}, 3)
|
|
78
|
-
if err != nil {
|
|
79
|
-
panic("Failed to search")
|
|
80
|
-
}
|
|
81
|
-
fmt.Println(keys, distances)
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
3. Get USearch:
|
|
86
|
-
|
|
87
|
-
```sh
|
|
88
|
-
go get github.com/unum-cloud/usearch/golang
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
4. Run:
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
go run example.go
|
|
95
|
-
```
|
package/golang/go.mod
DELETED