Trait darkfi::zk::gadget::arithmetic::ArithInstruction

source ·
pub trait ArithInstruction<F: WithSmallOrderMulGroup<3> + Ord>: Chip<F> {
    // Required methods
    fn add(
        &self,
        layouter: impl Layouter<F>,
        a: &AssignedCell<F, F>,
        b: &AssignedCell<F, F>,
    ) -> Result<AssignedCell<F, F>, Error>;
    fn sub(
        &self,
        layouter: impl Layouter<F>,
        a: &AssignedCell<F, F>,
        b: &AssignedCell<F, F>,
    ) -> Result<AssignedCell<F, F>, Error>;
    fn mul(
        &self,
        layouter: impl Layouter<F>,
        a: &AssignedCell<F, F>,
        b: &AssignedCell<F, F>,
    ) -> Result<AssignedCell<F, F>, Error>;
}
Expand description

Arithmetic instructions implemented in the chip

Required Methods§

source

fn add( &self, layouter: impl Layouter<F>, a: &AssignedCell<F, F>, b: &AssignedCell<F, F>, ) -> Result<AssignedCell<F, F>, Error>

Add two field elements and return their sum

source

fn sub( &self, layouter: impl Layouter<F>, a: &AssignedCell<F, F>, b: &AssignedCell<F, F>, ) -> Result<AssignedCell<F, F>, Error>

Subtract two field elements and return their difference

source

fn mul( &self, layouter: impl Layouter<F>, a: &AssignedCell<F, F>, b: &AssignedCell<F, F>, ) -> Result<AssignedCell<F, F>, Error>

Multiply two field elements and return their product

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<F: WithSmallOrderMulGroup<3> + Ord> ArithInstruction<F> for ArithChip<F>