Skip to main content

encode_turbovec

Function encode_turbovec 

Source
pub fn encode_turbovec(
    vector: &[f32],
    bits: u8,
) -> Result<EncodedVector, EncodingError>
Expand description

Encode a single f32 vector under the turbovec codec at bits bit-width.

The returned EncodedVector holds the source vector’s f32 little-endian bytes; the codec marker on the EncodedVector indicates that the table-level SIMD index owns the compressed representation. See module docs for the rationale.

§Errors

EncodingError::UnsupportedBitWidth for bits outside {2, 3, 4}; EncodingError::EmptyVector for a zero-dim input; EncodingError::UnsupportedDim when dim is not a positive multiple of 8; EncodingError::DimensionTooLarge for >65535 dimensions; EncodingError::NonFinite for any non-finite component.