Skip to main content

BitPack

Trait BitPack 

Source
pub trait BitPack {
    type Output;

    // Required method
    fn bit_pack(self, bits: u64) -> Self::Output;
}
Expand description

Packs the coefficients of a polynomial into a single number, placing the coefficient of $x^i$ at bit $ib$; that is, evaluates the polynomial at $2^b$.

When every coefficient’s absolute value is less than $2^b$, the coefficients occupy disjoint $b$-bit fields, with a borrow from the next field above each negative one; this is the representation that Kronecker substitution uses to reduce polynomial multiplication to integer multiplication. Wider coefficients overlap the fields above them, and the result is still $p(2^b)$.

Required Associated Types§

Required Methods§

Source

fn bit_pack(self, bits: u64) -> Self::Output

Packs the coefficients of a polynomial into fields of bits bits.

$$ f(p, b) = p(2^b) = \sum_i a_i2^{ib}. $$

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§