pub struct CompensatedCosine { /* private fields */ }Expand description
A DistanceFunction containing scaling parameters to enable distance the Cosine
distance function over vectors belonging to the same quantization space.
This distance function works by assuming input vectors were normalized prior to
compression and therefore cosine may be computed by delegating to inner product
computations. The crate::spherical::SphericalQuantizer will ensure this
pre-normalization when constructed with SupportedMetric::Cosine.
Implementations§
Source§impl CompensatedCosine
impl CompensatedCosine
Sourcepub fn new(inner: CompensatedIP) -> Self
pub fn new(inner: CompensatedIP) -> Self
Construct a new CompensatedCosine around the CompensatedIP.
Trait Implementations§
Source§impl<A> AsFunctor<CompensatedCosine> for SphericalQuantizer<A>where
A: Allocator,
impl<A> AsFunctor<CompensatedCosine> for SphericalQuantizer<A>where
A: Allocator,
fn as_functor(&self) -> CompensatedCosine
Source§impl Clone for CompensatedCosine
impl Clone for CompensatedCosine
Source§fn clone(&self) -> CompensatedCosine
fn clone(&self) -> CompensatedCosine
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 Debug for CompensatedCosine
impl Debug for CompensatedCosine
Source§impl<A, T, U> Target2<A, Result<MathematicalValue<f32>, UnequalLengths>, T, U> for CompensatedCosine
impl<A, T, U> Target2<A, Result<MathematicalValue<f32>, UnequalLengths>, T, U> for CompensatedCosine
Source§fn run(self, arch: A, x: T, y: U) -> MathematicalResult<f32>
fn run(self, arch: A, x: T, y: U) -> MathematicalResult<f32>
Run the operation with the provided
Architecture.Source§impl<A, T, U> Target2<A, Result<f32, UnequalLengths>, T, U> for CompensatedCosine
A blanket implementation for applying the transformation
impl<A, T, U> Target2<A, Result<f32, UnequalLengths>, T, U> for CompensatedCosine
A blanket implementation for applying the transformation
x -> 1-xfrom MathematicalValue to f32 for cosine distance computations.
impl Copy for CompensatedCosine
Auto Trait Implementations§
impl Freeze for CompensatedCosine
impl RefUnwindSafe for CompensatedCosine
impl Send for CompensatedCosine
impl Sync for CompensatedCosine
impl Unpin for CompensatedCosine
impl UnsafeUnpin for CompensatedCosine
impl UnwindSafe for CompensatedCosine
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more