pub struct GLWEPacker { /* private fields */ }Expand description
GLWEPacker enables only the fly GLWE packing with constant memory of Log(N) ciphertexts. Main difference with usual GLWE packing is that the output is bit-reversed.
Implementations§
Source§impl GLWEPacker
impl GLWEPacker
Sourcepub fn alloc<A>(infos: &A, log_batch: usize) -> Selfwhere
A: GLWEInfos,
pub fn alloc<A>(infos: &A, log_batch: usize) -> Selfwhere
A: GLWEInfos,
Instantiates a new GLWEPacker.
§Arguments
log_batch: packs coefficients which are multiples of X^{N/2^log_batch}. i.e. withlog_batch=0only the constant coefficient is packed and N GLWE ciphertext can be packed. Withlog_batch=2all coefficients which are multiples of X^{N/4} are packed. Meaning that N/4 ciphertexts can be packed.
Sourcepub fn tmp_bytes<R, K, M, BE: Backend>(
module: &M,
res_infos: &R,
key_infos: &K,
) -> usize
pub fn tmp_bytes<R, K, M, BE: Backend>( module: &M, res_infos: &R, key_infos: &K, ) -> usize
Number of scratch space bytes required to call Self::add.
pub fn galois_elements<M, BE: Backend>(module: &M) -> Vec<i64>where
M: GLWETrace<BE>,
Sourcepub fn add<A, K, M, BE: Backend>(
&mut self,
module: &M,
a: Option<&A>,
auto_keys: &HashMap<i64, K>,
scratch: &mut Scratch<BE>,
)where
A: GLWEToRef + GLWEInfos,
K: GGLWEPreparedToRef<BE> + GetGaloisElement + GGLWEInfos,
M: GLWEPacking<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
pub fn add<A, K, M, BE: Backend>(
&mut self,
module: &M,
a: Option<&A>,
auto_keys: &HashMap<i64, K>,
scratch: &mut Scratch<BE>,
)where
A: GLWEToRef + GLWEInfos,
K: GGLWEPreparedToRef<BE> + GetGaloisElement + GGLWEInfos,
M: GLWEPacking<BE>,
Scratch<BE>: ScratchTakeCore<BE>,
Adds a GLWE ciphertext to the GLWEPacker. #Arguments
module: static backend FFT tables.res: space to append fully packed ciphertext. Only when the number of packed ciphertexts reaches N/2^log_batch is a result written.a: ciphertext to pack. Can optionally give None to pack a 0 ciphertext.auto_keys: a HashMap containing the [AutomorphismKeyExec]s.scratch: scratch space of size at least Self::tmp_bytes.
Auto Trait Implementations§
impl Freeze for GLWEPacker
impl RefUnwindSafe for GLWEPacker
impl Send for GLWEPacker
impl Sync for GLWEPacker
impl Unpin for GLWEPacker
impl UnwindSafe for GLWEPacker
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> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
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 moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.