Skip to main content

ProjectiveCurve

Trait ProjectiveCurve 

Source
pub trait ProjectiveCurve:
    Sized
    + CanonicalSerialize
    + CanonicalDeserialize
    + Copy
    + Clone
    + Debug
    + Display
    + Default
    + FromBytes
    + Send
    + Sync
    + 'static
    + Eq
    + Hash
    + Neg<Output = Self>
    + Uniform
    + Zero
    + Add<Output = Self, Output = Self>
    + Sub<Output = Self, Output = Self>
    + Mul<Self::ScalarField, Output = Self>
    + AddAssign
    + SubAssign
    + MulAssign<Self::ScalarField>
    + for<'a> Add<&'a Self>
    + for<'a> Sub<&'a Self>
    + for<'a> AddAssign<&'a Self>
    + for<'a> SubAssign<&'a Self>
    + PartialEq<Self::Affine>
    + ToBytes
    + Sum
    + From<Self::Affine> {
    type Affine: AffineCurve<Projective = Self, ScalarField = Self::ScalarField> + From<Self> + Into<Self>;
    type BaseField: Field;
    type ScalarField: PrimeField + SquareRootField + Into<<Self::ScalarField as PrimeField>::BigInteger>;

    // Required methods
    fn prime_subgroup_generator() -> Self;
    fn batch_normalization(v: &mut [Self]);
    fn is_normalized(&self) -> bool;
    fn add_assign_mixed(&mut self, other: &Self::Affine);
    fn double(&self) -> Self;
    fn double_in_place(&mut self);
    fn to_affine(&self) -> Self::Affine;

    // Provided methods
    fn batch_normalization_into_affine(v: Vec<Self>) -> Vec<Self::Affine> { ... }
    fn add_mixed(&self, other: &Self::Affine) -> Self { ... }
    fn sub_assign_mixed(&mut self, other: &Self::Affine) { ... }
}
Expand description

Projective representation of an elliptic curve point guaranteed to be in the prime order subgroup.

Required Associated Types§

Source

type Affine: AffineCurve<Projective = Self, ScalarField = Self::ScalarField> + From<Self> + Into<Self>

Source

type BaseField: Field

Source

type ScalarField: PrimeField + SquareRootField + Into<<Self::ScalarField as PrimeField>::BigInteger>

Required Methods§

Source

fn prime_subgroup_generator() -> Self

Returns a fixed generator of unknown exponent.

Source

fn batch_normalization(v: &mut [Self])

Normalizes a slice of projective elements so that conversion to affine is cheap.

Source

fn is_normalized(&self) -> bool

Checks if the point is already “normalized” so that cheap affine conversion is possible.

Source

fn add_assign_mixed(&mut self, other: &Self::Affine)

Adds an affine element to this element.

Source

fn double(&self) -> Self

Returns self + self.

Source

fn double_in_place(&mut self)

Sets self := self + self.

Source

fn to_affine(&self) -> Self::Affine

Converts this element into its affine representation.

Provided Methods§

Source

fn batch_normalization_into_affine(v: Vec<Self>) -> Vec<Self::Affine>

Normalizes a slice of projective elements and outputs a vector containing the affine equivalents.

Source

fn add_mixed(&self, other: &Self::Affine) -> Self

Adds an affine element to this element.

Source

fn sub_assign_mixed(&mut self, other: &Self::Affine)

Adds an affine element to this element.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<P> ProjectiveCurve for snarkvm_curves::templates::short_weierstrass_jacobian::projective::Projective<P>

Source§

impl<P> ProjectiveCurve for snarkvm_curves::templates::twisted_edwards_extended::projective::Projective<P>