pub struct StoredRotation { /* private fields */ }Expand description
Stored deterministic orthogonal rotation.
Implementations§
Source§impl StoredRotation
impl StoredRotation
Sourcepub fn new(dim: usize, seed: u64) -> Result<Self>
pub fn new(dim: usize, seed: u64) -> Result<Self>
Generate a Haar-like orthogonal matrix via QR decomposition.
Sourcepub fn rotation_schema(&self) -> &'static str
pub fn rotation_schema(&self) -> &'static str
Stable rotation schema marker.
Sourcepub fn algorithm_version(&self) -> &'static str
pub fn algorithm_version(&self) -> &'static str
Rotation algorithm identity.
Sourcepub fn digest(&self) -> Result<String>
pub fn digest(&self) -> Result<String>
Deterministic digest over the rotation identity and matrix values.
Sourcepub fn matrix_f32(&self) -> Vec<f32>
pub fn matrix_f32(&self) -> Vec<f32>
Return the rotation matrix converted to f32. Useful for callers that
need to reuse the converted matrix across many apply_inverse_f32_with_matrix
calls without reconverting each time.
Sourcepub fn apply_inverse_f32(&self, input: &[f32]) -> Result<Vec<f32>>
pub fn apply_inverse_f32(&self, input: &[f32]) -> Result<Vec<f32>>
Apply inverse x = Pi^T y in f32. Faster than the f64 version for
batch decode of many small vectors, where the f32→f64 roundtrip is
the bottleneck. Result is mathematically equivalent for the
as f32 final-cast case; intermediate precision loss is below the
codebook quantization noise floor.
Sourcepub fn apply_inverse_f32_with_matrix(
&self,
input: &[f32],
matrix_f32: &[f32],
) -> Result<Vec<f32>>
pub fn apply_inverse_f32_with_matrix( &self, input: &[f32], matrix_f32: &[f32], ) -> Result<Vec<f32>>
Apply inverse x = Pi^T y using a pre-converted f32 matrix. This
avoids the f64→f32 conversion on every call, which is the bottleneck
in decode_batch_fast when decoding thousands of codes that share
the same rotation.
Trait Implementations§
Source§impl Clone for StoredRotation
impl Clone for StoredRotation
Source§fn clone(&self) -> StoredRotation
fn clone(&self) -> StoredRotation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StoredRotation
impl Debug for StoredRotation
Source§impl<'de> Deserialize<'de> for StoredRotation
impl<'de> Deserialize<'de> for StoredRotation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for StoredRotation
impl PartialEq for StoredRotation
Source§fn eq(&self, other: &StoredRotation) -> bool
fn eq(&self, other: &StoredRotation) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for StoredRotation
impl Serialize for StoredRotation
impl StructuralPartialEq for StoredRotation
Auto Trait Implementations§
impl Freeze for StoredRotation
impl RefUnwindSafe for StoredRotation
impl Send for StoredRotation
impl Sync for StoredRotation
impl Unpin for StoredRotation
impl UnsafeUnpin for StoredRotation
impl UnwindSafe for StoredRotation
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Scalar for T
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.