Skip to main content

decompress

Function decompress 

Source
pub fn decompress(d: u32, y: u16) -> u16
Expand description

Decompression from Z_{2^d} back to Z_q (FIPS 203 eq. 4.8).

Computes y -> round(q / 2^d * y) using integer-only arithmetic: floor((q * y + 2^{d-1}) / 2^d).

This is the approximate inverse of compress. The round-trip introduces a bounded quantization error.

§Arguments

  • d - Source bit-width (1..=12).
  • y - A compressed value in [0, 2^d - 1].

§Returns

The decompressed value in [0, q-1].