Struct snarkvm_gadgets::curves::templates::bls12::affine::AffineGadget
source · [−]pub struct AffineGadget<P: ShortWeierstrassParameters, F: Field, FG: FieldGadget<P::BaseField, F>> {
pub x: FG,
pub y: FG,
pub infinity: Boolean,
/* private fields */
}
Fields
x: FG
y: FG
infinity: Boolean
Implementations
sourceimpl<P: ShortWeierstrassParameters, F: Field, FG: FieldGadget<P::BaseField, F>> AffineGadget<P, F, FG>
impl<P: ShortWeierstrassParameters, F: Field, FG: FieldGadget<P::BaseField, F>> AffineGadget<P, F, FG>
pub fn new(x: FG, y: FG, infinity: Boolean) -> Self
pub fn alloc_without_check<Fn: FnOnce() -> Result<SWProjective<P>, SynthesisError>, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError>
Trait Implementations
sourceimpl<P: ShortWeierstrassParameters, F: PrimeField, FG: FieldGadget<P::BaseField, F>> AllocGadget<Affine<P>, F> for AffineGadget<P, F, FG>
impl<P: ShortWeierstrassParameters, F: PrimeField, FG: FieldGadget<P::BaseField, F>> AllocGadget<Affine<P>, F> for AffineGadget<P, F, FG>
fn alloc_constant<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<SWAffine<P>>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
fn alloc<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<SWAffine<P>>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
fn alloc_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<SWAffine<P>>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
fn alloc_input<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<SWAffine<P>>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
fn alloc_input_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
sourceimpl<P: ShortWeierstrassParameters, F: PrimeField, FG: FieldGadget<P::BaseField, F>> AllocGadget<Projective<P>, F> for AffineGadget<P, F, FG>
impl<P: ShortWeierstrassParameters, F: PrimeField, FG: FieldGadget<P::BaseField, F>> AllocGadget<Projective<P>, F> for AffineGadget<P, F, FG>
fn alloc_constant<Fn, T, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
T: Borrow<SWProjective<P>>,
fn alloc<Fn, T, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
T: Borrow<SWProjective<P>>,
fn alloc_checked<Fn, T, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
T: Borrow<SWProjective<P>>,
fn alloc_input<Fn, T, CS: ConstraintSystem<F>>(
cs: CS,
value_gen: Fn
) -> Result<Self, SynthesisError> where
Fn: FnOnce() -> Result<T, SynthesisError>,
T: Borrow<SWProjective<P>>,
fn alloc_input_checked<Fn: FnOnce() -> Result<T, SynthesisError>, T: Borrow<V>, CS: ConstraintSystem<F>>(
cs: CS,
f: Fn
) -> Result<Self, SynthesisError>
sourceimpl<P: ShortWeierstrassParameters, F: Field, FG: FieldGadget<P::BaseField, F>> Clone for AffineGadget<P, F, FG> where
FG: Clone,
impl<P: ShortWeierstrassParameters, F: Field, FG: FieldGadget<P::BaseField, F>> Clone for AffineGadget<P, F, FG> where
FG: Clone,
sourceimpl<P, F, FG> CondSelectGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> CondSelectGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F>,
fn conditionally_select<CS: ConstraintSystem<F>>(
cs: CS,
cond: &Boolean,
first: &Self,
second: &Self
) -> Result<Self, SynthesisError>
fn cost() -> usize
sourceimpl<P, F, FG> ConditionalEqGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> ConditionalEqGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
fn conditional_enforce_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self,
condition: &Boolean
) -> Result<(), SynthesisError>
fn cost() -> usize
sourceimpl<P: ShortWeierstrassParameters, F: Field, FG: FieldGadget<P::BaseField, F>> Debug for AffineGadget<P, F, FG> where
FG: Debug,
impl<P: ShortWeierstrassParameters, F: Field, FG: FieldGadget<P::BaseField, F>> Debug for AffineGadget<P, F, FG> where
FG: Debug,
sourceimpl<P, F, FG> EqGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> EqGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
sourcefn is_eq<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
fn is_eq<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Boolean, SynthesisError>
Output a Boolean
value representing whether self.value() == other.value()
. Read more
fn enforce_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<(), SynthesisError>
fn cost() -> usize
sourceimpl<P, F, FG> GroupGadget<Projective<P>, F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> GroupGadget<Projective<P>, F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F>,
sourcefn add<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
fn add<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
Incomplete addition: neither self
nor other
can be the neutral
element.
sourcefn add_constant<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &SWProjective<P>
) -> Result<Self, SynthesisError>
fn add_constant<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &SWProjective<P>
) -> Result<Self, SynthesisError>
Incomplete addition: neither self
nor other
can be the neutral
element.
type Value = SWProjective<P>
type Variable = (FG::Variable, FG::Variable)
fn get_value(&self) -> Option<Self::Value>
fn get_variable(&self) -> Self::Variable
fn zero<CS: ConstraintSystem<F>>(cs: CS) -> Result<Self, SynthesisError>
fn double_in_place<CS: ConstraintSystem<F>>(
&mut self,
cs: CS
) -> Result<(), SynthesisError>
fn negate<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Self, SynthesisError>
fn cost_of_add() -> usize
fn cost_of_double() -> usize
fn sub<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<Self, SynthesisError>
fn sub_constant<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &G
) -> Result<Self, SynthesisError>
sourcefn mul_bits<CS: ConstraintSystem<F>>(
&self,
cs: CS,
result: &Self,
bits: impl Iterator<Item = Boolean>
) -> Result<Self, SynthesisError>
fn mul_bits<CS: ConstraintSystem<F>>(
&self,
cs: CS,
result: &Self,
bits: impl Iterator<Item = Boolean>
) -> Result<Self, SynthesisError>
Inputs must be specified in little-endian form.
If the addition law is incomplete for the identity element,
result
must not be the identity element. Read more
fn scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
I: Iterator<Item = (B, &'a G)>,
B: Borrow<Boolean>,
G: 'a,
fn symmetric_scalar_multiplication<'a, CS, I, B>(
&mut self,
cs: CS,
scalar_bits_with_base_powers: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
I: Iterator<Item = (B, &'a G)>,
B: Borrow<Boolean>,
G: 'a,
fn masked_scalar_multiplication<'a, CS, I, B>(
&mut self,
_: CS,
_: I,
_: I
) -> Result<(), SynthesisError> where
CS: ConstraintSystem<F>,
I: Iterator<Item = (B, &'a G)>,
B: Borrow<Boolean>,
G: 'a,
fn three_bit_signed_digit_scalar_multiplication<CS, I, J, K, B>(
_: CS,
_: &[B],
_: K
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
I: Borrow<[Boolean]>,
J: Iterator<Item = I>,
K: Iterator<Item = J>,
B: Borrow<[G]>,
sourcefn multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>,
B: Borrow<[G]>,
fn multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>,
B: Borrow<[G]>,
Computes Σⱼ(scalarⱼ * baseⱼ)
for all j,
where scalarⱼ
is a Boolean
representation of the j-th scalar. Read more
fn symmetric_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>,
B: Borrow<[G]>,
sourcefn masked_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I,
mask_bases: &[B],
masks: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>,
B: Borrow<[G]>,
fn masked_multi_scalar_multiplication<'a, CS, T, I, B>(
cs: CS,
bases: &[B],
scalars: I,
mask_bases: &[B],
masks: I
) -> Result<Self, SynthesisError> where
CS: ConstraintSystem<F>,
T: 'a + ToBitsBEGadget<F> + ?Sized,
I: Iterator<Item = &'a T>,
B: Borrow<[G]>,
Compute ∏((h_i^{-1} * 1[p_i = 0] + h_i * 1[p_i = 1])^{1 - m_i \xor p_i})((g_i h_i^{-1} * 1[p_i = 0] + g_i^{-1} h_i * 1[p_i = 1])^{m_i \xor p_i}) for all i, m_i being the scalars, p_i being the masks, h_i being the symmetric Pedersen bases and g_i the Pedersen bases. Read more
sourceimpl<P, F, FG> NEqGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> NEqGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
fn enforce_not_equal<CS: ConstraintSystem<F>>(
&self,
cs: CS,
other: &Self
) -> Result<(), SynthesisError>
fn cost() -> usize
sourceimpl<P, F, FG> PartialEq<AffineGadget<P, F, FG>> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> PartialEq<AffineGadget<P, F, FG>> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
sourceimpl<P, F, FG> ToBitsBEGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> ToBitsBEGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
fn to_bits_be<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<Boolean>, SynthesisError>
sourcefn to_bits_be_strict<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<Boolean>, SynthesisError>
fn to_bits_be_strict<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<Boolean>, SynthesisError>
Additionally checks if the produced list of booleans is ‘valid’.
sourceimpl<P, F, FG> ToBytesGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> ToBytesGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
fn to_bytes<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<UInt8>, SynthesisError>
sourcefn to_bytes_strict<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<UInt8>, SynthesisError>
fn to_bytes_strict<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<UInt8>, SynthesisError>
Additionally checks if the produced list of booleans is ‘valid’.
sourceimpl<P, F, FG> ToConstraintFieldGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F> + ToConstraintFieldGadget<F>,
impl<P, F, FG> ToConstraintFieldGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F> + ToConstraintFieldGadget<F>,
sourcefn to_constraint_field<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<FpGadget<F>>, SynthesisError>
fn to_constraint_field<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<FpGadget<F>>, SynthesisError>
Converts self
to FpGadget<F>
variables.
sourceimpl<P, F, FG> ToMinimalBitsGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> ToMinimalBitsGadget<F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F>,
fn to_minimal_bits<CS: ConstraintSystem<F>>(
&self,
cs: CS
) -> Result<Vec<Boolean>, SynthesisError>
impl<P, F, FG> CurveGadget<Projective<P>, F> for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: PrimeField,
FG: FieldGadget<P::BaseField, F>,
impl<P, F, FG> Eq for AffineGadget<P, F, FG> where
P: ShortWeierstrassParameters,
F: Field,
FG: FieldGadget<P::BaseField, F>,
Auto Trait Implementations
impl<P, F, FG> RefUnwindSafe for AffineGadget<P, F, FG> where
F: RefUnwindSafe,
FG: RefUnwindSafe,
P: RefUnwindSafe,
impl<P, F, FG> Send for AffineGadget<P, F, FG> where
FG: Send,
impl<P, F, FG> Sync for AffineGadget<P, F, FG> where
FG: Sync,
impl<P, F, FG> Unpin for AffineGadget<P, F, FG> where
F: Unpin,
FG: Unpin,
P: Unpin,
impl<P, F, FG> UnwindSafe for AffineGadget<P, F, FG> where
F: UnwindSafe,
FG: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F, T> ConditionalOrEqualsGadget<F> for T where
F: Field,
T: ConditionalEqGadget<F> + CondSelectGadget<F>,
impl<F, T> ConditionalOrEqualsGadget<F> for T where
F: Field,
T: ConditionalEqGadget<F> + CondSelectGadget<F>,
fn conditional_enforce_equal_or<CS: ConstraintSystem<F>>(
cs: CS,
cond: &Boolean,
var: &Self,
first: &Self,
second: &Self,
should_enforce: &Boolean
) -> Result<(), SynthesisError>
fn cost() -> usize
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<F, T> OrEqualsGadget<F> for T where
F: Field,
T: ConditionalOrEqualsGadget<F>,
impl<F, T> OrEqualsGadget<F> for T where
F: Field,
T: ConditionalOrEqualsGadget<F>,
fn enforce_equal_or<CS: ConstraintSystem<F>>(
cs: CS,
cond: &Boolean,
var: &Self,
first: &Self,
second: &Self
) -> Result<(), SynthesisError>
fn cost() -> usize
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more