pub struct NonZeroAffineVar<P: SWCurveConfig, F: FieldVar<P::BaseField, <P::BaseField as Field>::BasePrimeField>>{
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: SWCurveConfig,
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: SWCurveConfig,
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: SWCurveConfig, 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>,
PhantomData<P>: Clone,
impl<P: SWCurveConfig, 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>,
PhantomData<P>: Clone,
Source§impl<P, F> CondSelectGadget<<<P as CurveConfig>::BaseField as Field>::BasePrimeField> for NonZeroAffineVar<P, F>where
P: SWCurveConfig,
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: SWCurveConfig,
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: SWCurveConfig, 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: SWCurveConfig, 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: SWCurveConfig,
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: SWCurveConfig,
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>
Auto Trait Implementations§
impl<P, F> Freeze for NonZeroAffineVar<P, F>
impl<P, F> RefUnwindSafe for NonZeroAffineVar<P, F>
impl<P, F> Send for NonZeroAffineVar<P, F>
impl<P, F> Sync for NonZeroAffineVar<P, F>
impl<P, F> Unpin for NonZeroAffineVar<P, F>
impl<P, F> UnwindSafe for NonZeroAffineVar<P, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more