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

Binary Hamming codes. More...

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

Inheritance diagram for itpp::Hamming_Code:

## Public Member Functions

| Hamming_Code (int m)
| Constructor for `hamming(n,k)`. n = pow(2,m)-1 and k = pow(2,m)-m-1.
virtual | ~Hamming_Code ()
| Destructor.
virtual void | encode (const bvec &uncoded_bits, bvec &coded_bits)
| Hamming encoder. Will truncate some bits if not length = `integer` * k.
virtual bvec | encode (const bvec &uncoded_bits)
| Hamming encoder. Will truncate some bits if not length = `integer` * k.
virtual void | decode (const bvec &coded_bits, bvec &decoded_bits)
| Hamming decoder. Will truncate some bits if not length = `integer` * n.
virtual bvec | decode (const bvec &coded_bits)
| Hamming decoder. Will truncate some bits if not length = `integer` * n.
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.
int | get_n () const
| Gets the code length n.
int | get_k () const
| Gets the number of information bits per code word, k.
bmat | get_H () const
| Gets the parity check matrix for the code.
bmat | get_G () const
| Gets the generator matrix for the code.

## Detailed Description

Binary Hamming codes.

Definition at line 44 of file hammcode.h.

## Constructor & Destructor Documentation

## Hamming_Code()

itpp::Hamming_Code::Hamming_Code | ( | int | m | ) |

Constructor for `hamming(n,k)`. n = pow(2,m)-1 and k = pow(2,m)-m-1.

Definition at line 37 of file hammcode.cpp.

References itpp::pow2i().

## ~Hamming_Code()

virtual itpp::Hamming_Code::~Hamming_Code | ( |  | ) |

inlinevirtual

Destructor.

Definition at line 51 of file hammcode.h.

## Member Function Documentation

## encode() [1/2]

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

virtual

Hamming encoder. Will truncate some bits if not length = `integer` * k.

Implements itpp::Channel_Code.

Definition at line 89 of file hammcode.cpp.

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

Referenced by encode().

## encode() [2/2]

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

virtual

Hamming encoder. Will truncate some bits if not length = `integer` * k.

Implements itpp::Channel_Code.

Definition at line 102 of file hammcode.cpp.

References encode().

## decode() [1/4]

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

virtual

Hamming decoder. Will truncate some bits if not length = `integer` * n.

Implements itpp::Channel_Code.

Definition at line 109 of file hammcode.cpp.

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

Referenced by decode().

## decode() [2/4]

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

virtual

Hamming decoder. Will truncate some bits if not length = `integer` * n.

Implements itpp::Channel_Code.

Definition at line 141 of file hammcode.cpp.

References decode().

## decode() [3/4]

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

virtual

Decode a vec of received data.

Implements itpp::Channel_Code.

Definition at line 150 of file hammcode.cpp.

References it_error.

## decode() [4/4]

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

virtual

Decode a vec of received data.

Implements itpp::Channel_Code.

Definition at line 155 of file hammcode.cpp.

References it_error.

## get_rate()

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

inlinevirtual

Get the code rate.

Implements itpp::Channel_Code.

Definition at line 68 of file hammcode.h.

## get_n()

int itpp::Hamming_Code::get_n | ( |  | ) | const

inline

Gets the code length n.

Definition at line 71 of file hammcode.h.

## get_k()

int itpp::Hamming_Code::get_k | ( |  | ) | const

inline

Gets the number of information bits per code word, k.

Definition at line 73 of file hammcode.h.

## get_H()

bmat itpp::Hamming_Code::get_H | ( |  | ) | const

inline

Gets the parity check matrix for the code.

Definition at line 75 of file hammcode.h.

## get_G()

bmat itpp::Hamming_Code::get_G | ( |  | ) | const

inline

Gets the generator matrix for the code.

Definition at line 77 of file hammcode.h.

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

- itpp/comm/hammcode.h
- itpp/comm/hammcode.cpp

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