GateInst

Trait GateInst 

Source
pub trait GateInst: ChipBase {
    // Required methods
    fn load_constant(&mut self, value: Fr) -> Self::F;
    fn constrain_equal(&mut self, a: Self::F, b: Self::F);
    fn select(
        &mut self,
        when_true: Self::F,
        when_false: Self::F,
        cond: Self::F,
    ) -> Self::F;
    fn select_const(
        &mut self,
        when_true: Fr,
        when_false: Fr,
        cond: Self::F,
    ) -> Self::F;
    fn num_to_bits(&mut self, a: Self::F, range_bits: usize) -> Vec<Self::F>;
    fn inner_product_const(
        &mut self,
        values: &[Self::F],
        coeffs: &[Fr],
    ) -> Self::F;
    fn cell_count(&self) -> usize;
}
Expand description

Raw Fr-cell operations mirroring GateChip and direct Context usage.

Required Methods§

Source

fn load_constant(&mut self, value: Fr) -> Self::F

Source

fn constrain_equal(&mut self, a: Self::F, b: Self::F)

Source

fn select( &mut self, when_true: Self::F, when_false: Self::F, cond: Self::F, ) -> Self::F

if cond { when_true } else { when_false }; cond must already be boolean-constrained.

Source

fn select_const( &mut self, when_true: Fr, when_false: Fr, cond: Self::F, ) -> Self::F

Self::select with constant branch values.

Source

fn num_to_bits(&mut self, a: Self::F, range_bits: usize) -> Vec<Self::F>

Little-endian bit decomposition, constrained to range_bits bits.

Source

fn inner_product_const(&mut self, values: &[Self::F], coeffs: &[Fr]) -> Self::F

Inner product of values with constant coefficients.

Source

fn cell_count(&self) -> usize

Number of cells assigned so far (for cell profiling).

Implementors§