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

#include <codes.hpp>

Inheritance diagram for CECCO::LinearCode< T >:
Inheritance graph

Public Types

using FIELD = T

Public Member Functions

 LinearCode (size_t n, size_t k, const Matrix< T > &X)
 LinearCode (size_t k, Polynomial< T > gamma)
 LinearCode (const LinearCode &other)
 LinearCode (LinearCode &&other)
LinearCodeoperator= (const LinearCode &other)
LinearCodeoperator= (LinearCode &&other)
size_t get_k () const noexcept
double get_R () const noexcept
InfInt get_size () const
const Matrix< T > & get_G () const noexcept
const Matrix< T > & get_HT () const noexcept
Matrix< T > get_H () const
virtual size_t get_dmin () const
size_t get_tmax () const
virtual const Polynomial< InfInt > & get_weight_enumerator () const
long double P_word (double pe) const
long double P_error (double pe) const
long double P_failure (double pe) const
long double Bhattacharyya_bound (long double gamma) const
const Polynomial< T > & get_gamma () const
void set_dmin (size_t d) const noexcept
void set_weight_enumerator (const Polynomial< InfInt > &p) const noexcept
void set_weight_enumerator (Polynomial< InfInt > &&p) const noexcept
void set_gamma (const Polynomial< T > &g) const noexcept
void set_gamma (Polynomial< T > &&g) const noexcept
const std::vector< Vector< T > > & get_standard_array () const
const std::vector< bool > & get_tainted () const
const std::unordered_map< size_t, Vector< T > > & get_Meggitt_table () const
auto cbegin () const noexcept
auto cend () const noexcept
template<FieldType S>
bool is_identical (const LinearCode< S > &other, Matrix< T > *L_ptr=nullptr) const
 Test whether two linear codes are identical.
template<FieldType S>
bool is_equivalent (const LinearCode< S > &other, Matrix< T > *L_ptr=nullptr, Matrix< T > *P_ptr=nullptr) const
 Test whether two linear codes are equivalent.
bool is_perfect () const
bool is_MDS () const
bool is_equidistant () const
bool is_weakly_self_dual () const
bool is_dual_containing () const
bool is_self_dual () const
bool is_polynomial () const
bool is_cyclic () const
virtual void get_info (std::ostream &os) const override
LinearCode< T > get_dual () const
LinearCode< T > get_equivalent_code_in_standard_form () const
LinearCode< T > get_identical_code_in_polynomial_form () const
Matrix< T > get_G_in_polynomial_form () const
Matrix< T > get_G_in_trellis_oriented_form () const
Trellis< T > get_trivial_trellis () const
const Trellis< T > & get_minimal_trellis () const
Vector< T > enc (const Vector< T > &u) const override
Vector< T > encinv (const Vector< T > &c) const override
virtual Vector< T > dec_BD (const Vector< T > &r) const override
virtual Vector< T > dec_boosted_BD (const Vector< T > &r) const override
virtual Vector< T > dec_ML (const Vector< T > &r) const override
virtual Vector< T > dec_burst (const Vector< T > &r) const override
virtual Vector< T > dec_Meggitt (const Vector< T > &r) const override
virtual Vector< T > dec_Viterbi (const Vector< T > &r, const std::string &filename="") const override
virtual Vector< T > dec_Viterbi_soft (const Vector< double > &llrs, const std::string &filename="") const override
virtual Vector< double > dec_BCJR (const Vector< double > &llrs, const std::string &filename="") const override
virtual Vector< T > dec_ML_soft (const Vector< double > &llrs, size_t cache_limit) const override
virtual Vector< T > dec_BD_EE (const Vector< T > &r) const override
virtual Vector< T > dec_Viterbi_EE (const Vector< T > &r, const std::string &filename="") const override
virtual Vector< T > dec_ML_EE (const Vector< T > &r) const override
Vector< T > dec_GMD (const Vector< T > &r, const std::vector< double > &reliability) const
Public Member Functions inherited from CECCO::Code< T >
 Code (size_t n)
 Code (const Code &other)
 Code (Code &&)=default
