Skip to main content

ArithmeticBackend

Trait ArithmeticBackend 

Source
pub trait ArithmeticBackend: Send + Sync {
    // Required methods
    fn batch_rns_add(&self, a: &RnsBatch, b: &RnsBatch) -> RnsBatch;
    fn batch_rns_mul(&self, a: &RnsBatch, b: &RnsBatch) -> RnsBatch;
    fn batch_crt(&self, batch: &RnsBatch) -> Vec<BigUint>;
    fn name(&self) -> &'static str;
}
Expand description

A backend that can perform elementwise RNS arithmetic over a RnsBatch.

Required Methods§

Source

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

Elementwise multiply: result[b][c] = (a[b][c] * b[b][c]) % m[c].

Source

fn batch_crt(&self, batch: &RnsBatch) -> Vec<BigUint>

CRT-reconstruct every item in the batch.

Source

fn name(&self) -> &'static str

Backend name for diagnostics.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§