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.1.5
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::ComponentType (the umbrella for @ref CECCO::Vector / @ref CECCO::Polynomial /
24 * @ref CECCO::Matrix component types), @ref CECCO::ReliablyComparableType, @ref CECCO::SignedIntType.
25 *
26 * Internals (in @c CECCO::details): metafunctions that compute field-tower relationships
27 * (@c is_subfield_of, @c collect_subfields, @c largest_common_subfield_t) and
28 * @c iso_info for Iso introspection.
29 *
30 * @see @ref fields.hpp for the field classes (Fp, Ext, Iso, Rationals) that satisfy these concepts
31 */
32
33#ifndef FIELD_CONCEPTS_TRAITS_HPP
34#define FIELD_CONCEPTS_TRAITS_HPP
35
36#include <complex>
37#include <concepts>
38
39#include "helpers.hpp"
40/*
41//transitive
42#include <string>
43#include <type_traits>
44
45#include "InfInt.hpp"
46*/
47
48namespace CECCO {
49
50/**
51 * @brief LUT generation mode for field operations
52 */
53enum class LutMode {
54 CompileTime, ///< Generate LUTs at compile-time using constexpr (default)
55 RunTime ///< Generate LUTs at runtime using lazy initialization
56};
57
58namespace details {
59// Forward declaration for Base (full definition in fields.hpp)
60class Base;
61} // namespace details
62
63/**
64 * @concept FieldType
65 * @brief Concept for field types: full algebraic interface
66 *
67 * @tparam T Candidate type
68 *
69 * Requires: compound assignments `+=`, `โˆ’=`, `*=`, `/=`; equality `==`; unary `โˆ’`; default,
70 * copy, move, and `int` construction; assignment from `T` and from `int`; the property
71 * queries `is_zero()`, `has_positive_sign()`, `get_characteristic()`, `get_info()`; and the
72 * randomization methods `randomize()` / `randomize_force_change()`. The binary `+`, `โˆ’`, `*`,
73 * `/` come for free from the CRTP operators in @ref fields.hpp.
74 *
75 * @section Usage_Example
76 *
77 * @code{.cpp}
78 * template <FieldType F>
79 * F discriminant(const F& a, const F& b, const F& c) {
80 * return b * b - F(4) * a * c;
81 * }
82 * @endcode
83 *
84 * @note Satisfied by @ref CECCO::Rationals, @ref CECCO::Fp, @ref CECCO::Ext, and @ref CECCO::Iso.
85 */
86template <typename T>
89 // Constructors (via constructibility checks)
90 requires std::constructible_from<T>; // Default constructor
91 requires std::copy_constructible<T>; // Copy constructor
92 requires std::move_constructible<T>; // Move constructor
93 requires std::constructible_from<T, int>; // From int constructor
94
95 // Assignment operators
96 { mutable_t = t } -> std::same_as<T&>; // Field element assignment
97 { mutable_t = 42 } -> std::same_as<T&>; // Integer assignment
98
99 // Compound assignment operators
100 { mutable_t += t } -> std::same_as<T&>;
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
105 // Comparison operators
106 { t == t } -> std::same_as<bool>;
107
108 // Unary - operator
109 { -t } -> std::same_as<T>;
110
111 // Element properties
112 { t.is_zero() } -> std::same_as<bool>;
113 { t.has_positive_sign() } -> std::same_as<bool>;
116
117 // Randomization
120 };
121
122/**
123 * @concept FiniteFieldType
124 * @brief Refines @ref FieldType for finite fields ๐”ฝ_{p^m}
125 *
126 * @tparam T Candidate type
127 *
128 * Adds: prime characteristic โ‰ฅ 2; field-structure queries `get_size()`, `get_m()`, `get_p()`,
129 * `get_q()`; static generator access via `T::get_generator()`; element-order queries
130 * `get_multiplicative_order()` and `get_additive_order()`.
131 *
132 * Cross-field constructors (embeddings between subfield and superfield) are expected but not
133 * enforced by the concept โ€” they live in the concrete classes.
134 *
135 * @note Satisfied by @ref CECCO::Fp, @ref CECCO::Ext, @ref CECCO::Iso. Not by @ref CECCO::Rationals
136 * (characteristic 0).
137 */
138
139template <typename T>
154
155/**
156 * @concept SignedIntType
157 * @brief Standard signed integers or @c InfInt for arbitrary precision
158 *
159 * @tparam T Candidate type
160 *
161 * Satisfied by any type with `std::is_integral_v<T> && std::is_signed_v<T>` (i.e. `int`,
162 * `long`, `long long`, โ€ฆ) and by @c InfInt. Used by @ref CECCO::Rationals so callers can
163 * trade speed for unbounded precision in numerator and denominator.
164 */
165template <typename T>
167
168// Forward declaration for Rationals (full definition in fields.hpp)
169template <SignedIntType T>
170class Rationals;
171
172/**
173 * @concept ReliablyComparableType
174 * @brief Types whose `operator==` reflects mathematical equality
175 *
176 * @tparam T Candidate type
177 *
178 * Satisfied by @ref FiniteFieldType, @ref SignedIntType, and `Rationals<InfInt>`. Excludes
179 * `double` and `std::complex<double>` because rounding makes comparison unreliable. Used by
180 * algorithms that need stable equality (e.g. Hamming weight, structural matrix tests).
181 */
182template <typename T>
184
185/**
186 * @concept ComponentType
187 * @brief Admissible component type for @ref CECCO::Vector, @ref CECCO::Polynomial, @ref CECCO::Matrix
188 *
189 * @tparam T Candidate type
190 *
191 * Satisfied by any @ref FieldType, by `double`, by `std::complex<double>`, and by any
192 * @ref SignedIntType. This is the umbrella concept used to template the linear-algebra and
193 * polynomial classes.
194 */
195template <typename T>
197 FieldType<T> || std::same_as<T, double> || std::same_as<T, std::complex<double>> || SignedIntType<T>;
198
199/**
200 * @concept BelongsTo
201 * @brief T is identical to at least one of `Types...`
202 *
203 * @tparam T Candidate type
204 * @tparam Types Parameter pack to test against
205 *
206 * Used to constrain @ref CECCO::Iso operators to its `OTHERS...` representations:
207 *
208 * @code{.cpp}
209 * template <BelongsTo<OTHERS...> OTHER>
210 * Iso& operator=(const OTHER& other);
211 * @endcode
212 */
213template <typename T, typename... Types>
215
216/**
217 * @def MOD
218 * @brief Alias for `std::array`, used to spell modulus polynomials in @ref CECCO::Ext
219 *
220 * Lets `Ext<F2, {1, 1, 1}>` deduce the array length from the brace-initialiser instead of
221 * requiring `std::array<int, 3>{โ€ฆ}`.
222 */
223#define MOD std::array
224
225// Forward declaration for Fp (full definition in fields.hpp)
226template <uint16_t p>
227class Fp;
228
229// Forward declaration for Ext (full definition in fields.hpp)
230template <FiniteFieldType B, MOD modulus, LutMode mode>
231class Ext;
232
233// Forward declaration for Iso (full definition in fields.hpp)
234template <FiniteFieldType MAIN, FiniteFieldType... OTHERS>
235class Iso;
236
237/**
238 * @concept Isomorphic
239 * @brief A and B are finite fields of the same size (and thus isomorphic)
240 *
241 * @tparam A First field type
242 * @tparam B Second field type
243 *
244 * Two finite fields of the same cardinality are isomorphic. The check is on size only โ€” the
245 * explicit isomorphism (a concrete field homomorphism) is computed by @ref CECCO::Isomorphism.
246 *
247 * @section Usage_Examples
248 *
249 * @code{.cpp}
250 * using F2 = Fp<2>;
251 * using F4_a = Ext<F2, {1, 1, 1}>; // ๐”ฝโ‚„ via xยฒ + x + 1
252 * using F4_b = Ext<F2, {1, 0, 1}>; // ๐”ฝโ‚„ via xยฒ + 1
253 * using F8 = Ext<F2, {1, 1, 0, 1}>;
254 * using F64_a = Ext<F8, {7, 1, 1}>;
255 * using F64_b = Ext<F4_a, {1, 2, 0, 1}>;
256 *
257 * static_assert(Isomorphic<F64_a, F64_b>); // same size, different constructions
258 * static_assert(Isomorphic<F4_a, F4_b>);
259 * static_assert(!Isomorphic<F4_a, F8>); // 4 โ‰  8
260 * @endcode
261 */
262template <typename A, typename B>
264
265namespace details {
266
267/**
268 * @brief Total extension degree of T over its prime field
269 *
270 * @tparam T Finite-field type
271 *
272 * Walks the construction tower and multiplies the local extension degree at each level. For
273 * `F256 = Ext<F16, โ€ฆ>`, `F16 = Ext<F4, โ€ฆ>`, `F4 = Ext<F2, โ€ฆ>` the result is 2 ยท 2 ยท 2 = 8.
274 * For an `Iso`, the value is taken from the MAIN representation (all are isomorphic).
275 */
276template <FiniteFieldType T>
278
279template <FiniteFieldType T>
281
282// Base case: Prime fields have degree 1 over themselves
283template <uint16_t p>
285 static constexpr size_t value = 1;
286};
287
288// Extension fields: multiply local extension degree by base field's total degree
289template <FiniteFieldType B, auto modulus, LutMode mode>
291 static constexpr size_t value = (modulus.size() - 1) * degree_over_prime<B>::value;
292};
293
294// Iso fields: use the total degree of the main field (all components are isomorphic)
298};
299
300/**
301 * @brief Construction-based subfield test: SUBFIELD reachable by descending SUPERFIELD's tower
302 *
303 * @tparam SUPERFIELD Finite-field type
304 * @tparam SUBFIELD Finite-field type
305 *
306 * The relationship is recorded by **construction**, not by mathematical containment. If `F16` is
307 * built directly as `Ext<F2, โ€ฆ>`, then `is_subfield_of_v<F16, F4>` is `false` even though
308 * mathematically ๐”ฝโ‚„ โІ ๐”ฝโ‚โ‚† โ€” `F4` simply does not appear in `F16`'s construction. This is the
309 * primitive that backs the user-facing @ref CECCO::SubfieldOf concept.
310 */
311template <FiniteFieldType SUPERFIELD, FiniteFieldType SUBFIELD>
313
316
317// Prime field reflexivity: Fp<p> contains only itself
318template <uint16_t p>
319struct is_subfield_of<Fp<p>, Fp<p>> : std::true_type {};
320
321// General extension field case: SUB โІ Ext<B, modulus, mode> if SUB = B or SUB โІ B
325
326// Extension field reflexivity: Ext<B, modulus, mode> contains itself
329
330// 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
336
337// Iso super, non-Iso sub: SUB โІ Iso if SUB is a subfield of any component (covers reflexive
338// SUB == MAIN / SUB == one of OTHERS via the per-component reflexive specializations below).
342
343// Iso field reflexivity: Iso<MAIN, OTHERS...> contains itself
346
347// Cross-Iso subfield relationships: Check if any representation from SubIso is a subfield of any representation in
348// SuperIso
349template <FiniteFieldType SUP_MAIN, FiniteFieldType... SUP_OTHERS, FiniteFieldType SUB_MAIN,
350 FiniteFieldType... SUB_OTHERS>
351 requires(!std::is_same_v<Iso<SUP_MAIN, SUP_OTHERS...>, Iso<SUB_MAIN, SUB_OTHERS...>>)
353 private:
354 // Helper to check if a single sub-field is a subfield of any super-field representation
355 template <FiniteFieldType SubField>
356 static constexpr bool is_subfield_of_any_super_repr() {
358 }
359
360 // Check if SUB_MAIN is a subfield of any representation in SuperIso
362
363 // Check if any SUB_OTHERS is a subfield of any representation in SuperIso
364 static constexpr bool any_sub_others_in_super = (is_subfield_of_any_super_repr<SUB_OTHERS>() || ...);
365
366 public:
368};
369
370} // namespace details
371
372/**
373 * @concept SubfieldOf
374 * @brief SUBFIELD โІ SUPERFIELD as constructed in this library (Iso paths included)
375 *
376 * @tparam SUPERFIELD Larger field
377 * @tparam SUBFIELD Candidate smaller field
378 *
379 * Walks the construction tower of SUPERFIELD; for `Iso` operands, every representation is
380 * inspected, so a subfield reachable through any of MAIN / OTHERS counts. Reflexive:
381 * `SubfieldOf<F, F>` is always true.
382 *
383 * @warning This is the construction tower, not the mathematical tower. A field that exists
384 * mathematically between SUBFIELD and SUPERFIELD but was never constructed (or never bridged
385 * by an `Iso`) is invisible. Construct an `Iso` over equivalent representations to merge towers.
386 *
387 * @section Usage_Examples
388 *
389 * @code{.cpp}
390 * using F2 = Fp<2>;
391 * using F4_a = Ext<F2, {1, 1, 1}>;
392 * using F4_b = Ext<F2, {1, 0, 1}>;
393 * using F4_Iso = Iso<F4_a, F4_b>;
394 * using F16 = Ext<F4_Iso, {2, 1, 1}>;
395 *
396 * static_assert(SubfieldOf<F16, F4_Iso>); // direct construction
397 * static_assert(SubfieldOf<F16, F4_a>); // via Iso: F4_a in F4_Iso โІ F16
398 * static_assert(SubfieldOf<F16, F2>); // recursive descent
399 * @endcode
400 */
401template <typename SUPERFIELD, typename SUBFIELD>
403
404/**
405 * @concept ExtensionOf
406 * @brief Inverse of @ref SubfieldOf: `ExtensionOf<S, E>` iff `SubfieldOf<E, S>`
407 *
408 * @tparam S Smaller (base) field
409 * @tparam E Candidate larger field
410 *
411 * Same construction-vs-mathematical caveat as @ref SubfieldOf. Reflexive.
412 */
413template <typename S, typename E>
415
416namespace details {
417
418/**
419 * @brief Compile-time type list utility for subfield calculations
420 * @tparam Types Variadic list of types
421 */
422template <typename... Types>
423struct type_list {
424 static constexpr size_t size = sizeof...(Types);
425};
426
427/**
428 * @brief Check if a type exists in a type_list
429 * @tparam T Type to search for
430 * @tparam List type_list to search in
431 */
432template <typename T, typename List>
433struct contains;
434
435template <typename T, typename... Types>
436struct contains<T, type_list<Types...>> : std::bool_constant<(std::is_same_v<T, Types> || ...)> {};
437
438template <typename T, typename List>
439constexpr bool contains_v = contains<T, List>::value;
440
441/**
442 * @brief Union of two type_lists (removes duplicates)
443 * @tparam List1 First type_list
444 * @tparam List2 Second type_list
445 */
446template <typename List1, typename List2>
448
449template <typename... Types1, typename... Types2>
450struct union_type_lists<type_list<Types1...>, type_list<Types2...>> {
451 private:
452 template <typename T>
454
455 template <typename... Lists>
456 struct concat;
457
458 template <typename... Types>
459 struct concat<type_list<Types...>> {
460 using type = type_list<Types...>;
461 };
462
463 template <typename... Types1_, typename... Types2_, typename... Rest>
464 struct concat<type_list<Types1_...>, type_list<Types2_...>, Rest...> {
465 using type = typename concat<type_list<Types1_..., Types2_...>, Rest...>::type;
466 };
467
468 public:
470};
471
472template <typename List1, typename List2>
473using union_type_lists_t = typename union_type_lists<List1, List2>::type;
474
475/**
476 * @brief Intersection of two type_lists
477 * @tparam List1 First type_list
478 * @tparam List2 Second type_list
479 */
480template <typename List1, typename List2>
482
483template <typename... Types1, typename... Types2>
484struct intersect_type_lists<type_list<Types1...>, type_list<Types2...>> {
485 private:
486 template <typename T>
488
489 template <typename... Lists>
490 struct concat;
491
492 template <typename... Types>
493 struct concat<type_list<Types...>> {
494 using type = type_list<Types...>;
495 };
496
497 template <typename... Types1_, typename... Types2_, typename... Rest>
498 struct concat<type_list<Types1_...>, type_list<Types2_...>, Rest...> {
499 using type = typename concat<type_list<Types1_..., Types2_...>, Rest...>::type;
500 };
501
502 public:
503 using type = typename concat<add_if_in_both<Types1>...>::type;
504};
505
506template <typename List1, typename List2>
507using intersect_type_lists_t = typename intersect_type_lists<List1, List2>::type;
508
509/**
510 * @brief Find the largest field (by get_size()) in a type_list
511 * @tparam List type_list of field types
512 */
513template <typename List>
515
516template <typename T>
518 using type = T;
519};
520
521template <typename T1, typename T2, typename... Rest>
522struct largest_field_in_list<type_list<T1, T2, Rest...>> {
523 private:
524 using larger = std::conditional_t<(T1::get_size() >= T2::get_size()), T1, T2>;
525
526 public:
528};
529
530template <typename List>
532
533/**
534 * @brief All subfields of F (including F itself), as a @ref type_list
535 *
536 * @tparam F Finite-field type
537 *
538 * Recurses through the construction tower: `Fp<p>` is the base case, `Ext<B, โ€ฆ>` extends
539 * `collect_subfields_t<B> โˆช {B}` with itself, and `Iso<โ€ฆ>` unions the subfield lists of all
540 * its representations. Used by @ref largest_common_subfield_t.
541 */
542template <typename F>
544
545// Specialization for prime fields - base case
546template <uint16_t p>
548 using type = type_list<Fp<p>>;
549};
550
551// Specialization for extension fields - recursive case
552template <FiniteFieldType B, MOD modulus, LutMode mode>
553struct collect_subfields<Ext<B, modulus, mode>> {
554 private:
555 using base_subfields = typename collect_subfields<B>::type;
557
558 public:
560};
561
562// Helper to compute union of all subfields for Iso types
563template <typename... Types>
565
566template <>
568 using type = type_list<>;
569};
570
571template <typename T>
573 using type = typename collect_subfields<T>::type;
574};
575
576template <typename T1, typename T2, typename... Rest>
577struct union_all_subfields<T1, T2, Rest...> {
578 using type =
580};
581
582// Specialization for isomorphic fields - union of all representations
583template <typename MAIN, typename... OTHERS>
593
594template <typename F>
596
597/**
598 * @brief Largest field that appears as a subfield of both F and G
599 *
600 * @tparam F Finite-field type
601 * @tparam G Finite-field type (same characteristic as F; checked by `static_assert`)
602 *
603 * Computes the bridge field used by the cross-field constructors of @ref CECCO::Ext and
604 * @ref CECCO::Iso. Procedure: intersect `collect_subfields_t<F>` with `collect_subfields_t<G>`
605 * and pick the largest by `get_size()`. As a tiebreaker, if that largest field is isomorphic
606 * to an `Iso` operand, the `Iso` itself is returned instead โ€” this preserves the merged-tower
607 * structure that the user explicitly built.
608 *
609 * @section Usage_Examples
610 *
611 * @code{.cpp}
612 * using F3 = Fp<3>;
613 * using F9 = Ext<F3, {2, 2, 1}>;
614 * using F81a = Ext<F3, {2, 1, 0, 0, 1}>; // direct F3 โ†’ F81
615 * using F81b = Ext<F9, {6, 0, 1}>; // F3 โ†’ F9 โ†’ F81
616 * using F27 = Ext<F3, {1, 2, 0, 1}>;
617 *
618 * using c1 = largest_common_subfield_t<F81a, F81b>; // F9
619 * using c2 = largest_common_subfield_t<F81a, F27>; // F3
620 * @endcode
621 */
622template <typename F, typename G>
624 static_assert(F::get_characteristic() == G::get_characteristic(), "Fields must have the same characteristic");
625
626 private:
631
632 // Detect Iso types
633 template <typename T>
634 struct is_iso : std::false_type {};
635 template <typename MAIN, typename... OTHERS>
636 struct is_iso<Iso<MAIN, OTHERS...>> : std::true_type {};
637
638 template <typename Largest, typename Param1, typename Param2>
639 using prefer_iso =
642
643 public:
645};
646
647template <typename F, typename G>
649
650/**
651 * @brief Detect whether T is an `Iso` and expose its components
652 *
653 * @tparam T Any type
654 *
655 * Primary template: `is_iso = false`, `main_type = void`. The specialization for
656 * `Iso<MAIN, OTHERS...>` (below) sets `is_iso = true`, `main_type = MAIN`, and packages
657 * `OTHERS...` into `others_tuple`.
658 */
659template <typename T>
660struct iso_info {
661 static constexpr bool is_iso = false;
662 using main_type = void;
663};
664
665/// @brief Specialization of @ref iso_info for `Iso<MAIN, OTHERS...>`
666template <FiniteFieldType MAIN, FiniteFieldType... OTHERS>
667struct iso_info<Iso<MAIN, OTHERS...>> {
668 static constexpr bool is_iso = true;
671};
672
673/// @brief True iff T is not the same as any of `Types...`
674template <typename T, typename... Types>
675constexpr bool is_distinct_from_all = (!std::is_same_v<T, Types> && ...);
676
677/**
678 * @brief True iff all types in the pack are pairwise distinct
679 *
680 * @tparam Types Parameter pack
681 * @return `true` if no two types in `Types...` are identical
682 *
683 * Used by @ref CECCO::Iso to reject duplicate representations.
684 */
685template <typename... Types>
686constexpr bool pairwise_distinct() {
687 if constexpr (sizeof...(Types) <= 1) {
688 return true;
689 } else {
690 return []<typename First, typename... Rest>(std::type_identity<First>, std::type_identity<Rest>...) {
691 return details::is_distinct_from_all<First, Rest...> && pairwise_distinct<Rest...>();
692 }(std::type_identity<Types>{}...);
693 }
694}
695
696/**
697 * @brief Mixin that deletes the copy operations and defaults the move operations
698 *
699 * Inherit (protected) to mark a class movable but non-copyable.
700 */
702 protected:
703 constexpr NonCopyable() = default;
704 ~NonCopyable() = default;
705
706 // Delete copy operations
707 NonCopyable(const NonCopyable&) = delete;
708 NonCopyable& operator=(const NonCopyable&) = delete;
709
710 // Allow move operations by changing to default
713};
714} // namespace details
715
716} // namespace CECCO
717
718#endif
Extension field ๐”ฝ_{q^m} โ‰… B[x]/(f(x)), constructed from a base field and an irreducible monic modulus...
Definition fields.hpp:2221
Prime field ๐”ฝ_p โ‰… โ„ค/pโ„ค
Definition fields.hpp:1647
Single logical field unifying several pairwise-isomorphic representations.
Definition fields.hpp:3115
Field of rational numbers โ„š = { p/q : p, q โˆˆ โ„ค, q โ‰  0 } with selectable precision.
Definition fields.hpp:471
Tag base for the CRTP-protection idiom.
Definition fields.hpp:181
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 component type for CECCO::Vector, CECCO::Polynomial, 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).
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
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 largest_field_in_list< List >::type largest_field_in_list_t
constexpr size_t degree_over_prime_v
typename collect_subfields< F >::type collect_subfields_t
constexpr bool pairwise_distinct()
True iff all types in the pack are pairwise distinct.
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.
All subfields of F (including F itself), as a type_list.
Check if a type exists in a type_list.
Total extension degree of T over its prime field.
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.
typename collect_subfields< T >::type type
Union of two type_lists (removes duplicates).