pub struct FixedProth<const N: u8, const K: u8>;Expand description
A modular reducer for Proth primes K * 2^N + 1.
Supports N up to 127, K odd with K < 2^N. Montgomery form with R = 2¹²⁸.
§Example
use num_modular::{FixedProth, Reducer};
const N: u8 = 16;
const K: u8 = 1;
let modulus = (K as u128) * (1u128 << N) + 1; // 2^16 + 1 = 65537
let reducer = FixedProth::<N, K>::new(&modulus);
let a = reducer.transform(1000);
let b = reducer.transform(2000);
assert_eq!(reducer.residue(reducer.mul(&a, &b)), (1000u128 * 2000) % modulus);Implementations§
Trait Implementations§
Source§impl<const N: u8, const K: u8> Clone for FixedProth<N, K>
impl<const N: u8, const K: u8> Clone for FixedProth<N, K>
Source§fn clone(&self) -> FixedProth<N, K>
fn clone(&self) -> FixedProth<N, K>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<const N: u8, const K: u8> Copy for FixedProth<N, K>
Source§impl<const N: u8, const K: u8> Reducer<u128> for FixedProth<N, K>
impl<const N: u8, const K: u8> Reducer<u128> for FixedProth<N, K>
Auto Trait Implementations§
impl<const N: u8, const K: u8> Freeze for FixedProth<N, K>
impl<const N: u8, const K: u8> RefUnwindSafe for FixedProth<N, K>
impl<const N: u8, const K: u8> Send for FixedProth<N, K>
impl<const N: u8, const K: u8> Sync for FixedProth<N, K>
impl<const N: u8, const K: u8> Unpin for FixedProth<N, K>
impl<const N: u8, const K: u8> UnsafeUnpin for FixedProth<N, K>
impl<const N: u8, const K: u8> UnwindSafe for FixedProth<N, K>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more