Usearch

Latest version: v2.16.6

Safety actively analyzes 688178 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 25 of 27

0.9.1

[0.9.1](https://github.com/unum-cloud/usearch/compare/v0.9.0...v0.9.1) (2023-05-25)


Fix

* GitHub CI version ([a8721af](https://github.com/unum-cloud/usearch/commit/a8721afa6099fbb1862d7c213c7377e425bb0ab4))

0.9

let weighted_distance = Box::new(move |a: *const f32, b: *const f32| unsafe {
let a_slice = std::slice::from_raw_parts(a, image_dimensions + text_dimensions);
let b_slice = std::slice::from_raw_parts(b, image_dimensions + text_dimensions);

let image_similarity = f32::cosine(a_slice[0..image_dimensions], b_slice[0..image_dimensions]);
let text_similarity = f32::cosine(a_slice[image_dimensions..], b_slice[image_dimensions..]);
let similarity = image_weights * image_similarity + text_weights * text_similarity / (image_weights + text_weights);

1.0 - similarity
});
index.change_metric(weighted_distance);


Broader Type System for Rust

USearch supports the Rust-native `f32` and `f64` scalar types, as well as the `i8` for quantized 8-bit scalars. Going beyond that, USearch supports non-native `f16` and `b1x8` for half-precision floating point and binary vectors, respectively.

Half Precision Floating Point

Rust has no native support for half-precision floating-point numbers, but USearch provides a `f16` type. It has no advanced functionality - it is a transparent wrapper around `i16` and can be used with `half` or any other half-precision library. Assuming USearch uses the IEEE 754 no conversion is needed, you can `unsafe`-cast the outputs of other IEEE-compliant libraries to `usearch::f16`.

rust
use usearch::f16 as USearchF16;
use half::f16 as HalfF16;

let vector_a: Vec<HalfF16> = ...
let vector_b: Vec<HalfF16> = ...

let buffer_a: &[USearchF16] = unsafe { std::slice::from_raw_parts(a_half.as_ptr() as *const SimF16, a_half.len()) };
let buffer_b: &[USearchF16] = unsafe { std::slice::from_raw_parts(b_half.as_ptr() as *const SimF16, b_half.len()) };

index.add(42, buffer_a);
index.add(43, buffer_b);


Binary Vectors

USearch also implement binary distance functions and natively supports bit-vectors. If you initialize the index with `quantization: ScalarKind::B1`, you can add floating-point vectors and they will be quantized mapping positive values to `1` and negative and zero values to `0`. Alternatively, you can use the `b1x8` type to represent packed binary vectors directly.

rs
let index = Index::new(&IndexOptions {
dimensions: 8,
metric: MetricKind::Hamming,
quantization: ScalarKind::B1,
..Default::default()
})
.unwrap();

// Binary vectors represented as `b1x8` slices
let vector42: Vec<b1x8> = vec![b1x8(0b00001111)];
let vector43: Vec<b1x8> = vec![b1x8(0b11110000)];
let query: Vec<b1x8> = vec![b1x8(0b01111000)];

// Adding binary vectors to the index
index.reserve(10).unwrap();
index.add(42, &vector42).unwrap();
index.add(43, &vector43).unwrap();

let results = index.search(&query, 5).unwrap();

// Validate the search results based on Hamming distance
assert_eq!(results.keys.len(), 2);
assert_eq!(results.keys[0], 43);
assert_eq!(results.distances[0], 2.0); // 2 bits differ between query and vector43
assert_eq!(results.keys[1], 42);
assert_eq!(results.distances[1], 6.0); // 6 bits differ between query and vector42


Metadata

Both C and Rust now provide:

- `memory_usage` API, that reports the number of bytes consumed.
- `hardware_acceleration` API that reports the codename for used SIMD extensions.

Changelog [2.11.0](https://github.com/unum-cloud/usearch/compare/v2.10.5...v2.11.0) (2024-04-08)

* `b1x8` for Rust ([540fc75](https://github.com/unum-cloud/usearch/commit/540fc75d682c209172170b75cafc879bcfcbdc58))
* `filtered_search` API in C & C++ ([5bb38aa](https://github.com/unum-cloud/usearch/commit/5bb38aacfba28ac270dc6d7e032ed89da772ff4e))
* `filtered_search` in Rust ([e1b24e1](https://github.com/unum-cloud/usearch/commit/e1b24e1950f25119471f037c90a5685e544897e0))
* Hyper-param configs in C ([c7ed1d4](https://github.com/unum-cloud/usearch/commit/c7ed1d4f6e1cabbe80b6f016863ae9bd9c311260))
* Metadata extraction in C ([2c698cd](https://github.com/unum-cloud/usearch/commit/2c698cd187c5dda1a313966bd71a77231bf1e3bf))
* Guides for Rust and C ([fe05ad8](https://github.com/unum-cloud/usearch/commit/fe05ad8516ebf6c0388c2cd14f5583e28f41a0ba))
* `-Wdeprecated-this-capture` (387) ([a233e20](https://github.com/unum-cloud/usearch/commit/a233e2084af903cb300c93c4d52f6dc2cdf9553b)), closes [#387](https://github.com/unum-cloud/usearch/issues/387)
* Explicit capture ([208e383](https://github.com/unum-cloud/usearch/commit/208e383c12b06fae783c7a15290c4f6100fb3718))
* Filter the entry point in the 0 layer ([4ff568b](https://github.com/unum-cloud/usearch/commit/4ff568b2322e1fc0ae20151a63d616f5f966007d))
* JS imports & Doxygen (384) ([7356158](https://github.com/unum-cloud/usearch/commit/7356158d62e2a290cc1edba55912895f0658adf9)), closes [#384](https://github.com/unum-cloud/usearch/issues/384)
* More adequate default Rust params ([c4f9e65](https://github.com/unum-cloud/usearch/commit/c4f9e6559b4037add0bd8de589de67f24003a303))
* `metric_punned_t` static methods ([220ef57](https://github.com/unum-cloud/usearch/commit/220ef572e6c42f6fa0e5cc6f144a8c2669949673))
* Configure Rust compilation options ([32c9f3b](https://github.com/unum-cloud/usearch/commit/32c9f3b12c516884685eaa451b4fc23a93e4e325)), closes [#378](https://github.com/unum-cloud/usearch/issues/378)
* Include sources in Crates ([0d414e4](https://github.com/unum-cloud/usearch/commit/0d414e46e6be0a816e30ec2cc9c4bd435d014da7))

0.9.0

[0.9.0](https://github.com/unum-cloud/usearch/compare/v0.8.1...v0.9.0) (2023-05-25)


Add

* Dockerfile automated builds ([fbc48f0](https://github.com/unum-cloud/usearch/commit/fbc48f05b8e8e3e934f46ea1332f0d6915230804))

Make

* Export container to both Docker and GitHub ([07bc3c6](https://github.com/unum-cloud/usearch/commit/07bc3c6802bf6d46828d101791a3078fdc5712d7))

Refactor

* Name of the Maven group ([5651517](https://github.com/unum-cloud/usearch/commit/5651517d7d670f50b3b5bde5b37c3736835259ee))

0.8.1

[0.8.1](https://github.com/unum-cloud/usearch/compare/v0.8.0...v0.8.1) (2023-05-25)


Fix

* PyTest path ([3368e92](https://github.com/unum-cloud/usearch/commit/3368e92df2716ece895ffc0d353c936dab9b6b7a))

Refactor

* Numba JIT benchmarks for `f8` ([a218780](https://github.com/unum-cloud/usearch/commit/a218780c31eeebc833fb82d2bdafc6b49ff56d5e))

0.8.0

[0.8.0](https://github.com/unum-cloud/usearch/compare/v0.7.0...v0.8.0) (2023-05-25)


Add

* `stats()` gathering interface ([ce0080e](https://github.com/unum-cloud/usearch/commit/ce0080eb9a7ebfec15d7ba3bff5ed7802acfa697))
* New tests and parameter tuning benchmarks ([c110a68](https://github.com/unum-cloud/usearch/commit/c110a68e9431a7045f44dd4f2a3ee3ecba39bc3c))

Fix

* Safe misaligned data access ([1996614](https://github.com/unum-cloud/usearch/commit/199661457d35ba874f702a51b08613ca1ed446a9))
* UB, wrong length passed ([56936e9](https://github.com/unum-cloud/usearch/commit/56936e9804f127ec9489123de8b14575f80b4942))

Make

* Default Python to NEON on Arm, AVX2 on x86 ([7a25a89](https://github.com/unum-cloud/usearch/commit/7a25a894811d2f36c97f9f40b3f6c2e77415ac37))
* Produce test builds ([d7d1095](https://github.com/unum-cloud/usearch/commit/d7d109529dcc264145f1354472761cddbac9a391))
* Un-nest binary output path ([4e9658e](https://github.com/unum-cloud/usearch/commit/4e9658e59a23d05d1b2d2bc98bfd518b20e79555))
* Updated Python package layout ([eb91f86](https://github.com/unum-cloud/usearch/commit/eb91f86b84f79f5938b3c1cde70e0b8148613fd0))

Refactor

* Clean pre-release ([1b18637](https://github.com/unum-cloud/usearch/commit/1b18637f1d7bf245f1e72adc6f1be0fc11ff363e))
* Expose `config()` reference ([d7de510](https://github.com/unum-cloud/usearch/commit/d7de5106575200415b66b4a9754af659773b26e4))
* Using a single atomic bitset ([10044d8](https://github.com/unum-cloud/usearch/commit/10044d8510670c6d4748925ec06d490bae6df4d1))

0.7

Page 25 of 27

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.