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
CECCO::details Namespace Reference

Contains implementation details not to be exposed to the user. Functions and classes here may change without notice. More...

Classes

class  BlockProcessor
 CRTP base providing element-wise, vector, and matrix operator() overloads. More...
struct  degree_over_prime
 Total extension degree of T over its prime field. More...
struct  degree_over_prime< Fp< p > >
struct  degree_over_prime< Ext< B, modulus, mode > >
struct  degree_over_prime< Iso< MAIN, OTHERS... > >
struct  is_subfield_of
 Construction-based subfield test: SUBFIELD reachable by descending SUPERFIELD's tower. More...
struct  is_subfield_of< Fp< p >, Fp< p > >
struct  is_subfield_of< Ext< B, modulus, mode >, SUB >
struct  is_subfield_of< Ext< B, modulus, mode >, Ext< B, modulus, mode > >
struct  is_subfield_of< Ext< B_SUP, modulus_SUP, mode_SUP >, Ext< B_SUB, modulus_SUB, mode_SUB > >
struct  is_subfield_of< Iso< MAIN, OTHERS... >, SUB >
struct  is_subfield_of< Iso< MAIN, OTHERS... >, Iso< MAIN, OTHERS... > >
struct  is_subfield_of< Iso< SUP_MAIN, SUP_OTHERS... >, Iso< SUB_MAIN, SUB_OTHERS... > >
struct  type_list
 Compile-time type list utility for subfield calculations. More...
struct  contains
 Check if a type exists in a type_list. More...
struct  contains< T, type_list< Types... > >
struct  union_type_lists
 Union of two type_lists (removes duplicates). More...
struct  union_type_lists< type_list< Types1... >, type_list< Types2... > >
struct  intersect_type_lists
 Intersection of two type_lists. More...
struct  intersect_type_lists< type_list< Types1... >, type_list< Types2... > >
struct  largest_field_in_list
 Find the largest field (by get_size()) in a type_list. More...
struct  largest_field_in_list< type_list< T > >
struct  largest_field_in_list< type_list< T1, T2, Rest... > >
struct  collect_subfields
 All subfields of F (including F itself), as a type_list. More...
struct  collect_subfields< Fp< p > >
struct  collect_subfields< Ext< B, modulus, mode > >
struct  union_all_subfields
struct  union_all_subfields<>
struct  union_all_subfields< T >
struct  union_all_subfields< T1, T2, Rest... >
struct  collect_subfields< Iso< MAIN, OTHERS... > >
struct  largest_common_subfield
 Largest field that appears as a subfield of both F and G. More...
struct  iso_info
 Detect whether T is an Iso and expose its components. More...
struct  iso_info< Iso< MAIN, OTHERS... > >
 Specialization of iso_info for Iso<MAIN, OTHERS...>. More...
class  NonCopyable
 Mixin that deletes the copy operations and defaults the move operations. More...
class  Base
 Tag base for the CRTP-protection idiom. More...
class  Field
 CRTP base documenting the interface every field type must provide. More...
struct  Lut1D
 1D lookup table for unary field operations (negation, inversion, order) More...
struct  Lut2D
 2D lookup table for commutative binary operations, optionally compressed More...
struct  Lut2Dcoeff
 Lookup table mapping each extension-field label to its base-field coefficient vector. More...
struct  LutHolderNoProvider
 Holds a LUT generated by F() (no dependencies); selects compile-time or lazy storage. More...
struct  LutHolderNoProvider< LutType, F, LutMode::CompileTime >
 CompileTime specialisation: table is a constexpr static member. More...
struct  LutHolderNoProvider< LutType, F, LutMode::RunTime >
 RunTime specialisation: thread-safe lazy initialisation on first access. More...
struct  LutHolder
 Holds a LUT generated by F(P); P provides a dependency table. More...
struct  LutHolder< LutType, ProviderLutType, P, F, LutMode::CompileTime >
 CompileTime specialisation: table baked into the binary. More...
struct  LutHolder< LutType, ProviderLutType, P, F, LutMode::RunTime >
 RunTime specialisation: thread-safe lazy initialisation, dependency resolved on first access. More...
