Skip to main content

FancyArithmetic

Trait FancyArithmetic 

Source
pub trait FancyArithmetic: Fancy {
    // Required methods
    fn add(&mut self, x: &Self::Item, y: &Self::Item) -> Self::Item;
    fn sub(&mut self, x: &Self::Item, y: &Self::Item) -> Self::Item;
    fn cmul(&mut self, x: &Self::Item, c: u16) -> Self::Item;
    fn mul(
        &mut self,
        x: &Self::Item,
        y: &Self::Item,
        channel: &mut Channel<'_>,
    ) -> Result<Self::Item>;

    // Provided method
    fn add_many(&mut self, args: &[Self::Item]) -> Self::Item { ... }
}
Expand description

Extension trait for Fancy that provides arithmetic operations.

Required Methods§

Source

fn add(&mut self, x: &Self::Item, y: &Self::Item) -> Self::Item

Add x and y.

§Panics

This panics if x and y do not have equal moduli.

Source

fn sub(&mut self, x: &Self::Item, y: &Self::Item) -> Self::Item

Subtract x and y.

§Panics

This panics if x and y do not have equal moduli.

Source

fn cmul(&mut self, x: &Self::Item, c: u16) -> Self::Item

Multiply x with the constant c.

Source

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

Multiply x and y.

Provided Methods§

Source

fn add_many(&mut self, args: &[Self::Item]) -> Self::Item

Sum up a slice of wires.

§Panics

Panics if args.len() < 2.

Implementors§