Trait num_modular::Reducer
source · pub trait Reducer<T> {
Show 17 methods
// Required methods
fn new(m: &T) -> Self;
fn transform(&self, target: T) -> T;
fn check(&self, target: &T) -> bool;
fn modulus(&self) -> T;
fn residue(&self, target: T) -> T;
fn is_zero(&self, target: &T) -> bool;
fn add(&self, lhs: &T, rhs: &T) -> T;
fn dbl(&self, target: T) -> T;
fn sub(&self, lhs: &T, rhs: &T) -> T;
fn neg(&self, target: T) -> T;
fn mul(&self, lhs: &T, rhs: &T) -> T;
fn inv(&self, target: T) -> Option<T>;
fn sqr(&self, target: T) -> T;
fn pow(&self, base: T, exp: &T) -> T;
// Provided methods
fn add_in_place(&self, lhs: &mut T, rhs: &T) { ... }
fn sub_in_place(&self, lhs: &mut T, rhs: &T) { ... }
fn mul_in_place(&self, lhs: &mut T, rhs: &T) { ... }
}
Expand description
A modular reducer that can ensure that the operations on integers are all performed in a modular ring.
Essential information for performing the modulo operation will be stored in the reducer.