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§
sourcefn add(
&self,
layouter: impl Layouter<F>,
a: &AssignedCell<F, F>,
b: &AssignedCell<F, F>,
) -> Result<AssignedCell<F, F>, Error>
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
sourcefn sub(
&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>
Subtract two field elements and return their difference
sourcefn mul(
&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>
Multiply two field elements and return their product
Object Safety§
This trait is not object safe.