Trait ark_r1cs_std::select::CondSelectGadget [−][src]
pub trait CondSelectGadget<ConstraintF: Field> where
Self: Sized,
Self: Clone, { fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>; fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError> { ... } }
Expand description
Generates constraints for selecting between one of two values.
Required methods
fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]
fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]If cond == &Boolean::TRUE, then this returns true_value; else,
returns false_value.
Note
Self::conditionally_select(cond, true_value, false_value)? can be more
succinctly written as cond.select(&true_value, &false_value)?.
Provided methods
fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>[src]
fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>[src]Returns an element of values whose index in represented by position.
position is an array of boolean that represents an unsigned integer in big endian order.
Example
To get the 6th element of values, convert unsigned integer 6 (0b110) to position = [True, True, False],
and call conditionally_select_power_of_two_vector(position, values).
Implementors
impl<BF, P> CondSelectGadget<<P as CubicExtParameters>::BasePrimeField> for CubicExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField>,
&'a BF: FieldOpsBounds<'a, P::BaseField, BF>,
P: CubicExtVarParams<BF>, [src]
impl<BF, P> CondSelectGadget<<P as CubicExtParameters>::BasePrimeField> for CubicExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField>,
&'a BF: FieldOpsBounds<'a, P::BaseField, BF>,
P: CubicExtVarParams<BF>, [src]fn conditionally_select(
cond: &Boolean<P::BasePrimeField>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]impl<BF, P> CondSelectGadget<<P as QuadExtParameters>::BasePrimeField> for QuadExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField>,
&'b BF: FieldOpsBounds<'b, P::BaseField, BF>,
P: QuadExtVarParams<BF>, [src]
impl<BF, P> CondSelectGadget<<P as QuadExtParameters>::BasePrimeField> for QuadExtVar<BF, P> where
BF: FieldVar<P::BaseField, P::BasePrimeField>,
&'b BF: FieldOpsBounds<'b, P::BaseField, BF>,
P: QuadExtVarParams<BF>, [src]fn conditionally_select(
cond: &Boolean<P::BasePrimeField>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<ConstraintF>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<F>,
true_val: &Self,
false_val: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<F>,
true_val: &Self,
false_val: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<F>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]fn conditionally_select(
cond: &Boolean<F>,
true_val: &Self,
false_val: &Self
) -> Result<Self, SynthesisError>[src]impl<P, F> CondSelectGadget<<<P as ModelParameters>::BaseField as Field>::BasePrimeField> for ProjectiveVar<P, F> where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
&'a F: FieldOpsBounds<'a, P::BaseField, F>, [src]
impl<P, F> CondSelectGadget<<<P as ModelParameters>::BaseField as Field>::BasePrimeField> for ProjectiveVar<P, F> where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
&'a F: FieldOpsBounds<'a, P::BaseField, F>, [src]fn conditionally_select(
cond: &Boolean<<P::BaseField as Field>::BasePrimeField>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]impl<P, F> CondSelectGadget<<<P as ModelParameters>::BaseField as Field>::BasePrimeField> for AffineVar<P, F> where
P: TEModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
&'b F: FieldOpsBounds<'b, P::BaseField, F>, [src]
impl<P, F> CondSelectGadget<<<P as ModelParameters>::BaseField as Field>::BasePrimeField> for AffineVar<P, F> where
P: TEModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
&'b F: FieldOpsBounds<'b, P::BaseField, F>, [src]fn conditionally_select(
cond: &Boolean<<P::BaseField as Field>::BasePrimeField>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>[src]