Skip to main content

ModSquareTruncated

Trait ModSquareTruncated 

Source
pub trait ModSquareTruncated<M = Self> {
    type Output;

    // Required method
    fn mod_square_truncated(self, len: u64, m: M) -> Self::Output;
}
Expand description

Squares a polynomial modulo $m$, keeping only the coefficients of $x^i$ for $i$ less than a given length. The coefficients must already be reduced modulo $m$.

With $n$ equal to len, this is squaring in the ring of polynomials with coefficients modulo $m$, taken modulo $x^n$, applied to the image of the polynomial there. Unlike the coefficients, which must already be reduced, the polynomial need not already be truncated: it may have any number of coefficients, and only the first len are read.

Required Associated Types§

Required Methods§

Source

fn mod_square_truncated(self, len: u64, m: M) -> Self::Output

Squares a polynomial modulo $m$ and truncates the square to its first len coefficients.

$$ f(p, n, m) = (p^2 \bmod x^n) \bmod m. $$

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§