C(++)ECCO
C++ Error Control COding: a header-only library for ECC simulations and experiments, modeling complete coding systems across arbitrary finite fields and complex inter-field relationships - Christian Senger <senger@inue.uni-stuttgart.de>
Loading...
Searching...
No Matches
field_concepts_traits.hpp
Go to the documentation of this file.
1/**
2 * @file field_concepts_traits.hpp
3 * @brief Concepts, traits, and type utilities for finite field arithmetic
4 * @author Christian Senger <senger@inue.uni-stuttgart.de>
5 * @version 2.2.1
6 * @date 2026
7 *
8 * @copyright
9 * Copyright (c) 2026, Christian Senger <senger@inue.uni-stuttgart.de>
10 *
11 * Licensed for noncommercial use only, including academic teaching, research, and personal non-profit purposes.
12 * Commercial use is prohibited without a separate commercial license. See the [LICENSE](../../LICENSE) file in the
13 * repository root for full terms and how to request a commercial license.
14 *
15 *
16 * @section Description
17 *
18 * Conceptual foundation for the finite field arithmetic library: C++20 concepts and traits that
19 * constrain field types and let cross-field operations decide compatibility at compile time.
20 *
21 * Concepts visible to library users: @ref CECCO::FieldType, @ref CECCO::FiniteFieldType,
22 * @ref CECCO::SubfieldOf / @ref CECCO::ExtensionOf, @ref CECCO::Isomorphic,
23 * @ref CECCO::CoefficientType (@ref CECCO::Polynomial coefficient types), @ref CECCO::PolynomialType,
24 * @ref CECCO::ComponentType (@ref CECCO::Vector / @ref CECCO::Matrix component types),
25 * @ref CECCO::ReliablyComparableType, @ref CECCO::SignedIntType.
26 *
27 * Internals (in @c CECCO::details): the @c is_polynomial / @c coefficient_of traits behind the
28 * polynomial concepts, metafunctions that compute field-tower relationships (@c is_subfield_of,
29 * @c degree_over_prime, @c collect_subfields, @c largest_common_subfield_t), @c iso_info for
30 * Iso introspection, and the utilities @c pairwise_distinct_v and @c NonCopyable.
31 *
32 * @see @ref fields.hpp for the field classes (Fp, Ext, Iso, Rationals) that satisfy these concepts
33 */
34
35#ifndef FIELD_CONCEPTS_TRAITS_HPP
36#define FIELD_CONCEPTS_TRAITS_HPP
37
38#include <complex>
39#include <concepts>
40
41#include "helpers.hpp"
42/*
43//transitive
44#include <string>
45#include <type_traits>
46
47#include "InfInt.hpp"
48*/
49
50namespace CECCO {
51
52/**
53 * @brief LUT generation mode for field operations
54 */
55enum class LutMode {
56 CompileTime, ///< Generate LUTs at compile-time using constexpr (default)
57 RunTime ///< Generate LUTs at runtime using lazy initialization
58};
59
60namespace details {
61class Base;
62} // namespace details
63
64/**
65 * @concept FieldType
66 * @brief Concept for field types: full algebraic interface
67 *
68 * @tparam T Candidate type
69 *
70 * Requires: compound assignments `+=`, `āˆ’=`, `*=`, `/=`; equality `==`; unary `āˆ’`; default,
71 * copy, move, and `int` construction; assignment from `T` and from `int`; the property
72 * queries `is_zero()`, `has_positive_sign()`, `get_characteristic()`, `get_info()`; and the
73 * randomization methods `randomize()` / `randomize_force_change()`. The binary `+`, `āˆ’`, `*`,
74 * `/` come for free from the CRTP operators in @ref fields.hpp.
75 *
76 * @section Usage_Example
77 *
78 * @code{.cpp}
79 * template <FieldType F>
80 * F discriminant(const F& a, const F& b, const F& c) {
81 * return b * b - daa(a * c, 4);
82 * }
83 * @endcode
84 *
85 * @note Satisfied by @ref CECCO::Rationals, @ref CECCO::Fp, @ref CECCO::Ext, and @ref CECCO::Iso.
86 */
87template <typename T>
90 // Constructors (via constructibility checks)
91 requires std::constructible_from<T>; // Default constructor
92 requires std::copy_constructible<T>; // Copy constructor
93 requires std::move_constructible<T>; // Move constructor
94 requires std::constructible_from<T, int>; // From int constructor
95
96 // Assignment operators
97 { mutable_t = t } -> std::same_as<T&>; // Field element assignment
98 { mutable_t = 42 } -> std::same_as<T&>; // Integer assignment
99
100 // Compound assignment operators
101 { mutable_t += t } -> std::same_as<T&>;
102 { mutable_t -= t } -> std::same_as<T&>;
103 { mutable_t *= t } -> std::same_as<T&>;
104 { mutable_t /= t } -> std::same_as<T&>;
105
106 // Comparison operators
107 { t == t } -> std::same_as<bool>;
108
109 // Unary - operator
110 { -t } -> std::same_as<T>;
111
112 // Element properties
113 { t.is_zero() } -> std::same_as<bool>;
114 { t.has_positive_sign() } -> std::same_as<bool>;
117
118 // Randomization
121 };
122
123/**
124 * @concept FiniteFieldType
125 * @brief Refines @ref FieldType for finite fields š”½_{p^m}
126 *
127 * @tparam T Candidate type
128 *
129 * Adds: prime characteristic ≄ 2; field-structure queries `get_size()`, `get_m()`, `get_p()`,
130 * `get_q()`; static generator access via `T::get_generator()`; element-order queries
131 * `get_multiplicative_order()` and `get_additive_order()`.
132 *
133 * Cross-field constructors (embeddings between subfield and superfield) are expected but not
134 * enforced by the concept: they live in the concrete classes.
135 *
136 * @note Satisfied by @ref CECCO::Fp, @ref CECCO::Ext, @ref CECCO::Iso. Not by @ref CECCO::Rationals
137 * (characteristic 0).
138 */
139
140template <typename T>
155
156/**
157 * @concept SignedIntType
158 * @brief Standard signed integers or @c InfInt for arbitrary precision
159 *
160 * @tparam T Candidate type
161 *
162 * Satisfied by any `std::signed_integral` type (`int`, `long`, `long long`, …) and by
163 * @c InfInt. Used by @ref CECCO::Rationals so callers can trade speed for unbounded precision
164 * in numerator and denominator.
165 */
166template <typename T>
168
169template <SignedIntType T>
170class Rationals;
171
172/**
173 * @concept CoefficientType
174 * @brief Admissible coefficient type for @ref CECCO::Polynomial (scalar-like types)
175 *
176 * @tparam T Candidate type
177 *
178 * Satisfied by any @ref FieldType, by `double`, by `std::complex<double>`, and by any
179 * @ref SignedIntType. @ref CECCO::Vector and @ref CECCO::Matrix are templated on the wider
180 * @ref ComponentType, which additionally admits polynomial components.
181 */
182template <typename T>
184 FieldType<T> || std::same_as<T, double> || std::same_as<T, std::complex<double>> || SignedIntType<T>;
185
186template <CoefficientType T>
187class Polynomial;
188
189namespace details {
190
191/**
192 * @brief Detect whether T is a `Polynomial` specialization
193 *
194 * @tparam T Any type
195 *
196 * Primary template: `false`. The partial specialization for `Polynomial<C>` (any
197 * @ref CECCO::CoefficientType C) is `true`. This is the primitive that backs the user-facing
198 * @ref CECCO::PolynomialType concept.
199 */
200template <typename T>
202
203template <typename T>
205
206/// @brief Specialization of @ref is_polynomial for `Polynomial<C>`
207template <CoefficientType C>
209
210/**
211 * @brief Coefficient type of a `Polynomial`; identity for all other types
212 *
213 * @tparam T Any type
214 *
215 * `coefficient_of_t<Polynomial<C>>` is `C`, and `coefficient_of_t<T>` is `T` for every
216 * non-polynomial T. Lets a concept apply one scalar-level test uniformly to scalars and to
217 * polynomials over scalars (see @ref CECCO::ReliablyComparableType).
218 */
219template <typename T>
221 using type = T;
222};
223
224/// @brief Specialization of @ref coefficient_of for `Polynomial<C>`
225template <CoefficientType C>
227 using type = C;
228};
229
230template <typename T>
232
233} // namespace details
234
235/**
236 * @concept PolynomialType
237 * @brief T is a `Polynomial<C>` over some @ref CoefficientType C
238 *
239 * @tparam T Candidate type
240 */
241template <typename T>
243
244/**
245 * @concept ReliablyComparableType
246 * @brief Types whose `operator==` reflects mathematical equality
247 *
248 * @tparam T Candidate type
249 *
250 * Satisfied by @ref FiniteFieldType, @ref SignedIntType, `Rationals<InfInt>`, and by
251 * `Polynomial<C>` exactly when C is itself reliably comparable (polynomials are kept in
252 * canonical pruned form, so coefficient-wise comparison is mathematical equality). Excludes
253 * `double` and `std::complex<double>` (and polynomials over them) because rounding makes
254 * comparison unreliable. Used by algorithms that need stable equality (e.g. Hamming weight,
255 * structural matrix tests).
256 */
257template <typename T>
261
262/**
263 * @concept ComponentType
264 * @brief Admissible component type for @ref CECCO::Vector and @ref CECCO::Matrix
265 *
266 * @tparam T Candidate type
267 *
268 * Extends @ref CoefficientType by @ref PolynomialType, so vectors and matrices can hold
269 * polynomial components (e.g. `Matrix<Polynomial<Fp<2>>>`). Polynomial coefficients remain
270 * restricted to @ref CoefficientType, so nested polynomials such as
271 * `Polynomial<Polynomial<Fp<2>>>` stay unsupported by design.
272 */
273template <typename T>
275
276/**
277 * @concept BelongsTo
278 * @brief T is identical to at least one of `Types...`
279 *
280 * @tparam T Candidate type
281 * @tparam Types Parameter pack to test against
282 *
283 * Used to constrain @ref CECCO::Iso operators to its `OTHERS...` representations:
284 *
285 * @code{.cpp}
286 * template <BelongsTo<OTHERS...> OTHER>
287 * Iso& operator=(const OTHER& other);
288 * @endcode
289 */
290template <typename T, typename... Types>
292
293/**
294 * @def MOD
295 * @brief Alias for `std::array`, used to spell modulus polynomials in @ref CECCO::Ext
296 *
297 * Lets `Ext<F2, {1, 1, 1}>` deduce the array length from the brace-initialiser instead of
298 * requiring `std::array<int, 3>{…}`.
299 */
300#define MOD std::array
301
302template <uint16_t p>
303class Fp;
304
305template <FiniteFieldType B, MOD modulus, LutMode mode>
306class Ext;
307
308template <FiniteFieldType MAIN, FiniteFieldType... OTHERS>
309class Iso;
310
311/**
312 * @concept Isomorphic
313 * @brief A and B are finite fields of the same size (and thus isomorphic)
314 *
315 * @tparam A First field type
316 * @tparam B Second field type
317 *
318 * Two finite fields of the same cardinality are isomorphic. The check is on size only, the
319 * explicit isomorphism (a concrete field homomorphism) is computed by @ref CECCO::Isomorphism.
320 *
321 * @section Usage_Examples
322 *
323 * @code{.cpp}
324 * using F2 = Fp<2>;
325 * using F4_a = Ext<F2, {1, 1, 1}>; // š”½ā‚„ via x² + x + 1
326 * using F4_b = Ext<F2, {1, 0, 1}>; // š”½ā‚„ via x² + 1
327 * using F8 = Ext<F2, {1, 1, 0, 1}>;
328 * using F64_a = Ext<F8, {7, 1, 1}>;
329 * using F64_b = Ext<F4_a, {1, 2, 0, 1}>;
330 *
331 * static_assert(Isomorphic<F64_a, F64_b>); // same size, different constructions
332 * static_assert(Isomorphic<F4_a, F4_b>);
333 * static_assert(!Isomorphic<F4_a, F8>); // 4 ≠ 8
334 * @endcode
335 */
336template <typename A, typename B>
338
339namespace details {
340
341/**
342 * @brief Total extension degree of T over its prime field
343 *
344 * @tparam T Finite-field type
345 *
346 * Walks the construction tower and multiplies the local extension degree at each level. For
347 * `F256 = Ext<F16, …>`, `F16 = Ext<F4, …>`, `F4 = Ext<F2, …>` the result is 2 Ā· 2 Ā· 2 = 8.
348 * For an `Iso`, the value is taken from the MAIN representation (all are isomorphic).
349 */
350template <FiniteFieldType T>
352
353template <FiniteFieldType T>
355
356// Base case: Prime fields have degree 1 over themselves
357template <uint16_t p>
359 static constexpr size_t value = 1;
360};
361
362// Extension fields: multiply local extension degree by base field's total degree
363template <FiniteFieldType B, auto modulus, LutMode mode>
365 static constexpr size_t value = (modulus.size() - 1) * degree_over_prime<B>::value;
366};
367
368// Iso fields: use the total degree of the main field (all components are isomorphic)
372};
373
374/**
375 * @brief Construction-based subfield test: SUBFIELD reachable by descending SUPERFIELD's tower
376 *
377 * @tparam SUPERFIELD Finite-field type
378 * @tparam SUBFIELD Finite-field type
379 *
380 * The relationship is recorded by **construction**, not by mathematical containment. If `F16` is
381 * built directly as `Ext<F2, …>`, then `is_subfield_of_v<F16, F4>` is `false` even though
382 * mathematically š”½ā‚„ āŠ† š”½ā‚ā‚†: `F4` simply does not appear in `F16`'s construction. This is the
383 * primitive that backs the user-facing @ref CECCO::SubfieldOf concept.
384 */
385template <FiniteFieldType SUPERFIELD, FiniteFieldType SUBFIELD>
387
390
391// Prime field reflexivity: Fp<p> contains only itself
392template <uint16_t p>
393struct is_subfield_of<Fp<p>, Fp<p>> : std::true_type {};
394
395// General extension field case: SUB āŠ† Ext<B, modulus, mode> if SUB = B or SUB āŠ† B
399
400// Extension field reflexivity: Ext<B, modulus, mode> contains itself
403
404// Extension-to-extension: Ext<B_SUB, mod_SUB, mode_SUB> āŠ† Ext<B_SUP, mod_SUP, mode_SUP> if SUB = B_SUP or SUB āŠ† B_SUP
410
411// Iso super, non-Iso sub: SUB āŠ† Iso if SUB is a subfield of any component (covers reflexive
412// SUB == MAIN / SUB == one of OTHERS via the per-component reflexive specializations below).
416
417// Iso field reflexivity: Iso<MAIN, OTHERS...> contains itself
420
421// Cross-Iso subfield relationships: Check if any representation from SubIso is a subfield of any representation in
422// SuperIso
423template <FiniteFieldType SUP_MAIN, FiniteFieldType... SUP_OTHERS, FiniteFieldType SUB_MAIN,
424 FiniteFieldType... SUB_OTHERS>
425 requires(!std::is_same_v<Iso<SUP_MAIN, SUP_OTHERS...>, Iso<SUB_MAIN, SUB_OTHERS...>>)
427 private:
428 // Helper to check if a single sub-field is a subfield of any super-field representation
429 template <FiniteFieldType SubField>
430 static constexpr bool is_subfield_of_any_super_repr() {
432 }
433
434 // Check if SUB_MAIN is a subfield of any representation in SuperIso
436
437 // Check if any SUB_OTHERS is a subfield of any representation in SuperIso
438 static constexpr bool any_sub_others_in_super = (is_subfield_of_any_super_repr<SUB_OTHERS>() || ...);
439
440 public:
442};
443
444} // namespace details
445
446/**
447 * @concept SubfieldOf
448 * @brief SUBFIELD āŠ† SUPERFIELD as constructed in this library (Iso paths included)
449 *
450 * @tparam SUPERFIELD Larger field
451 * @tparam SUBFIELD Candidate smaller field
452 *
453 * Walks the construction tower of SUPERFIELD; for `Iso` operands, every representation is
454 * inspected, so a subfield reachable through any of MAIN / OTHERS counts. Reflexive:
455 * `SubfieldOf<F, F>` is always true.
456 *
457 * @warning This is the construction tower, not the mathematical tower. A field that exists
458 * mathematically between SUBFIELD and SUPERFIELD but was never constructed (or never bridged
459 * by an `Iso`) is invisible. Construct an `Iso` over equivalent representations to merge towers.
460 *
461 * @section Usage_Examples
462 *
463 * @code{.cpp}
464 * using F2 = Fp<2>;
465 * using F4_a = Ext<F2, {1, 1, 1}>;
466 * using F4_b = Ext<F2, {1, 0, 1}>;
467 * using F4_Iso = Iso<F4_a, F4_b>;
468 * using F16 = Ext<F4_Iso, {2, 1, 1}>;
469 *
470 * static_assert(SubfieldOf<F16, F4_Iso>); // direct construction
471 * static_assert(SubfieldOf<F16, F4_a>); // via Iso: F4_a in F4_Iso āŠ† F16
472 * static_assert(SubfieldOf<F16, F2>); // recursive descent
473 * @endcode
474 */
475template <typename SUPERFIELD, typename SUBFIELD>
477
478/**
479 * @concept ExtensionOf
480 * @brief Inverse of @ref SubfieldOf: `ExtensionOf<S, E>` iff `SubfieldOf<E, S>`
481 *
482 * @tparam S Smaller (base) field
483 * @tparam E Candidate larger field
484 *
485 * Same construction-vs-mathematical caveat as @ref SubfieldOf. Reflexive.
486 */
487template <typename S, typename E>
489
490namespace details {
491
492/**
493 * @brief Compile-time type list utility for subfield calculations
494 * @tparam Types Variadic list of types
495 */
496template <typename... Types>
497struct type_list {};
498
499/**
500 * @brief Concatenation of type_lists (duplicates preserved)
501 * @tparam Lists type_lists to concatenate
502 */
503template <typename... Lists>
504struct concat;
505
506template <>
507struct concat<> {
508 using type = type_list<>;
509};
510
511template <typename... Types>
512struct concat<type_list<Types...>> {
513 using type = type_list<Types...>;
514};
515
516template <typename... Types1, typename... Types2, typename... Rest>
517struct concat<type_list<Types1...>, type_list<Types2...>, Rest...> {
518 using type = typename concat<type_list<Types1..., Types2...>, Rest...>::type;
519};
520
521template <typename... Lists>
522using concat_t = typename concat<Lists...>::type;
523
524/**
525 * @brief Check if a type exists in a type_list
526 * @tparam T Type to search for
527 * @tparam List type_list to search in
528 */
529template <typename T, typename List>
530struct contains;
531
532template <typename T, typename... Types>
533struct contains<T, type_list<Types...>> : std::bool_constant<(std::is_same_v<T, Types> || ...)> {};
534
535template <typename T, typename List>
536constexpr bool contains_v = contains<T, List>::value;
537
538/**
539 * @brief Union of two type_lists (removes duplicates)
540 * @tparam List1 First type_list
541 * @tparam List2 Second type_list
542 */
543template <typename List1, typename List2>
545
546template <typename... Types1, typename... Types2>
547struct union_type_lists<type_list<Types1...>, type_list<Types2...>> {
548 private:
549 template <typename T>
551
552 public:
554};
555
556template <typename List1, typename List2>
557using union_type_lists_t = typename union_type_lists<List1, List2>::type;
558
559/**
560 * @brief Intersection of two type_lists
561 * @tparam List1 First type_list
562 * @tparam List2 Second type_list
563 */
564template <typename List1, typename List2>
566
567template <typename... Types1, typename... Types2>
568struct intersect_type_lists<type_list<Types1...>, type_list<Types2...>> {
569 private:
570 template <typename T>
572
573 public:
575};
576
577template <typename List1, typename List2>
578using intersect_type_lists_t = typename intersect_type_lists<List1, List2>::type;
579
580/**
581 * @brief Find the largest field (by get_size()) in a type_list
582 * @tparam List type_list of field types
583 */
584template <typename List>
586
587template <typename T>
589 using type = T;
590};
591
592template <typename T1, typename T2, typename... Rest>
593struct largest_field_in_list<type_list<T1, T2, Rest...>> {
594 private:
595 using larger = std::conditional_t<(T1::get_size() >= T2::get_size()), T1, T2>;
596
597 public:
599};
600
601template <typename List>
603
604/**
605 * @brief All subfields of F (including F itself), as a @ref type_list
606 *
607 * @tparam F Finite-field type
608 *
609 * Recurses through the construction tower: `Fp<p>` is the base case, `Ext<B, …>` extends
610 * `collect_subfields_t<B>` with itself, and `Iso<…>` unions the subfield lists of all its
611 * representations (and itself). Used by @ref largest_common_subfield_t.
612 */
613template <typename F>
615
616// Specialization for prime fields - base case
617template <uint16_t p>
619 using type = type_list<Fp<p>>;
620};
621
622// Specialization for extension fields - recursive case
623template <FiniteFieldType B, MOD modulus, LutMode mode>
624struct collect_subfields<Ext<B, modulus, mode>> {
626};
627
628// Helper to compute union of all subfields for Iso types
629template <typename... Types>
631
632template <>
634 using type = type_list<>;
635};
636
637template <typename First, typename... Rest>
638struct union_all_subfields<First, Rest...> {
639 using type =
641};
642
643// Specialization for isomorphic fields - union of all representations
644template <typename MAIN, typename... OTHERS>
649
650template <typename F>
652
653/**
654 * @brief Detect whether T is an `Iso` and expose its components
655 *
656 * @tparam T Any type
657 *
658 * Primary template: `is_iso = false`, `main_type = void`. The specialization for
659 * `Iso<MAIN, OTHERS...>` (below) sets `is_iso = true`, `main_type = MAIN`, and packages
660 * `OTHERS...` into `others_tuple`.
661 */
662template <typename T>
663struct iso_info {
664 static constexpr bool is_iso = false;
665 using main_type = void;
666};
667
668/// @brief Specialization of @ref iso_info for `Iso<MAIN, OTHERS...>`
669template <FiniteFieldType MAIN, FiniteFieldType... OTHERS>
670struct iso_info<Iso<MAIN, OTHERS...>> {
671 static constexpr bool is_iso = true;
674};
675
676/**
677 * @brief Largest field that appears as a subfield of both F and G
678 *
679 * @tparam F Finite-field type
680 * @tparam G Finite-field type (same characteristic as F; checked by `static_assert`)
681 *
682 * Computes the bridge field used by the cross-field constructors of @ref CECCO::Ext and
683 * @ref CECCO::Iso. Procedure: intersect `collect_subfields_t<F>` with `collect_subfields_t<G>`
684 * and pick the largest by `get_size()`. As a tiebreaker, if that largest field is isomorphic
685 * to an `Iso` operand, the `Iso` itself is returned instead, which preserves the merged-tower
686 * structure that the user explicitly built.
687 *
688 * @section Usage_Examples
689 *
690 * @code{.cpp}
691 * using F3 = Fp<3>;
692 * using F9 = Ext<F3, {2, 2, 1}>;
693 * using F81a = Ext<F3, {2, 1, 0, 0, 1}>; // direct F3 → F81
694 * using F81b = Ext<F9, {6, 0, 1}>; // F3 → F9 → F81
695 * using F27 = Ext<F3, {1, 2, 0, 1}>;
696 *
697 * using c1 = largest_common_subfield_t<F81a, F81b>; // F9
698 * using c2 = largest_common_subfield_t<F81a, F27>; // F3
699 * @endcode
700 */
701template <typename F, typename G>
703 static_assert(F::get_characteristic() == G::get_characteristic(), "Fields must have the same characteristic");
704
705 private:
710
711 template <typename Largest, typename Param1, typename Param2>
715
716 public:
718};
719
720template <typename F, typename G>
722
723/// @brief True iff T is not the same as any of `Types...`
724template <typename T, typename... Types>
725constexpr bool is_distinct_from_all = (!std::is_same_v<T, Types> && ...);
726
727/**
728 * @brief True iff all types in the pack are pairwise distinct
729 *
730 * @tparam Types Parameter pack
731 *
732 * Used by @ref CECCO::Iso to reject duplicate representations.
733 */
734template <typename... Types>
735constexpr bool pairwise_distinct_v = true;
736
737/// @brief Specialization of @ref pairwise_distinct_v splitting off the first type
738template <typename First, typename... Rest>
739constexpr bool pairwise_distinct_v<First, Rest...> =
740 is_distinct_from_all<First, Rest...> && pairwise_distinct_v<Rest...>;
741
742/**
743 * @brief Mixin that deletes the copy operations and defaults the move operations
744 *
745 * Inherit (protected) to mark a class movable but non-copyable.
746 */
748 protected:
749 constexpr NonCopyable() = default;
750 ~NonCopyable() = default;
751
752 // Delete copy operations
753 NonCopyable(const NonCopyable&) = delete;
754 NonCopyable& operator=(const NonCopyable&) = delete;
755
756 // Allow move operations by changing to default
759};
760} // namespace details
761
762} // namespace CECCO
763
764#endif
Extension field š”½_{q^m} ≅ B[x]/(f(x)), constructed from a base field and an irreducible monic modulus...
Definition fields.hpp:2244
Prime field š”½_p ≅ ℤ/pℤ
Definition fields.hpp:1663
Single logical field unifying several pairwise-isomorphic representations.
Definition fields.hpp:3159
Univariate polynomial p(x) = aā‚€ + a₁x + … + aā‚™xⁿ over a CECCO::CoefficientType.
Field of rational numbers ā„š = { p/q : p, q ∈ ℤ, q ≠ 0 } with selectable precision.
Definition fields.hpp:470
Tag base for the CRTP-protection idiom.
Definition fields.hpp:180
Mixin that deletes the copy operations and defaults the move operations.
NonCopyable(const NonCopyable &)=delete
NonCopyable & operator=(NonCopyable &&)=default
NonCopyable(NonCopyable &&)=default
constexpr NonCopyable()=default
NonCopyable & operator=(const NonCopyable &)=delete
T is identical to at least one of Types....
Admissible coefficient type for CECCO::Polynomial (scalar-like types).
Admissible component type for CECCO::Vector and CECCO::Matrix.
Inverse of SubfieldOf: ExtensionOf<S, E> iff SubfieldOf<E, S>.
Concept for field types: full algebraic interface.
Refines FieldType for finite fields š”½_{p^m}.
A and B are finite fields of the same size (and thus isomorphic).
T is a Polynomial<C> over some CoefficientType C.
Types whose operator== reflects mathematical equality.
Standard signed integers or InfInt for arbitrary precision.
SUBFIELD āŠ† SUPERFIELD as constructed in this library (Iso paths included).
#define MOD
Alias for std::array, used to spell modulus polynomials in CECCO::Ext.
Contains implementation details not to be exposed to the user. Functions and classes here may change ...
Definition blocks.hpp:59
typename intersect_type_lists< List1, List2 >::type intersect_type_lists_t
constexpr bool pairwise_distinct_v< First, Rest... >
Specialization of pairwise_distinct_v splitting off the first type.
constexpr bool is_polynomial_v
typename concat< Lists... >::type concat_t
typename largest_common_subfield< F, G >::type largest_common_subfield_t
constexpr bool is_subfield_of_v
constexpr bool is_distinct_from_all
True iff T is not the same as any of Types....
typename coefficient_of< T >::type coefficient_of_t
typename largest_field_in_list< List >::type largest_field_in_list_t
constexpr bool pairwise_distinct_v
True iff all types in the pack are pairwise distinct.
constexpr size_t degree_over_prime_v
typename collect_subfields< F >::type collect_subfields_t
typename union_type_lists< List1, List2 >::type union_type_lists_t
Provides a framework for error correcting codes.
Definition blocks.hpp:57
LutMode
LUT generation mode for field operations.
@ CompileTime
Generate LUTs at compile-time using constexpr (default).
@ RunTime
Generate LUTs at runtime using lazy initialization.
Specialization of coefficient_of for Polynomial<C>.
Coefficient type of a Polynomial; identity for all other types.
All subfields of F (including F itself), as a type_list.
typename concat< type_list< Types1..., Types2... >, Rest... >::type type
Concatenation of type_lists (duplicates preserved).
Check if a type exists in a type_list.
Total extension degree of T over its prime field.
Specialization of is_polynomial for Polynomial<C>.
Detect whether T is a Polynomial specialization.
Construction-based subfield test: SUBFIELD reachable by descending SUPERFIELD's tower.
Specialization of iso_info for Iso<MAIN, OTHERS...>.
Detect whether T is an Iso and expose its components.
Largest field that appears as a subfield of both F and G.
Find the largest field (by get_size()) in a type_list.
Compile-time type list utility for subfield calculations.
Union of two type_lists (removes duplicates).