Trait snarkvm_gadgets::traits::fields::field::FieldGadget
source · [−]pub trait FieldGadget<NativeF: Field, F: Field>: Sized + 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 {
type Variable: Clone + Debug;
Show 32 methods
fn get_value(&self) -> Option<NativeF>;
fn get_variable(&self) -> Self::Variable;
fn zero<CS: ConstraintSystem<F>>(_: CS) -> Result<Self, SynthesisError>;
fn one<CS: ConstraintSystem<F>>(_: CS) -> Result<Self, SynthesisError>;
fn conditionally_add_constant<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Boolean,
_: NativeF
) -> Result<Self, SynthesisError>;
fn add<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Self
) -> Result<Self, SynthesisError>;
fn sub<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Self
) -> Result<Self, SynthesisError>;
fn negate<CS: ConstraintSystem<F>>(
&self,
_: CS
) -> Result<Self, SynthesisError>;
fn mul<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Self
) -> Result<Self, SynthesisError>;
fn add_constant<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &NativeF
) -> Result<Self, SynthesisError>;
fn mul_by_constant<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &NativeF
) -> Result<Self, SynthesisError>;
fn inverse<CS: ConstraintSystem<F>>(
&self,
_: CS
) -> Result<Self, SynthesisError>;
fn frobenius_map<CS: ConstraintSystem<F>>(
&self,
_: CS,
power: usize
) -> Result<Self, SynthesisError>;
fn cost_of_mul() -> usize;
fn cost_of_inv() -> usize;
fn add_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError> { ... }
fn double<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Self, SynthesisError> { ... }
fn double_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError> { ... }
fn sub_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError> { ... }
fn negate_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError> { ... }
fn mul_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError> { ... }
fn square<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Self, SynthesisError> { ... }
fn square_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError> { ... }
fn mul_equals<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self,
result: &Self
) -> Result<(), SynthesisError> { ... }
fn square_equals<CS: ConstraintSystem<F>>(
&self,
cs: CS,
result: &Self
) -> Result<(), SynthesisError> { ... }
fn add_constant_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError> { ... }
fn sub_constant<CS: ConstraintSystem<F>>(
&self,
cs: CS,
fe: &NativeF
) -> Result<Self, SynthesisError> { ... }
fn sub_constant_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError> { ... }
fn mul_by_constant_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError> { ... }
fn frobenius_map_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
power: usize
) -> Result<&mut Self, SynthesisError> { ... }
fn pow<CS: ConstraintSystem<F>>(
&self,
cs: CS,
bits: &[Boolean]
) -> Result<Self, SynthesisError> { ... }
fn pow_by_constant<CS: ConstraintSystem<F>, S: AsRef<[u64]>>(
&self,
cs: CS,
exp: S
) -> Result<Self, SynthesisError> { ... }
}
Associated Types
Required methods
fn get_variable(&self) -> Self::Variable
fn zero<CS: ConstraintSystem<F>>(_: CS) -> Result<Self, SynthesisError>
fn one<CS: ConstraintSystem<F>>(_: CS) -> Result<Self, SynthesisError>
fn conditionally_add_constant<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Boolean,
_: NativeF
) -> Result<Self, SynthesisError>
fn add<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Self
) -> Result<Self, SynthesisError>
fn sub<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Self
) -> Result<Self, SynthesisError>
fn negate<CS: ConstraintSystem<F>>(&self, _: CS) -> Result<Self, SynthesisError>
fn mul<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &Self
) -> Result<Self, SynthesisError>
fn add_constant<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &NativeF
) -> Result<Self, SynthesisError>
fn mul_by_constant<CS: ConstraintSystem<F>>(
&self,
_: CS,
_: &NativeF
) -> Result<Self, SynthesisError>
fn inverse<CS: ConstraintSystem<F>>(
&self,
_: CS
) -> Result<Self, SynthesisError>
fn frobenius_map<CS: ConstraintSystem<F>>(
&self,
_: CS,
power: usize
) -> Result<Self, SynthesisError>
fn cost_of_mul() -> usize
fn cost_of_inv() -> usize
Provided methods
fn add_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError>
fn double<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Self, SynthesisError>
fn double_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError>
fn sub_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError>
fn negate_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError>
fn mul_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &Self
) -> Result<&mut Self, SynthesisError>
fn square<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Self, SynthesisError>
fn square_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS
) -> Result<&mut Self, SynthesisError>
fn mul_equals<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self,
result: &Self
) -> Result<(), SynthesisError>
fn square_equals<CS: ConstraintSystem<F>>(
&self,
cs: CS,
result: &Self
) -> Result<(), SynthesisError>
fn add_constant_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError>
fn sub_constant<CS: ConstraintSystem<F>>(
&self,
cs: CS,
fe: &NativeF
) -> Result<Self, SynthesisError>
fn sub_constant_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError>
fn mul_by_constant_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
other: &NativeF
) -> Result<&mut Self, SynthesisError>
fn frobenius_map_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS,
power: usize
) -> Result<&mut Self, SynthesisError>
fn pow<CS: ConstraintSystem<F>>(
&self,
cs: CS,
bits: &[Boolean]
) -> Result<Self, SynthesisError>
fn pow<CS: ConstraintSystem<F>>(
&self,
cs: CS,
bits: &[Boolean]
) -> Result<Self, SynthesisError>
Accepts as input a list of bits which, when interpreted in big-endian form, are a scalar.
fn pow_by_constant<CS: ConstraintSystem<F>, S: AsRef<[u64]>>(
&self,
cs: CS,
exp: S
) -> Result<Self, SynthesisError>
fn pow_by_constant<CS: ConstraintSystem<F>, S: AsRef<[u64]>>(
&self,
cs: CS,
exp: S
) -> Result<Self, SynthesisError>
Computes self^S
, where S is interpreted as an little-endian
u64-decomposition of an integer.