Trait num_modular::ModularSymbols
source · [−]pub trait ModularSymbols<Modulus = Self> {
fn checked_legendre(&self, n: Modulus) -> Option<i8>;
fn checked_jacobi(&self, n: Modulus) -> Option<i8>;
fn kronecker(&self, n: Modulus) -> i8;
fn legendre(&self, n: Modulus) -> i8 { ... }
fn jacobi(&self, n: Modulus) -> i8 { ... }
}
Expand description
Math symbols related to modular arithmetics
Required Methods
fn checked_legendre(&self, n: Modulus) -> Option<i8>
fn checked_legendre(&self, n: Modulus) -> Option<i8>
Checked version of legendre(), return None if n is not prime
fn checked_jacobi(&self, n: Modulus) -> Option<i8>
fn checked_jacobi(&self, n: Modulus) -> Option<i8>
Provided Methods
Calculate Legendre Symbol (a|n), where a is self.
Note that this function doesn’t perform primality check, since is costly. So if n is not a prime, the result is not reasonable.
Panics
if n is not prime