pub fn quantize_vec_with_codebook(
config: &TurboQuantConfig,
data: &[f32],
codebook: &Codebook,
sign_pattern: &[f32],
) -> Result<PackedBlock>Expand description
Quantizes a floating-point vector into a packed PackedBlock using
pre-fetched codebook and sign pattern.
Hot-path variant of quantize_vec: avoids repeated codebook allocation
and sign-pattern generation when quantizing many vectors with the same
config (e.g. in batch KV-cache insertion during prefill).
Integration: orchestrates check_values_match, l2_norm,
normalize_inplace, rotate, quantize_coordinates, select_scale,
and PackedBlock::new – all using caller-provided codebook and sign
pattern.
§Errors
Returns [TurboQuantError::DimensionMismatch] if data.len() != config.dim.