virtual ~Code ()=default
Codeoperator= (const Code &other)
Codeoperator= (Code &&)=default
size_t get_n () const noexcept
virtual Vector< T > dec_recursive (const Vector< T > &r) const
virtual Vector< T > dec_WBA (const Vector< T > &r) const
virtual Vector< T > dec_BMA (const Vector< T > &r) const
virtual Vector< T > dec_recursive_EE (const Vector< T > &r) const
virtual Vector< T > dec_WBA_EE (const Vector< T > &r) const
virtual Vector< T > dec_BMA_EE (const Vector< T > &r) const

Protected Member Functions

template<ComponentType S>
void validate_length (const Vector< S > &r) const
Protected Member Functions inherited from CECCO::Code< T >
std::vector< size_t > erasure_positions (const Vector< T > &r) const

Static Protected Member Functions

static bool erasures_present (const Vector< T > &r)

Protected Attributes

size_t k
Matrix< T > G
Matrix< T > HT
Matrix< T > MI
std::vector< size_t > infoset {}
details::OnceCache< size_t > dmin
details::OnceCache< Polynomial< InfInt > > weight_enumerator
details::OnceCache< std::vector< Vector< T > > > codewords
details::OnceCache< std::vector< Vector< T > > > standard_array
details::OnceCache< std::vector< bool > > tainted
details::OnceCache< std::vector< bool > > tainted_burst
details::OnceCache< std::unordered_map< size_t, Vector< T > > > Meggitt_table
details::OnceCache< std::vector< std::optional< LinearCode< T > > > > punctured_codes_BD
details::OnceCache< std::vector< std::optional< LinearCode< T > > > > punctured_codes_ML
details::OnceCache< bool > polynomial
details::OnceCache< Polynomial< T > > gamma
details::OnceCache< Trellis< T > > minimal_trellis
Protected Attributes inherited from CECCO::Code< T >
size_t n

Detailed Description

template<FieldType T>
class CECCO::LinearCode< T >

Definition at line 320 of file codes.hpp.

Member Typedef Documentation

◆ FIELD

template<FieldType T>
using CECCO::LinearCode< T >::FIELD = T

Definition at line 323 of file codes.hpp.

Constructor & Destructor Documentation

◆ LinearCode() [1/4]

template<FieldType T>
CECCO::LinearCode< T >::LinearCode ( size_t n,
size_t k,
const Matrix< T > & X )
inline

Definition at line 328 of file codes.hpp.

◆ LinearCode() [2/4]

template<FieldType T>
CECCO::LinearCode< T >::LinearCode ( size_t k,
Polynomial< T > gamma )
inline

Definition at line 378 of file codes.hpp.

◆ LinearCode() [3/4]

template<FieldType T>
CECCO::LinearCode< T >::LinearCode ( const LinearCode< T > & other)
inline

Definition at line 388 of file codes.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LinearCode() [4/4]

template<FieldType T>
CECCO::LinearCode< T >::LinearCode ( LinearCode< T > && other)
inline

Definition at line 411 of file codes.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ Bhattacharyya_bound()

template<FieldType T>
long double CECCO::LinearCode< T >::Bhattacharyya_bound ( long double gamma) const
inline

Definition at line 633 of file codes.hpp.

◆ cbegin()

template<FieldType T>
auto CECCO::LinearCode< T >::cbegin ( ) const
inlinenoexcept

Definition at line 841 of file codes.hpp.

◆ cend()

template<FieldType T>
auto CECCO::LinearCode< T >::cend ( ) const
inlinenoexcept

Definition at line 850 of file codes.hpp.

◆ dec_BCJR()

template<FieldType T>
virtual Vector< double > CECCO::LinearCode< T >::dec_BCJR ( const Vector< double > & llrs,
const std::string & filename = "" ) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Definition at line 1560 of file codes.hpp.

