pub struct AlmostExactMatrixBaseConversion<A = Global>{ /* private fields */ }Expand description
Stores values for an almost exact conversion between RNS bases. A complete conversion refers to the function
Z/QZ -> Z/Q'Z, x -> [lift(x)]In our case, the output of the function is allowed to have an error of { -Q, 0, Q },
unless the shortest lift of the input is bounded by Q/4, in which case the result
is always correct.
§Implementation
Similar to super::lift::AlmostExactBaseConversion, but this
implementation makes some assumptions on the sizes of the moduli, which allows
to use a matrix multiplication for the performance-critical section.
Implementations§
Trait Implementations§
Source§impl<A> RNSOperation for AlmostExactMatrixBaseConversion<A>
impl<A> RNSOperation for AlmostExactMatrixBaseConversion<A>
Source§fn apply<V1, V2>(
&self,
input: Submatrix<'_, V1, El<Self::Ring>>,
output: SubmatrixMut<'_, V2, El<Self::Ring>>,
)
fn apply<V1, V2>( &self, input: Submatrix<'_, V1, El<Self::Ring>>, output: SubmatrixMut<'_, V2, El<Self::Ring>>, )
Performs the (almost) exact RNS base conversion
Z/QZ -> Z/Q'Z, x -> smallest_lift(x) + kQ mod Q''where k in { -1, 0, 1 }.
Furthermore, if the shortest lift of the input is bounded by Q/4,
then the result is guaranteed to be exact.
type Ring = RingValue<ZnBase>
type RingType = ZnBase
fn input_rings<'a>(&'a self) -> &'a [Zn] ⓘ
fn output_rings<'a>(&'a self) -> &'a [Zn] ⓘ
Auto Trait Implementations§
impl<A> Freeze for AlmostExactMatrixBaseConversion<A>where
A: Freeze,
impl<A> RefUnwindSafe for AlmostExactMatrixBaseConversion<A>where
A: RefUnwindSafe,
impl<A> Send for AlmostExactMatrixBaseConversion<A>where
A: Send,
impl<A> Sync for AlmostExactMatrixBaseConversion<A>where
A: Sync,
impl<A> Unpin for AlmostExactMatrixBaseConversion<A>where
A: Unpin,
impl<A> UnwindSafe for AlmostExactMatrixBaseConversion<A>where
A: UnwindSafe,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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