Projective

Struct Projective 

Source
pub struct Projective<P: SWCurveConfig> {
    pub x: P::BaseField,
    pub y: P::BaseField,
    pub z: P::BaseField,
}
Expand description

Jacobian coordinates for a point on an elliptic curve in short Weierstrass form, over the base field P::BaseField. This struct implements arithmetic via the Jacobian formulae.

Fields§

§x: P::BaseField

X / Z projection of the affine X

§y: P::BaseField

Y / Z projection of the affine Y

§z: P::BaseField

Projective multiplicative inverse. Will be 0 only at infinity.

Implementations§

Source§

impl<P: SWCurveConfig> Projective<P>

Source

pub const fn new_unchecked( x: P::BaseField, y: P::BaseField, z: P::BaseField, ) -> Self

Constructs a new group element without checking whether the coordinates specify a point in the subgroup.

Source

pub fn new(x: P::BaseField, y: P::BaseField, z: P::BaseField) -> Self

Constructs a new group element in a way while enforcing that points are in the prime-order subgroup.

§Panics
  • If point is not on curve.
  • If point is not in the prime-order subgroup.

Trait Implementations§

Source§

impl<'a, 'b, P: SWCurveConfig> Add<&'a Projective<P>> for &'b Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<'a, P: SWCurveConfig> Add<&'a Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<'a, P: SWCurveConfig> Add<&'a Projective<P>> for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a Self) -> Self

Performs the + operation. Read more
Source§

impl<'a, 'b, P: SWCurveConfig> Add<&'a mut Projective<P>> for &'b Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a mut Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<'a, P: SWCurveConfig> Add<&'a mut Projective<P>> for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a mut Self) -> Self

Performs the + operation. Read more
Source§

impl<'b, P: SWCurveConfig> Add<Projective<P>> for &'b Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P: SWCurveConfig> Add<Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<Affine<P>>> Add<T> for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Self

Performs the + operation. Read more
Source§

impl<P: SWCurveConfig> Add for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<'a, P: SWCurveConfig> AddAssign<&'a Projective<P>> for Projective<P>

Source§