◆ dec_BD()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_BD ( const Vector< T > & r) const
inlineoverridevirtual

◆ dec_BD_EE()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_BD_EE ( const Vector< T > & r) const
inlineoverridevirtual

◆ dec_boosted_BD()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_boosted_BD ( const Vector< T > & r) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Definition at line 1421 of file codes.hpp.

◆ dec_burst()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_burst ( const Vector< T > & r) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Reimplemented in CECCO::UniverseCode< T >.

Definition at line 1460 of file codes.hpp.

◆ dec_GMD()

template<FieldType T>
Vector< T > CECCO::LinearCode< T >::dec_GMD ( const Vector< T > & r,
const std::vector< double > & reliability ) const
inline

Definition at line 1771 of file codes.hpp.

◆ dec_Meggitt()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_Meggitt ( const Vector< T > & r) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Definition at line 1485 of file codes.hpp.

◆ dec_ML()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_ML ( const Vector< T > & r) const
inlineoverridevirtual

◆ dec_ML_EE()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_ML_EE ( const Vector< T > & r) const
inlineoverridevirtual

◆ dec_ML_soft()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_ML_soft ( const Vector< double > & llrs,
size_t cache_limit ) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Definition at line 1579 of file codes.hpp.

◆ dec_Viterbi()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_Viterbi ( const Vector< T > & r,
const std::string & filename = "" ) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Definition at line 1523 of file codes.hpp.

◆ dec_Viterbi_EE()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_Viterbi_EE ( const Vector< T > & r,
const std::string & filename = "" ) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Definition at line 1690 of file codes.hpp.

◆ dec_Viterbi_soft()

template<FieldType T>
virtual Vector< T > CECCO::LinearCode< T >::dec_Viterbi_soft ( const Vector< double > & llrs,
const std::string & filename = "" ) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Definition at line 1544 of file codes.hpp.

◆ enc()

template<FieldType T>
Vector< T > CECCO::LinearCode< T >::enc ( const Vector< T > & u) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Reimplemented in CECCO::RepetitionCode< T >, and CECCO::UniverseCode< T >.

Definition at line 1390 of file codes.hpp.

◆ encinv()

template<FieldType T>
Vector< T > CECCO::LinearCode< T >::encinv ( const Vector< T > & c) const
inlineoverridevirtual

Reimplemented from CECCO::Code< T >.

Reimplemented in CECCO::RepetitionCode< T >, and CECCO::UniverseCode< T >.

Definition at line 1392 of file codes.hpp.

◆ erasures_present()

template<FieldType T>
bool CECCO::LinearCode< T >::erasures_present ( const Vector< T > & r)
inlinestaticprotected

Definition at line 1819 of file codes.hpp.

◆ get_dmin()

template<FieldType T>
virtual size_t CECCO::LinearCode< T >::get_dmin ( ) const
inlinevirtual

Reimplemented in CECCO::LDCCode< BU, BV >.

Definition at line 499 of file codes.hpp.

◆ get_dual()

template<FieldType T>
LinearCode< T > CECCO::LinearCode< T >::get_dual ( ) const
inline

Definition at line 1194 of file codes.hpp.

◆ get_equivalent_code_in_standard_form()

template<FieldType T>
LinearCode< T > CECCO::LinearCode< T >::get_equivalent_code_in_standard_form ( ) const
inline

Definition at line 1203 of file codes.hpp.

◆ get_G()

template<FieldType T>
const Matrix< T > & CECCO::LinearCode< T >::get_G ( ) const
inlinenoexcept

Definition at line 495 of file codes.hpp.

◆ get_G_in_polynomial_form()

template<FieldType T>
Matrix< T > CECCO::LinearCode< T >::get_G_in_polynomial_form ( ) const
inline

Definition at line 1234 of file codes.hpp.

◆ get_G_in_trellis_oriented_form()

