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::Field< T > Class Template Reference

CRTP base documenting the interface every field type must provide. More...

#include <fields.hpp>

Inheritance diagram for CECCO::details::Field< T >:
Inheritance graph

Public Member Functions

Assignment Operators
T & operator= (int l)=delete
 Assign from int — derived must implement.
T & operator= (const T &rhs) noexcept=delete
 Copy assignment — derived must implement.
T & operator= (T &&rhs) noexcept=delete
 Move assignment — derived must implement.
Comparison
constexpr bool operator!= (const T &rhs) const
 Inequality, defined as !(*this == rhs).
Unary Operations
constexpr T operator+ () const &
 Unary + on an lvalue: returns a copy.
constexpr T && operator+ () &&noexcept
 Unary + on an rvalue: returns the rvalue itself.
operator- () const &noexcept=delete
 Additive inverse on an lvalue — derived must implement.
T & operator- () &&noexcept=delete
 Additive inverse on an rvalue (in place) — derived must implement.
Compound Assignment
T & operator+= (const T &rhs) noexcept=delete
 *this += rhs — derived must implement
T & operator-= (const T &rhs) noexcept=delete
 *this -= rhs — derived must implement
T & operator*= (const T &rhs) noexcept=delete
 *this *= rhs — derived must implement
T & operator/= (const T &rhs)=delete
 *this /= rhs; throws std::invalid_argument if rhs is zero — derived must implement
Randomization
Fieldrandomize ()=delete
 Uniform random element of the field — derived must implement; may return the same value.
Fieldrandomize_force_change ()=delete
 Like randomize but guaranteed to differ from the current value — derived must implement.
Properties
size_t get_multiplicative_order () const =delete
 Smallest k > 0 with this^k == 1; throws std::invalid_argument if *this is zero.
size_t get_additive_order () const =delete
 Smallest k > 0 with k * *this == 0; for finite fields of characteristic p this is p (or 1 for zero); for ā„š it is 1 for zero and 0 (infinite) otherwise.
bool has_positive_sign () const noexcept=delete
 True if the element is "positive" (always true for finite fields; sign of numerator for ā„š).
bool is_zero () const noexcept=delete
 True if *this is the additive identity.
Fielderase () noexcept=delete
 Mark this element as erased (out-of-field marker for erasure decoding).
Fieldunerase () noexcept=delete
 Clear the erasure flag, resetting to additive identity.
bool is_erased () const noexcept=delete
 Test whether this element is currently erased.

Protected Member Functions

 ~Field () noexcept=default
Protected Member Functions inherited from CECCO::details::Base
 Base ()=default

Detailed Description

template<class T>
class CECCO::details::Field< T >

CRTP base documenting the interface every field type must provide.

Template Parameters
TDerived field type (CRTP parameter)

Most members are = delete, present solely to advertise the interface — derived types shadow them with their own definitions. The free arithmetic operators in this file template on CECCO::FieldType and dispatch directly to T's compound assignments; there is no virtual dispatch.

Derived types must supply: assignment from T, T&&, and int; operator==; unary -; the four compound assignments +=, āˆ’=, *=, /=; randomize() / randomize_force_change(); the property queries is_zero(), has_positive_sign(), get_multiplicative_order(), get_additive_order(). When CECCO_ERASURE_SUPPORT is defined, also erase() / unerase() / is_erased().

Provided here (not deleted): operator!= (delegates to ==) and the two unary operator+ overloads (identity).

Definition at line 206 of file fields.hpp.

Constructor & Destructor Documentation

◆ ~Field()

template<class T>
CECCO::details::Field< T >::~Field ( )
protecteddefaultnoexcept

Member Function Documentation

◆ erase()

template<class T>
Field & CECCO::details::Field< T >::erase ( )
deletenoexcept

Mark this element as erased (out-of-field marker for erasure decoding).

Warning
Erased elements must not participate in field arithmetic; correct use is the caller's responsibility

◆ get_additive_order()

template<class T>
size_t CECCO::details::Field< T >::get_additive_order ( ) const
delete

Smallest k > 0 with k * *this == 0; for finite fields of characteristic p this is p (or 1 for zero); for ā„š it is 1 for zero and 0 (infinite) otherwise.

◆ get_multiplicative_order()

template<class T>
size_t CECCO::details::Field< T >::get_multiplicative_order ( ) const
delete

Smallest k > 0 with this^k == 1; throws std::invalid_argument if *this is zero.

◆ has_positive_sign()

template<class T>
bool CECCO::details::Field< T >::has_positive_sign ( ) const
deletenoexcept

True if the element is "positive" (always true for finite fields; sign of numerator for ā„š).

◆ is_erased()

template<class T>
bool CECCO::details::Field< T >::is_erased ( ) const
deletenoexcept

Test whether this element is currently erased.

◆ is_zero()

template<class T>
bool CECCO::details::Field< T >::is_zero ( ) const
deletenoexcept

True if *this is the additive identity.

◆ operator!=()

template<class T>
bool CECCO::details::Field< T >::operator!= ( const T & rhs) const
inlineconstexpr

Inequality, defined as !(*this == rhs).

Definition at line 226 of file fields.hpp.

◆ operator*=()

template<class T>
T & CECCO::details::Field< T >::operator*= ( const T & rhs)
deletenoexcept

*this *= rhs — derived must implement

◆ operator+() [1/2]

template<class T>
T && CECCO::details::Field< T >::operator+ ( ) &&
inlineconstexprnoexcept

Unary + on an rvalue: returns the rvalue itself.

Definition at line 235 of file fields.hpp.

◆ operator+() [2/2]

template<class T>
T CECCO::details::Field< T >::operator+ ( ) const &
inlineconstexpr

Unary + on an lvalue: returns a copy.

Definition at line 233 of file fields.hpp.

◆ operator+=()

template<class T>
T & CECCO::details::Field< T >::operator+= ( const T & rhs)
deletenoexcept

*this += rhs — derived must implement

◆ operator-() [1/2]

template<class T>
T & CECCO::details::Field< T >::operator- ( ) &&
deletenoexcept

Additive inverse on an rvalue (in place) — derived must implement.

◆ operator-() [2/2]

template<class T>
T CECCO::details::Field< T >::operator- ( ) const &
deletenoexcept

Additive inverse on an lvalue — derived must implement.

◆ operator-=()

template<class T>
T & CECCO::details::Field< T >::operator-= ( const T & rhs)
deletenoexcept

*this -= rhs — derived must implement

◆ operator/=()

template<class T>
T & CECCO::details::Field< T >::operator/= ( const T & rhs)
delete

*this /= rhs; throws std::invalid_argument if rhs is zero — derived must implement

◆ operator=() [1/3]

template<class T>
T & CECCO::details::Field< T >::operator= ( const T & rhs)
deletenoexcept

Copy assignment — derived must implement.

◆ operator=() [2/3]

template<class T>
T & CECCO::details::Field< T >::operator= ( int l)
delete

Assign from int — derived must implement.

◆ operator=() [3/3]

template<class T>
T & CECCO::details::Field< T >::operator= ( T && rhs)
deletenoexcept

Move assignment — derived must implement.

◆ randomize()

template<class T>
Field & CECCO::details::Field< T >::randomize ( )
delete

Uniform random element of the field — derived must implement; may return the same value.

◆ randomize_force_change()

template<class T>
Field & CECCO::details::Field< T >::randomize_force_change ( )
delete

Like randomize but guaranteed to differ from the current value — derived must implement.

◆ unerase()

template<class T>
Field & CECCO::details::Field< T >::unerase ( )
deletenoexcept

Clear the erasure flag, resetting to additive identity.


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