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§
fn load_constant(&mut self, value: Fr) -> Self::F
fn constrain_equal(&mut self, a: Self::F, b: Self::F)
Sourcefn select(
&mut self,
when_true: Self::F,
when_false: Self::F,
cond: Self::F,
) -> Self::F
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.
Sourcefn select_const(
&mut self,
when_true: Fr,
when_false: Fr,
cond: Self::F,
) -> Self::F
fn select_const( &mut self, when_true: Fr, when_false: Fr, cond: Self::F, ) -> Self::F
Self::select with constant branch values.
Sourcefn num_to_bits(&mut self, a: Self::F, range_bits: usize) -> Vec<Self::F>
fn num_to_bits(&mut self, a: Self::F, range_bits: usize) -> Vec<Self::F>
Little-endian bit decomposition, constrained to range_bits bits.
Sourcefn inner_product_const(&mut self, values: &[Self::F], coeffs: &[Fr]) -> Self::F
fn inner_product_const(&mut self, values: &[Self::F], coeffs: &[Fr]) -> Self::F
Inner product of values with constant coefficients.
Sourcefn cell_count(&self) -> usize
fn cell_count(&self) -> usize
Number of cells assigned so far (for cell profiling).