template<FieldType T>
Matrix< T > CECCO::LinearCode< T >::get_G_in_trellis_oriented_form ( ) const
inline

Definition at line 1242 of file codes.hpp.

◆ get_gamma()

template<FieldType T>
const Polynomial< T > & CECCO::LinearCode< T >::get_gamma ( ) const
inline

Definition at line 645 of file codes.hpp.

◆ get_H()

template<FieldType T>
Matrix< T > CECCO::LinearCode< T >::get_H ( ) const
inline

Definition at line 497 of file codes.hpp.

◆ get_HT()

template<FieldType T>
const Matrix< T > & CECCO::LinearCode< T >::get_HT ( ) const
inlinenoexcept

Definition at line 496 of file codes.hpp.

◆ get_identical_code_in_polynomial_form()

template<FieldType T>
LinearCode< T > CECCO::LinearCode< T >::get_identical_code_in_polynomial_form ( ) const
inline

Definition at line 1222 of file codes.hpp.

◆ get_info()

◆ get_k()

template<FieldType T>
size_t CECCO::LinearCode< T >::get_k ( ) const
inlinenoexcept

Definition at line 486 of file codes.hpp.

◆ get_Meggitt_table()

template<FieldType T>
const std::unordered_map< size_t, Vector< T > > & CECCO::LinearCode< T >::get_Meggitt_table ( ) const
inline

Definition at line 776 of file codes.hpp.

◆ get_minimal_trellis()

template<FieldType T>
const Trellis< T > & CECCO::LinearCode< T >::get_minimal_trellis ( ) const
inline

Definition at line 1330 of file codes.hpp.

◆ get_R()

template<FieldType T>
double CECCO::LinearCode< T >::get_R ( ) const
inlinenoexcept

Definition at line 487 of file codes.hpp.

◆ get_size()

template<FieldType T>
InfInt CECCO::LinearCode< T >::get_size ( ) const
inline

Definition at line 489 of file codes.hpp.

◆ get_standard_array()

template<FieldType T>
const std::vector< Vector< T > > & CECCO::LinearCode< T >::get_standard_array ( ) const
inline

Definition at line 675 of file codes.hpp.

◆ get_tainted()

template<FieldType T>
const std::vector< bool > & CECCO::LinearCode< T >::get_tainted ( ) const
inline

Definition at line 770 of file codes.hpp.

◆ get_tmax()

template<FieldType T>
size_t CECCO::LinearCode< T >::get_tmax ( ) const
inline

Definition at line 563 of file codes.hpp.

◆ get_trivial_trellis()

template<FieldType T>
Trellis< T > CECCO::LinearCode< T >::get_trivial_trellis ( ) const
inline

Definition at line 1311 of file codes.hpp.

◆ get_weight_enumerator()

template<FieldType T>
virtual const Polynomial< InfInt > & CECCO::LinearCode< T >::get_weight_enumerator ( ) const
inlinevirtual

Reimplemented in CECCO::ExtendedCode< T, B >.

Definition at line 568 of file codes.hpp.

◆ is_cyclic()

template<FieldType T>
bool CECCO::LinearCode< T >::is_cyclic ( ) const
inline

Definition at line 1110 of file codes.hpp.

◆ is_dual_containing()

template<FieldType T>
bool CECCO::LinearCode< T >::is_dual_containing ( ) const
inline

Definition at line 1075 of file codes.hpp.

◆ is_equidistant()

template<FieldType T>
bool CECCO::LinearCode< T >::is_equidistant ( ) const
inline

Definition at line 1066 of file codes.hpp.

◆ is_equivalent()

template<FieldType T>
template<FieldType S>
bool CECCO::LinearCode< T >::is_equivalent ( const LinearCode< S > & other,
Matrix< T > * L_ptr = nullptr,
Matrix< T > * P_ptr = nullptr ) const
inline

Test whether two linear codes are equivalent.