struct  IsomorphismPair
 Shared static storage of the forward and reverse maps for the isomorphism A โ†” B. More...
struct  CacheEntry
 Cache entry specification. More...
class  Cache
 Heterogeneous cache indexed by entry ID. More...
class  OnceCache
 Thread-safe single-value cache. More...
struct  Vertex
 Vertex in one trellis layer. More...
struct  Edge
 Edge between two adjacent trellis layers. More...
struct  FiniteFieldHasher

Typedefs

template<typename T, typename ElementType>
using SameTypeProcessor = BlockProcessor<T, ElementType, ElementType>
 CRTP base for blocks where input and output element types coincide.
template<typename T>
using EncoderProcessor = BlockProcessor<T, Fp<2>, std::complex<double>>
 CRTP base for blocks mapping bits to complex symbols (e.g. NRZ/BPSK modulation).
template<typename T>
using DecoderProcessor = BlockProcessor<T, std::complex<double>, Fp<2>>
 CRTP base for blocks mapping complex symbols back to bits (hard demod).
template<typename T>
using LLRProcessor = BlockProcessor<T, std::complex<double>, double>
 CRTP base for blocks producing log-likelihood ratios from complex symbols.
template<typename List1, typename List2>
using union_type_lists_t = typename union_type_lists<List1, List2>::type
template<typename List1, typename List2>
using intersect_type_lists_t = typename intersect_type_lists<List1, List2>::type
template<typename List>
using largest_field_in_list_t = typename largest_field_in_list<List>::type
template<typename F>
using collect_subfields_t = typename collect_subfields<F>::type
template<typename F, typename G>
using largest_common_subfield_t = typename largest_common_subfield<F, G>::type

Enumerations

enum  matrix_type_t : uint8_t {
  Generic , Zero , Diagonal , Identity ,
  Vandermonde , Toeplitz
}
 Matrix structural type tag for optimization (internal). More...

Functions

template<FiniteFieldType T>
InfInt A (size_t n, size_t d, InfInt w)
template<FieldType T>
Matrix< T > LDC_G (const Matrix< T > &G_U, const Matrix< T > &G_V)
bool validate (const std::vector< size_t > &v, std::size_t n)
template<typename... Types>
constexpr bool pairwise_distinct ()
 True iff all types in the pack are pairwise distinct.
template<uint16_t q, uint8_t m, size_t SIZE>
static size_t constexpr integer_from_coeffs (const std::array< size_t, SIZE > &coeffs) noexcept
 Encode polynomial coefficients (low-to-high) as a base-q integer label.
template<typename LabelType, LabelType FieldSize>
constexpr auto compute_multiplicative_orders (const Lut2D< LabelType, FieldSize > &mul_lut)
 Build the table of multiplicative orders for all elements of ๐”ฝ_Q.
template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
constexpr auto compute_multiplicative_inverses_direct ()
 Build multiplicative-inverse table for ๐”ฝ_p via extended Euclidean algorithm.
template<typename LabelType, LabelType FieldSize>
constexpr auto compute_multiplicative_inverses_search (const Lut2D< LabelType, FieldSize > &mul_lut)
 Build multiplicative-inverse table by searching the multiplication LUT.
template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
constexpr auto compute_additive_inverses_direct ()
 Build additive-inverse (negation) table for ๐”ฝ_p.
template<typename LabelType, LabelType FieldSize>
constexpr auto compute_additive_inverses_search (const Lut2D< LabelType, FieldSize > &add_lut)
 Build additive-inverse table by searching the addition LUT.
template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
constexpr auto compute_modular_addition_table ()
 Build the addition table for ๐”ฝ_p: lut_add(a, b) = (a + b) mod p.
template<typename F>
constexpr F::label_t compute_primitive_root ()
 Smallest primitive root of F* by direct power enumeration.
template<typename LabelType, LabelType FieldSize, typename LutCoeffType, uint8_t ExtensionDegree, typename BaseFieldType>
constexpr auto compute_polynomial_addition_table (const LutCoeffType &lut_coeff)
 Build the addition table for ๐”ฝ_{q^m} via coefficient-wise base-field addition.
