Skip to main content

Projective

Struct Projective 

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

Projective implements Extended Twisted Edwards Coordinates as described in [HKCD08].

This implementation uses the unified addition formulae from that paper (see Section 3.1).

Fields§

§x: P::BaseField§y: P::BaseField§t: P::BaseField§z: P::BaseField

Implementations§

Source§

impl<P: TECurveConfig> Projective<P>

Source

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

Construct 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, t: P::BaseField, z: P::BaseField, ) -> Self

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

Trait Implementations§

Source§

impl<'a, 'b, P: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig, 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig, T: Borrow<Affine<P>>> AddAssign<T> for Projective<P>

Source§

fn add_assign(&mut self, other: T)

Performs the += operation. Read more
Source§

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

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

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

Source§

const ZERO: Self

The additive identity of the field.
Source§

type Scalar = <P as CurveConfig>::ScalarField

Source§

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

Doubles self in place.
Source§

fn double(&self) -> Self

Doubles self.
Source§

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

Negates self in place.
Source§

impl<P: TECurveConfig> CanonicalDeserialize for Projective<P>

Source§

fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate, ) -> Result<Self, SerializationError>

The general deserialize method that takes in customization flags.
Source§

fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

Reads Self from reader using the compressed form if applicable. Performs validation if applicable.
Source§

fn deserialize_compressed_unchecked<R>( reader: R, ) -> Result<Self, SerializationError>
where R: Read,

Reads Self from reader using the compressed form if applicable, without validating the deserialized value. Read more
Source§

fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

Reads Self from reader using the uncompressed form. Performs validation if applicable.
Source§

fn deserialize_uncompressed_unchecked<R>( reader: R, ) -> Result<Self, SerializationError>
where R: Read,

Reads Self from reader using the uncompressed form, without validating the deserialized value. Read more
Source§

impl<P: TECurveConfig> CanonicalSerialize for Projective<P>

Source§

fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>

The general serialize method that takes in customization flags.
Source§

fn serialized_size(&self, compress: Compress) -> usize

Returns the size in bytes of the serialized version of self with the given compression mode.
Source§

fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

Serializes self into writer using the compressed form if applicable.
Source§

fn compressed_size(&self) -> usize

Returns the size in bytes of the compressed serialized version of self.
Source§

fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

Serializes self into writer using the uncompressed form.
Source§

fn uncompressed_size(&self) -> usize

Returns the size in bytes of the uncompressed serialized version of self.
Source§

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

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

Source§

type Config = P

Source§

type BaseField = <P as CurveConfig>::BaseField

The field over which this curve is defined.
Source§

type Affine = Affine<P>

The affine representation of this element.
Source§

type FullGroup = Affine<P>

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

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

Normalizes a slice of group elements into affine.
Source§

fn into_affine(self) -> Self::Affine

Converts self into the affine representation.
Source§

impl<P: TECurveConfig> Debug for Projective<P>
where P::BaseField: Debug,

Source§

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

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

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

Source§

fn default() -> Self

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

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

Source§

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

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

impl<P: TECurveConfig> Distribution<Projective<P>> for Standard

Source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Projective<P>

Generates a uniformly random instance of the curve.

Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
Source§

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

Source§

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

Converts to this type from the input type.
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl<P: TECurveConfig> 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: Elligator2Config> MapToCurve<Projective<P>> for Elligator2Map<P>

Source§

fn check_parameters() -> Result<(), HashToCurveError>

Checks if P represents a valid Elligator2 map. Panics otherwise.

Source§

fn map_to_curve(element: P::BaseField) -> Result<Affine<P>, HashToCurveError>

Map an arbitrary base field element element to a curve point.

Source§

impl<P: TECurveConfig, 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: TECurveConfig, 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: TECurveConfig> 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: TECurveConfig> 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 (const: unstable) · 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: TECurveConfig> 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 (const: unstable) · 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: TECurveConfig> 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 (const: unstable) · 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: TECurveConfig> 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 AsRef<[u64]>) -> 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<P: TECurveConfig> ScalarMul for Projective<P>

Source§

const NEGATION_IS_CHEAP: bool = true

Source§

type MulBase = Affine<P>

Source§

fn batch_convert_to_mul_base(bases: &[Self]) -> Vec<Self::MulBase>

Source§

fn batch_mul(self, v: &[Self::ScalarField]) -> Vec<Self::MulBase>

Compute the vector v[0].G, v[1].G, …, v[n-1].G, given: Read more
Source§

fn batch_mul_with_preprocessing( table: &BatchMulPreprocessing<Self>, v: &[Self::ScalarField], ) -> Vec<Self::MulBase>

