cosine-fast 0.1.0

Hot-loop cosine similarity for f32 slices. Auto-vectorized scalar core, optional precompute-norms helper. Zero deps.
Documentation
  • Coverage
  • 100%
    5 out of 5 items documented1 out of 5 items with examples
  • Size
  • Source code size: 19.16 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 261.38 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 21s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • MukundaKatta/cosine-fast
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MukundaKatta

cosine-fast

crates.io

Hot-loop cosine similarity for f32 slices. Scalar core that the compiler auto-vectorizes well; precompute_norm for cheap repeated queries.

use cosine_fast::{cosine, batch_cosine};
let a = vec![1.0f32, 2.0, 3.0];
let b = vec![2.0, 4.0, 6.0];
assert!((cosine(&a, &b) - 1.0).abs() < 1e-5);

Zero deps. MIT or Apache-2.0.