usearch icon indicating copy to clipboard operation
usearch copied to clipboard

Extend test suite to int8 and uint8

Open liquidcarbon opened this issue 8 months ago • 1 comments

Fix for #595

Little something to get going.

There appears to be unused global dtypes which I've extended with np.int8 and np.uint8 and used in the first test.

Tests pass with int8 but not uint8.

Shall I modify the rest of the tests in a similar manner? (will check for nuances and fix formatting)

liquidcarbon avatar Apr 22 '25 22:04 liquidcarbon

I'll take it from here, thanks @liquidcarbon!

ashvardanian avatar Apr 22 '25 22:04 ashvardanian

Hi @liquidcarbon! The issue is coming from the constraints of Python's & NumPy's type-system. There is no separate definition for bit-packs, so I've reserved the u8 values in Python for bit arrays. So your inputs are being treated as individual bits. In SimSIMD, I've addressed it by forcing users to pass an additional dtype-like parameter (like "bin8" for 8-bit packs).

I can perform a similar change in USearch, but it will break the existing behaviour. I'll tag it accordingly and get back to it for v3. Thanks!

ashvardanian avatar May 14 '25 10:05 ashvardanian

Maybe it's a good idea to steer clear of unsigned ints altogether. image

liquidcarbon avatar May 17 '25 00:05 liquidcarbon

Hi @liquidcarbon! Thanks for all the work! I've merged it into the working draft of v3 🤗

ashvardanian avatar Sep 23 '25 10:09 ashvardanian