Trait snarkvm_wasm::traits::fields::FieldGadget[][src]

pub trait FieldGadget<NativeF, F>: AllocGadget<NativeF, F> + ConditionalEqGadget<F> + EqGadget<F> + NEqGadget<F> + CondSelectGadget<F> + TwoBitLookupGadget<F, TableConstant = NativeF> + ThreeBitCondNegLookupGadget<F, TableConstant = NativeF> + ToBitsGadget<F> + ToBytesGadget<F> + Clone + Debug where
    F: Field,
    NativeF: Field
{ type Variable: Clone + Debug; pub fn get_value(&self) -> Option<NativeF>;
pub fn get_variable(&self) -> Self::Variable;
pub fn zero<CS>(CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn one<CS>(CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn conditionally_add_constant<CS>(
        &self,
        CS,
        &Boolean,
        NativeF
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn add<CS>(&self, CS, &Self) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn sub<CS>(&self, CS, &Self) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn negate<CS>(&self, CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn mul<CS>(&self, CS, &Self) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn add_constant<CS>(&self, CS, &NativeF) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn mul_by_constant<CS>(
        &self,
        CS,
        &NativeF
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn inverse<CS>(&self, CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn frobenius_map<CS>(
        &self,
        CS,
        power: usize
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
;
pub fn cost_of_mul() -> usize;
pub fn cost_of_inv() -> usize; pub fn add_in_place<CS>(
        &mut self,
        cs: CS,
        other: &Self
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn double<CS>(&self, cs: CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn double_in_place<CS>(
        &mut self,
        cs: CS
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn sub_in_place<CS>(
        &mut self,
        cs: CS,
        other: &Self
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn negate_in_place<CS>(
        &mut self,
        cs: CS
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn mul_in_place<CS>(
        &mut self,
        cs: CS,
        other: &Self
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn square<CS>(&self, cs: CS) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn square_in_place<CS>(
        &mut self,
        cs: CS
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn mul_equals<CS>(
        &self,
        cs: CS,
        other: &Self,
        result: &Self
    ) -> Result<(), SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn square_equals<CS>(
        &self,
        cs: CS,
        result: &Self
    ) -> Result<(), SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn add_constant_in_place<CS>(
        &mut self,
        cs: CS,
        other: &NativeF
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn sub_constant<CS>(
        &self,
        cs: CS,
        fe: &NativeF
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn sub_constant_in_place<CS>(
        &mut self,
        cs: CS,
        other: &NativeF
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn mul_by_constant_in_place<CS>(
        &mut self,
        cs: CS,
        other: &NativeF
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn frobenius_map_in_place<CS>(
        &mut self,
        cs: CS,
        power: usize
    ) -> Result<&mut Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... }
pub fn pow<CS>(
        &self,
        cs: CS,
        bits: &[Boolean]
    ) -> Result<Self, SynthesisError>
    where
        CS: ConstraintSystem<F>
, { ... } }

Associated Types

Loading content...

Required methods

pub fn get_value(&self) -> Option<NativeF>[src]

pub fn get_variable(&self) -> Self::Variable[src]

pub fn zero<CS>(CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn one<CS>(CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn conditionally_add_constant<CS>(
    &self,
    CS,
    &Boolean,
    NativeF
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn add<CS>(&self, CS, &Self) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn sub<CS>(&self, CS, &Self) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn negate<CS>(&self, CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn mul<CS>(&self, CS, &Self) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn add_constant<CS>(&self, CS, &NativeF) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn mul_by_constant<CS>(&self, CS, &NativeF) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn inverse<CS>(&self, CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn frobenius_map<CS>(
    &self,
    CS,
    power: usize
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn cost_of_mul() -> usize[src]

pub fn cost_of_inv() -> usize[src]

Loading content...

Provided methods

pub fn add_in_place<CS>(
    &mut self,
    cs: CS,
    other: &Self
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn double<CS>(&self, cs: CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn double_in_place<CS>(
    &mut self,
    cs: CS
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn sub_in_place<CS>(
    &mut self,
    cs: CS,
    other: &Self
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn negate_in_place<CS>(
    &mut self,
    cs: CS
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn mul_in_place<CS>(
    &mut self,
    cs: CS,
    other: &Self
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn square<CS>(&self, cs: CS) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn square_in_place<CS>(
    &mut self,
    cs: CS
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn mul_equals<CS>(
    &self,
    cs: CS,
    other: &Self,
    result: &Self
) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn square_equals<CS>(
    &self,
    cs: CS,
    result: &Self
) -> Result<(), SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn add_constant_in_place<CS>(
    &mut self,
    cs: CS,
    other: &NativeF
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn sub_constant<CS>(
    &self,
    cs: CS,
    fe: &NativeF
) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn sub_constant_in_place<CS>(
    &mut self,
    cs: CS,
    other: &NativeF
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn mul_by_constant_in_place<CS>(
    &mut self,
    cs: CS,
    other: &NativeF
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn frobenius_map_in_place<CS>(
    &mut self,
    cs: CS,
    power: usize
) -> Result<&mut Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

pub fn pow<CS>(&self, cs: CS, bits: &[Boolean]) -> Result<Self, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

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

Loading content...

Implementors

impl<F> FieldGadget<F, F> for FpGadget<F> where
    F: PrimeField
[src]

type Variable = ConstraintVariable<F>

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, 
[src]

type Variable = ((ConstraintVariable<F>, ConstraintVariable<F>), (ConstraintVariable<F>, ConstraintVariable<F>), (ConstraintVariable<F>, ConstraintVariable<F>))

pub fn mul<CS>(
    &self,
    cs: CS,
    other: &Fp6Gadget<P, F>
) -> Result<Fp6Gadget<P, F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Use the Toom-Cook-3x method to compute multiplication.

pub fn square<CS>(&self, cs: CS) -> Result<Fp6Gadget<P, F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Use the Toom-Cook-3x method to compute multiplication.

pub fn mul_by_constant<CS>(
    &self,
    cs: CS,
    other: &Fp6<P>
) -> Result<Fp6Gadget<P, F>, SynthesisError> where
    CS: ConstraintSystem<F>, 
[src]

Use the Toom-Cook-3x method to compute multiplication.

impl<P, F> FieldGadget<Fp2<P>, F> for Fp2Gadget<P, F> where
    P: Fp2Parameters<Fp = F>,
    F: PrimeField
[src]

type Variable = (ConstraintVariable<F>, ConstraintVariable<F>)

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, 
[src]

type Variable = (<Fp6Gadget<<P as Fp12Parameters>::Fp6Params, F> as FieldGadget<Fp6<<P as Fp12Parameters>::Fp6Params>, F>>::Variable, <Fp6Gadget<<P as Fp12Parameters>::Fp6Params, F> as FieldGadget<Fp6<<P as Fp12Parameters>::Fp6Params>, F>>::Variable)

Loading content...