Template Parameters
SField type of the other code (must equal T for a meaningful comparison)
Parameters
otherLinear code to compare against
L_ptrIf non-null, receives the invertible k × k matrix L such that G' = L · G · P
P_ptrIf non-null, receives the n × n permutation matrix P such that G' = L · G · P
Returns
True if the codes are equivalent, false otherwise

Two [n, k] linear codes are equivalent if their generator matrices are related by G' = L · G · P for some invertible matrix L and permutation matrix P. When n − k < k, the search is performed on the dual codes for efficiency.

Note
The search has combinatorial complexity and may be slow for large codes

Definition at line 913 of file codes.hpp.

◆ is_identical()

template<FieldType T>
template<FieldType S>
bool CECCO::LinearCode< T >::is_identical ( const LinearCode< S > & other,
Matrix< T > * L_ptr = nullptr ) const
inline

Test whether two linear codes are identical.

Template Parameters
SField type of the other code (must equal T for a meaningful comparison)
Parameters
otherLinear code to compare against
L_ptrIf non-null, receives the invertible k × k matrix L such that G' = L · G
Returns
True if both codes span the same codebook, false otherwise

Two [n, k] linear codes are identical if they have the same codebook, which is the case if and only if their generator matrices have the same RREF. When n − k < k, the comparison is performed on the parity-check matrices for efficiency.

Definition at line 870 of file codes.hpp.

◆ is_MDS()

template<FieldType T>
bool CECCO::LinearCode< T >::is_MDS ( ) const
inline

Definition at line 1061 of file codes.hpp.

◆ is_perfect()

template<FieldType T>
bool CECCO::LinearCode< T >::is_perfect ( ) const
inline

Definition at line 1053 of file codes.hpp.

◆ is_polynomial()

template<FieldType T>
bool CECCO::LinearCode< T >::is_polynomial ( ) const
inline

Definition at line 1078 of file codes.hpp.

◆ is_self_dual()

template<FieldType T>
bool CECCO::LinearCode< T >::is_self_dual ( ) const
inline

Definition at line 1076 of file codes.hpp.

◆ is_weakly_self_dual()

template<FieldType T>
bool CECCO::LinearCode< T >::is_weakly_self_dual ( ) const
inline

Definition at line 1074 of file codes.hpp.

◆ operator=() [1/2]

template<FieldType T>
LinearCode & CECCO::LinearCode< T >::operator= ( const LinearCode< T > & other)
inline

Definition at line 434 of file codes.hpp.

◆ operator=() [2/2]

template<FieldType T>
LinearCode & CECCO::LinearCode< T >::operator= ( LinearCode< T > && other)
inline

Definition at line 460 of file codes.hpp.

◆ P_error()

template<FieldType T>
long double CECCO::LinearCode< T >::P_error ( double pe) const
inline

Definition at line 606 of file codes.hpp.

◆ P_failure()

template<FieldType T>
long double CECCO::LinearCode< T >::P_failure ( double pe) const
inline

Definition at line 623 of file codes.hpp.

◆ P_word()

template<FieldType T>
long double CECCO::LinearCode< T >::P_word ( double pe) const
inline

Definition at line 597 of file codes.hpp.

◆ set_dmin()

template<FieldType T>
void CECCO::LinearCode< T >::set_dmin ( size_t d) const
inlinenoexcept

Definition at line 651 of file codes.hpp.

◆ set_gamma() [1/2]

template<FieldType T>
void CECCO::LinearCode< T >::set_gamma ( const Polynomial< T > & g) const
inlinenoexcept

Definition at line 665 of file codes.hpp.

◆ set_gamma() [2/2]

template<FieldType T>
void CECCO::LinearCode< T >::set_gamma ( Polynomial< T > && g) const
inlinenoexcept

Definition at line 670 of file codes.hpp.

◆ set_weight_enumerator() [1/2]

template<FieldType T>
void CECCO::LinearCode< T >::set_weight_enumerator ( const Polynomial< InfInt > & p) const
inlinenoexcept

