Skip to main content

ModEvaluate

Trait ModEvaluate 

Source
pub trait ModEvaluate<T, M = T> {
    type Output;

    // Required method
    fn mod_evaluate(self, x: T, m: M) -> Self::Output;
}
Expand description

Evaluates a polynomial at a value, modulo $m$. The value must already be reduced modulo $m$, and so must the polynomial’s coefficients, unless an implementation says otherwise.

Required Associated Types§

Source

type Output

The type of the polynomial’s value.

Required Methods§

Source

fn mod_evaluate(self, x: T, m: M) -> Self::Output

Evaluates a polynomial at x, modulo m.

$$ f(p, x, m) = \sum_{i=0}^{n-1} c_i x^i \bmod m, $$

where $c_i$ is the coefficient of $x^i$ in $p$ and $n$ is its length.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§