pub struct MathematicalValue<T>(/* private fields */)
where
T: Copy;Expand description
The DiskANN library uses f32 values to represent similarity scores, but distance
functions can return either similarity-scores (those that are potentially transformed
so that minimization yields higher similarity) and mathematical values (those that
are computed from the mathematical definition of the operation.
Since those are currently mixed in the library with the more common use being a
similarity-score, make the MathematicalValue the type to represent no transformation
was performed.
Implementations§
Source§impl<T: Copy> MathematicalValue<T>
impl<T: Copy> MathematicalValue<T>
pub fn new(value: T) -> Self
pub fn into_inner(self) -> T
Trait Implementations§
Source§impl<T> Clone for MathematicalValue<T>
impl<T> Clone for MathematicalValue<T>
Source§fn clone(&self) -> MathematicalValue<T>
fn clone(&self) -> MathematicalValue<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for MathematicalValue<T>
impl<T> Debug for MathematicalValue<T>
Source§impl<T> PartialEq for MathematicalValue<T>
impl<T> PartialEq for MathematicalValue<T>
Source§impl<T> PartialOrd for MathematicalValue<T>where
T: Copy + PartialOrd,
impl<T> PartialOrd for MathematicalValue<T>where
T: Copy + PartialOrd,
Source§impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for Cosine
impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for Cosine
Source§impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for CosineNormalized
impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for CosineNormalized
Source§impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for FullL2
impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for FullL2
Source§impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for InnerProduct
impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for InnerProduct
Source§impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for SquaredL2
impl PureDistanceFunction<&[f16], &[f16], MathematicalValue<f32>> for SquaredL2
Source§impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for Cosine
impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for Cosine
Source§impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for CosineNormalized
impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for CosineNormalized
Source§impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for FullL2
impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for FullL2
Source§impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for InnerProduct
impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for InnerProduct
Source§impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for SquaredL2
impl<const N: usize> PureDistanceFunction<&[f16; N], &[f16; N], MathematicalValue<f32>> for SquaredL2
Source§impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for Cosine
impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for Cosine
Source§impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for CosineNormalized
impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for CosineNormalized
Source§impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for FullL2
impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for FullL2
Source§impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for InnerProduct
impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for InnerProduct
Source§impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for SquaredL2
impl PureDistanceFunction<&[f32], &[f16], MathematicalValue<f32>> for SquaredL2
Source§impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for Cosine
impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for Cosine
Source§impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for CosineNormalized
impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for CosineNormalized
Source§impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for FullL2
impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for FullL2
Source§impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for InnerProduct
impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for InnerProduct
Source§impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for SquaredL2
impl PureDistanceFunction<&[f32], &[f32], MathematicalValue<f32>> for SquaredL2
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for Cosine
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for Cosine
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for CosineNormalized
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for CosineNormalized
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for FullL2
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for FullL2
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for InnerProduct
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for InnerProduct
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for SquaredL2
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f16; N], MathematicalValue<f32>> for SquaredL2
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for Cosine
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for Cosine
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for CosineNormalized
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for CosineNormalized
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for FullL2
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for FullL2
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for InnerProduct
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for InnerProduct
Source§impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for SquaredL2
impl<const N: usize> PureDistanceFunction<&[f32; N], &[f32; N], MathematicalValue<f32>> for SquaredL2
Source§impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for Cosine
impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for Cosine
Source§impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for FullL2
impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for FullL2
Source§impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for InnerProduct
impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for InnerProduct
Source§impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for SquaredL2
impl PureDistanceFunction<&[i8], &[i8], MathematicalValue<f32>> for SquaredL2
Source§impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for Cosine
impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for Cosine
Source§impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for FullL2
impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for FullL2
Source§impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for InnerProduct
impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for InnerProduct
Source§impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for SquaredL2
impl<const N: usize> PureDistanceFunction<&[i8; N], &[i8; N], MathematicalValue<f32>> for SquaredL2
Source§impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for Cosine
impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for Cosine
Source§impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for FullL2
impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for FullL2
Source§impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for InnerProduct
impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for InnerProduct
Source§impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for SquaredL2
impl PureDistanceFunction<&[u8], &[u8], MathematicalValue<f32>> for SquaredL2
Source§impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for Cosine
impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for Cosine
Source§impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for FullL2
impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for FullL2
Source§impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for InnerProduct
impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for InnerProduct
Source§impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for SquaredL2
impl<const N: usize> PureDistanceFunction<&[u8; N], &[u8; N], MathematicalValue<f32>> for SquaredL2
impl<T> Copy for MathematicalValue<T>
impl<T> StructuralPartialEq for MathematicalValue<T>where
T: Copy,
Auto Trait Implementations§
impl<T> Freeze for MathematicalValue<T>where
T: Freeze,
impl<T> RefUnwindSafe for MathematicalValue<T>where
T: RefUnwindSafe,
impl<T> Send for MathematicalValue<T>where
T: Send,
impl<T> Sync for MathematicalValue<T>where
T: Sync,
impl<T> Unpin for MathematicalValue<T>where
T: Unpin,
impl<T> UnwindSafe for MathematicalValue<T>where
T: UnwindSafe,
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