fn add_assign(&mut self, other: &'a Self)

Performs the += operation. Read more
Source§

impl<'a, P: SWCurveConfig> AddAssign<&'a mut Projective<P>> for Projective<P>

Source§

fn add_assign(&mut self, other: &'a mut Self)

Performs the += operation. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<Affine<P>>> AddAssign<T> for Projective<P>

Source§

impl<P: SWCurveConfig> AddAssign for Projective<P>

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<P: SWCurveConfig> AdditiveGroup for Projective<P>

Source§

fn double_in_place(&mut self) -> &mut Self

Sets self = 2 * self. Note that Jacobian formulae are incomplete, and so doubling cannot be computed as self + self. Instead, this implementation uses the following specialized doubling formulae:

Source§

const ZERO: Self

Additive identity of the group.
Source§

type Scalar = <P as CurveConfig>::ScalarField

Scalar associated with the group.
Source§

fn double(&self) -> Self

Doubles self.
Source§

fn neg_in_place(&mut self) -> &mut Self

Negates self in place.
Source§

impl<P: SWCurveConfig> Clone for Projective<P>
where P::BaseField: Copy,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: SWCurveConfig> CurveGroup for Projective<P>

Source§

fn normalize_batch(v: &[Self]) -> Vec<Self::Affine>

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

In more detail, this method converts a curve point in Jacobian coordinates (x, y, z) into an equivalent representation (x/z^2, y/z^3, 1).

For N = v.len(), this costs 1 inversion + 6N field multiplications + N field squarings.

(Where batch inversion comprises 3N field multiplications + 1 inversion of these operations)

Source§

type Affine = Affine<P>

The affine representation of this element.
Source§

type BaseField = <P as CurveConfig>::BaseField

The field over which this curve is defined.
Source§

type Config = P

Associated configuration for this curve.
Source§

type FullGroup = Affine<P>

Type representing an element of the full elliptic curve group, not just the prime order subgroup.
Source§

fn into_affine(self) -> Self::Affine

Converts self into the affine representation.
Source§

impl<P: SWCurveConfig> Debug for Projective<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: SWCurveConfig> Default for Projective<P>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<P: SWCurveConfig> Display for Projective<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: SWCurveConfig> From<Affine<P>> for Projective<P>

Source§

fn from(p: Affine<P>) -> Projective<P>

Converts to this type from the input type.
Source§

impl<P: SWCurveConfig> From<Projective<P>> for Affine<P>

Source§

fn from(p: Projective<P>) -> Affine<P>

Converts to this type from the input type.
Source§

impl<P: SWCurveConfig> Hash for Projective<P>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self

Performs the * operation. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<P::ScalarField>> MulAssign<T> for Projective<P>

Source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
Source§

impl<P: SWCurveConfig> Neg for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<P: SWCurveConfig> PartialEq<Affine<P>> for Projective<P>

Source§

fn eq(&self, other: &Affine<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: SWCurveConfig> PartialEq<Projective<P>> for Affine<P>

Source§

fn eq(&self, other: &Projective<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: SWCurveConfig> PartialEq for Projective<P>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: SWCurveConfig> PrimeGroup for Projective<P>

Source§

type ScalarField = <P as CurveConfig>::ScalarField

The scalar field F_r, where r is the order of this group.
Source§

fn generator() -> Self

Returns a fixed generator of this group.
Source§

fn mul_bigint(&self, other: impl BitIteratorBE) -> Self

Performs scalar multiplication of this element.
Source§

fn mul_bits_be(&self, other: impl Iterator<Item = bool>) -> Self

Computes other * self, where other is a big-endian bit representation of some integer.
Source§

impl<'a, 'b, P: SWCurveConfig> Sub<&'a Projective<P>> for &'b Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<'a, P: SWCurveConfig> Sub<&'a Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<'a, P: SWCurveConfig> Sub<&'a Projective<P>> for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a Self) -> Self

Performs the - operation. Read more
Source§

impl<'a, 'b, P: SWCurveConfig> Sub<&'a mut Projective<P>> for &'b Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a mut Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<'a, P: SWCurveConfig> Sub<&'a mut Projective<P>> for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a mut Self) -> Self

Performs the - operation. Read more
Source§

impl<'b, P: SWCurveConfig> Sub<Projective<P>> for &'b Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<P: SWCurveConfig> Sub<Projective<P>> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<Affine<P>>> Sub<T> for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> Self

Performs the - operation. Read more
Source§

impl<P: SWCurveConfig> Sub for Projective<P>

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
Source§

impl<'a, P: SWCurveConfig> SubAssign<&'a Projective<P>> for Projective<P>

Source§

fn sub_assign(&mut self, other: &'a Self)

Performs the -= operation. Read more
Source§

impl<'a, P: SWCurveConfig> SubAssign<&'a mut Projective<P>> for Projective<P>

Source§

fn sub_assign(&mut self, other: &'a mut Self)

Performs the -= operation. Read more
Source§

impl<P: SWCurveConfig, T: Borrow<Affine<P>>> SubAssign<T> for Projective<P>

Source§

fn sub_assign(&mut self, other: T)

Performs the -= operation. Read more
Source§

impl<P: SWCurveConfig> SubAssign for Projective<P>

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<'a, P: SWCurveConfig> Sum<&'a Projective<P>> for Projective<P>

Source§

fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<P: SWCurveConfig, T: Borrow<Affine<P>>> Sum<T> for Projective<P>

Source§

fn sum<I: Iterator<Item = T>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<P: SWCurveConfig> Sum for Projective<P>

Source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl<P: SWCurveConfig> Zero for Projective<P>

Source§

fn zero() -> Self

Returns the point at infinity, which always has Z = 0.

Source§

fn is_zero(&self) -> bool

Checks whether self.z.is_zero().

Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<P: SWCurveConfig> Zeroize for Projective<P>

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<P: SWCurveConfig> Copy for Projective<P>
where P::BaseField: Copy,

Source§

impl<P: SWCurveConfig> Eq for Projective<P>

Auto Trait Implementations§

§

impl<P> Freeze for Projective<P>
where <P as CurveConfig>::BaseField: Freeze,

§

impl<P> RefUnwindSafe for Projective<P>

§

impl<P> Send for Projective<P>

§

impl<P> Sync for Projective<P>

§

impl<P> Unpin for Projective<P>
where <P as CurveConfig>::BaseField: Unpin,

§

impl<P> UnwindSafe for Projective<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.