#[repr(C, align(64))]pub struct E8LatticeCodebook {
pub table: [i8; 1024],
}Expand description
E8 Lattice Codebook of 1 KiB. Explicitly aligned to 64 bytes to guarantee residence in exactly 16 contiguous L1d cache lines.
Fields§
§table: [i8; 1024]128 centroids x 8 integer coordinates (scaled int8) = 1024 bytes
Implementations§
Source§impl E8LatticeCodebook
impl E8LatticeCodebook
Sourcepub fn new() -> Self
pub fn new() -> Self
Initializes E8P codebook with canonical E8 half-integer roots scaled by 2 (coordinates in {+1, -1}). Every 8D centroid has an even number of minus signs, satisfying E8 membership.
Sourcepub fn decode_nibble(nibble: u8) -> (f32, f32)
pub fn decode_nibble(nibble: u8) -> (f32, f32)
Decodes a 4-bit nibble [0..15] back into its 2D constituent weights (w0, w1). Invertible bijection with project_and_encode_to_nibbles. Unbiased symmetric levels in [-1.5, +1.5].
Sourcepub fn decode_4_nibbles(nibbles: &[u8; 4], scale: f32) -> [f32; 8]
pub fn decode_4_nibbles(nibbles: &[u8; 4], scale: f32) -> [f32; 8]
Decodes 4 4-bit nibbles (2 bytes) back to an 8-dimensional E8 vector.
Sourcepub fn project_and_encode_to_nibbles(x: &[f32; 8], scale: f32) -> [u8; 4]
pub fn project_and_encode_to_nibbles(x: &[f32; 8], scale: f32) -> [u8; 4]
Projects an 8D continuous vector onto the closest vector in the Conway-Sloane half-integer E8 coset (D8 + 1/2*1), then discretizes each 2D sub-vector to 1 of 16 symmetric zero-mean states (4 bits: 2 bits per coordinate). Levels per coordinate: {-1.5, -0.5, +0.5, +1.5} * scale. Strictly unbiased (mean = 0.0).