usearch 2.9.2 → 2.10.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/README.md +39 -38
- package/javascript/{types → dist/cjs}/usearch.d.ts +90 -115
- package/javascript/dist/cjs/usearch.js +531 -0
- package/javascript/dist/esm/usearch.d.ts +212 -0
- package/javascript/{usearch.js → dist/esm/usearch.js} +199 -153
- package/package.json +25 -23
- package/prebuilds/darwin-arm64+x64/usearch.node +0 -0
- package/prebuilds/linux-arm64/usearch.node +0 -0
- package/prebuilds/linux-x64/usearch.node +0 -0
- package/prebuilds/win32-ia32/usearch.node +0 -0
- package/prebuilds/win32-x64/usearch.node +0 -0
- package/.clang-format +0 -10
- package/.clang-tidy +0 -60
- package/.cmake-format.py +0 -19
- package/.dockerignore +0 -93
- package/.gitattributes +0 -9
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -90
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
- package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -64
- package/.github/workflows/Dockerfile.libs +0 -36
- package/.github/workflows/prerelease.yml +0 -331
- package/.github/workflows/release.yml +0 -722
- package/.github/workflows/update_version.sh +0 -15
- package/.gitmodules +0 -9
- package/.releaserc +0 -90
- package/CITATION.cff +0 -11
- package/CMakeLists.txt +0 -324
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -361
- package/Cargo.toml +0 -19
- package/Dockerfile +0 -16
- package/VERSION +0 -1
- package/assets/unum.png +0 -0
- package/assets/usearch-approaches-transparent.png +0 -0
- package/assets/usearch-approaches-white.png +0 -0
- package/assets/usearch-neighbor-types.png +0 -0
- package/binding.gyp +0 -87
- package/build.gradle +0 -204
- package/build.rs +0 -18
- package/c/CMakeLists.txt +0 -25
- package/c/README.md +0 -34
- package/c/lib.cpp +0 -358
- package/c/test.c +0 -382
- package/c/usearch.h +0 -311
- package/cmake/clipp.cmake +0 -7
- package/cmake/config.cmake.in +0 -15
- package/cmake/emscripten.cmake +0 -8
- package/cmake/jemalloc.cmake +0 -62
- package/cmake/pkg-config.pc.in +0 -4
- package/cmake/usearchConfigVersion.cmake.in +0 -20
- package/conanfile.py +0 -26
- package/cpp/CMakeLists.txt +0 -14
- package/cpp/README.md +0 -161
- package/cpp/bench.cpp +0 -618
- package/cpp/test.cpp +0 -323
- package/fp16/CMakeLists.txt +0 -176
- package/fp16/LICENSE +0 -11
- package/fp16/README.md +0 -20
- package/fp16/bench/alt-element.cc +0 -89
- package/fp16/bench/from-alt-array.cc +0 -175
- package/fp16/bench/from-ieee-array.cc +0 -399
- package/fp16/bench/ieee-element.cc +0 -272
- package/fp16/bench/to-alt-array.cc +0 -91
- package/fp16/bench/to-ieee-array.cc +0 -303
- package/fp16/cmake/DownloadGoogleBenchmark.cmake +0 -15
- package/fp16/cmake/DownloadGoogleTest.cmake +0 -15
- package/fp16/cmake/DownloadPSimd.cmake +0 -15
- package/fp16/configure.py +0 -65
- package/fp16/confu.yaml +0 -8
- package/fp16/include/fp16/__init__.py +0 -0
- package/fp16/include/fp16/avx.py +0 -50
- package/fp16/include/fp16/avx2.py +0 -53
- package/fp16/include/fp16/bitcasts.h +0 -92
- package/fp16/include/fp16/fp16.h +0 -451
- package/fp16/include/fp16/psimd.h +0 -131
- package/fp16/include/fp16.h +0 -11
- package/fp16/jni/Android.mk +0 -6
- package/fp16/jni/Application.mk +0 -4
- package/fp16/test/alt-from-fp32-value.cc +0 -498
- package/fp16/test/alt-to-fp32-bits.cc +0 -263
- package/fp16/test/alt-to-fp32-psimd.cc +0 -145
- package/fp16/test/alt-to-fp32-value.cc +0 -348
- package/fp16/test/alt-to-fp32x2-psimd.cc +0 -245
- package/fp16/test/bitcasts.cc +0 -56
- package/fp16/test/ieee-from-fp32-value.cc +0 -523
- package/fp16/test/ieee-to-fp32-bits.cc +0 -333
- package/fp16/test/ieee-to-fp32-psimd.cc +0 -312
- package/fp16/test/ieee-to-fp32-value.cc +0 -420
- package/fp16/test/ieee-to-fp32x2-psimd.cc +0 -541
- package/fp16/test/peachpy/alt-xmm-to-fp32-xmm-avx.cc +0 -96
- package/fp16/test/peachpy/alt-xmm-to-fp32-ymm-avx2.cc +0 -96
- package/fp16/test/peachpy/stubs.py +0 -38
- package/fp16/test/tables.cc +0 -530
- package/fp16/test/tables.h +0 -13
- package/fp16/third-party/THHalf.h +0 -92
- package/fp16/third-party/eigen-half.h +0 -170
- package/fp16/third-party/float16-compressor.h +0 -80
- package/fp16/third-party/half.hpp +0 -2916
- package/fp16/third-party/npy-halffloat.h +0 -328
- package/include/usearch/index.hpp +0 -3836
- package/include/usearch/index_dense.hpp +0 -2004
- package/include/usearch/index_plugins.hpp +0 -2213
- package/javascript/lib.cpp +0 -341
- package/javascript/types/usearch.d.ts.map +0 -1
- package/javascript/usearch.test.js +0 -74
- package/package-ci.json +0 -10
- package/pyproject.toml +0 -51
- package/setup.py +0 -201
- package/simsimd/.releaserc +0 -86
- package/simsimd/CONTRIBUTING.md +0 -88
- package/simsimd/Cargo.lock +0 -709
- package/simsimd/Cargo.toml +0 -44
- package/simsimd/LICENSE +0 -201
- package/simsimd/README.md +0 -317
- package/simsimd/binding.gyp +0 -36
- package/simsimd/build.rs +0 -20
- package/simsimd/include/simsimd/binary.h +0 -245
- package/simsimd/include/simsimd/complex.h +0 -174
- package/simsimd/include/simsimd/probability.h +0 -548
- package/simsimd/include/simsimd/simsimd.h +0 -465
- package/simsimd/include/simsimd/spatial.h +0 -1267
- package/simsimd/include/simsimd/types.h +0 -208
- package/simsimd/javascript/bench.js +0 -127
- package/simsimd/javascript/fallback.ts +0 -193
- package/simsimd/javascript/lib.c +0 -102
- package/simsimd/javascript/node-gyp-build.d.ts +0 -1
- package/simsimd/javascript/simsimd.ts +0 -124
- package/simsimd/javascript/test.mjs +0 -153
- package/simsimd/javascript/tsconfig-base.json +0 -25
- package/simsimd/javascript/tsconfig-cjs.json +0 -8
- package/simsimd/javascript/tsconfig-esm.json +0 -8
- package/simsimd/package-lock.json +0 -1688
- package/simsimd/package.json +0 -61
- package/simsimd/rust/benches/cosine.rs +0 -27
- package/simsimd/rust/benches/native.rs +0 -30
- package/simsimd/rust/benches/sqeuclidean.rs +0 -27
- package/simsimd/rust/lib.c +0 -45
- package/simsimd/rust/lib.rs +0 -550
- package/sqlite/README.md +0 -178
- package/sqlite/lib.cpp +0 -325
- package/stringzilla/CONTRIBUTING.md +0 -446
- package/stringzilla/Cargo.lock +0 -25
- package/stringzilla/Cargo.toml +0 -26
- package/stringzilla/LICENSE +0 -201
- package/stringzilla/README.md +0 -1422
- package/stringzilla/VERSION +0 -1
- package/stringzilla/assets/cover-strinzilla.jpeg +0 -0
- package/stringzilla/assets/meme-stringzilla-v2.jpeg +0 -0
- package/stringzilla/assets/meme-stringzilla-v3.jpeg +0 -0
- package/stringzilla/binding.gyp +0 -16
- package/stringzilla/build.rs +0 -87
- package/stringzilla/c/lib.c +0 -337
- package/stringzilla/cli/README.md +0 -65
- package/stringzilla/cli/__init__.py +0 -0
- package/stringzilla/cli/split.py +0 -105
- package/stringzilla/cli/wc.py +0 -117
- package/stringzilla/include/stringzilla/experimental.h +0 -845
- package/stringzilla/include/stringzilla/module.modulemap +0 -9
- package/stringzilla/include/stringzilla/stringzilla.h +0 -5370
- package/stringzilla/include/stringzilla/stringzilla.hpp +0 -3838
- package/stringzilla/javascript/lib.c +0 -125
- package/stringzilla/javascript/stringzilla.js +0 -22
- package/stringzilla/package-ci.json +0 -10
- package/stringzilla/package.json +0 -32
- package/stringzilla/rust/lib.rs +0 -873
- package/stringzilla/swift/StringProtocol+StringZilla.swift +0 -280
- package/stringzilla/swift/Test.swift +0 -60
- package/tsconfig.json +0 -21
- package/wasmer.toml +0 -12
- package/winlibinstaller.bat +0 -42
- /package/{simsimd/javascript/dist-package-cjs.json → javascript/dist/cjs/package.json} +0 -0
- /package/{simsimd/javascript/dist-package-esm.json → javascript/dist/esm/package.json} +0 -0
package/simsimd/package.json
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "simsimd",
|
|
3
|
-
"version": "3.9.0",
|
|
4
|
-
"description": "Fastest SIMD-Accelerated Vector Similarity Functions for x86 and Arm",
|
|
5
|
-
"homepage": "https://github.com/ashvardanian/simsimd",
|
|
6
|
-
"author": "Ash Vardanian",
|
|
7
|
-
"license": "Apache 2.0",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"vector",
|
|
10
|
-
"distance",
|
|
11
|
-
"similarity",
|
|
12
|
-
"search",
|
|
13
|
-
"ai",
|
|
14
|
-
"math",
|
|
15
|
-
"avx2",
|
|
16
|
-
"avx512",
|
|
17
|
-
"neon",
|
|
18
|
-
"sve",
|
|
19
|
-
"arm",
|
|
20
|
-
"x86",
|
|
21
|
-
"simd",
|
|
22
|
-
"f16"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"install": "node-gyp-build",
|
|
26
|
-
"prebuild-single": "prebuildify --napi --strip --target=10.4.0",
|
|
27
|
-
"prebuild-arm64": "prebuildify --arch arm64 --napi --strip --target=10.4.0",
|
|
28
|
-
"prebuild-darwin-x64+arm64": "prebuildify --arch arm64+x64 --napi --strip --target=10.4.0",
|
|
29
|
-
"build-js": "rm -fr javascript/dist/* && tsc -p javascript/tsconfig-esm.json && tsc -p javascript/tsconfig-cjs.json && cp javascript/dist-package-esm.json javascript/dist/esm/package.json && cp javascript/dist-package-cjs.json javascript/dist/cjs/package.json",
|
|
30
|
-
"test": "node --test ./javascript/test.mjs",
|
|
31
|
-
"bench": "node ./javascript/bench.js"
|
|
32
|
-
},
|
|
33
|
-
"main": "javascript/dist/cjs/simsimd.js",
|
|
34
|
-
"module": "javascript/dist/esm/simsimd.js",
|
|
35
|
-
"exports": {
|
|
36
|
-
".": {
|
|
37
|
-
"import": "./javascript/dist/esm/simsimd.js",
|
|
38
|
-
"require": "./javascript/dist/cjs/simsimd.js"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"engines": {
|
|
42
|
-
"node": "~10 >=10.20 || >=12.17"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@types/node": "^20.10.7",
|
|
46
|
-
"bindings": "^1.5.0",
|
|
47
|
-
"node-addon-api": "^3.2.1",
|
|
48
|
-
"node-gyp-build": "^4.8.0"
|
|
49
|
-
},
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@types/bindings": "^1.5.5",
|
|
52
|
-
"node-gyp": "^10.0.1",
|
|
53
|
-
"prebuildify": "^6.0.0",
|
|
54
|
-
"typescript": "^5.3.3"
|
|
55
|
-
},
|
|
56
|
-
"optionalDependencies": {
|
|
57
|
-
"benchmark": "^2.1.4",
|
|
58
|
-
"mathjs": "^11.11.2",
|
|
59
|
-
"usearch": "^2.8.15"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
|
2
|
-
use simsimd::SimSIMD;
|
|
3
|
-
|
|
4
|
-
mod native;
|
|
5
|
-
|
|
6
|
-
const DIMENSIONS: usize = 1536;
|
|
7
|
-
|
|
8
|
-
pub fn cosine_benchmark(c: &mut Criterion) {
|
|
9
|
-
let inputs: (Vec<f32>, Vec<f32>) = (
|
|
10
|
-
native::generate_random_vector(DIMENSIONS),
|
|
11
|
-
native::generate_random_vector(DIMENSIONS),
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
let mut group = c.benchmark_group("SIMD Cosine");
|
|
15
|
-
|
|
16
|
-
for i in 0..=5 {
|
|
17
|
-
group.bench_with_input(BenchmarkId::new("SimSIMD", i), &i, |b, _| {
|
|
18
|
-
b.iter(|| SimSIMD::cosine(&inputs.0, &inputs.1))
|
|
19
|
-
});
|
|
20
|
-
group.bench_with_input(BenchmarkId::new("Rust Native", i), &i, |b, _| {
|
|
21
|
-
b.iter(|| native::cosine_similarity_cpu(&inputs.0, &inputs.1))
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
criterion_group!(benches, cosine_benchmark);
|
|
27
|
-
criterion_main!(benches);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
#![allow(unused)]
|
|
2
|
-
use rand::Rng;
|
|
3
|
-
|
|
4
|
-
pub(crate) fn generate_random_vector(dim: usize) -> Vec<f32> {
|
|
5
|
-
(0..dim).map(|_| rand::thread_rng().gen()).collect()
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
pub(crate) fn cosine_similarity_cpu(a: &[f32], b: &[f32]) -> Option<f32> {
|
|
9
|
-
if a.len() != b.len() {
|
|
10
|
-
return None;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let (dot_product, norm_a, norm_b) = a
|
|
14
|
-
.iter()
|
|
15
|
-
.zip(b)
|
|
16
|
-
.map(|(a, b)| (a * b, a * a, b * b))
|
|
17
|
-
.fold((0.0, 0.0, 0.0), |acc, x| {
|
|
18
|
-
(acc.0 + x.0, acc.1 + x.1, acc.2 + x.2)
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
Some(1.0 - (dot_product / (norm_a.sqrt() * norm_b.sqrt())))
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
pub(crate) fn squared_euclidean_cpu(a: &[f32], b: &[f32]) -> Option<f32> {
|
|
25
|
-
if a.len() != b.len() {
|
|
26
|
-
return None;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
Some(a.iter().zip(b).map(|(x, y)| (x - y).powi(2)).sum())
|
|
30
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
|
2
|
-
use simsimd::SimSIMD;
|
|
3
|
-
|
|
4
|
-
mod native;
|
|
5
|
-
|
|
6
|
-
const DIMENSIONS: usize = 1536;
|
|
7
|
-
|
|
8
|
-
pub fn sqeuclidean_benchmark(c: &mut Criterion) {
|
|
9
|
-
let inputs: (Vec<f32>, Vec<f32>) = (
|
|
10
|
-
native::generate_random_vector(DIMENSIONS),
|
|
11
|
-
native::generate_random_vector(DIMENSIONS),
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
let mut group = c.benchmark_group("SIMD SqEuclidean");
|
|
15
|
-
|
|
16
|
-
for i in 0..=5 {
|
|
17
|
-
group.bench_with_input(BenchmarkId::new("SimSIMD", i), &i, |b, _| {
|
|
18
|
-
b.iter(|| SimSIMD::sqeuclidean(&inputs.0, &inputs.1))
|
|
19
|
-
});
|
|
20
|
-
group.bench_with_input(BenchmarkId::new("Rust Native", i), &i, |b, _| {
|
|
21
|
-
b.iter(|| native::squared_euclidean_cpu(&inputs.0, &inputs.1))
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
criterion_group!(benches, sqeuclidean_benchmark);
|
|
27
|
-
criterion_main!(benches);
|
package/simsimd/rust/lib.c
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
#include <simsimd/simsimd.h>
|
|
2
|
-
|
|
3
|
-
simsimd_capability_t cached_capabilities(void) {
|
|
4
|
-
static simsimd_capability_t static_capabilities = 0;
|
|
5
|
-
if (static_capabilities == 0)
|
|
6
|
-
static_capabilities = simsimd_capabilities();
|
|
7
|
-
return static_capabilities;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
#define SIMSIMD_METRIC_DECLARATION(name, type) \
|
|
11
|
-
simsimd_f32_t name##_##type(simsimd_##type##_t const* a, simsimd_##type##_t const* b, simsimd_size_t d) { \
|
|
12
|
-
static simsimd_metric_punned_t metric = 0; \
|
|
13
|
-
if (metric == 0) { \
|
|
14
|
-
simsimd_capability_t used_capability; \
|
|
15
|
-
simsimd_find_metric_punned(simsimd_metric_##name##_k, simsimd_datatype_##type##_k, cached_capabilities(), \
|
|
16
|
-
simsimd_cap_any_k, &metric, &used_capability); \
|
|
17
|
-
} \
|
|
18
|
-
return metric(a, b, d, d); \
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Spatial distances
|
|
22
|
-
SIMSIMD_METRIC_DECLARATION(cosine, i8)
|
|
23
|
-
SIMSIMD_METRIC_DECLARATION(cosine, f16)
|
|
24
|
-
SIMSIMD_METRIC_DECLARATION(cosine, f32)
|
|
25
|
-
SIMSIMD_METRIC_DECLARATION(cosine, f64)
|
|
26
|
-
SIMSIMD_METRIC_DECLARATION(inner, i8)
|
|
27
|
-
SIMSIMD_METRIC_DECLARATION(inner, f16)
|
|
28
|
-
SIMSIMD_METRIC_DECLARATION(inner, f32)
|
|
29
|
-
SIMSIMD_METRIC_DECLARATION(inner, f64)
|
|
30
|
-
SIMSIMD_METRIC_DECLARATION(sqeuclidean, i8)
|
|
31
|
-
SIMSIMD_METRIC_DECLARATION(sqeuclidean, f16)
|
|
32
|
-
SIMSIMD_METRIC_DECLARATION(sqeuclidean, f32)
|
|
33
|
-
SIMSIMD_METRIC_DECLARATION(sqeuclidean, f64)
|
|
34
|
-
|
|
35
|
-
// Binary distances
|
|
36
|
-
SIMSIMD_METRIC_DECLARATION(hamming, b8)
|
|
37
|
-
SIMSIMD_METRIC_DECLARATION(jaccard, b8)
|
|
38
|
-
|
|
39
|
-
// Probability distributions
|
|
40
|
-
SIMSIMD_METRIC_DECLARATION(kl, f16)
|
|
41
|
-
SIMSIMD_METRIC_DECLARATION(kl, f32)
|
|
42
|
-
SIMSIMD_METRIC_DECLARATION(kl, f64)
|
|
43
|
-
SIMSIMD_METRIC_DECLARATION(js, f16)
|
|
44
|
-
SIMSIMD_METRIC_DECLARATION(js, f32)
|
|
45
|
-
SIMSIMD_METRIC_DECLARATION(js, f64)
|