Trait snarkvm_wasm::FieldGadget [−][src]
pub trait FieldGadget<NativeF, F>: Clone + EqGadget<F> + NEqGadget<F> + ConditionalEqGadget<F> + ToBitsBEGadget<F> + ToBitsLEGadget<F> + AllocGadget<NativeF, F> + ToBytesGadget<F> + CondSelectGadget<F> + TwoBitLookupGadget<F, TableConstant = NativeF> + ThreeBitCondNegLookupGadget<F, TableConstant = NativeF> + Debug where
F: Field,
NativeF: Field, { type Variable: Clone + Debug;}Show methods
fn get_value(&self) -> Option<NativeF>; fn get_variable(&self) -> Self::Variable; fn zero<CS>(CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn one<CS>(CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn conditionally_add_constant<CS>(
&self,
CS,
&Boolean,
NativeF
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn add<CS>(&self, CS, &Self) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn sub<CS>(&self, CS, &Self) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn negate<CS>(&self, CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn mul<CS>(&self, CS, &Self) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn add_constant<CS>(&self, CS, &NativeF) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn mul_by_constant<CS>(&self, CS, &NativeF) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn inverse<CS>(&self, CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn frobenius_map<CS>(
&self,
CS,
power: usize
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>; fn cost_of_mul() -> usize; fn cost_of_inv() -> usize; fn add_in_place<CS>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn double<CS>(&self, cs: CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn double_in_place<CS>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn sub_in_place<CS>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn negate_in_place<CS>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn mul_in_place<CS>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn square<CS>(&self, cs: CS) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn square_in_place<CS>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn mul_equals<CS>(
&self,
cs: CS,
other: &Self,
result: &Self
) -> Result<(), SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn square_equals<CS>(
&self,
cs: CS,
result: &Self
) -> Result<(), SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn add_constant_in_place<CS>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn sub_constant<CS>(
&self,
cs: CS,
fe: &NativeF
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn sub_constant_in_place<CS>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn mul_by_constant_in_place<CS>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn frobenius_map_in_place<CS>(
&mut self,
cs: CS,
power: usize
) -> Result<&mut Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn pow<CS>(&self, cs: CS, bits: &[Boolean]) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>, { ... } fn pow_by_constant<CS, S>(
&self,
cs: CS,
exp: S
) -> Result<Self, SynthesisError>
where
CS: ConstraintSystem<F>,
S: AsRef<[u64]>, { ... }
Associated Types
Required methods
fn get_variable(&self) -> Self::Variable
fn zero<CS>(CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn one<CS>(CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn conditionally_add_constant<CS>(
&self,
CS,
&Boolean,
NativeF
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn add<CS>(&self, CS, &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn sub<CS>(&self, CS, &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn negate<CS>(&self, CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn mul<CS>(&self, CS, &Self) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn add_constant<CS>(&self, CS, &NativeF) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn mul_by_constant<CS>(&self, CS, &NativeF) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn inverse<CS>(&self, CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn frobenius_map<CS>(&self, CS, power: usize) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn cost_of_mul() -> usize
fn cost_of_inv() -> usize
Provided methods
fn add_in_place<CS>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn double<CS>(&self, cs: CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn double_in_place<CS>(&mut self, cs: CS) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn sub_in_place<CS>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn negate_in_place<CS>(&mut self, cs: CS) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn mul_in_place<CS>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn square<CS>(&self, cs: CS) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn square_in_place<CS>(&mut self, cs: CS) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn mul_equals<CS>(
&self,
cs: CS,
other: &Self,
result: &Self
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
fn square_equals<CS>(&self, cs: CS, result: &Self) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
fn add_constant_in_place<CS>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn sub_constant<CS>(&self, cs: CS, fe: &NativeF) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn sub_constant_in_place<CS>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn mul_by_constant_in_place<CS>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn frobenius_map_in_place<CS>(
&mut self,
cs: CS,
power: usize
) -> Result<&mut Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn pow<CS>(&self, cs: CS, bits: &[Boolean]) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
fn pow<CS>(&self, cs: CS, bits: &[Boolean]) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
Accepts as input a list of bits which, when interpreted in big-endian form, are a scalar.
fn pow_by_constant<CS, S>(&self, cs: CS, exp: S) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
S: AsRef<[u64]>,
fn pow_by_constant<CS, S>(&self, cs: CS, exp: S) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
S: AsRef<[u64]>,
Computes self^S
, where S is interpreted as an little-endian
u64-decomposition of an integer.
Implementors
impl<P, F> FieldGadget<Fp6<P>, F> for Fp6Gadget<P, F> where
P: Fp6Parameters,
F: PrimeField,
<P as Fp6Parameters>::Fp2Params: Fp2Parameters,
<<P as Fp6Parameters>::Fp2Params as Fp2Parameters>::Fp == F,
impl<P, F> FieldGadget<Fp2<P>, F> for Fp2Gadget<P, F> where
P: Fp2Parameters<Fp = F>,
F: PrimeField,
impl<P, F> FieldGadget<Fp12<P>, 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,
impl<TargetField, BaseField> FieldGadget<TargetField, BaseField> for NonNativeFieldVar<TargetField, BaseField> where
BaseField: PrimeField,
TargetField: PrimeField,