|
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>
|
Single logical field unifying several pairwise-isomorphic representations. More...
#include <fields.hpp>

Public Types | |
| using | label_t = typename MAIN::label_t |
| using | BASE_FIELD = MAIN::BASE_FIELD |
Public Member Functions | |
| constexpr | Iso () noexcept |
| Default constructor: 0 (consistent across all representations). | |
| constexpr | Iso (int l) |
| Construct from int via the MAIN representation. | |
| constexpr | Iso (const MAIN &other) noexcept |
| Wrap a MAIN-representation element. | |
| constexpr | Iso (MAIN &&other) noexcept |
| Wrap a MAIN-representation rvalue. | |
| template<BelongsTo< OTHERS... > OTHER> | |
| constexpr | Iso (const OTHER &other) |
| Wrap an OTHERS element by converting to MAIN. | |
| template<BelongsTo< OTHERS... > OTHER> | |
| constexpr | Iso (OTHER &&other) |
| Wrap an OTHERS rvalue by converting to MAIN. | |
| constexpr | Iso (const Iso &other) noexcept=default |
| constexpr | Iso (Iso &&other) noexcept=default |
| template<FiniteFieldType T> | |
| Iso (const Vector< T > &v) | |
| Construct from a coefficient vector over a subfield T. | |
| template<FiniteFieldType B, MOD modulus, LutMode mode> | |
| Iso (const Ext< B, modulus, mode > &other) | |
| Cross-field conversion from an extension field. | |
| template<uint16_t p> requires SubfieldOf<Iso<MAIN, OTHERS...>, Fp<p>> && (!std::is_same_v<MAIN, Fp<p>>) && (!BelongsTo<Fp<p>, OTHERS...>) | |
| constexpr | Iso (const Fp< p > &other) |
| Embed a prime-field element when š½_p is a (possibly indirect) subfield of the Iso. | |
| template<FiniteFieldType OTHER_MAIN, FiniteFieldType... OTHER_OTHERS> | |
| Iso (const Iso< OTHER_MAIN, OTHER_OTHERS... > &other) | |
| Cross-field conversion from another Iso of the same characteristic. | |
| constexpr Iso | operator- () const |
| Additive inverse (delegates to MAIN). | |
| constexpr Iso & | operator+= (const Iso &other) |
| *this += other (delegates to MAIN) | |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| constexpr Iso & | operator+= (const OTHER &other) |
| *this += other after converting an OTHERS operand to MAIN | |
| constexpr Iso & | operator-= (const Iso &other) |
| *this -= other (delegates to MAIN) | |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| constexpr Iso & | operator-= (const OTHER &other) |
| *this -= other after converting an OTHERS operand to MAIN | |
| constexpr Iso & | operator*= (const Iso &other) |
| *this *= other (delegates to MAIN) | |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| constexpr Iso & | operator*= (const OTHER &other) |
| *this *= other after converting an OTHERS operand to MAIN | |
| constexpr Iso & | operator*= (int s) |
| Scalar multiplication by an int (delegates to MAIN). | |
| Iso & | operator/= (const Iso &other) |
| *this /= other; throws std::invalid_argument if other is zero | |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| Iso & | operator/= (const OTHER &other) |
| *this /= other after converting an OTHERS operand to MAIN; same exception | |
| template<typename TO> requires BelongsTo<TO, OTHERS...> | |
| constexpr TO | as () const |
| Project to a specific representation by applying the cached Isomorphism. | |
| constexpr const MAIN & | main () const noexcept |
| Read-only access to the underlying MAIN-representation element. | |
| constexpr bool | is_zero () const noexcept |
| constexpr bool | has_positive_sign () const noexcept |
| constexpr Iso & | randomize () |
| constexpr Iso & | randomize_force_change () |
| size_t | get_multiplicative_order () const |
| size_t | get_additive_order () const |
| constexpr auto | get_label () const noexcept |
| constexpr Iso & | erase () noexcept |
| Mark this element as erased (delegates to MAIN). | |
| constexpr Iso & | unerase () noexcept |
| Clear the erasure flag, resetting MAIN to its additive identity. | |
| constexpr bool | is_erased () const noexcept |
| Test whether this element is currently erased. | |
| constexpr Iso & | operator= (const Iso &other) |
| constexpr Iso & | operator= (Iso &&other) noexcept=default |
| constexpr Iso & | operator= (const MAIN &other) |
| Assign a MAIN-representation element directly. | |
| constexpr Iso & | operator= (int other) |
| Assign an int via MAIN. | |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| Iso & | operator= (const OTHER &other) |
| Assign from an OTHERS representation (copy-and-swap; same semantics as the constructor). | |
| template<uint16_t p> | |
| Iso & | operator= (const Fp< p > &other) |
| Assign from an Fp of matching characteristic (copy-and-swap). | |
| template<FiniteFieldType B, MOD ext_modulus, LutMode mode> | |
| Iso & | operator= (const Ext< B, ext_modulus, mode > &other) |
| Assign from an Ext of matching characteristic (copy-and-swap). | |
| template<FiniteFieldType OTHER_MAIN, FiniteFieldType... OTHER_OTHERS> requires (OTHER_MAIN::get_characteristic() == MAIN::get_characteristic()) && (!std::is_same_v<Iso<OTHER_MAIN, OTHER_OTHERS...>, Iso<MAIN, OTHERS...>>) | |
| Iso & | operator= (const Iso< OTHER_MAIN, OTHER_OTHERS... > &other) |
| Assign from another Iso of matching characteristic (copy-and-swap). | |
| constexpr bool | operator== (const Iso &other) const noexcept |
| constexpr bool | operator== (const MAIN &other) const noexcept |
| constexpr bool | operator!= (const Iso &other) const |
| constexpr bool | operator!= (const MAIN &other) const |
| template<FiniteFieldType T> requires ((SubfieldOf<MAIN, T> || ((SubfieldOf<OTHERS, T>) || ...))) && (!std::is_same_v<Iso<MAIN, OTHERS...>, T>) | |
| Vector< T > | as_vector () const |
| Coordinate vector over a subfield T of MAIN or any OTHERS representation. | |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| Iso< MAIN, OTHERS... > & | operator= (const OTHER &other) |
| template<uint16_t p> | |
| Iso< MAIN, OTHERS... > & | operator= (const Fp< p > &other) |
| template<FiniteFieldType B, MOD ext_modulus, LutMode mode> | |
| Iso< MAIN, OTHERS... > & | operator= (const Ext< B, ext_modulus, mode > &other) |
| template<FiniteFieldType OTHER_MAIN, FiniteFieldType... OTHER_OTHERS> requires (OTHER_MAIN::get_characteristic() == MAIN::get_characteristic()) && (!std::is_same_v<Iso<OTHER_MAIN, OTHER_OTHERS...>, Iso<MAIN, OTHERS...>>) | |
| Iso< MAIN, OTHERS... > & | operator= (const Iso< OTHER_MAIN, OTHER_OTHERS... > &other) |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| constexpr Iso< MAIN, OTHERS... > & | operator+= (const OTHER &other) |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| constexpr Iso< MAIN, OTHERS... > & | operator-= (const OTHER &other) |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| constexpr Iso< MAIN, OTHERS... > & | operator*= (const OTHER &other) |
| template<typename OTHER> requires BelongsTo<OTHER, OTHERS...> | |
| Iso< MAIN, OTHERS... > & | operator/= (const OTHER &other) |
Static Public Member Functions | |
| static const std::string | get_info () |
| static constexpr size_t | get_characteristic () noexcept |
| static constexpr size_t | get_p () noexcept |
| static constexpr size_t | get_q () noexcept |
| static constexpr size_t | get_m () noexcept |
| static constexpr size_t | get_size () noexcept |
| static constexpr Polynomial< BASE_FIELD > | get_modulus () |
| static constexpr Iso | get_generator () |
| static constexpr bool | is_constexpr_ready () noexcept |
| Inherits constexpr-readiness from MAIN (OTHERS may differ; isomorphisms run at runtime). | |
| static constexpr bool | ready () |
| static constexpr auto & | lut_add () |
| static constexpr auto & | lut_neg () |
| static constexpr auto & | lut_mul () |
| static constexpr auto & | lut_inv () |
| static constexpr label_t | lut_add (label_t a, label_t b) |
| static constexpr label_t | lut_mul (label_t a, label_t b) |
| static constexpr label_t | lut_neg (label_t a) |
| static constexpr label_t | lut_inv (label_t a) |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Iso &iso) |
Additional Inherited Members | |
| Protected Member Functions inherited from CECCO::details::Base | |
| Base ()=default | |
Single logical field unifying several pairwise-isomorphic representations.
| MAIN | Primary representation; satisfies CECCO::FiniteFieldType. All operations are forwarded to it, so the Iso inherits its CECCO::LutMode and performance characteristics. |
| OTHERS | Alternative representations of the same abstract field (each Isomorphic<MAIN, OTHER>). Pairwise distinctness is enforced at instantiation. |
Useful for merging two construction towers that meet at the same mathematical field ā e.g. š½āā built once from š½ā and once from š½ā. With those two Ext types wrapped in an Iso, CECCO::SubfieldOf can recognise both as containing š½ā and š½ā, which makes the cross-field constructors of CECCO::Ext and CECCO::Iso pick optimal paths. The OTHERS representations may use different LUT modes from MAIN; isomorphism conversions across representations happen at runtime via cached maps.
Definition at line 3115 of file fields.hpp.
| using CECCO::Iso< MAIN, OTHERS >::BASE_FIELD = MAIN::BASE_FIELD |
Definition at line 3127 of file fields.hpp.
| using CECCO::Iso< MAIN, OTHERS >::label_t = typename MAIN::label_t |
Definition at line 3126 of file fields.hpp.
|
inlineconstexprnoexcept |
Default constructor: 0 (consistent across all representations).
Definition at line 3134 of file fields.hpp.
|
inlineconstexpr |
Construct from int via the MAIN representation.
Definition at line 3137 of file fields.hpp.
|
inlineconstexprnoexcept |
Wrap a MAIN-representation element.
Definition at line 3140 of file fields.hpp.
|
inlineconstexprnoexcept |
Wrap a MAIN-representation rvalue.
Definition at line 3142 of file fields.hpp.
|
inlineconstexpr |
Wrap an OTHERS element by converting to MAIN.
Definition at line 3146 of file fields.hpp.
|
inlineconstexpr |
Wrap an OTHERS rvalue by converting to MAIN.
Definition at line 3149 of file fields.hpp.
|
constexprdefaultnoexcept |
|
constexprdefaultnoexcept |
| CECCO::Iso< MAIN, OTHERS >::Iso | ( | const Vector< T > & | v | ) |
Construct from a coefficient vector over a subfield T.
| T | Subfield type |
| std::invalid_argument | if no representation in the Iso can be constructed from v |
Tries MAIN first, then each of OTHERS until one succeeds. Round-trip correct with as_vector.
Definition at line 3694 of file fields.hpp.
| CECCO::Iso< MAIN, OTHERS >::Iso | ( | const Ext< B, modulus, mode > & | other | ) |
Cross-field conversion from an extension field.
Delegates to MAIN(Ext(...)) (or to an OTHERS representation when MAIN cannot reach the source directly), then stores the MAIN result. All paths supported by the Ext-from-Ext constructor are available ā direct copy, isomorphism, upcast, downcast, cross-tower bridge.
| std::invalid_argument | if no conversion path exists (typically a downcast where the source value lies outside the target) |
Definition at line 3443 of file fields.hpp.
|
constexpr |
Embed a prime-field element when š½_p is a (possibly indirect) subfield of the Iso.
Picks the first of MAIN / OTHERS that contains š½_p and embeds via the corresponding Embedding. The constraints rule out the trivial cases where š½_p already appears literally as MAIN or one of OTHERS (those use the wrapping constructors above).
Definition at line 3515 of file fields.hpp.
| CECCO::Iso< MAIN, OTHERS >::Iso | ( | const Iso< OTHER_MAIN, OTHER_OTHERS... > & | other | ) |
Cross-field conversion from another Iso of the same characteristic.
Same four-way decision as the Ext cross-field constructor ā direct isomorphism, upcast, downcast, or bridge via details::largest_common_subfield_t ā but extended to handle every (MAIN, OTHERS...) pairing on both sides. Each side's representation tower is searched for the cheapest viable path.
| std::invalid_argument | on a downcast whose source value lies outside the target |
Definition at line 3550 of file fields.hpp.
|
constexpr |
Project to a specific representation by applying the cached Isomorphism.
| TO | Target representation, one of the OTHERS |
Definition at line 3790 of file fields.hpp.
| Vector< T > CECCO::Iso< MAIN, OTHERS >::as_vector | ( | ) | const |
Coordinate vector over a subfield T of MAIN or any OTHERS representation.
| T | Subfield reachable from MAIN or one of OTHERS |
Definition at line 3811 of file fields.hpp.
|
constexprnoexcept |
Mark this element as erased (delegates to MAIN).
Definition at line 3843 of file fields.hpp.
|
inline |
Definition at line 3267 of file fields.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 3331 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3343 of file fields.hpp.
|
static |
Definition at line 3802 of file fields.hpp.
|
inlineconstexprnoexcept |
Definition at line 3269 of file fields.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 3337 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3341 of file fields.hpp.
|
inline |
Definition at line 3265 of file fields.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 3333 of file fields.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 3335 of file fields.hpp.
|
inlinestaticconstexprnoexcept |
Definition at line 3339 of file fields.hpp.
|
inlineconstexprnoexcept |
Definition at line 3253 of file fields.hpp.
|
inlinestaticconstexprnoexcept |
Inherits constexpr-readiness from MAIN (OTHERS may differ; isomorphisms run at runtime).
Definition at line 3346 of file fields.hpp.
|
inlineconstexprnoexcept |
Test whether this element is currently erased.
Definition at line 3282 of file fields.hpp.
|
inlineconstexprnoexcept |
Definition at line 3251 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3353 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3363 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3359 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3369 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3357 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3365 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3355 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3367 of file fields.hpp.
|
inlineconstexprnoexcept |
Read-only access to the underlying MAIN-representation element.
Definition at line 3249 of file fields.hpp.
|
inlineconstexpr |
Definition at line 3319 of file fields.hpp.
|
inlineconstexpr |
Definition at line 3321 of file fields.hpp.
|
constexpr |
*this *= other (delegates to MAIN)
Definition at line 3753 of file fields.hpp.
|
constexpr |
Definition at line 3760 of file fields.hpp.
|
constexpr |
*this *= other after converting an OTHERS operand to MAIN
|
constexpr |
Scalar multiplication by an int (delegates to MAIN).
Definition at line 3768 of file fields.hpp.
|
constexpr |
*this += other (delegates to MAIN)
Definition at line 3723 of file fields.hpp.
|
constexpr |
Definition at line 3730 of file fields.hpp.
|
constexpr |
*this += other after converting an OTHERS operand to MAIN
|
inlineconstexpr |
Additive inverse (delegates to MAIN).
Definition at line 3206 of file fields.hpp.
|
constexpr |
*this -= other (delegates to MAIN)
Definition at line 3738 of file fields.hpp.
|
constexpr |
Definition at line 3745 of file fields.hpp.
|
constexpr |
*this -= other after converting an OTHERS operand to MAIN
| Iso< MAIN, OTHERS... > & CECCO::Iso< MAIN, OTHERS >::operator/= | ( | const Iso< MAIN, OTHERS > & | other | ) |
*this /= other; throws std::invalid_argument if other is zero
Definition at line 3774 of file fields.hpp.
| Iso< MAIN, OTHERS... > & CECCO::Iso< MAIN, OTHERS >::operator/= | ( | const OTHER & | other | ) |
Definition at line 3781 of file fields.hpp.
| Iso & CECCO::Iso< MAIN, OTHERS >::operator/= | ( | const OTHER & | other | ) |
*this /= other after converting an OTHERS operand to MAIN; same exception
| Iso< MAIN, OTHERS... > & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const Ext< B, ext_modulus, mode > & | other | ) |
Definition at line 3424 of file fields.hpp.
| Iso & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const Ext< B, ext_modulus, mode > & | other | ) |
Assign from an Ext of matching characteristic (copy-and-swap).
| Iso< MAIN, OTHERS... > & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const Fp< p > & | other | ) |
Definition at line 3415 of file fields.hpp.
| Iso & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const Fp< p > & | other | ) |
Assign from an Fp of matching characteristic (copy-and-swap).
|
constexpr |
Definition at line 3385 of file fields.hpp.
| Iso< MAIN, OTHERS... > & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const Iso< OTHER_MAIN, OTHER_OTHERS... > & | other | ) |
Definition at line 3432 of file fields.hpp.
| Iso & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const Iso< OTHER_MAIN, OTHER_OTHERS... > & | other | ) |
Assign from another Iso of matching characteristic (copy-and-swap).
|
constexpr |
Assign a MAIN-representation element directly.
Definition at line 3391 of file fields.hpp.
| Iso< MAIN, OTHERS... > & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const OTHER & | other | ) |
Definition at line 3404 of file fields.hpp.
| Iso & CECCO::Iso< MAIN, OTHERS >::operator= | ( | const OTHER & | other | ) |
Assign from an OTHERS representation (copy-and-swap; same semantics as the constructor).
|
constexpr |
Assign an int via MAIN.
Definition at line 3397 of file fields.hpp.
|
constexprdefaultnoexcept |
|
inlineconstexprnoexcept |
Definition at line 3315 of file fields.hpp.
|
inlineconstexprnoexcept |
Definition at line 3317 of file fields.hpp.
|
inlineconstexpr |
Definition at line 3255 of file fields.hpp.
|
inlineconstexpr |
Definition at line 3260 of file fields.hpp.
|
inlinestaticconstexpr |
Definition at line 3349 of file fields.hpp.
|
constexprnoexcept |
Clear the erasure flag, resetting MAIN to its additive identity.
Definition at line 3849 of file fields.hpp.
|
friend |
Definition at line 3326 of file fields.hpp.