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

Provided methods

Accepts as input a list of bits which, when interpreted in big-endian form, are a scalar.

Computes self^S, where S is interpreted as an little-endian u64-decomposition of an integer.

Implementors