TurboQuantCodec

End-to-end TurboQuant encode/decode codec.

Wires together the full TurboQuant pipeline:

  1. Random rotation (spread quantization error)

  2. Scalar quantization (map to N-bit codes)

  3. Optional QJL residual (preserve inner-product accuracy)

  4. Bit-packing (compact storage)

Supports two variants:

  • PolarOnly: Steps 1-2-4 (fast, backend-friendly)

  • PolarPlusQjl: Steps 1-2-3-4 (higher accuracy)

Usage:

val encoded = TurboQuantCodec.encode(vector, config)
val decoded = TurboQuantCodec.decode(encoded)

Functions

Link copied to clipboard

Decode a TurboQuant block back to float values.

Link copied to clipboard

Encode a float vector using TurboQuant.

Link copied to clipboard
fun encodedSize(elementCount: Int, config: TurboQuantConfig): Int

Compute the byte size of an encoded block.