Usearch

Latest version: v2.16.6

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

Scan your dependencies

Page 19 of 27

0.20.0

[0.20.0](https://github.com/unum-cloud/usearch/compare/v0.19.3...v0.20.0) (2023-07-10)


Add

* Arbitrary predicates on search ([2fef719](https://github.com/unum-cloud/usearch/commit/2fef7194c81734c46701e0a93a1e88f4e99f6ab9))

Build

* Add overloaded constructor for `f8_bits_t` ([497faea](https://github.com/unum-cloud/usearch/commit/497faeacd965cff5d41ae5fc8c50c2ca6b62f1ee))

Fix

* `uint40_t` byte order and mem-leaks ([4c84109](https://github.com/unum-cloud/usearch/commit/4c84109f511300b1075dd8eee88afa26530213dd))
* Include last level stats ([ea8026e](https://github.com/unum-cloud/usearch/commit/ea8026e5884b8a30a034021a81566d4c4632f3ab))
* Reset memory leaks ([dc444e9](https://github.com/unum-cloud/usearch/commit/dc444e9689411574776f8f7d67438906fc2cad28))
* Unit test compilation ([b7eafaf](https://github.com/unum-cloud/usearch/commit/b7eafafa559fc5c00d9d492f952ed51d1191c66b))

Improve

* `member_ref_t` to keep IDs ([6451a2e](https://github.com/unum-cloud/usearch/commit/6451a2ebd00bc91a26781de7883ccad17ec037e4))

Make

* Build C test by GCC ([0c57311](https://github.com/unum-cloud/usearch/commit/0c57311114e00c25d94932f7ec80cc322e30eae4))
* GCC version fix ([54592f5](https://github.com/unum-cloud/usearch/commit/54592f5d48ba95666ba5e497ed57a610acaab1cb))

Refactor

* Split `connect_new_node_` in two ([3e3ba1b](https://github.com/unum-cloud/usearch/commit/3e3ba1b831495bf96d7772ddd08a0ca457afb98a))

Test

* Refactor C interface tests ([b4bcbbd](https://github.com/unum-cloud/usearch/commit/b4bcbbd33d69672ef7068b87670db688d31cc025))




Hashes
* Source code (zip) : `f79dfabcc1ead6cbfcb52c05f495547f42545c27b388dadf57b82df102cc33c3`
* Source code (tar.gz) : `23390bc38fdeeea4147149cbb2c8f05a91e9dd8ee7fb283e32c0eb1817c710f8`

0.19.3

[0.19.3](https://github.com/unum-cloud/usearch/compare/v0.19.2...v0.19.3) (2023-07-06)


Fix

* Using same label types across bindings ([ccdf18b](https://github.com/unum-cloud/usearch/commit/ccdf18b2f61ed4eca28a927271a03df5e829bb4f))




Hashes
* Source code (zip) : `b028d45afc7a286591b5a31df5b102e6ce5b262c781a58cc6b771df688809c62`
* Source code (tar.gz) : `d60c98708d08046dc1096a3a8c85a15282a7cba0e5ae9d54d5a8c5c9fe327951`

0.19.2

[0.19.2](https://github.com/unum-cloud/usearch/compare/v0.19.1...v0.19.2) (2023-07-04)


Improve

* Simpler JIT-ing interface ([903af3c](https://github.com/unum-cloud/usearch/commit/903af3cdaee682710ad0f396d69452bf905e0c47))




Hashes
* Source code (zip) : `2322c8ec38d3968bfd17e4a9abd72402b88a2dc0eaeecc100f112ebdd52eed7d`
* Source code (tar.gz) : `868e3b8c9aae6689864351ede246b8a742a022f878b25242dec106f22733c9aa`

0.19.1

[0.19.1](https://github.com/unum-cloud/usearch/compare/v0.19.0...v0.19.1) (2023-07-02)


Docs

* Updated datasets ([a00d5f2](https://github.com/unum-cloud/usearch/commit/a00d5f2a953149a8f25d5ae891285c616e4e0595))

Fix

* `reserve` for ObjC/Swift ([5e84162](https://github.com/unum-cloud/usearch/commit/5e8416289440005730043af53decfcb0b6c3b6d0))
* Avoid inadequate test configurations ([60f81ca](https://github.com/unum-cloud/usearch/commit/60f81ca14d5a346da94df7d9b068b056b480b3f7))
* Measuring exact recall ([71c1813](https://github.com/unum-cloud/usearch/commit/71c18133a713a6800df41e0fbcbf231257efc405))
* Scalar kinds and dynamic type inference ([b792f7c](https://github.com/unum-cloud/usearch/commit/b792f7c563154955a01a0a2941f74b32be288c7d))
* Using unsigned integers for `.bbin` files ([c2c44e7](https://github.com/unum-cloud/usearch/commit/c2c44e7d5e81ef99370e8455897649ed08b8b622))
* Wrap the Swift test in XCTestCase ([e38eda2](https://github.com/unum-cloud/usearch/commit/e38eda2e0b6feed7c1283cd7ccf25a78dc008f69))

Improve

* Allow `<f` short style Numpy formats ([2d4e4c9](https://github.com/unum-cloud/usearch/commit/2d4e4c9a9e699ceef7319591f4cdf0bc0c6b9e9f))
* Auto-resolve save/load/view path ([c1bbf50](https://github.com/unum-cloud/usearch/commit/c1bbf509a84005e3077f8f40043a3b00f9c34b44))
* Handling GIL and keyboard interrupt ([ca148a8](https://github.com/unum-cloud/usearch/commit/ca148a8e65a1c6ddd3b2546ef296a74dd9fcc507))
* Logging long-running `add` tasks ([f6ac472](https://github.com/unum-cloud/usearch/commit/f6ac47283efb0cc826b03a4eada089913ebfcbcc))
* User Defined Functions in C ([e5d9a27](https://github.com/unum-cloud/usearch/commit/e5d9a2774538da466d8e574bdfc81db1831d1a5a))

Make

* Disable OpenMP on MacOS ([c9c8bca](https://github.com/unum-cloud/usearch/commit/c9c8bca0b79ed3ccecc045b8619011564f93b532))
* Enable OpenMP for MacOs and format ([3bfaa6b](https://github.com/unum-cloud/usearch/commit/3bfaa6bd7b881fd5d928d0e02ca5419d79cc1a50))




Hashes
* Source code (zip) : `870ebfb5df66c7d262afded4d704735bd3781f937ecfe2eaa1a4dd04e9ab2f0d`
* Source code (tar.gz) : `fd88e0c4d373bac217d91fb63563f932ef6d025ea99f726d4fd24378ebe181f9`

0.19.0

**USearch has now been used in two internet-scale companies/projects 🎉**

In one case, it's only 1 Billion vectors. The second is closer to 10 Billion per node. So it feels like a good time to enter the [Big ANN](https://big-ann-benchmarks.com) competition track 🐎 Still, we aim for an even larger **scale** and introduce a few improvements, such as the new `CompiledMetric` interface that allows one to mix C/C++, Python, and Assembly code for different hardware architectures in the same USearch configuration file 🤯 It should come in handy, given the rise in the number of exotic AI hardware vendors 😉

SIMD and JIT

The common idea across [Unum projects](https://github.com/unum-cloud) is to use SIMD for hardware acceleration when we hit the wall.
Writing SIMD can be challenging, but distributing it may be even more difficult. You are compiling for modern hardware and modern libraries, and all of a sudden, someone deploys it on an old machine...

> illegal instruction

A good balance can be achieved by compiling the core of USearch for higher compatibility and leaving plugs for hardware-specific optimizations. That is where Just-in-Time Compilation comes in. USearch allows combining the pre-compiled HNSW structure with JIT-ed distance metrics, which would tune the resulting assembly for the current target architecture. Such functionality was already supported with Numba JIT, but now you have more flexibility to choose different backends and define functions with different signatures:

- `MetricSignature.ArrayArray`, aka `float distance(scalar *, scalar *)`.
- `MetricSignature.ArrayArraySize`, aka `float distance(scalar *, scalar *, size_t)`.
- `MetricSignature.ArraySizeArraySize`, aka `float distance(scalar *, size_t, scalar *, size_t)`.

This enum is a core part of `CompiledMetric` and is passed down to our CPython binding.

py
class CompiledMetric(NamedTuple):
pointer: int
kind: MetricKind
signature: MetricSignature


Numba JIT

Just to remind you, a minimal Numba + USearch example would look like this:

py
from numba import cfunc, types, carray

ndim = 256
signature = types.float32(
types.CPointer(types.float32),
types.CPointer(types.float32))

cfunc(signature)
def inner_product(a, b):
a_array = carray(a, ndim)
b_array = carray(b, ndim)
c = 0.0
for i in range(ndim):
c += a_array[i] * b_array[i]
return 1 - c

index = Index(ndim=ndim, metric=CompiledMetric(
pointer=inner_product.address,
kind=MetricKind.IP,
signature=MetricSignature.ArrayArray,
))


No scary C++ or Assembly involved.

Cppyy

Similarly, you can use Cppyy with Cling to JIT-compile native C or C++ code and pass it to USearch, which may be a good idea if you want to explicitly request loop-unrolling or other low-level optimizations!

py
import cppyy
import cppyy.ll

cppyy.cppdef("""
float inner_product(float *a, float *b) {
float result = 0;
pragma unroll
for (size_t i = 0; i != ndim; ++i)
result += a[i] * b[i];
return 1 - result;
}
""".replace("ndim", str(ndim)))

function = cppyy.gbl.inner_product
index = Index(ndim=ndim, metric=CompiledMetric(
pointer=cppyy.ll.addressof(function),
kind=MetricKind.IP,
signature=MetricSignature.ArrayArraySize,
))


PeachPy

Instead of writing in C or C++, you can go one level down and directly assemble a kernel for x86. Below is an example of constructing the "Inner Product" distance for 8-dimensional f32 vectors for x86 using [PeachPy](https://github.com/Maratyszcza/PeachPy).

py
from peachpy import (
Argument,
ptr,
float_,
const_float_,
)
from peachpy.x86_64 import (
abi,
Function,
uarch,
isa,
GeneralPurposeRegister64,
LOAD,
YMMRegister,
VSUBPS,
VADDPS,
VHADDPS,
VMOVUPS,
VFMADD231PS,
VPERM2F128,
VXORPS,
RETURN,
)

a = Argument(ptr(const_float_), name="a")
b = Argument(ptr(const_float_), name="b")

with Function(
"inner_product", (a, b), float_, target=uarch.default + isa.avx2
) as asm_function:

Request two 64-bit general-purpose registers for addresses
reg_a, reg_b = GeneralPurposeRegister64(), GeneralPurposeRegister64()
LOAD.ARGUMENT(reg_a, a)
LOAD.ARGUMENT(reg_b, b)

Load the vectors
ymm_a = YMMRegister()
ymm_b = YMMRegister()
VMOVUPS(ymm_a, [reg_a])
VMOVUPS(ymm_b, [reg_b])

Prepare the accumulator
ymm_c = YMMRegister()
ymm_one = YMMRegister()
VXORPS(ymm_c, ymm_c, ymm_c)
VXORPS(ymm_one, ymm_one, ymm_one)

Accumulate A and B products into C
VFMADD231PS(ymm_c, ymm_a, ymm_b)

Reduce the contents of a YMM register
ymm_c_permuted = YMMRegister()
VPERM2F128(ymm_c_permuted, ymm_c, ymm_c, 1)
VADDPS(ymm_c, ymm_c, ymm_c_permuted)
VHADDPS(ymm_c, ymm_c, ymm_c)
VHADDPS(ymm_c, ymm_c, ymm_c)

Negate the values from "similarity" to "distance"
VSUBPS(ymm_c, ymm_one, ymm_c)

A common convention is to return floats in XMM registers
RETURN(ymm_c.as_xmm)

python_function = asm_function.finalize(abi.detect()).encode().load()
metric = CompiledMetric(
pointer=python_function.loader.code_address,
kind=MetricKind.IP,
signature=MetricSignature.ArrayArray,
)
index = Index(ndim=ndim, metric=metric)


SimSIMD

Last but not the list, for the most common metrics and vector spaces, I am going to provide pre-compiled optimized CPython Capsules as part of SimSIMD. Let us know which embeddings you use the most - OpenAI, BERT, ViT, or maybe [UForm](https://github.com/unum-cloud/uform)?

Release Notes: [0.19.0](https://github.com/unum-cloud/usearch/compare/v0.18.8...v0.19.0) (2023-06-24)

Add

* NDCG evaluation ([25cb6af](https://github.com/unum-cloud/usearch/commit/25cb6aff8f905d03b361d9e54736d8c24cc14a31))
* PeachPy example ([1bf0bbb](https://github.com/unum-cloud/usearch/commit/1bf0bbb8d796c3e9d0a9b8f12cd70e3645a2cb7d))
* Restore index from disk with only a path ([b7aec4c](https://github.com/unum-cloud/usearch/commit/b7aec4c9c2f8f22d7b6422019e327f2c9b029f99))
* Windows file-mapping API ([794f173](https://github.com/unum-cloud/usearch/commit/794f17378cfeed8b8888c9ad8a7dc07d27b3f620))

Fix

* Re-indexing vectors on restart ([529c137](https://github.com/unum-cloud/usearch/commit/529c137bcf7ffa2b49dcf20ce4f95adb219277ff))

Improve

* Preserve `metric_kind_t` in snapshots ([5ec0b65](https://github.com/unum-cloud/usearch/commit/5ec0b65357d4efd96c4c1d076f13b31e03bdb9e1))
* Support Cppyy JIT compilation ([80f99cd](https://github.com/unum-cloud/usearch/commit/80f99cd13a7e5dcc3066531990d97b320746694a))
* Support signatures for JIT-ed metrics ([c89e145](https://github.com/unum-cloud/usearch/commit/c89e145bfd06c85d14c324b1a1ce1ba64e9b46ca))

Hashes

* Source code (zip): `19c2e9f41134c17ac5db20567b268ee1fce1b4d5dbb42a8b6e5a252ac9e242de`
* Source code (tar.gz): `34e5bd00639504d752f0ab5eb96e62bc34ab18537e6e31823f3e487a4d8139a3`

0.18.8

[0.18.8](https://github.com/unum-cloud/usearch/compare/v0.18.7...v0.18.8) (2023-06-17)


Fix

* Missing benchmark dependencies ([5b0d6b2](https://github.com/unum-cloud/usearch/commit/5b0d6b26927158c5a90c1dde937ce46cdbe12480))
* Missing header ([43be681](https://github.com/unum-cloud/usearch/commit/43be6814c7fc420d5c7b8dbf5618ec803a93db0a))

Improve

* Broader types support for Numba ([1631638](https://github.com/unum-cloud/usearch/commit/16316381f4a2232d26706c139cc6718d9c062db6))




Hashes
* Source code (zip) : `13495be36d302788278df0f0dc726cc1cf5708a2dbdc8b42b0e3f228e7a5ef7b`
* Source code (tar.gz) : `069072fa5ad6817f24fa1d2599dac41263c78096bccb97382d6447c733df279d`

Page 19 of 27

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.