pub struct RnsContext { /* private fields */ }Expand description
Context for a Residue Number System.
Implementations§
Source§impl RnsContext
impl RnsContext
Sourcepub fn new(moduli_u64: &[u64]) -> Result<Self>
pub fn new(moduli_u64: &[u64]) -> Result<Self>
Create a RNS context from a list of moduli.
Returns an error if the list is empty, or if the moduli are no coprime.
Sourcepub const fn modulus(&self) -> &BigUint
pub const fn modulus(&self) -> &BigUint
Returns the product of the moduli used when creating the RNS context.
Sourcepub fn lift(&self, rests: ArrayView1<'_, u64>) -> BigUint
pub fn lift(&self, rests: ArrayView1<'_, u64>) -> BigUint
Lift rests into a BigUint.
Aborts if the number of rests is different than the number of moduli in debug mode.
Sourcepub fn get_garner(&self, i: usize) -> Option<&BigUint>
pub fn get_garner(&self, i: usize) -> Option<&BigUint>
Getter for the i-th garner coefficient.
Trait Implementations§
Source§impl Clone for RnsContext
impl Clone for RnsContext
Source§fn clone(&self) -> RnsContext
fn clone(&self) -> RnsContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RnsContext
impl Debug for RnsContext
Source§impl Default for RnsContext
impl Default for RnsContext
Source§fn default() -> RnsContext
fn default() -> RnsContext
Returns the “default value” for a type. Read more
Source§impl PartialEq for RnsContext
impl PartialEq for RnsContext
impl Eq for RnsContext
impl StructuralPartialEq for RnsContext
Auto Trait Implementations§
impl Freeze for RnsContext
impl RefUnwindSafe for RnsContext
impl Send for RnsContext
impl Sync for RnsContext
impl Unpin for RnsContext
impl UnwindSafe for RnsContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more