#[non_exhaustive]pub enum TransformKind {
PaddingHadamard {
target_dim: TargetDim,
},
DoubleHadamard {
target_dim: TargetDim,
},
Null,
RandomRotation {
target_dim: TargetDim,
},
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PaddingHadamard
Use a Hadamard transform
HDx / sqrt(n)where
His an (implicit) Hadamard matrixDis a diagonal matrix with+/-1on the diagonal.xis the input vector.nis the number of rows inx.
Unlike Self::RandomRotation, this method does not require matrix-vector
multiplication and is therefore much faster for high-dimensional vectors.
The Hadamard multiplication requires dimensions to be a power of two. Internally,
this method will pad x with zeros up to the next power of two and transform the
result.
DoubleHadamard
Use a Double Hadamard transform, which applies two Hadamard transformations in sequence; first to the head of the vector and then to the tail.
This approach does not have any requirement on the input dimension to apply
the distance preserving transformation using Hadamard multiplication,
unlike PaddingHadamard.
Empirically, this approach seems to give better recall performance than
applying PaddingHadamard and sampling down when self.output_dim() == self.dim()
and the dimension is not a power of two.
See DoubleHadamard for the implementation details.
Null
A naive transform that copies source into destination.
RandomRotation
linalg only.Use a full-dimensional, randomly sampled orthogonal matrix to transform vectors.
Transformation involves matrix multiplication and may be slow for high-dimensional vectors.
Trait Implementations§
Source§impl Clone for TransformKind
impl Clone for TransformKind
Source§fn clone(&self) -> TransformKind
fn clone(&self) -> TransformKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TransformKind
impl Debug for TransformKind
impl Copy for TransformKind
Auto Trait Implementations§
impl Freeze for TransformKind
impl RefUnwindSafe for TransformKind
impl Send for TransformKind
impl Sync for TransformKind
impl Unpin for TransformKind
impl UnwindSafe for TransformKind
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
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>
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>
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