Definition at line 653 of file codes.hpp.

◆ set_weight_enumerator() [2/2]

template<FieldType T>
void CECCO::LinearCode< T >::set_weight_enumerator ( Polynomial< InfInt > && p) const
inlinenoexcept

Definition at line 659 of file codes.hpp.

◆ validate_length()

template<FieldType T>
template<ComponentType S>
void CECCO::LinearCode< T >::validate_length ( const Vector< S > & r) const
inlineprotected

Definition at line 1828 of file codes.hpp.

Member Data Documentation

◆ codewords

template<FieldType T>
details::OnceCache<std::vector<Vector<T> > > CECCO::LinearCode< T >::codewords
mutableprotected

Definition at line 1840 of file codes.hpp.

◆ dmin

template<FieldType T>
details::OnceCache<size_t> CECCO::LinearCode< T >::dmin
mutableprotected

Definition at line 1838 of file codes.hpp.

◆ G

template<FieldType T>
Matrix<T> CECCO::LinearCode< T >::G
protected

Definition at line 1834 of file codes.hpp.

◆ gamma

template<FieldType T>
details::OnceCache<Polynomial<T> > CECCO::LinearCode< T >::gamma
mutableprotected

Definition at line 1850 of file codes.hpp.

◆ HT

template<FieldType T>
Matrix<T> CECCO::LinearCode< T >::HT
protected

Definition at line 1835 of file codes.hpp.

◆ infoset

template<FieldType T>
std::vector<size_t> CECCO::LinearCode< T >::infoset {}
protected

Definition at line 1837 of file codes.hpp.

◆ k

template<FieldType T>
size_t CECCO::LinearCode< T >::k
protected

Definition at line 1833 of file codes.hpp.

◆ Meggitt_table

template<FieldType T>
details::OnceCache<std::unordered_map<size_t, Vector<T> > > CECCO::LinearCode< T >::Meggitt_table
mutableprotected

Definition at line 1844 of file codes.hpp.

◆ MI

template<FieldType T>
Matrix<T> CECCO::LinearCode< T >::MI
protected

Definition at line 1836 of file codes.hpp.

◆ minimal_trellis

template<FieldType T>
details::OnceCache<Trellis<T> > CECCO::LinearCode< T >::minimal_trellis
mutableprotected

Definition at line 1851 of file codes.hpp.

◆ polynomial

template<FieldType T>
details::OnceCache<bool> CECCO::LinearCode< T >::polynomial
mutableprotected

Definition at line 1849 of file codes.hpp.

◆ punctured_codes_BD

template<FieldType T>
details::OnceCache<std::vector<std::optional<LinearCode<T> > > > CECCO::LinearCode< T >::punctured_codes_BD
mutableprotected

Definition at line 1846 of file codes.hpp.

◆ punctured_codes_ML

template<FieldType T>
details::OnceCache<std::vector<std::optional<LinearCode<T> > > > CECCO::LinearCode< T >::punctured_codes_ML
mutableprotected

Definition at line 1847 of file codes.hpp.

◆ standard_array

template<FieldType T>
details::OnceCache<std::vector<Vector<T> > > CECCO::LinearCode< T >::standard_array
mutableprotected

Definition at line 1841 of file codes.hpp.

◆ tainted

template<FieldType T>
details::OnceCache<std::vector<bool> > CECCO::LinearCode< T >::tainted
mutableprotected

Definition at line 1842 of file codes.hpp.

◆ tainted_burst

template<FieldType T>
details::OnceCache<std::vector<bool> > CECCO::LinearCode< T >::tainted_burst
mutableprotected

Definition at line 1843 of file codes.hpp.

◆ weight_enumerator

template<FieldType T>
details::OnceCache<Polynomial<InfInt> > CECCO::LinearCode< T >::weight_enumerator
mutableprotected

Definition at line 1839 of file codes.hpp.


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