template<typename FieldType>
size_t calculate_multiplicative_order (const FieldType &element)
 Multiplicative order of element by repeated multiplication.
template<typename LabelType, LabelType FieldSize>
constexpr LabelType find_generator (const Lut1D< LabelType, FieldSize > &lut_mul_ord)
 First element with multiplicative order Q โˆ’ 1 (a generator of ๐”ฝ_Q*).
template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
constexpr auto compute_modular_multiplication_table ()
 Build the multiplication table for ๐”ฝ_p: lut_mul(a, b) = (a ยท b) mod p.
template<typename LabelType, LabelType FieldSize, typename LutCoeffType, uint8_t ExtensionDegree, typename BaseFieldType, auto Modulus>
constexpr auto compute_polynomial_multiplication_table (const LutCoeffType &lut_coeff)
 Build the multiplication table for ๐”ฝ_{q^m}: polynomial multiply, then reduce mod f(x).
constexpr double floor_constexpr (double x)
 Constexpr floor function.
std::string basename (const char *path)

Variables

const int index = std::ios_base::xalloc()
template<FiniteFieldType T>
constexpr size_t degree_over_prime_v = degree_over_prime<T>::value
template<FiniteFieldType SUPER, FiniteFieldType SUB>
constexpr bool is_subfield_of_v = is_subfield_of<SUPER, SUB>::value
template<typename T, typename List>
constexpr bool contains_v = contains<T, List>::value
template<typename T, typename... Types>
constexpr bool is_distinct_from_all = (!std::is_same_v<T, Types> && ...)
 True iff T is not the same as any of Types....
template<typename LutType, LutType(*)() F>
constexpr LutType LutHolderNoProvider< LutType, F, LutMode::CompileTime >::lut
template<typename LutType, typename ProviderLutType, const ProviderLutType &(*)() P, LutType(*)(const ProviderLutType &(*)()) F>
constexpr LutType LutHolder< LutType, ProviderLutType, P, F, LutMode::CompileTime >::lut
static const uint8_t colormap [64][3]

Detailed Description

Contains implementation details not to be exposed to the user. Functions and classes here may change without notice.

Typedef Documentation

◆ collect_subfields_t

template<typename F>
using CECCO::details::collect_subfields_t = typename collect_subfields<F>::type

Definition at line 595 of file field_concepts_traits.hpp.

◆ DecoderProcessor

template<typename T>
using CECCO::details::DecoderProcessor = BlockProcessor<T, std::complex<double>, Fp<2>>

CRTP base for blocks mapping complex symbols back to bits (hard demod).

Definition at line 187 of file blocks.hpp.

◆ EncoderProcessor

template<typename T>
using CECCO::details::EncoderProcessor = BlockProcessor<T, Fp<2>, std::complex<double>>

CRTP base for blocks mapping bits to complex symbols (e.g. NRZ/BPSK modulation).

Definition at line 183 of file blocks.hpp.

◆ intersect_type_lists_t

template<typename List1, typename List2>
using CECCO::details::intersect_type_lists_t = typename intersect_type_lists<List1, List2>::type

Definition at line 507 of file field_concepts_traits.hpp.

◆ largest_common_subfield_t

template<typename F, typename G>
using CECCO::details::largest_common_subfield_t = typename largest_common_subfield<F, G>::type

Definition at line 648 of file field_concepts_traits.hpp.

◆ largest_field_in_list_t

template<typename List>
using CECCO::details::largest_field_in_list_t = typename largest_field_in_list<List>::type

Definition at line 531 of file field_concepts_traits.hpp.

◆ LLRProcessor

template<typename T>
using CECCO::details::LLRProcessor = BlockProcessor<T, std::complex<double>, double>

CRTP base for blocks producing log-likelihood ratios from complex symbols.

Definition at line 191 of file blocks.hpp.

◆ SameTypeProcessor

template<typename T, typename ElementType>
using CECCO::details::SameTypeProcessor = BlockProcessor<T, ElementType, ElementType>

CRTP base for blocks where input and output element types coincide.

