Skip to main content

Module reconstruct

Module reconstruct 

Source
Expand description

Rational reconstruction — turns the original engine’s worst failure mode (silent aliasing mod M) into a clean, checkable event.

Given a residue x = value mod M, recover the unique reduced p/q with |p|, |q| <= sqrt(M/2) such that p ≡ q·x (mod M). When no such fraction exists within the bound, the basis was too small: the caller extends it and retries (see crate::basis::Basis::extend_to_bits).

Functions§

balanced_lift
Balanced (symmetric) lift of x mod m into (-m/2, m/2].
rational_reconstruct
Recover the unique reduced p/q with |p|, |q| <= sqrt(M/2) and p ≡ q·x (mod M), or None if none exists within the bound.