pub struct L2;Expand description
Squared Euclidean distance over Vec<f32> / [f32] points.
Returns Σᵢ (aᵢ − bᵢ)² — not the square root. For HNSW this is equivalent (monotonic in the true L² distance) and avoids a sqrt per comparison.
Panics in debug builds if input lengths differ; in release builds, trailing elements of the longer slice are ignored.
Trait Implementations§
Source§impl Metric for L2
impl Metric for L2
impl Copy for L2
Auto Trait Implementations§
impl Freeze for L2
impl RefUnwindSafe for L2
impl Send for L2
impl Sync for L2
impl Unpin for L2
impl UnsafeUnpin for L2
impl UnwindSafe for L2
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