Skip to main content

CrtGadgets

Trait CrtGadgets 

Source
pub trait CrtGadgets:
    FancyArithmetic
    + FancyBinary
    + ArithmeticBundleGadgets
    + BundleGadgets {
    // Provided methods
    fn crt_encode(
        &mut self,
        value: u128,
        modulus: u128,
        channel: &mut Channel<'_>,
    ) -> Result<CrtBundle<Self::Item>> { ... }
    fn crt_receive(
        &mut self,
        modulus: u128,
        channel: &mut Channel<'_>,
    ) -> Result<CrtBundle<Self::Item>> { ... }
    fn crt_encode_many(
        &mut self,
        values: &[u128],
        modulus: u128,
        channel: &mut Channel<'_>,
    ) -> Result<Vec<CrtBundle<Self::Item>>> { ... }
    fn crt_receive_many(
        &mut self,
        n: usize,
        modulus: u128,
        channel: &mut Channel<'_>,
    ) -> Result<Vec<CrtBundle<Self::Item>>> { ... }
    fn crt_constant_bundle(
        &mut self,
        x: u128,
        q: u128,
        channel: &mut Channel<'_>,
    ) -> Result<CrtBundle<Self::Item>> { ... }
    fn crt_output(
        &mut self,
        x: &CrtBundle<Self::Item>,
        channel: &mut Channel<'_>,
    ) -> Result<Option<u128>> { ... }
    fn crt_outputs(
        &mut self,
        xs: &[CrtBundle<Self::Item>],
        channel: &mut Channel<'_>,
    ) -> Result<Option<Vec<u128>>> { ... }
    fn crt_add(
        &mut self,
        x: &CrtBundle<Self::Item>,
        y: &CrtBundle<Self::Item>,
    ) -> CrtBundle<Self::Item> { ... }
    fn crt_sub(
        &mut self,
        x: &CrtBundle<Self::Item>,
        y: &CrtBundle<Self::Item>,
    ) -> CrtBundle<Self::Item> { ... }
    fn crt_cmul(
        &mut self,
        x: &CrtBundle<Self::Item>,
        c: u128,
    ) -> CrtBundle<Self::Item> { ... }
    fn crt_mul(
        &mut self,
        x: &CrtBundle<Self::Item>,
        y: &CrtBundle<Self::Item>,
        channel: &mut Channel<'_>,
    ) -> Result<CrtBundle<Self::Item>> { ... }
}
Expand description

Extension trait for Fancy providing advanced CRT gadgets based on bundles of wires.

Provided Methods§

Source

fn crt_encode( &mut self, value: u128, modulus: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>

Encode a CRT input bundle.

Source

fn crt_receive( &mut self, modulus: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>

Receive an CRT input bundle.

Source

fn crt_encode_many( &mut self, values: &[u128], modulus: u128, channel: &mut Channel<'_>, ) -> Result<Vec<CrtBundle<Self::Item>>>

Encode many CRT input bundles.

Source

fn crt_receive_many( &mut self, n: usize, modulus: u128, channel: &mut Channel<'_>, ) -> Result<Vec<CrtBundle<Self::Item>>>

Receive many CRT input bundles.

Source

fn crt_constant_bundle( &mut self, x: u128, q: u128, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>

Creates a bundle of constant wires for the CRT representation of x under composite modulus q.

Source

fn crt_output( &mut self, x: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<Option<u128>>

Output a CRT bundle and interpret it mod Q.

Source

fn crt_outputs( &mut self, xs: &[CrtBundle<Self::Item>], channel: &mut Channel<'_>, ) -> Result<Option<Vec<u128>>>

Output a slice of CRT bundles and interpret the outputs mod Q.

Source

fn crt_add( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, ) -> CrtBundle<Self::Item>

Add two CRT bundles.

Source

fn crt_sub( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, ) -> CrtBundle<Self::Item>

Subtract two CRT bundles.

Source

fn crt_cmul( &mut self, x: &CrtBundle<Self::Item>, c: u128, ) -> CrtBundle<Self::Item>

Multiplies each wire in x by the corresponding residue of c.

Source

fn crt_mul( &mut self, x: &CrtBundle<Self::Item>, y: &CrtBundle<Self::Item>, channel: &mut Channel<'_>, ) -> Result<CrtBundle<Self::Item>>

Multiply x with y.

Implementors§