Skip to main content

dequantize_into_with_codebook

Function dequantize_into_with_codebook 

Source
pub fn dequantize_into_with_codebook(
    config: &TurboQuantConfig,
    block: &PackedBlock,
    codebook: &Codebook,
    sign_pattern: &[f32],
    scratch: &mut DequantScratch,
) -> Result<()>
Expand description

Dequantizes a PackedBlock into a caller-provided buffer, avoiding allocation on the hot path.

Uses pre-fetched codebook and sign pattern, plus caller-owned scratch buffers for indices and output. Designed for tight loops (attention score / weighted value computation).

Integration: unpacks indices, looks up centroids, applies inverse rotation, and scales by the stored norm – all into caller-provided buffers.

§Errors

Returns an error if the inverse rotation fails.