Trait num_modular::ModularOps
source · [−]pub trait ModularOps<Rhs = Self, Modulus = Self> {
type Output;
fn addm(self, rhs: Rhs, m: Modulus) -> Self::Output;
fn subm(self, rhs: Rhs, m: Modulus) -> Self::Output;
fn mulm(self, rhs: Rhs, m: Modulus) -> Self::Output;
fn powm(self, exp: Rhs, m: Modulus) -> Self::Output;
fn negm(self, m: Modulus) -> Self::Output;
fn invm(self, m: Modulus) -> Option<Self::Output>
where
Self: Sized;
fn jacobi(self, n: Modulus) -> i8;
}
Expand description
This trait describes modular arithmetic operations
Associated Types
Required methods
Return (-self) % m and make sure the result is normalized in range [0,m)
Calculate modular inverse (x such that self*x = 1 mod m).