pub struct PowerBasis<A> { /* private fields */ }Expand description
Stores pre-computed powers of a ciphertext for BSGS polynomial evaluation.
values[n] = X^n (monomial basis) or Tₙ(X) (Chebyshev basis).
values[1] must be provided at construction time.
Implementations§
Source§impl<A> PowerBasis<A>
impl<A> PowerBasis<A>
Sourcepub fn new(basis: Basis, x: A) -> Self
pub fn new(basis: Basis, x: A) -> Self
Creates a power basis with x treated as X (or T₁(X) for Chebyshev).
Sourcepub fn get_stored(&self, n: usize) -> Option<&A>
pub fn get_stored(&self, n: usize) -> Option<&A>
Returns a reference to the stored power at degree n, if computed.
Sourcepub fn contains_power(&self, n: usize) -> bool
pub fn contains_power(&self, n: usize) -> bool
Returns whether the power at degree n is stored.
Sourcepub fn set_power(&mut self, n: usize, value: A)
pub fn set_power(&mut self, n: usize, value: A)
Stores value as the power at degree n, replacing any existing entry.
Sourcepub fn take_power(&mut self, n: usize) -> Option<A>
pub fn take_power(&mut self, n: usize) -> Option<A>
Removes and returns a stored power.
Trait Implementations§
Auto Trait Implementations§
impl<A> Freeze for PowerBasis<A>
impl<A> RefUnwindSafe for PowerBasis<A>
impl<A> Send for PowerBasis<A>
impl<A> Sync for PowerBasis<A>
impl<A> Unpin for PowerBasis<A>
impl<A> UnsafeUnpin for PowerBasis<A>
impl<A> UnwindSafe for PowerBasis<A>
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> 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