Definition at line 179 of file blocks.hpp.

◆ union_type_lists_t

template<typename List1, typename List2>
using CECCO::details::union_type_lists_t = typename union_type_lists<List1, List2>::type

Definition at line 473 of file field_concepts_traits.hpp.

Enumeration Type Documentation

◆ matrix_type_t

Matrix structural type tag for optimization (internal).

Maintained automatically by Matrix<T> operations; mutations that break a structure demote the tag to Generic. Specialized algorithms dispatch on this tag to avoid full O(mn) traversals when possible.

Enumerator
Generic 

Generic matrix with arbitrary elements.

Zero 

Zero matrix with all elements equal to zero.

Diagonal 

Diagonal matrix (square) with non-zero elements only on the main diagonal.

Identity 

Identity matrix with ones on diagonal and zeros elsewhere.

Vandermonde 

Vandermonde matrix with arithmetic progressions (of pairwise distinct elements) in columns.

Toeplitz 

Toeplitz matrix T_{i,j} = t_{i-j} with constant diagonals.

Definition at line 88 of file matrices.hpp.

Function Documentation

◆ A()

template<FiniteFieldType T>
InfInt CECCO::details::A ( size_t n,
size_t d,
InfInt w )

Definition at line 58 of file code_bounds.hpp.

Here is the call graph for this function:

◆ basename()

std::string CECCO::details::basename ( const char * path)
inline

Definition at line 589 of file helpers.hpp.

◆ calculate_multiplicative_order()

template<typename FieldType>
size_t CECCO::details::calculate_multiplicative_order ( const FieldType & element)

Multiplicative order of element by repeated multiplication.

Exceptions
std::invalid_argumentif element is zero

Single-element runtime path; batch precomputation lives in compute_multiplicative_orders. Order always divides Q โˆ’ 1.

Definition at line 1048 of file fields.hpp.

◆ compute_additive_inverses_direct()

template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
auto CECCO::details::compute_additive_inverses_direct ( )
constexpr

Build additive-inverse (negation) table for ๐”ฝ_p.

Direct formula: โˆ’0 = 0, โˆ’a = p โˆ’ a otherwise. Prime-field path; extension fields use compute_additive_inverses_search.

Definition at line 940 of file fields.hpp.

◆ compute_additive_inverses_search()

template<typename LabelType, LabelType FieldSize>
auto CECCO::details::compute_additive_inverses_search ( const Lut2D< LabelType, FieldSize > & add_lut)
constexpr

Build additive-inverse table by searching the addition LUT.

Used for extension fields. Symmetry a + b = 0 โ‡’ b + a = 0 fills two entries per match.

Definition at line 953 of file fields.hpp.

◆ compute_modular_addition_table()

template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
auto CECCO::details::compute_modular_addition_table ( )
constexpr

Build the addition table for ๐”ฝ_p: lut_add(a, b) = (a + b) mod p.

Stores the upper triangle only (commutativity). Extension-field analogue: compute_polynomial_addition_table.

Definition at line 974 of file fields.hpp.

◆ compute_modular_multiplication_table()

template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
auto CECCO::details::compute_modular_multiplication_table ( )
constexpr

Build the multiplication table for ๐”ฝ_p: lut_mul(a, b) = (a ยท b) mod p.

Stores the upper triangle only (commutativity). Extension-field analogue: compute_polynomial_multiplication_table.

Definition at line 1078 of file fields.hpp.

◆ compute_multiplicative_inverses_direct()

template<typename LabelType, LabelType FieldSize>
requires (is_prime<LabelType>(FieldSize))
auto CECCO::details::compute_multiplicative_inverses_direct ( )
constexpr

Build multiplicative-inverse table for ๐”ฝ_p via extended Euclidean algorithm.

Sentinel: lut_inv[0] == 0. Prime-field path; for extension fields use compute_multiplicative_inverses_search.

Definition at line 896 of file fields.hpp.

◆ compute_multiplicative_inverses_search()

template<typename LabelType, LabelType FieldSize>
auto CECCO::details::compute_multiplicative_inverses_search ( const Lut2D< LabelType, FieldSize > & mul_lut)
constexpr