Compute the vector v[0].G, v[1].G, …, v[n-1].G, given: Read more
Source§

impl<'a, 'b, P: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig, 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig> 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: TECurveConfig, 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: TECurveConfig> SubAssign for Projective<P>

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<'a, P: TECurveConfig> 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: TECurveConfig, T: Borrow<Affine<P>>> Sum<T> for Projective<P>

Source§

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

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

impl<P: TECurveConfig> 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<M: TECurveConfig, ConstraintF: Field> ToConstraintField<ConstraintF> for Projective<M>
where M::BaseField: ToConstraintField<ConstraintF>,

Source§

fn to_field_elements(&self) -> Option<Vec<ConstraintF>>

Source§

impl<P: TECurveConfig> Valid for Projective<P>

Source§

fn check(&self) -> Result<(), SerializationError>

Checks whether self is valid. If self is valid, returns Ok(()). Otherwise, returns an error describing the failure. This method is called by deserialize_with_mode if validate is Validate::Yes.
Source§

fn batch_check<'a>( batch: impl Iterator<Item = &'a Self> + Send, ) -> Result<(), SerializationError>
where Self: 'a,

Checks whether all items in batch are valid. If all items are valid, returns Ok(()). Otherwise, returns an error describing the first failure.
Source§

const TRIVIAL_CHECK: bool = false

Whether the check method is trivial (i.e. always returns Ok(())). If this is true, the batch_check method will skip all checks and return Ok(()). This should be set to true for types where check is trivial, e.g. integers, field elements, etc. This is false by default. This is primarily an optimization to skip unnecessary checks in batch_check.
Source§

impl<P: TECurveConfig> VariableBaseMSM for Projective<P>

Source§

const ZERO_BUCKET: Self = Self::ZERO

Source§

type Bucket = Projective<P>

Source§

fn msm( bases: &[Self::MulBase], bigints: &[Self::ScalarField], ) -> Result<Self, usize>

Performs multi-scalar multiplication. Read more
Source§

fn msm_unchecked(bases: &[Self::MulBase], scalars: &[Self::ScalarField]) -> Self

Computes an inner product between the PrimeField elements in scalars and the corresponding group elements in bases. Read more
Source§

fn msm_bigint( bases: &[Self::MulBase], bigints: &[<Self::ScalarField as PrimeField>::BigInt], ) -> Self

Optimized implementation of multi-scalar multiplication.
Source§

fn msm_u1(bases: &[Self::MulBase], scalars: &[bool]) -> Self

Performs multi-scalar multiplication when the scalars are known to be boolean. The default implementation is faster than Self::msm_bigint.
Source§

fn msm_u8(bases: &[Self::MulBase], scalars: &[u8]) -> Self

Performs multi-scalar multiplication when the scalars are known to be u8-sized. The default implementation is faster than Self::msm_bigint.
Source§

fn msm_u16(bases: &[Self::MulBase], scalars: &[u16]) -> Self

Performs multi-scalar multiplication when the scalars are known to be u16-sized. The default implementation is faster than Self::msm_bigint.
Source§

fn msm_u32(bases: &[Self::MulBase], scalars: &[u32]) -> Self

Performs multi-scalar multiplication when the scalars are known to be u32-sized. The default implementation is faster than Self::msm_bigint.
Source§

fn msm_u64(bases: &[Self::MulBase], scalars: &[u64]) -> Self

Performs multi-scalar multiplication when the scalars are known to be u64-sized. The default implementation is faster than Self::msm_bigint.
Source§

fn msm_chunks<I, J>(bases_stream: &J, scalars_stream: &I) -> Self
where I: Iterable + ?Sized, I::Item: Borrow<Self::ScalarField>, J: Iterable, J::Item: Borrow<Self::MulBase>,

Streaming multi-scalar multiplication algorithm with hard-coded chunk size.
Source§

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

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

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

impl<P: TECurveConfig> 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: TECurveConfig> Copy for Projective<P>
where P::BaseField: Copy,

Source§

impl<P: TECurveConfig> Eq for Projective<P>
where P::BaseField: PartialEq, Self: PartialEq,

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> UnsafeUnpin for Projective<P>

§

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> CanonicalSerializeHashExt for T

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
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.
Source§

impl<T> UniformRand for T

Source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T, F> DomainCoeff<F> for T
where F: FftField, T: Copy + Send + Sync + Add<Output = T> + Sub<Output = T> + AddAssign + SubAssign + Zero + MulAssign<F> + Debug + PartialEq,