pub struct LinearTransformation<P> {
pub baby_steps: Vec<i64>,
pub giant_steps: Vec<LinearTransformationGiantStep<P>>,
}Expand description
A linear transformation in baby-step / giant-step form.
P is the encoded-plaintext container.
Fields§
§baby_steps: Vec<i64>Distinct baby-step slot rotations k; baby_steps[0] == 0 (the identity).
giant_steps: Vec<LinearTransformationGiantStep<P>>The giant steps.
Implementations§
Source§impl<BE: Backend> LinearTransformation<PreparedDiagonal<BE::OwnedBuf, BE>>
impl<BE: Backend> LinearTransformation<PreparedDiagonal<BE::OwnedBuf, BE>>
Sourcepub fn alloc_prepared<M, P>(
module: &M,
layout: &LinearTransformationLayout,
pt_infos: &P,
) -> Selfwhere
M: CnvPVecAlloc<BE>,
P: LWEInfos,
pub fn alloc_prepared<M, P>(
module: &M,
layout: &LinearTransformationLayout,
pt_infos: &P,
) -> Selfwhere
M: CnvPVecAlloc<BE>,
P: LWEInfos,
Pre-allocates a resident (prepared) linear transformation sized for the
given BSGS layout and plaintext shape pt_infos.
Convenience for the layout-driven flow: builds the BSGS index via
layout.index() and forwards to Self::alloc_prepared_from_index.
Sourcepub fn alloc_prepared_from_index<M, P>(
module: &M,
index: &LinearTransformationPlan,
pt_infos: &P,
) -> Selfwhere
M: CnvPVecAlloc<BE>,
P: LWEInfos,
pub fn alloc_prepared_from_index<M, P>(
module: &M,
index: &LinearTransformationPlan,
pt_infos: &P,
) -> Selfwhere
M: CnvPVecAlloc<BE>,
P: LWEInfos,
Pre-allocates a resident transform sized for an explicit BSGS index.
Each diagonal carries the plaintext’s base2k / k so the evaluator
never needs the raw plaintext transform again; the convolution buffers are
zeroed and populated by glwe_prepare_linear_transformation_rhs. The
per-diagonal log_scale is left at 0 for the scheme layer to set.
Sourcepub fn set_log_scale(&mut self, log_scale: usize)
pub fn set_log_scale(&mut self, log_scale: usize)
Sets the per-diagonal log_scale of every diagonal; called by the scheme
layer during the populate step (mirrors the streamed plaintext’s
log_delta).
Source§impl<P> LinearTransformation<P>
impl<P> LinearTransformation<P>
Sourcepub fn baby_steps(&self) -> &[i64]
pub fn baby_steps(&self) -> &[i64]
The distinct baby-step slot rotations k (baby_steps[0] == 0, the
identity); the set the prepared baby cache must hold. Accessor over the
baby_steps field for callers that prefer a method.
Sourcepub fn first_diagonal_plaintext(&self) -> Option<&P>
pub fn first_diagonal_plaintext(&self) -> Option<&P>
The first encoded diagonal across all giant steps, or None if the
transform is empty. The diagonals share a uniform plaintext shape, so this
is the canonical place callers read base2k / k / log_delta from.
Sourcepub fn index(&self) -> LinearTransformationPlan
pub fn index(&self) -> LinearTransformationPlan
Derives the BSGS index schedule implied by this transform’s actual baby/giant rotations. Useful for one-shot allocation of the prepared cache directly from an unprepared transform.
The output is canonical — giant steps sorted, per-giant baby rotations
sorted and de-duplicated — so it matches the schedule
LinearTransformationLayout::index would derive from the same diagonal
set. Only baby rotations actually referenced by at least one non-empty
giant step are included; the field self.baby_steps may declare more
rotations than the transform’s data populates, and those extras would
otherwise force the caller to provide automorphism keys that the
schedule does not actually need.
Sourcepub fn galois_elements(&self, cyclotomic_order: i64) -> Vec<i64>
pub fn galois_elements(&self, cyclotomic_order: i64) -> Vec<i64>
The Galois elements whose automorphism keys are required to evaluate this transform: one per non-zero baby- and giant-step rotation.
Automorphism keys are keyed by Galois element throughout the engine (cf.
LinearTransformationPlan::galois_elements); pass the result here to
index the key store the eval entry points look up.
Auto Trait Implementations§
impl<P> Freeze for LinearTransformation<P>
impl<P> RefUnwindSafe for LinearTransformation<P>
impl<P> Send for LinearTransformation<P>
impl<P> Sync for LinearTransformation<P>
impl<P> Unpin for LinearTransformation<P>
impl<P> UnsafeUnpin for LinearTransformation<P>
impl<P> UnwindSafe for LinearTransformation<P>
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
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> ⓘ
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> ⓘ
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