pub struct AlmostExactBaseConversion<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
Implementation is changed to approximating the lifted value using lower precision integers, which can be used to determine the overflow when computing
lift(x) = sum_q lift(x * q/Q mod q) * Q/qmodulo some q'.
Implementations§
Trait Implementations§
Source§impl<A> RNSOperation for AlmostExactBaseConversion<A>
impl<A> RNSOperation for AlmostExactBaseConversion<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 AlmostExactBaseConversion<A>where
A: Freeze,
impl<A> RefUnwindSafe for AlmostExactBaseConversion<A>where
A: RefUnwindSafe,
impl<A> Send for AlmostExactBaseConversion<A>where
A: Send,
impl<A> Sync for AlmostExactBaseConversion<A>where
A: Sync,
impl<A> Unpin for AlmostExactBaseConversion<A>where
A: Unpin,
impl<A> UnwindSafe for AlmostExactBaseConversion<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