pub struct RnsScaler { /* private fields */ }Expand description
Scaler for a RNS context. This is a helper struct to perform RNS scaling.
Implementations§
Source§impl RnsScaler
impl RnsScaler
Sourcepub fn new(
from: &Arc<RnsContext>,
to: &Arc<RnsContext>,
scaling_factor: ScalingFactor,
) -> Self
pub fn new( from: &Arc<RnsContext>, to: &Arc<RnsContext>, scaling_factor: ScalingFactor, ) -> Self
Create a RNS scaler by numerator / denominator.
Aborts if denominator is equal to 0.
Sourcepub fn scale_new(&self, rests: ArrayView1<'_, u64>, size: usize) -> Vec<u64>
pub fn scale_new(&self, rests: ArrayView1<'_, u64>, size: usize) -> Vec<u64>
Output the RNS representation of the rests scaled by numerator * denominator, and either rounded or floored.
Aborts if the number of rests is different than the number of moduli in debug mode, or if the size is not in [1, …, rests.len()].
Sourcepub fn scale(
&self,
rests: ArrayView1<'_, u64>,
out: ArrayViewMut1<'_, u64>,
starting_index: usize,
)
pub fn scale( &self, rests: ArrayView1<'_, u64>, out: ArrayViewMut1<'_, u64>, starting_index: usize, )
Compute the RNS representation of the rests scaled by numerator *
denominator, and either rounded or floored, and store the result in
out.
Aborts if the number of rests is different than the number of moduli in debug mode, or if the size of out is not in [1, …, rests.len()].
Trait Implementations§
impl Eq for RnsScaler
impl StructuralPartialEq for RnsScaler
Auto Trait Implementations§
impl Freeze for RnsScaler
impl RefUnwindSafe for RnsScaler
impl Send for RnsScaler
impl Sync for RnsScaler
impl Unpin for RnsScaler
impl UnwindSafe for RnsScaler
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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