Skip to main content

Module math

Module math 

Source
Expand description

Mathematical utilities for vector operations.

This module provides general-purpose vector math as well as the EmbeddingVector<State> typestate wrapper that encodes L2-normalization at the type level. Use EmbeddingVector::<Normalized> as the required parameter type on functions that feed vectors directly into Qdrant cosine-distance searches.

Structs§

EmbeddingVector
An embedding vector tagged with a normalization-state marker.
Normalized
Typestate marker indicating that an EmbeddingVector has been L2-normalized to unit length.
Unnormalized
Typestate marker indicating that an EmbeddingVector has not been normalized yet (raw output from a model or loaded from storage).

Functions§

cosine_similarity
Compute cosine similarity between two equal-length f32 vectors.