pub enum Metric {
Cosine,
L2,
DotProduct,
}Expand description
Distance metric for vector comparison.
Variants§
Cosine
Cosine distance: 1 - dot(q,c) / (|q| * |c|).
Range [0, 2] where 0 = identical.
L2
Euclidean (L2) distance: sqrt(sum((q_i - c_i)^2)).
DotProduct
Negated dot product: -dot(q,c).
Negated so that lower = better (consistent with min-heap search).
Trait Implementations§
impl Copy for Metric
impl Eq for Metric
impl StructuralPartialEq for Metric
Auto Trait Implementations§
impl Freeze for Metric
impl RefUnwindSafe for Metric
impl Send for Metric
impl Sync for Metric
impl Unpin for Metric
impl UnsafeUnpin for Metric
impl UnwindSafe for Metric
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more