itpp::BCH Class Reference
Communications Module » Forward Error Correcting Codes

Class for binary, narrow-sense BCH codes. More...

`#include <itpp/comm/bch.h>`

Inheritance diagram for itpp::BCH:

## Public Member Functions

| BCH (int in_n, int in_k, int in_t, const ivec &genpolynom, bool sys=false)
| Initialize a (n,k)-code that can correct t errors.
| BCH (int in_n, int in_t, bool sys=false)
| Initialize a (n,k)-code that can correct t errors.
virtual | ~BCH ()
| Destructor.
virtual void | encode (const bvec &uncoded_bits, bvec &coded_bits)
| Encode a bvec of indata.
virtual bvec | encode (const bvec &uncoded_bits)
| Encode a bvec of indata.
virtual bool | decode (const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid)
| Decode the BCH code bits. Return false if there has been any decoding failure.
virtual void | decode (const bvec &coded_bits, bvec &decoded_bits)
| Decode a bvec of coded data. This function is kept for backward compatibility. Better use.
virtual bvec | decode (const bvec &coded_bits)
| Decode a bvec of coded data. This function is kept for backward compatibility. Better use.
virtual void | decode (const vec &received_signal, bvec &output)
| Decode a vec of received data.
virtual bvec | decode (const vec &received_signal)
| Decode a vec of received data.
virtual double | get_rate () const
| Get the code rate.
virtual int | get_k () const
| Get cardinality of code k.
BCH & | operator= (const BCH &)
| Dummy assignment operator - MSVC++ warning C4512.

## Detailed Description

Class for binary, narrow-sense BCH codes.

The notation used is found in S. B. Wicker, "Error control systems for digital communication and storage", Appendix E, Prentice-Hall, 1995.

Example:

BCH bch(31,21,2,ivec("3 5 5 1"))
itpp::Array
General array class.
Definition array.h:105
itpp::BCH
Class for binary, narrow-sense BCH codes.
Definition bch.h:60

uses the generator polynomial , and is capable of correcting 2 errors with n = 31 and k = 21.

Definition at line 59 of file bch.h.

## Constructor & Destructor Documentation

## BCH() [1/2]

itpp::BCH::BCH | ( | int | in_n,
|  | int | in_k,
|  | int | in_t,
|  | const ivec & | genpolynom,
|  | bool | sys = `false`
| ) |  |

Initialize a (n,k)-code that can correct t errors.

Note
  Do not call this constructor with e.g. BCH bch(31, 21, 2, "3 5 5 1") but with BCH bch(31, 21, 2, ivec("3 5 5 1")) instead. Otherwise the complier will complain.

Definition at line 39 of file bch.cpp.

References itpp::Array< T >::length(), itpp::oct2bin(), itpp::GFX::set(), and itpp::zeros_i().

## BCH() [2/2]

itpp::BCH::BCH | ( | int | in_n,
|  | int | in_t,
|  | bool | sys = `false`
| ) |  |

Initialize a (n,k)-code that can correct t errors.

Author
  Stephan Ludwig

The generator polynomial is automatically generated from the (n, t) parameters of the BCH code. The constructor generates the generator polynomial (and determines k) according to the method described in:

[Wic95] S. B. Wicker, "Error control systems for digital communication and storage", Prentice-Hall, 1995

Definition at line 51 of file bch.cpp.

References itpp::GFX::get_true_degree(), itpp::int2bits(), it_assert, itpp::Array< T >::length(), itpp::length(), itpp::GFX::set(), itpp::Array< T >::set_size(), and itpp::zeros_i().

## ~BCH()

virtual itpp::BCH::~BCH | ( |  | ) |

inlinevirtual

Destructor.

Definition at line 85 of file bch.h.

## Member Function Documentation

## encode() [1/2]

void itpp::BCH::encode | ( | const bvec & | uncoded_bits,
|  | bvec & | coded_bits
| ) |  |

virtual

Encode a bvec of indata.

Implements itpp::Channel_Code.

Definition at line 150 of file bch.cpp.

References itpp::floor_i(), itpp::Array< T >::length(), itpp::Array< T >::mid(), itpp::modgfx(), and itpp::Array< T >::set_size().

Referenced by encode().

## encode() [2/2]

bvec itpp::BCH::encode | ( | const bvec & | uncoded_bits | ) |

virtual

Encode a bvec of indata.

Implements itpp::Channel_Code.

Definition at line 201 of file bch.cpp.

References encode().

## decode() [1/5]

bool itpp::BCH::decode | ( | const bvec & | coded_bits,
|  | bvec & | decoded_message,
|  | bvec & | cw_isvalid
| ) |  |

virtual

Decode the BCH code bits. Return false if there has been any decoding failure.

The `coded_bits` are block-wise decoded into `decoded_message` messages. If there has been any decoding failure, the function will return `false`. If this happened in the n-th block, then `cw_isvalid(n)` will be set to `false` (zero-indexed). In case of a systematic code the systematic bits will be extracted and presented in the corresponding block of `decoded_message`. This is better than just presenting zeros, which is done in case of a decoding failure of non-systematic codes.

Definition at line 208 of file bch.cpp.

References itpp::divgfx(), itpp::floor_i(), itpp::Array< T >::length(), itpp::Array< T >::mid(), itpp::Array< T >::set_length(), itpp::Array< T >::set_size(), and itpp::zeros_b().

Referenced by decode(), and decode().

## decode() [2/5]

void itpp::BCH::decode | ( | const bvec & | coded_bits,
|  | bvec & | decoded_bits
| ) |  |

virtual

Decode a bvec of coded data. This function is kept for backward compatibility. Better use.

bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid)
itpp::BCH::decode
virtual bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid)
Decode the BCH code bits. Return false if there has been any decoding failure.
Definition bch.cpp:208

.

Implements itpp::Channel_Code.

Definition at line 337 of file bch.cpp.

References decode(), itpp::Array< T >::length(), and itpp::zeros_b().

## decode() [3/5]

bvec itpp::BCH::decode | ( | const bvec & | coded_bits | ) |

virtual

Decode a bvec of coded data. This function is kept for backward compatibility. Better use.

bool decode(const bvec &coded_bits, bvec &decoded_message, bvec &cw_isvalid)

.

Implements itpp::Channel_Code.

Definition at line 349 of file bch.cpp.

References decode().

## decode() [4/5]

void itpp::BCH::decode | ( | const vec & | received_signal,
|  | bvec & | decoded_bits
| ) |  |

virtual

Decode a vec of received data.

Implements itpp::Channel_Code.

Definition at line 359 of file bch.cpp.

References it_error.

## decode() [5/5]

bvec itpp::BCH::decode | ( | const vec & | received_signal | ) |

virtual

Decode a vec of received data.

Implements itpp::Channel_Code.

Definition at line 364 of file bch.cpp.

References it_error.

## get_rate()

virtual double itpp::BCH::get_rate | ( | void |  | ) | const

inlinevirtual

Get the code rate.

Implements itpp::Channel_Code.

Definition at line 116 of file bch.h.

## get_k()

virtual int itpp::BCH::get_k | ( |  | ) | const

inlinevirtual

Get cardinality of code k.

Definition at line 121 of file bch.h.

## operator=()

BCH & itpp::BCH::operator= | ( | const BCH & |  | ) |

inline

Dummy assignment operator - MSVC++ warning C4512.

Definition at line 126 of file bch.h.

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

- itpp/comm/bch.h
- itpp/comm/bch.cpp

Generated on Mon Jun 10 2024 11:49:33 for IT++ by Doxygen 1.9.8