\(\mathbb{Z}/N\mathbb{Z}\) as a total finite cyclic ring.
More...
|
|
using | machine_type = decltype(N) |
|
using | Domain = Modular |
| using | wide_type |
|
|
constexpr | Modular (machine_type v=0) |
| constexpr Modular | inverse () const |
| | The multiplicative inverse on a prime modulus, \(a^{N-2}\) (Fermat): ℤ/p is the field 𝔽ₚ.
|
|
|
static constexpr Modular | generator () |
|
static constexpr Modular | successor (Modular a) |
|
|
static constexpr machine_type | modulus = N |
| | The modulus N, as a value.
|
|
|
constexpr friend Modular | operator+ (Modular a, Modular b) |
|
constexpr friend Modular | operator- (Modular a, Modular b) |
|
constexpr friend Modular | operator* (Modular a, Modular b) |
| constexpr friend Modular | operator/ (Modular a, Modular b) |
| | Division on a prime modulus: multiplication by the inverse.
|
|
constexpr friend bool | operator== (Modular a, Modular b) |
|
constexpr friend std::weak_ordering | constant_order (Modular a, Modular b) |
| | The structural order of residues as constants of a term (#884, canonical's sort key): their stored representatives compared. No order of the ring: ℤ/N has none compatible with its operations.
|
template<auto N>
struct dedekind::morphologies::Modular< N >
\(\mathbb{Z}/N\mathbb{Z}\) as a total finite cyclic ring.
cyclic__The_Modular_Species
Relocated from dedekind.category:species into dedekind.morphologies:cyclic to live alongside the IsCyclic concept and its sibling carriers. The type satisfies both morphologies::IsCyclic (via the Domain / generator() / successor() member API) and dedekind::category::IsCyclicGroup<Modular<N>, std::plus<Modular<N>>> (via the trait specialisations below).
◆ wide_type
Initial value:
std::conditional_t<(N == 1 ||
static_cast<std::uint64_t>(N - 1) <=
std::numeric_limits<std::uint64_t>::max() /
static_cast<std::uint64_t>(N - 1)),
unsigned long long, unsigned __int128>
◆ inverse()
The multiplicative inverse on a prime modulus, \(a^{N-2}\) (Fermat): ℤ/p is the field 𝔽ₚ.
- Returns
- the element whose product with this one is 1.
- Exceptions
-
| std::domain_error | for 0, which has no inverse. |
◆ operator/
template<auto N>
| friend Modular operator/ |
( |
Modular< N > | a, |
|
|
Modular< N > | b ) |
|
friend |
Division on a prime modulus: multiplication by the inverse.
- Returns
- \(a \cdot b^{-1}\).
- Exceptions
-
| std::domain_error | when b is 0. |
The documentation for this struct was generated from the following file: