Trait snarkvm_wasm::traits::utilities::select::CondSelectGadget [−][src]
If condition is true, return first; else, select second.
Required methods
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Self,
second: &Self
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Self,
second: &Self
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
Implementors
impl<F> CondSelectGadget<F> for FpGadget<F> where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &FpGadget<F>,
second: &FpGadget<F>
) -> Result<FpGadget<F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &FpGadget<F>,
second: &FpGadget<F>
) -> Result<FpGadget<F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for Boolean where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Boolean,
second: &Boolean
) -> Result<Boolean, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Boolean,
second: &Boolean
) -> Result<Boolean, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for Blake2sOutputGadget where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
_cs: CS,
_cond: &Boolean,
_first: &Blake2sOutputGadget,
_second: &Blake2sOutputGadget
) -> Result<Blake2sOutputGadget, SynthesisError> where
CS: ConstraintSystem<F>, [src]
_cs: CS,
_cond: &Boolean,
_first: &Blake2sOutputGadget,
_second: &Blake2sOutputGadget
) -> Result<Blake2sOutputGadget, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for AllocatedFp<F> where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &AllocatedFp<F>,
second: &AllocatedFp<F>
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &AllocatedFp<F>,
second: &AllocatedFp<F>
) -> Result<AllocatedFp<F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for AllocatedBit where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &AllocatedBit,
second: &AllocatedBit
) -> Result<AllocatedBit, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &AllocatedBit,
second: &AllocatedBit
) -> Result<AllocatedBit, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for Int8 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Int8,
second: &Int8
) -> Result<Int8, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Int8,
second: &Int8
) -> Result<Int8, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for Int16 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Int16,
second: &Int16
) -> Result<Int16, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Int16,
second: &Int16
) -> Result<Int16, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for Int32 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Int32,
second: &Int32
) -> Result<Int32, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Int32,
second: &Int32
) -> Result<Int32, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for Int64 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Int64,
second: &Int64
) -> Result<Int64, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Int64,
second: &Int64
) -> Result<Int64, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for Int128 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Int128,
second: &Int128
) -> Result<Int128, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Int128,
second: &Int128
) -> Result<Int128, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for UInt8 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &UInt8,
second: &UInt8
) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &UInt8,
second: &UInt8
) -> Result<UInt8, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for UInt16 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &UInt16,
second: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &UInt16,
second: &UInt16
) -> Result<UInt16, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for UInt32 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &UInt32,
second: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &UInt32,
second: &UInt32
) -> Result<UInt32, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for UInt64 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &UInt64,
second: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &UInt64,
second: &UInt64
) -> Result<UInt64, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<F> CondSelectGadget<F> for UInt128 where
F: PrimeField, [src]
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &UInt128,
second: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &UInt128,
second: &UInt128
) -> Result<UInt128, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<P, F> CondSelectGadget<F> for Fp2Gadget<P, F> where
P: Fp2Parameters<Fp = F>,
F: PrimeField, [src]
P: Fp2Parameters<Fp = F>,
F: PrimeField,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Fp2Gadget<P, F>,
second: &Fp2Gadget<P, F>
) -> Result<Fp2Gadget<P, F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Fp2Gadget<P, F>,
second: &Fp2Gadget<P, F>
) -> Result<Fp2Gadget<P, F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<P, F> CondSelectGadget<F> for Fp6Gadget<P, F> where
P: Fp6Parameters,
F: PrimeField,
<P as Fp6Parameters>::Fp2Params: Fp2Parameters,
<<P as Fp6Parameters>::Fp2Params as Fp2Parameters>::Fp == F, [src]
P: Fp6Parameters,
F: PrimeField,
<P as Fp6Parameters>::Fp2Params: Fp2Parameters,
<<P as Fp6Parameters>::Fp2Params as Fp2Parameters>::Fp == F,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Fp6Gadget<P, F>,
second: &Fp6Gadget<P, F>
) -> Result<Fp6Gadget<P, F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Fp6Gadget<P, F>,
second: &Fp6Gadget<P, F>
) -> Result<Fp6Gadget<P, F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<P, F> CondSelectGadget<F> for Fp12Gadget<P, F> where
P: Fp12Parameters,
F: PrimeField,
<<P as Fp12Parameters>::Fp6Params as Fp6Parameters>::Fp2Params: Fp2Parameters,
<<<P as Fp12Parameters>::Fp6Params as Fp6Parameters>::Fp2Params as Fp2Parameters>::Fp == F, [src]
P: Fp12Parameters,
F: PrimeField,
<<P as Fp12Parameters>::Fp6Params as Fp6Parameters>::Fp2Params: Fp2Parameters,
<<<P as Fp12Parameters>::Fp6Params as Fp6Parameters>::Fp2Params as Fp2Parameters>::Fp == F,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &Fp12Gadget<P, F>,
second: &Fp12Gadget<P, F>
) -> Result<Fp12Gadget<P, F>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &Fp12Gadget<P, F>,
second: &Fp12Gadget<P, F>
) -> Result<Fp12Gadget<P, F>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<P, F, FG> CondSelectGadget<F> for snarkvm_wasm::curves::templates::bls12::AffineGadget<P, F, FG> where
P: SWModelParameters,
F: PrimeField,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]
P: SWModelParameters,
F: PrimeField,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &AffineGadget<P, F, FG>,
second: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &AffineGadget<P, F, FG>,
second: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>,
pub fn cost() -> usize[src]
impl<P, F, FG> CondSelectGadget<F> for snarkvm_wasm::curves::templates::twisted_edwards::AffineGadget<P, F, FG> where
P: TEModelParameters,
F: Field,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>, [src]
P: TEModelParameters,
F: Field,
FG: FieldGadget<<P as ModelParameters>::BaseField, F>,
pub fn conditionally_select<CS>(
cs: CS,
cond: &Boolean,
first: &AffineGadget<P, F, FG>,
second: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>, [src]
cs: CS,
cond: &Boolean,
first: &AffineGadget<P, F, FG>,
second: &AffineGadget<P, F, FG>
) -> Result<AffineGadget<P, F, FG>, SynthesisError> where
CS: ConstraintSystem<F>,