Channel

Channel offers an interface to implement Discrete Memoryless Channels, which are a class of communication channels, as well as a number of pre-defined channels. A number of well-known channels are already implemented.

Interface

Channel Base Class

Each channel inherits from the channel base class template:

template <typename Input, typename Output>
struct Channel;
Input is the type of objects that enter the channel, Output is the type of objects that emerge from the channel, i.e. the channel output.

  virtual ~Channel()  
Make sure to always define a virtual destructor, see Scott Meyers' ``effective C++''.
  virtual
  double probabilityOf(Output &channelOutput,       
		       Input &channelInput) const;  
Return the probability that the channel output is channelOutput when the input to the channel is channelInput.

Unless explicity stated otherwise each channel given below is a template class and inherits from the base class as in this example:

template <Input, Output>
struct ExampleChannel : public Channel<Input, Output>
{
	// ... Overload destructor and probabilityOf(...) ...
};
You can create your own channels in the same way.

NoiselessChannel

A channel that models noiseless communication. Thus, the channel output is always equal to the channel input; equivalently, probabilityOf(...) returns 1 if channelOutput equals channelInput and zero otherwise.

  NoiselessChannel();  
Only a default Constructor is available.

ShiftChannel

Models a channel where the output is a shifted version of the input.

  ShiftChannel(double offset);  
The offset is the shift introduced by the channel, i.e. channelOutput = channelInput + offset.

AWGNChannel

The well-known Additive White Gaussian Noise channel. If the mean of the noise is zero, and a given variance, the AWGNChannel with that variance is the worst possible kind of additive noise. Hence if the actual probability model of the noise is not known, but the mean is zero and the variance is known, the AWGNChannel is equivalent to a worst-case scenario.

  AWGNChannel(double variance);  
The variance refers to the variance of the noise.

AGNChannel

The AGNChannel models an Additive Gaussian Noise channel. Unlike the AWGNChannel, the mean does not have to be zero, otherwise it is equivalent. Hence, it is a combination of the ShiftChannel and AWGNChannel. To be used like the AWGNChannel when the mean of the noise is not equal to zero.

  AGNChannel(double mean, double variance);  
	
The parameters are the mean and variance of the noise.

AGGNChannel

Models additive noise distributed according to the Generalized Gaussian distribution. In addition to the parameters mean and variance, which are equivalent to those in the Gaussian channels, the shape parameter is unique to the Generalized Gaussian distribution and is often denoted as alpha. Note that there is procedure generalizedGaussianShape(...) to estimate the shape parameter from a dataset in Math.

  AGGNChannel(double mean, double variance,
	      double shape = 2.0);  
The input to the constructor are simply the parameters of the distribution of the noise. By default the shape is 2.0 which makes the distribution Gaussian.

MultiChannel

Unlike most channels in Channel, MultiChannel is not an existing channel model. It allows one to create a channel that behaves differently for each input by associating a particular channel with each possible input.

In the table below, CHANNEL_MAP, the type of the parameter to the constructor is in fact:

std::map<Input, std::tr1::shared_ptr< Channel<Input,Output> > >
This is only to simplify the documentation, CHANNEL_MAP is not defined in the code.
  MultiChannel(CHANNEL_MAP channels)  
The constructor requires a map from each possible valid Input to an associated shared-pointer to a channel to be used to obtain the likelihood of the channel output for a given input symbol.

BinarySymmetricChannel

The Binary Symmetric Channel is a well-known channel that takes bits as input and produces bits as output, flipping the bits during transport with a certain probability that is usually denoted as p.

By exception, BinarySymmetricChannel is not a template class as the channel input symbols and the channel output are defined to be booleans, and hence the definition is:

class BinarySymmetricChannel : public Channel<bool, bool> ...

  BinarySymmetricChannel(double pFlip);  
Constructor, the probability that a bit is flipped is pFlip.