pub struct NonZeroAffineVar<P: SWModelParameters, F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>>where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,{
pub x: F,
pub y: F,
/* private fields */
}
Expand description
An affine representation of a prime order curve point that is guaranteed to not be the point at infinity.
Fields§
§x: F
The x-coordinate.
y: F
The y-coordinate.
Implementations§
source§impl<P, F> NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P, F> NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
pub fn new(x: F, y: F) -> Self
sourcepub fn into_projective(&self) -> ProjectiveVar<P, F>
pub fn into_projective(&self) -> ProjectiveVar<P, F>
Converts self into a non-zero projective point.
sourcepub fn add_unchecked(&self, other: &Self) -> Result<Self, SynthesisError>
pub fn add_unchecked(&self, other: &Self) -> Result<Self, SynthesisError>
Performs an addition without checking that other != ±self.
sourcepub fn double(&self) -> Result<Self, SynthesisError>
pub fn double(&self) -> Result<Self, SynthesisError>
Doubles self
. As this is a prime order curve point,
the output is guaranteed to not be the point at infinity.
sourcepub fn double_and_add_unchecked(
&self,
other: &Self
) -> Result<Self, SynthesisError>
pub fn double_and_add_unchecked(
&self,
other: &Self
) -> Result<Self, SynthesisError>
Computes (self + other) + self
. This method requires only 5
constraints, less than the 7 required when computing via
self.double() + other
.
This follows the formulae from [ELM03].
sourcepub fn double_in_place(&mut self) -> Result<(), SynthesisError>
pub fn double_in_place(&mut self) -> Result<(), SynthesisError>
Doubles self
in place.
Trait Implementations§
source§impl<P: SWModelParameters, F> Clone for NonZeroAffineVar<P, F>where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
F: Clone + FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
impl<P: SWModelParameters, F> Clone for NonZeroAffineVar<P, F>where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
F: Clone + FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
source§impl<P, F> CondSelectGadget<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P, F> CondSelectGadget<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
source§fn conditionally_select(
cond: &Boolean<<P::BaseField as Field>::BasePrimeField>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>
fn conditionally_select(
cond: &Boolean<<P::BaseField as Field>::BasePrimeField>,
true_value: &Self,
false_value: &Self
) -> Result<Self, SynthesisError>
source§fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>
fn conditionally_select_power_of_two_vector(
position: &[Boolean<ConstraintF>],
values: &[Self]
) -> Result<Self, SynthesisError>
Returns an element of
values
whose index in represented by position
.
position
is an array of boolean that represents an unsigned integer in
big endian order. Read moresource§impl<P: SWModelParameters, F> Debug for NonZeroAffineVar<P, F>where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
F: Debug + FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
impl<P: SWModelParameters, F> Debug for NonZeroAffineVar<P, F>where
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
F: Debug + FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
source§impl<P, F> EqGadget<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P, F> EqGadget<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
source§fn is_eq(
&self,
other: &Self
) -> Result<Boolean<<P::BaseField as Field>::BasePrimeField>, SynthesisError>
fn is_eq(
&self,
other: &Self
) -> Result<Boolean<<P::BaseField as Field>::BasePrimeField>, SynthesisError>
Output a
Boolean
value representing whether self.value() == other.value()
.source§fn conditional_enforce_equal(
&self,
other: &Self,
condition: &Boolean<<P::BaseField as Field>::BasePrimeField>
) -> Result<(), SynthesisError>
fn conditional_enforce_equal(
&self,
other: &Self,
condition: &Boolean<<P::BaseField as Field>::BasePrimeField>
) -> Result<(), SynthesisError>
If
should_enforce == true
, enforce that self
and other
are equal;
else, enforce a vacuously true statement. Read moresource§fn enforce_equal(&self, other: &Self) -> Result<(), SynthesisError>
fn enforce_equal(&self, other: &Self) -> Result<(), SynthesisError>
source§fn conditional_enforce_not_equal(
&self,
other: &Self,
condition: &Boolean<<P::BaseField as Field>::BasePrimeField>
) -> Result<(), SynthesisError>
fn conditional_enforce_not_equal(
&self,
other: &Self,
condition: &Boolean<<P::BaseField as Field>::BasePrimeField>
) -> Result<(), SynthesisError>
If
should_enforce == true
, enforce that self
and other
are not
equal; else, enforce a vacuously true statement. Read moresource§fn enforce_not_equal(&self, other: &Self) -> Result<(), SynthesisError>
fn enforce_not_equal(&self, other: &Self) -> Result<(), SynthesisError>
source§impl<P, F> R1CSVar<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
impl<P, F> R1CSVar<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>where
P: SWModelParameters,
F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>,
for<'a> &'a F: FieldOpsBounds<'a, P::BaseField, F>,
§type Value = Affine<P>
type Value = Affine<P>
The type of the “native” value that
Self
represents in the constraint
system.source§fn cs(&self) -> ConstraintSystemRef<<P::BaseField as Field>::BasePrimeField>
fn cs(&self) -> ConstraintSystemRef<<P::BaseField as Field>::BasePrimeField>
Returns the underlying
ConstraintSystemRef
. Read moresource§fn value(&self) -> Result<SWAffine<P>, SynthesisError>
fn value(&self) -> Result<SWAffine<P>, SynthesisError>
Returns the value that is assigned to
self
in the underlying
ConstraintSystem
.source§fn is_constant(&self) -> bool
fn is_constant(&self) -> bool
Returns
true
if self
is a circuit-generation-time constant.