Expand description
Small, dependency-free vector maths used by embedders and stores.
Functionsยง
- cosine
- Cosine similarity in
[-1, 1]; returns 0 if either vector is zero-length. - dot
- Dot product of two equal-length slices (unchecked length; extra tail ignored).
- from_
bytes - Decode a little-endian
f32byte blob back into a vector. - norm
- Euclidean (L2) norm.
- normalize
- L2-normalize a vector in place. A zero vector is left unchanged.
- to_
bytes - Encode a vector as a little-endian
f32byte blob (for DB storage).