Build multiplicative-inverse table by searching the multiplication LUT.

Used for extension fields, where extended Euclidean over the prime is not applicable. Exploits the symmetry a ยท b = 1 โ‡’ b ยท a = 1 to fill two entries per match.

Definition at line 917 of file fields.hpp.

◆ compute_multiplicative_orders()

template<typename LabelType, LabelType FieldSize>
auto CECCO::details::compute_multiplicative_orders ( const Lut2D< LabelType, FieldSize > & mul_lut)
constexpr

Build the table of multiplicative orders for all elements of ๐”ฝ_Q.

Each entry is the smallest k > 0 with a^k == 1; element 0 carries the sentinel order 0. All orders divide Q โˆ’ 1.

Definition at line 872 of file fields.hpp.

◆ compute_polynomial_addition_table()

template<typename LabelType, LabelType FieldSize, typename LutCoeffType, uint8_t ExtensionDegree, typename BaseFieldType>
auto CECCO::details::compute_polynomial_addition_table ( const LutCoeffType & lut_coeff)
constexpr

Build the addition table for ๐”ฝ_{q^m} via coefficient-wise base-field addition.

Each element is a polynomial over ๐”ฝ_q; addition reduces to base-field addition on the coefficient vectors taken from lut_coeff.

Definition at line 1017 of file fields.hpp.

◆ compute_polynomial_multiplication_table()

template<typename LabelType, LabelType FieldSize, typename LutCoeffType, uint8_t ExtensionDegree, typename BaseFieldType, auto Modulus>
auto CECCO::details::compute_polynomial_multiplication_table ( const LutCoeffType & lut_coeff)
constexpr

Build the multiplication table for ๐”ฝ_{q^m}: polynomial multiply, then reduce mod f(x).

f(x) = Modulus must be monic and irreducible over ๐”ฝ_q. Reducibility is detected during table construction (a non-zero label that maps to 0 is impossible in a field) and surfaces as std::invalid_argument.

Exceptions
std::invalid_argumentif Modulus is not irreducible over the base field

Definition at line 1102 of file fields.hpp.

◆ compute_primitive_root()

template<typename F>
F::label_t CECCO::details::compute_primitive_root ( )
constexpr

Smallest primitive root of F* by direct power enumeration.

For each candidate g โˆˆ {2, โ€ฆ, pโˆ’1} walks g, gยฒ, โ€ฆ, g^{pโˆ’2}; g is primitive iff none of those equals 1. Evaluated at compile time via F's constexpr operator*=.

Definition at line 991 of file fields.hpp.

◆ find_generator()

template<typename LabelType, LabelType FieldSize>
LabelType CECCO::details::find_generator ( const Lut1D< LabelType, FieldSize > & lut_mul_ord)
constexpr

First element with multiplicative order Q โˆ’ 1 (a generator of ๐”ฝ_Q*).

Definition at line 1066 of file fields.hpp.

◆ floor_constexpr()

double CECCO::details::floor_constexpr ( double x)
constexpr

Constexpr floor function.

Parameters
xFloating-point value
Returns
Floor of x (largest integer โ‰ค x)

Alternative to std::floor for constant evaluation.

Note
Returns double, matching std::floor.

Definition at line 362 of file helpers.hpp.

Here is the caller graph for this function:

◆ integer_from_coeffs()

template<uint16_t q, uint8_t m, size_t SIZE>
size_t constexpr CECCO::details::integer_from_coeffs ( const std::array< size_t, SIZE > & coeffs)
staticconstexprnoexcept

Encode polynomial coefficients (low-to-high) as a base-q integer label.

Template Parameters
qBase field size
mExtension degree (number of coefficients used)
SIZELength of coeffs (must be โ‰ฅ m)

Definition at line 786 of file fields.hpp.

◆ LDC_G()

template<FieldType T>
Matrix< T > CECCO::details::LDC_G ( const Matrix< T > & G_U,
const Matrix< T > & G_V )

Definition at line 3432 of file codes.hpp.

◆ pairwise_distinct()

