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::BlockProcessor< T, InputType, OutputType > Class Template Reference

CRTP base providing element-wise, vector, and matrix operator() overloads. More...

#include <blocks.hpp>

Inheritance diagram for CECCO::details::BlockProcessor< T, InputType, OutputType >:
Inheritance graph

Public Member Functions

Vector< OutputType > operator() (const Vector< InputType > &in)
 Apply the block element-wise to each vector entry.
Vector< OutputType > operator() (Vector< InputType > &&in)
 Apply the block element-wise (rvalue input).
Matrix< OutputType > operator() (const Matrix< InputType > &in)
 Apply the block element-wise to each matrix entry.
Matrix< OutputType > operator() (Matrix< InputType > &&in)
 Apply the block element-wise (rvalue input).
template<FiniteFieldType U>
OutputType operator() (const U &)
 Catch-all for inputs whose element type differs from InputType.
template<FiniteFieldType U>
Vector< OutputType > operator() (const Vector< U > &)
template<FiniteFieldType U>
Matrix< OutputType > operator() (const Matrix< U > &)

Protected Member Functions

const T & derived () const noexcept
T & derived () noexcept

Detailed Description

template<typename T, typename InputType, typename OutputType>
class CECCO::details::BlockProcessor< T, InputType, OutputType >

CRTP base providing element-wise, vector, and matrix operator() overloads.

Template Parameters
TDerived class (CRTP)
InputTypeElement type accepted by the block
OutputTypeElement type produced by the block

Derived blocks implement a single-element operator()(const InputType&); this base then generates Vector<OutputType> operator()(const Vector<InputType>&) and the matrix counterpart (plus rvalue versions, with in-place reuse when InputType == OutputType).

Catch-all overloads accept any other CECCO::FiniteFieldType and throw at runtime — useful inside if constexpr (std::is_same_v<F, InputType>) guards in non-template contexts, where the discarded branch must still compile.

Vector<Fp<2>> message = {1, 0, 1, 1};
AWGN awgn(6.0, map.get_a(), map.get_b());
message >> map >> awgn >> demap >> r;
Additive White Gaussian Noise channel for complex-valued symbols.
Definition blocks.hpp:539
BPSK hard-decision demapper — NRZDemapper with threshold 0.
Definition blocks.hpp:783
Binary Phase Shift Keying mapper — NRZMapper with a = 0, b = 2.
Definition blocks.hpp:513
constexpr double get_b() const noexcept
Constellation distance parameter b.
Definition blocks.hpp:485
constexpr double get_a() const noexcept
DC offset parameter a.
Definition blocks.hpp:482
Vector v = (vā‚€, v₁, …, vₙ₋₁) over a CECCO::ComponentType.
Definition vectors.hpp:115

Definition at line 86 of file blocks.hpp.

Member Function Documentation

◆ derived() [1/2]

template<typename T, typename InputType, typename OutputType>
const T & CECCO::details::BlockProcessor< T, InputType, OutputType >::derived ( ) const
inlineprotectednoexcept

Definition at line 88 of file blocks.hpp.

◆ derived() [2/2]

template<typename T, typename InputType, typename OutputType>
T & CECCO::details::BlockProcessor< T, InputType, OutputType >::derived ( )
inlineprotectednoexcept

Definition at line 90 of file blocks.hpp.

◆ operator()() [1/7]

template<typename T, typename InputType, typename OutputType>
Matrix< OutputType > CECCO::details::BlockProcessor< T, InputType, OutputType >::operator() ( const Matrix< InputType > & in)
inline

Apply the block element-wise to each matrix entry.

Parameters
inInput matrix
Returns
Matrix of processed outputs

Definition at line 121 of file blocks.hpp.

◆ operator()() [2/7]

template<typename T, typename InputType, typename OutputType>
template<FiniteFieldType U>
Matrix< OutputType > CECCO::details::BlockProcessor< T, InputType, OutputType >::operator() ( const Matrix< U > & )
inline

Definition at line 172 of file blocks.hpp.

◆ operator()() [3/7]

template<typename T, typename InputType, typename OutputType>
template<FiniteFieldType U>
OutputType CECCO::details::BlockProcessor< T, InputType, OutputType >::operator() ( const U & )
inline

Catch-all for inputs whose element type differs from InputType.

Template Parameters
UAny CECCO::FiniteFieldType other than InputType

Always throws std::logic_error at runtime. See the class doc for the if constexpr use case that motivates these overloads.

Definition at line 160 of file blocks.hpp.

◆ operator()() [4/7]

template<typename T, typename InputType, typename OutputType>
Vector< OutputType > CECCO::details::BlockProcessor< T, InputType, OutputType >::operator() ( const Vector< InputType > & in)
inline

Apply the block element-wise to each vector entry.

Parameters
inInput vector
Returns
Vector of processed outputs

Definition at line 98 of file blocks.hpp.

◆ operator()() [5/7]

template<typename T, typename InputType, typename OutputType>
template<FiniteFieldType U>
Vector< OutputType > CECCO::details::BlockProcessor< T, InputType, OutputType >::operator() ( const Vector< U > & )
inline

Definition at line 166 of file blocks.hpp.

◆ operator()() [6/7]

template<typename T, typename InputType, typename OutputType>
Matrix< OutputType > CECCO::details::BlockProcessor< T, InputType, OutputType >::operator() ( Matrix< InputType > && in)
inline

Apply the block element-wise (rvalue input).

Parameters
inInput matrix (moved)
Returns
Matrix of processed outputs (reuses input storage when InputType == OutputType)

Definition at line 134 of file blocks.hpp.

◆ operator()() [7/7]

template<typename T, typename InputType, typename OutputType>
Vector< OutputType > CECCO::details::BlockProcessor< T, InputType, OutputType >::operator() ( Vector< InputType > && in)
inline

Apply the block element-wise (rvalue input).

Parameters
inInput vector (moved)
Returns
Vector of processed outputs

Definition at line 109 of file blocks.hpp.


The documentation for this class was generated from the following file: