pub struct Context { /* private fields */ }Expand description
Struct that holds the context associated with elements in rq.
Implementations§
Source§impl Context
impl Context
Sourcepub fn new(moduli: &[u64], degree: usize) -> Result<Self>
pub fn new(moduli: &[u64], degree: usize) -> Result<Self>
Creates a context from a list of moduli and a polynomial degree.
Returns an error if the moduli are not primes less than 62 bits which
supports the NTT of size degree.
Sourcepub fn new_arc(moduli: &[u64], degree: usize) -> Result<Arc<Self>>
pub fn new_arc(moduli: &[u64], degree: usize) -> Result<Arc<Self>>
Creates a context in an Arc.
Sourcepub fn moduli_operators(&self) -> &[Modulus]
pub fn moduli_operators(&self) -> &[Modulus]
Returns a reference to the moduli as Modulus in this context.
Sourcepub fn niterations_to(&self, context: &Arc<Context>) -> Result<usize>
pub fn niterations_to(&self, context: &Arc<Context>) -> Result<usize>
Returns the number of iterations to switch to a children context. Returns an error if the context provided is not a child context.
Sourcepub fn context_at_level(&self, i: usize) -> Result<Arc<Self>>
pub fn context_at_level(&self, i: usize) -> Result<Arc<Self>>
Returns the context after i iterations.
Trait Implementations§
impl Eq for Context
impl StructuralPartialEq for Context
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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