pub trait ModularUnaryOps<Modulus = Self> {
    type Output;
    fn negm(self, m: Modulus) -> Self::Output;
    fn invm(self, m: Modulus) -> Option<Self::Output>;
}
Expand description

Core unary modular arithmetics

Note that all functions will panic if the modulus is zero.

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).

This operation is only available for integer that is coprime to m. If not, the result will be None.

Implementations on Foreign Types

Implementors