|
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>
|
Functor representing the field embedding φ: SUBFIELD → SUPERFIELD, with reverse lookup. More...
#include <fields.hpp>
Public Member Functions | |
| Embedding () | |
| Constructs the embedding (cached on first instantiation per template arguments). | |
| constexpr SUPERFIELD | operator() (const SUBFIELD &sub) const |
| Apply φ: SUBFIELD → SUPERFIELD. | |
| constexpr SUBFIELD | extract (const SUPERFIELD &super) const |
| Reverse φ: find the unique s ∈ SUBFIELD with φ(s) == super. | |
Functor representing the field embedding φ: SUBFIELD → SUPERFIELD, with reverse lookup.
| SUBFIELD | Subfield (finite-field type) |
| SUPERFIELD | Superfield (finite-field type, must satisfy SubfieldOf<SUPERFIELD, SUBFIELD>) |
Maps zero and one identically and preserves addition and multiplication. The identity map on labels is tried first: it is the natural embedding whenever SUBFIELD sits in the tower that defines the labels of SUPERFIELD (same field, prime subfield, plain Ext towers), and it is the unique choice consistent with label-based conversions such as Ext(const Vector<B>&) and as_vector(). Only for relationships where labels do not correspond (Iso-mediated towers) the image of a multiplicative generator is selected among the generators of the unique subgroup of SUPERFIELD* of order |SUBFIELD| − 1; candidates are accepted only when φ(x + 1) = φ(x) + 1 for every x, which together with multiplicativity implies additivity. The table is computed once per template instantiation and cached. Construction uses O(q) memory and O(q) time in the identity case, O(q²) in the worst case, for q = |SUBFIELD|; applying the resulting map is O(1).
Forward map (operator()) is an O(1) array lookup; extract reverses it via linear search through the cached map. When SUPERFIELD is an CECCO::Iso, extract walks the MAIN representation first, then each of OTHERS, until it finds one that contains SUBFIELD.
| std::logic_error | if the declared finite-field relationship admits no additive embedding |
Definition at line 1322 of file fields.hpp.
| CECCO::Embedding< SUBFIELD, SUPERFIELD >::Embedding | ( | ) |
Constructs the embedding (cached on first instantiation per template arguments).
Definition at line 1358 of file fields.hpp.
|
constexpr |
Reverse φ: find the unique s ∈ SUBFIELD with φ(s) == super.
| std::invalid_argument | if super is not in the image of φ |
O(|SUBFIELD|) for regular fields; for Iso superfields, O(k · |SUBFIELD|) where k is the number of inspected components.
Definition at line 1365 of file fields.hpp.
|
inlineconstexpr |
Apply φ: SUBFIELD → SUPERFIELD.
Definition at line 1328 of file fields.hpp.