-
Group
: a generic group$(G, \cdot)$ where$G$ is a set and$\cdot$ is a binary operation. -
FiniteGroup
: a group with finite elements defined usingFinite
trait -
AbelianGroup
: group with commutative operation -
FiniteCyclicGroup
: a finite group with a generator.
Group
represents a group with finite elements. It defines a binary operation on the set of elements of the group.
IDENTITY
: The identity element of the group.inverse(&self) -> Self
: inverse of the element.operation(a: &Self, b: &Self) -> Self
: the operation of the group.scalar_mul(&self, scalar: &Self::Scalar)
: multiplication of the element by a scalar.
The structs that implement these traits are
MultiplicativePrimeGroup
The MultiplicativePrimeGroup
struct is a wrapper around a usize
that defines
pub struct MultiplicativePrimeGroup<const P: usize, const K: usize>(usize);
It uses compile time assertions to check that
Symmetric Group example showcases how Group
trait is implemented for any struct.