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>
impl<F: IsField + HasCircleParams<F>> CirclePoint<F>
pub const GENERATOR: Self
pub const ORDER: u128 = F::ORDER
pub fn new(x: FieldElement<F>, y: FieldElement<F>) -> Result<Self, CircleError>
Sourcepub fn repeated_double(self, n: u32) -> Self
pub fn repeated_double(self, n: u32) -> Self
Computes 2^n * (x, y).
Sourcepub fn conjugate(self) -> Self
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.
pub fn antipode(self) -> Self
Sourcepub fn get_generator_of_subgroup(log_2_size: u32) -> Self
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>
impl<F: IsField + HasCircleParams<F>> Add<&CirclePoint<F>> for CirclePoint<F>
Source§type Output = CirclePoint<F>
type Output = CirclePoint<F>
+
operator.Source§impl<F: IsField + HasCircleParams<F>> Add<CirclePoint<F>> for &CirclePoint<F>
impl<F: IsField + HasCircleParams<F>> Add<CirclePoint<F>> for &CirclePoint<F>
Source§type Output = CirclePoint<F>
type Output = CirclePoint<F>
+
operator.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)
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§impl<F: IsField + HasCircleParams<F>> Add for CirclePoint<F>
impl<F: IsField + HasCircleParams<F>> Add for CirclePoint<F>
Source§type Output = CirclePoint<F>
type Output = CirclePoint<F>
+
operator.Source§impl<F: IsField + HasCircleParams<F>> AddAssign<&CirclePoint<F>> for CirclePoint<F>
impl<F: IsField + HasCircleParams<F>> AddAssign<&CirclePoint<F>> for CirclePoint<F>
Source§fn add_assign(&mut self, rhs: &CirclePoint<F>)
fn add_assign(&mut self, rhs: &CirclePoint<F>)
+=
operation. Read moreSource§impl<F: IsField + HasCircleParams<F>> AddAssign for CirclePoint<F>
impl<F: IsField + HasCircleParams<F>> AddAssign for CirclePoint<F>
Source§fn add_assign(&mut self, rhs: CirclePoint<F>)
fn add_assign(&mut self, rhs: CirclePoint<F>)
+=
operation. Read moreSource§impl<F: Clone + IsField> Clone for CirclePoint<F>
impl<F: Clone + IsField> Clone for CirclePoint<F>
Source§fn clone(&self) -> CirclePoint<F>
fn clone(&self) -> CirclePoint<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§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.
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§impl<F: IsField + HasCircleParams<F>> Mul<u128> for CirclePoint<F>
impl<F: IsField + HasCircleParams<F>> Mul<u128> for CirclePoint<F>
Source§impl<F: IsField + HasCircleParams<F>> MulAssign<u128> for CirclePoint<F>
impl<F: IsField + HasCircleParams<F>> MulAssign<u128> for CirclePoint<F>
Source§fn mul_assign(&mut self, scalar: u128)
fn mul_assign(&mut self, scalar: u128)
*=
operation. Read moreSource§impl<F: IsField + HasCircleParams<F>> PartialEq for CirclePoint<F>
Equality between two cricle points.
impl<F: IsField + HasCircleParams<F>> PartialEq for CirclePoint<F>
Equality between two cricle points.
Auto Trait Implementations§
impl<F> Freeze for CirclePoint<F>
impl<F> RefUnwindSafe for CirclePoint<F>
impl<F> Send for CirclePoint<F>
impl<F> Sync for CirclePoint<F>
impl<F> Unpin for CirclePoint<F>
impl<F> UnwindSafe for CirclePoint<F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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