Skip to main content

dequantize_vec_with_codebook

Function dequantize_vec_with_codebook 

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

Dequantizes a PackedBlock using a pre-fetched codebook and sign pattern.

Hot-path variant: avoids repeated codebook allocation and sign-pattern generation when dequantizing many blocks with the same config (e.g. in attention score computation).

Integration: unpacks indices, looks up centroids, applies inverse rotation, and scales by the stored norm.

§Errors

Returns an error if the inverse rotation fails.