Trait libbgs::numbers::GroupElem

source ·
pub trait GroupElem: Clone + Eq {
    const ONE: Self;
    const SIZE: u128;
    const ONE_256: [Self; 256] = _;

    // Required method
    fn multiply(&self, other: &Self) -> Self;

    // Provided methods
    fn pow(&self, n: u128) -> Self { ... }
    fn inverse(&self) -> Self { ... }
    fn order<S>(&self) -> u128
       where Self: Factor<S> { ... }
}
Expand description

Types that represent the elements of a group. In order for a type to represent the elements of the group, the type must satisfy these axioms:

  • The type has a binary operator (multiply).
  • The type must have a const ONE
  • Every element of the type must have element given by inverse().

Required Associated Constants§

source

const ONE: Self

The unique identity element of this group.

source

const SIZE: u128

The size of the group this element belongs to.

Provided Associated Constants§

source

const ONE_256: [Self; 256] = _

👎Deprecated: To be replaced by inline const expressions once stabilized.

! 256 copies of Self::ONE in an array.

Required Methods§

source

fn multiply(&self, other: &Self) -> Self

Returns the product of two elements under the group binary operator. If you implement this trait, you must guarantee that the operation is associative; that is, a.multiply(b.multiply(c)) == a.multiply(b).multiply(c).

Provided Methods§

source

fn pow(&self, n: u128) -> Self

Raises this element to the power of n.

source

fn inverse(&self) -> Self

Returns the multiplicative inverse of this element. If you implement this trait, you must guarantee x.inverse().multiply(x) and x.multiply(x.inverse()) both evaluate to ONE.

source

fn order<S>(&self) -> u128where Self: Factor<S>,

Returns the order of this element, that is, the smallest positive power p for which a.pow(p).is_one() returns True.

Implementors§

source§

impl<S, const L: usize, C> GroupElem for SylowElem<S, L, C>where C: SylowDecomposable<S> + Eq,

source§

const ONE: Self = _

source§

const SIZE: u128 = C::SIZE

source§

impl<const P: u128> GroupElem for FpNum<P>

source§

const ONE: Self = _

source§

const SIZE: u128 = _

source§

impl<const P: u128> GroupElem for QuadNum<P>

source§

const ONE: Self = _

source§

const SIZE: u128 = _