pub struct CpuBackend { /* private fields */ }Expand description
CPU backend backed by a dedicated rayon thread pool.
Implementations§
Source§impl CpuBackend
impl CpuBackend
Sourcepub fn rns_add_single(&self, a: &RnsInt, b: &RnsInt) -> RnsInt
pub fn rns_add_single(&self, a: &RnsInt, b: &RnsInt) -> RnsInt
Single-value addition: parallel over channels only when k is large.
Below RAYON_CHANNEL_THRESHOLD channels, rayon’s per-task overhead
(~50ns) exceeds the cost of a channel op (~1ns), so we stay sequential.
Trait Implementations§
Source§impl ArithmeticBackend for CpuBackend
impl ArithmeticBackend for CpuBackend
Source§fn batch_rns_add(&self, a: &RnsBatch, b: &RnsBatch) -> RnsBatch
fn batch_rns_add(&self, a: &RnsBatch, b: &RnsBatch) -> RnsBatch
Elementwise add:
result[b][c] = (a[b][c] + b[b][c]) % m[c].Source§fn batch_rns_mul(&self, a: &RnsBatch, b: &RnsBatch) -> RnsBatch
fn batch_rns_mul(&self, a: &RnsBatch, b: &RnsBatch) -> RnsBatch
Elementwise multiply:
result[b][c] = (a[b][c] * b[b][c]) % m[c].Auto Trait Implementations§
impl !RefUnwindSafe for CpuBackend
impl !UnwindSafe for CpuBackend
impl Freeze for CpuBackend
impl Send for CpuBackend
impl Sync for CpuBackend
impl Unpin for CpuBackend
impl UnsafeUnpin for CpuBackend
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> 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