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§
source§impl<P: Parameters> AffineCurve for Affine<P>
impl<P: Parameters> AffineCurve for Affine<P>
source§fn 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.
source§fn 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.
source§fn 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.
source§fn 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.
source§fn is_on_curve(&self) -> bool
fn is_on_curve(&self) -> bool
Checks that the current point is on the elliptic curve.
source§fn 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.
source§fn 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
source§fn prime_subgroup_generator() -> Self
fn prime_subgroup_generator() -> Self
source§fn from_random_bytes(bytes: &[u8]) -> Option<Self>
fn from_random_bytes(bytes: &[u8]) -> Option<Self>
source§fn mul_bits(&self, bits: impl Iterator<Item = bool>) -> Projective<P>
fn mul_bits(&self, bits: impl Iterator<Item = bool>) -> Projective<P>
source§fn mul_by_cofactor_to_projective(&self) -> Self::Projective
fn mul_by_cofactor_to_projective(&self) -> Self::Projective
source§fn mul_by_cofactor_inv(&self) -> Self
fn mul_by_cofactor_inv(&self) -> Self
Self::ScalarField
. Read moresource§fn to_projective(&self) -> Projective<P>
fn to_projective(&self) -> Projective<P>
source§fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool
fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool
source§fn to_x_coordinate(&self) -> Self::BaseField
fn to_x_coordinate(&self) -> Self::BaseField
source§fn to_y_coordinate(&self) -> Self::BaseField
fn to_y_coordinate(&self) -> Self::BaseField
source§fn mul_by_cofactor(&self) -> Self
fn mul_by_cofactor(&self) -> Self
source§impl<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,
source§impl<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
source§impl<P: Parameters> Default for Affine<P>
impl<P: Parameters> Default for Affine<P>
source§impl<'de, P: Parameters> Deserialize<'de> for Affine<P>where
P::BaseField: Deserialize<'de>,
impl<'de, P: Parameters> Deserialize<'de> for Affine<P>where
P::BaseField: Deserialize<'de>,
source§fn 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>,
source§impl<P: Parameters> Display for Affine<P>
impl<P: Parameters> Display for Affine<P>
source§impl<P: Parameters> Distribution<Affine<P>> for Standard
impl<P: Parameters> Distribution<Affine<P>> for Standard
source§fn 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.source§impl<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.
source§fn from(p: Affine<P>) -> Projective<P>
fn from(p: Affine<P>) -> Projective<P>
source§impl<P: Parameters> From<Projective<P>> for Affine<P>
impl<P: Parameters> From<Projective<P>> for Affine<P>
source§fn from(p: Projective<P>) -> Affine<P>
fn from(p: Projective<P>) -> Affine<P>
source§impl<P: Parameters> FromBytes for Affine<P>
impl<P: Parameters> FromBytes for Affine<P>
source§impl<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.source§impl<P: Parameters> Neg for Affine<P>
impl<P: Parameters> Neg for Affine<P>
source§impl<P: PartialEq + Parameters> PartialEq<Affine<P>> for Affine<P>where
P::BaseField: PartialEq,
impl<P: PartialEq + Parameters> PartialEq<Affine<P>> for Affine<P>where
P::BaseField: PartialEq,
source§impl<P: Parameters> PartialEq<Affine<P>> for Projective<P>
impl<P: Parameters> PartialEq<Affine<P>> for Projective<P>
source§impl<P: Parameters> PartialEq<Projective<P>> for Affine<P>
impl<P: Parameters> PartialEq<Projective<P>> for Affine<P>
source§fn eq(&self, other: &Projective<P>) -> bool
fn eq(&self, other: &Projective<P>) -> bool
source§impl<P: Parameters> ToBytes for Affine<P>
impl<P: Parameters> ToBytes for Affine<P>
source§impl<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>
source§impl<P: Parameters> ToMinimalBits for Affine<P>
impl<P: Parameters> ToMinimalBits for Affine<P>
source§fn to_minimal_bits(&self) -> Vec<bool>
fn to_minimal_bits(&self) -> Vec<bool>
self
as a minimal boolean array.