template<typename... Types>
bool CECCO::details::pairwise_distinct ( )
constexpr

True iff all types in the pack are pairwise distinct.

Template Parameters
TypesParameter pack
Returns
true if no two types in Types... are identical

Used by CECCO::Iso to reject duplicate representations.

Definition at line 686 of file field_concepts_traits.hpp.

◆ validate()

bool CECCO::details::validate ( const std::vector< size_t > & v,
std::size_t n )

Definition at line 4498 of file codes.hpp.

Variable Documentation

◆ colormap

const uint8_t CECCO::details::colormap[64][3]
static
Initial value:
= {
{0, 0, 0}, {0, 0, 24}, {0, 0, 40}, {0, 0, 56}, {0, 0, 72}, {0, 0, 88},
{0, 0, 104}, {0, 0, 120}, {0, 0, 136}, {0, 0, 152}, {0, 0, 167}, {0, 0, 183},
{0, 0, 199}, {0, 0, 215}, {0, 0, 231}, {0, 0, 252}, {0, 6, 253}, {0, 24, 232},
{0, 40, 216}, {0, 56, 200}, {0, 72, 184}, {0, 88, 168}, {0, 104, 152}, {0, 120, 136},
{0, 136, 120}, {0, 152, 104}, {0, 167, 88}, {0, 183, 72}, {0, 199, 56}, {0, 215, 41},
{0, 231, 25}, {0, 249, 6}, {6, 255, 0}, {24, 255, 0}, {40, 255, 0}, {56, 255, 0},
{72, 255, 0}, {88, 255, 0}, {104, 255, 0}, {120, 255, 0}, {136, 255, 0}, {152, 255, 0},
{167, 255, 0}, {183, 255, 0}, {199, 255, 0}, {215, 255, 0}, {231, 255, 0}, {249, 255, 0},
{255, 255, 6}, {255, 255, 24}, {255, 255, 40}, {255, 255, 56}, {255, 255, 72}, {255, 255, 88},
{255, 255, 104}, {255, 255, 120}, {255, 255, 136}, {255, 255, 152}, {255, 255, 167}, {255, 255, 183},
{255, 255, 199}, {255, 255, 215}, {255, 255, 231}, {255, 255, 255}}

Definition at line 601 of file helpers.hpp.

◆ contains_v

template<typename T, typename List>
bool CECCO::details::contains_v = contains<T, List>::value
constexpr

Definition at line 439 of file field_concepts_traits.hpp.

◆ degree_over_prime_v

template<FiniteFieldType T>
size_t CECCO::details::degree_over_prime_v = degree_over_prime<T>::value
inlineconstexpr

Definition at line 280 of file field_concepts_traits.hpp.

◆ index

const int CECCO::details::index = std::ios_base::xalloc()
inline

Definition at line 101 of file codes.hpp.

◆ is_distinct_from_all

template<typename T, typename... Types>
bool CECCO::details::is_distinct_from_all = (!std::is_same_v<T, Types> && ...)
constexpr

True iff T is not the same as any of Types....

Definition at line 675 of file field_concepts_traits.hpp.

◆ is_subfield_of_v

template<FiniteFieldType SUPER, FiniteFieldType SUB>
bool CECCO::details::is_subfield_of_v = is_subfield_of<SUPER, SUB>::value
constexpr

Definition at line 315 of file field_concepts_traits.hpp.

◆ LutHolder< LutType, ProviderLutType, P, F, LutMode::CompileTime >::lut

template<typename LutType, typename ProviderLutType, const ProviderLutType &(*)() P, LutType(*)(const ProviderLutType &(*)()) F>
LutType CECCO::details::LutHolder< LutType, ProviderLutType, P, F, LutMode::CompileTime >::lut
constexpr

Definition at line 1251 of file fields.hpp.

◆ LutHolderNoProvider< LutType, F, LutMode::CompileTime >::lut

template<typename LutType, LutType(*)() F>
LutType CECCO::details::LutHolderNoProvider< LutType, F, LutMode::CompileTime >::lut
constexpr

Definition at line 1209 of file fields.hpp.