Struct snarkvm_curves::templates::short_weierstrass_jacobian::affine::Affine
source · pub struct Affine<P: Parameters> {
pub x: P::BaseField,
pub y: P::BaseField,
pub infinity: bool,
}
Fields
x: P::BaseField
y: P::BaseField
infinity: bool
Implementations
Trait Implementations
sourceimpl<P: Parameters> AffineCurve for Affine<P>
impl<P: Parameters> AffineCurve for Affine<P>
sourcefn from_coordinates(coordinates: Self::Coordinates) -> Option<Self>
fn from_coordinates(coordinates: Self::Coordinates) -> Option<Self>
Initializes a new affine group element from the given coordinates.
sourcefn from_coordinates_unchecked(coordinates: Self::Coordinates) -> Self
fn from_coordinates_unchecked(coordinates: Self::Coordinates) -> Self
Initializes a new affine group element from the given coordinates. Note: The resulting point is not enforced to be on the curve or in the correct subgroup.
sourcefn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>
fn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>
Attempts to construct an affine point given an x-coordinate. The point is not guaranteed to be in the prime order subgroup.
If and only if greatest
is set will the lexicographically
largest y-coordinate be selected.
sourcefn from_y_coordinate(_y: Self::BaseField, _greatest: bool) -> Option<Self>
fn from_y_coordinate(_y: Self::BaseField, _greatest: bool) -> Option<Self>
Attempts to construct an affine point given a y-coordinate. The point is not guaranteed to be in the prime order subgroup.
If and only if greatest
is set will the lexicographically
largest y-coordinate be selected.
sourcefn is_on_curve(&self) -> bool
fn is_on_curve(&self) -> bool
Checks that the current point is on the elliptic curve.
sourcefn batch_add_loop_1(
a: &mut Self,
b: &mut Self,
half: &Self::BaseField,
inversion_tmp: &mut Self::BaseField
)
fn batch_add_loop_1(
a: &mut Self,
b: &mut Self,
half: &Self::BaseField,
inversion_tmp: &mut Self::BaseField
)
Performs the first half of batch addition in-place:
lambda
:= (y2 - y1) / (x2 - x1)
,
for two given affine points.
sourcefn batch_add_loop_2(a: &mut Self, b: Self, inversion_tmp: &mut Self::BaseField)
fn batch_add_loop_2(a: &mut Self, b: Self, inversion_tmp: &mut Self::BaseField)
Performs the second half of batch addition in-place:
x3
:= lambda^2 - x1 - x2
y3
:= lambda * (x1 - x3) - y1
.
type BaseField = <P as ModelParameters>::BaseField
type Coordinates = (<Affine<P> as AffineCurve>::BaseField, <Affine<P> as AffineCurve>::BaseField, bool)
type Projective = Projective<P>
type ScalarField = <P as ModelParameters>::ScalarField
sourcefn prime_subgroup_generator() -> Self
fn prime_subgroup_generator() -> Self
sourcefn from_random_bytes(bytes: &[u8]) -> Option<Self>
fn from_random_bytes(bytes: &[u8]) -> Option<Self>
sourcefn mul_bits(&self, bits: impl Iterator<Item = bool>) -> Projective<P>
fn mul_bits(&self, bits: impl Iterator<Item = bool>) -> Projective<P>
sourcefn mul_by_cofactor_to_projective(&self) -> Self::Projective
fn mul_by_cofactor_to_projective(&self) -> Self::Projective
sourcefn mul_by_cofactor_inv(&self) -> Self
fn mul_by_cofactor_inv(&self) -> Self
Self::ScalarField
. Read moresourcefn to_projective(&self) -> Projective<P>
fn to_projective(&self) -> Projective<P>
sourcefn is_in_correct_subgroup_assuming_on_curve(&self) -> bool
fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool
sourcefn to_x_coordinate(&self) -> Self::BaseField
fn to_x_coordinate(&self) -> Self::BaseField
sourcefn to_y_coordinate(&self) -> Self::BaseField
fn to_y_coordinate(&self) -> Self::BaseField
sourcefn mul_by_cofactor(&self) -> Self
fn mul_by_cofactor(&self) -> Self
sourceimpl<P: Parameters> CanonicalDeserialize for Affine<P>
impl<P: Parameters> CanonicalDeserialize for Affine<P>
fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate
) -> Result<Self, SerializationError>
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_compressed_unchecked<R>(
reader: R
) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where
R: Read,
fn deserialize_uncompressed_unchecked<R>(
reader: R
) -> Result<Self, SerializationError>where
R: Read,
sourceimpl<P: Parameters> CanonicalSerialize for Affine<P>
impl<P: Parameters> CanonicalSerialize for Affine<P>
fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress
) -> Result<(), SerializationError>
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where
W: Write,
fn uncompressed_size(&self) -> usize
sourceimpl<P: Clone + Parameters> Clone for Affine<P>where
P::BaseField: Clone,
P::BaseField: Clone,
impl<P: Clone + Parameters> Clone for Affine<P>where
P::BaseField: Clone,
P::BaseField: Clone,
sourceimpl<P: Debug + Parameters> Debug for Affine<P>where
P::BaseField: Debug,
P::BaseField: Debug,
impl<P: Debug + Parameters> Debug for Affine<P>where
P::BaseField: Debug,
P::BaseField: Debug,
sourceimpl<P: Parameters> Default for Affine<P>
impl<P: Parameters> Default for Affine<P>
sourceimpl<'de, P: Parameters> Deserialize<'de> for Affine<P>where
P::BaseField: Deserialize<'de>,
P::BaseField: Deserialize<'de>,
impl<'de, P: Parameters> Deserialize<'de> for Affine<P>where
P::BaseField: Deserialize<'de>,
P::BaseField: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
sourceimpl<P: Parameters> Display for Affine<P>
impl<P: Parameters> Display for Affine<P>
sourceimpl<P: Parameters> Distribution<Affine<P>> for Standard
impl<P: Parameters> Distribution<Affine<P>> for Standard
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Affine<P>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Affine<P>
T
, using rng
as the source of randomness.sourceimpl<P: Parameters> From<Affine<P>> for Projective<P>
impl<P: Parameters> From<Affine<P>> for Projective<P>
The affine point X, Y is represented in the Jacobian coordinates with Z = 1.
sourcefn from(p: Affine<P>) -> Projective<P>
fn from(p: Affine<P>) -> Projective<P>
sourceimpl<P: Parameters> From<Projective<P>> for Affine<P>
impl<P: Parameters> From<Projective<P>> for Affine<P>
sourcefn from(p: Projective<P>) -> Affine<P>
fn from(p: Projective<P>) -> Affine<P>
sourceimpl<P: Parameters> FromBytes for Affine<P>
impl<P: Parameters> FromBytes for Affine<P>
sourceimpl<P: Parameters> Mul<<P as ModelParameters>::ScalarField> for Affine<P>
impl<P: Parameters> Mul<<P as ModelParameters>::ScalarField> for Affine<P>
type Output = Projective<P>
type Output = Projective<P>
*
operator.sourcefn mul(self, other: P::ScalarField) -> Self::Output
fn mul(self, other: P::ScalarField) -> Self::Output
*
operation. Read moresourceimpl<P: Parameters> Neg for Affine<P>
impl<P: Parameters> Neg for Affine<P>
sourceimpl<P: PartialEq + Parameters> PartialEq<Affine<P>> for Affine<P>where
P::BaseField: PartialEq,
P::BaseField: PartialEq,
impl<P: PartialEq + Parameters> PartialEq<Affine<P>> for Affine<P>where
P::BaseField: PartialEq,
P::BaseField: PartialEq,
sourceimpl<P: Parameters> PartialEq<Affine<P>> for Projective<P>
impl<P: Parameters> PartialEq<Affine<P>> for Projective<P>
sourceimpl<P: Parameters> PartialEq<Projective<P>> for Affine<P>
impl<P: Parameters> PartialEq<Projective<P>> for Affine<P>
sourcefn eq(&self, other: &Projective<P>) -> bool
fn eq(&self, other: &Projective<P>) -> bool
sourceimpl<P: Parameters> Serialize for Affine<P>where
P::BaseField: Serialize,
P::BaseField: Serialize,
impl<P: Parameters> Serialize for Affine<P>where
P::BaseField: Serialize,
P::BaseField: Serialize,
sourceimpl<P: Parameters> ToBytes for Affine<P>
impl<P: Parameters> ToBytes for Affine<P>
sourceimpl<M: ShortWeierstrassParameters, F: Field> ToConstraintField<F> for SWAffine<M>where
M::BaseField: ToConstraintField<F>,
impl<M: ShortWeierstrassParameters, F: Field> ToConstraintField<F> for SWAffine<M>where
M::BaseField: ToConstraintField<F>,
fn to_field_elements(&self) -> Result<Vec<F>, ConstraintFieldError>
sourceimpl<P: Parameters> ToMinimalBits for Affine<P>
impl<P: Parameters> ToMinimalBits for Affine<P>
sourcefn to_minimal_bits(&self) -> Vec<bool>
fn to_minimal_bits(&self) -> Vec<bool>
self
as a minimal boolean array.