vecstasy
Minimal and fast Rust library for high-dimensional vector arithmetic.
Features
-
VecLiketrait defining:l2_dist_squared(squared Euclidean distance)dot(inner product)normalized(unit‑length copy)
-
Always-on SIMD‑backed implementation for
&[f32]slices via Rust’s unstable portable SIMD APIs -
HashVecwrapper: stable hashing & equality by IEEE‑754 bit patterns
Installation
Add to your Cargo.toml:
[]
= "0.1"
or cargo add vecstasy
Usage
Core trait (VecLike)
use VecLike;
let a: & = &; // length must be multiple of SIMD_LANECOUNT
let b: & = &;
let dist2 = a.l2_dist_squared;
let dot = a.dot;
let normed: = a.normalized;
Stable hashing (HashVec)
use HashVec;
use DefaultHasher;
use ;
let data: & = &;
let hv = from;
let mut hasher = new;
hv.hash;
let hash_value = hasher.finish;
Requirements
- Nightly Rust with the
portable_simdfeature enabled
Documentation
API docs are available on docs.rs.
License
MIT. See LICENSE for details.