Trait ark_r1cs_std::select::ThreeBitCondNegLookupGadget [−][src]
pub trait ThreeBitCondNegLookupGadget<ConstraintF: Field> where
Self: Sized, { type TableConstant; fn three_bit_cond_neg_lookup(
bits: &[Boolean<ConstraintF>],
b0b1: &Boolean<ConstraintF>,
constants: &[Self::TableConstant]
) -> Result<Self, SynthesisError>; }
Expand description
Uses three bits to perform a lookup into a table, where the last bit conditionally negates the looked-up value.
Associated Types
type TableConstant[src]
type TableConstant[src]The type of values being looked up.
Required methods
fn three_bit_cond_neg_lookup(
bits: &[Boolean<ConstraintF>],
b0b1: &Boolean<ConstraintF>,
constants: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]
fn three_bit_cond_neg_lookup(
bits: &[Boolean<ConstraintF>],
b0b1: &Boolean<ConstraintF>,
constants: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]Interprets the slice bits as a two-bit integer b = bits[0] + (bits[1] << 1), and then outputs constants[b] * c, where c = if bits[2] { -1 } else { 1 };.
That is, bits[2] conditionally negates the looked-up value.
For example, if bits == [1, 0, 1], and constants == [0, 1, 2, 3],
this method should output a variable corresponding to -1.
Panics
This method panics if bits.len() != 3 or constants.len() != 4.
Implementors
impl<BF, P> ThreeBitCondNegLookupGadget<<P as CubicExtParameters>::BasePrimeField> for CubicExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField> + ThreeBitCondNegLookupGadget<P::BasePrimeField, TableConstant = P::BaseField>,
&'a BF: FieldOpsBounds<'a, P::BaseField, BF>,
P: CubicExtVarParams<BF>, [src]
impl<BF, P> ThreeBitCondNegLookupGadget<<P as CubicExtParameters>::BasePrimeField> for CubicExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField> + ThreeBitCondNegLookupGadget<P::BasePrimeField, TableConstant = P::BaseField>,
&'a BF: FieldOpsBounds<'a, P::BaseField, BF>,
P: CubicExtVarParams<BF>, [src]type TableConstant = CubicExtField<P>fn three_bit_cond_neg_lookup(
b: &[Boolean<P::BasePrimeField>],
b0b1: &Boolean<P::BasePrimeField>,
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]impl<BF, P> ThreeBitCondNegLookupGadget<<P as QuadExtParameters>::BasePrimeField> for QuadExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField> + ThreeBitCondNegLookupGadget<P::BasePrimeField, TableConstant = P::BaseField>,
&'b BF: FieldOpsBounds<'b, P::BaseField, BF>,
P: QuadExtVarParams<BF>, [src]
impl<BF, P> ThreeBitCondNegLookupGadget<<P as QuadExtParameters>::BasePrimeField> for QuadExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField> + ThreeBitCondNegLookupGadget<P::BasePrimeField, TableConstant = P::BaseField>,
&'b BF: FieldOpsBounds<'b, P::BaseField, BF>,
P: QuadExtVarParams<BF>, [src]type TableConstant = QuadExtField<P>fn three_bit_cond_neg_lookup(
b: &[Boolean<P::BasePrimeField>],
b0b1: &Boolean<P::BasePrimeField>,
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]type TableConstant = Ffn three_bit_cond_neg_lookup(
b: &[Boolean<F>],
b0b1: &Boolean<F>,
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]type TableConstant = Ffn three_bit_cond_neg_lookup(
b: &[Boolean<F>],
b0b1: &Boolean<F>,
c: &[Self::TableConstant]
) -> Result<Self, SynthesisError>[src]