pub struct Bit4Factors { /* private fields */ }Expand description
Per-row scalars required by the four-bit unbiased dot estimator.
Implementations§
Source§impl Bit4Factors
impl Bit4Factors
Sourcepub const fn from_persisted(
scale: f32,
normalized_norm: f32,
normalized_correction: f32,
) -> Self
pub const fn from_persisted( scale: f32, normalized_norm: f32, normalized_correction: f32, ) -> Self
Reconstructs the permanent three-f32 persisted factor record.
Sourcepub const fn persisted_fields(self) -> [f32; 3]
pub const fn persisted_fields(self) -> [f32; 3]
Returns the permanent little-endian record fields in declaration order.
Sourcepub const fn norm(self) -> f64
pub const fn norm(self) -> f64
Returns the original row’s Euclidean norm.
A finite f32 row scale and finite normalized f32 norm are expanded
in f64, so the logical norm remains usable above f32::MAX without
enlarging the three-scalar factor record.
Sourcepub const fn correction(self) -> f64
pub const fn correction(self) -> f64
Returns ||v||^2 / <y, v> for the selected grid direction.
The stored normalized correction is multiplied by the finite row scale
in f64, avoiding overflow in persisted metadata.
Sourcepub fn reconstruction_error_bound(self) -> f64
pub fn reconstruction_error_bound(self) -> f64
Returns the L2 error bound for norm-scaled code reconstruction.
Every selected grid coordinate is sign-aligned with the input, hence
the direction cosine is non-negative and the deterministic bound is
sqrt(2) ||v||. The exact grid search normally gives a tighter error;
retaining this conservative bound avoids a fourth per-row scalar.