Skip to main content

PowerBasis

Struct PowerBasis 

Source
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>

Source

pub fn new(basis: Basis, x: A) -> Self

Creates a power basis with x treated as X (or T₁(X) for Chebyshev).

Source

pub fn basis(&self) -> Basis

Returns the polynomial basis represented by the stored powers.

Source

pub fn get_stored(&self, n: usize) -> Option<&A>

Returns a reference to the stored power at degree n, if computed.

Source

pub fn contains_power(&self, n: usize) -> bool

Returns whether the power at degree n is stored.

Source

pub fn set_power(&mut self, n: usize, value: A)

Stores value as the power at degree n, replacing any existing entry.

Source

pub fn take_power(&mut self, n: usize) -> Option<A>

Removes and returns a stored power.

Trait Implementations§

Source§

impl<BE: Backend, A> PowerBasisHelper<BE, A> for PowerBasis<A>
where A: GLWEToBackendRef<BE>,

Source§

fn basis(&self) -> Basis

Source§

fn has_power(&self, power: usize) -> bool

Source§

fn get(&self, power: usize) -> Result<&A>

Auto Trait Implementations§

§

impl<A> Freeze for PowerBasis<A>
where HashMap<usize, A>: Freeze,

§

impl<A> RefUnwindSafe for PowerBasis<A>

§

impl<A> Send for PowerBasis<A>
where HashMap<usize, A>: Send,

§

impl<A> Sync for PowerBasis<A>
where HashMap<usize, A>: Sync,

§

impl<A> Unpin for PowerBasis<A>
where HashMap<usize, A>: Unpin,

§

impl<A> UnsafeUnpin for PowerBasis<A>

§

impl<A> UnwindSafe for PowerBasis<A>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V