Struct CirclePoint

Source
pub struct CirclePoint<F: IsField> {
    pub x: FieldElement<F>,
    pub y: FieldElement<F>,
}
Expand description

Given a Field F, we implement here the Group which consists of all the points (x, y) such as x in F, y in F and x^2 + y^2 = 1, i.e. the Circle. The operation of the group will have additive notation and is as follows: (a, b) + (c, d) = (a * c - b * d, a * d + b * c)

Fields§

§x: FieldElement<F>§y: FieldElement<F>

Implementations§

Source§

impl<F: IsField + HasCircleParams<F>> CirclePoint<F>

Source

pub const GENERATOR: Self

Source

pub const ORDER: u128 = F::ORDER

Source

pub fn new(x: FieldElement<F>, y: FieldElement<F>) -> Result<Self, CircleError>

Source

pub fn zero() -> Self

Neutral element of the Circle group (with additive notation).

Source

pub fn double(&self) -> Self

Computes 2(x, y) = (2x^2 - 1, 2xy).

Source

pub fn repeated_double(self, n: u32) -> Self

Computes 2^n * (x, y).

Source

pub fn conjugate(self) -> Self

Computes the inverse of the point. We are using -(x, y) = (x, -y), i.e. the inverse of the group opertion is conjugation because the norm of every point in the circle is one.

Source

pub fn antipode(self) -> Self

Source

pub fn get_generator_of_subgroup(log_2_size: u32) -> Self

Returns the generator of the subgroup of order n = 2^log_2_size. We are using that 2^k * g is a generator of the subgroup of order 2^{31 - k}.

Trait Implementations§

Source§

impl<F: IsField + HasCircleParams<F>> Add<&CirclePoint<F>> for CirclePoint<F>

Source§

type Output = CirclePoint<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &CirclePoint<F>) -> Self::Output

Performs the + operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> Add<CirclePoint<F>> for &CirclePoint<F>

Source§

type Output = CirclePoint<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: CirclePoint<F>) -> Self::Output

Performs the + operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> Add for &CirclePoint<F>

Addition (i.e. group operation) between two points: (a, b) + (c, d) = (a * c - b * d, a * d + b * c)

Source§

type Output = CirclePoint<F>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> Add for CirclePoint<F>

Source§

type Output = CirclePoint<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: CirclePoint<F>) -> Self::Output

Performs the + operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> AddAssign<&CirclePoint<F>> for CirclePoint<F>

Source§

fn add_assign(&mut self, rhs: &CirclePoint<F>)

Performs the += operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> AddAssign for CirclePoint<F>

Source§

fn add_assign(&mut self, rhs: CirclePoint<F>)

Performs the += operation. Read more
Source§

impl<F: Clone + IsField> Clone for CirclePoint<F>

Source§

fn clone(&self) -> CirclePoint<F>

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<F: Debug + IsField> Debug for CirclePoint<F>

Source§

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

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

impl<F: IsField + HasCircleParams<F>> Mul<u128> for &CirclePoint<F>

Multiplication between a point and a scalar (i.e. group operation repeatedly): (x, y) * n = (x ,y) + … + (x, y) n-times.

Source§

type Output = CirclePoint<F>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: u128) -> Self::Output

Performs the * operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> Mul<u128> for CirclePoint<F>

Source§

type Output = CirclePoint<F>

The resulting type after applying the * operator.
Source§

fn mul(self, scalar: u128) -> Self::Output

Performs the * operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> MulAssign<u128> for CirclePoint<F>

Source§

fn mul_assign(&mut self, scalar: u128)

Performs the *= operation. Read more
Source§

impl<F: IsField + HasCircleParams<F>> PartialEq for CirclePoint<F>

Equality between two cricle points.

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.

Auto Trait Implementations§

§

impl<F> Freeze for CirclePoint<F>
where <F as IsField>::BaseType: Freeze,

§

impl<F> RefUnwindSafe for CirclePoint<F>

§

impl<F> Send for CirclePoint<F>
where <F as IsField>::BaseType: Send,

§

impl<F> Sync for CirclePoint<F>
where <F as IsField>::BaseType: Sync,

§

impl<F> Unpin for CirclePoint<F>

§

impl<F> UnwindSafe for CirclePoint<F>
where <F as IsField>::BaseType: UnwindSafe,

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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, 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.