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

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

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