IT++ Logo
Public Member Functions | Protected Member Functions | Protected Attributes | Related Functions | List of all members
itpp::PAM_c Class Reference

M-ary PAM modulator with complex symbols. More...

#include <itpp/comm/modulator.h>

Inheritance diagram for itpp::PAM_c:
itpp::Modulator< std::complex< double > >

Public Member Functions

 PAM_c ()
 Default Constructor.
 
 PAM_c (int M)
 Constructor.
 
virtual ~PAM_c ()
 Destructor.
 
void set_M (int M)
 Set the size of the signal constellation.
 
void demodulate_bits (const cvec &signal, bvec &output) const
 Hard demodulation of PAM symbols in complex domain to bits.
 
bvec demodulate_bits (const cvec &signal) const
 Hard demodulation of PAM symbols in complex domain to bits.
 
virtual void demodulate_soft_bits (const cvec &rx_symbols, double N0, vec &soft_bits, Soft_Method method=LOGMAP) const
 Soft demodulator for AWGN channels.
 
virtual vec demodulate_soft_bits (const cvec &rx_symbols, double N0, Soft_Method method=LOGMAP) const
 Soft demodulator for AWGN channels.
 
virtual void demodulate_soft_bits (const cvec &rx_symbols, const cvec &channel, double N0, vec &soft_bits, Soft_Method method=LOGMAP) const
 Soft demodulator for known fading channels.
 
virtual vec demodulate_soft_bits (const cvec &rx_symbols, const cvec &channel, double N0, Soft_Method method=LOGMAP) const
 Soft demodulator for known fading channels.
 
virtual void set (const Vec< std::complex< double > > &symbols, const ivec &bits2symbols)
 Set the constellation to use in the modulator.
 
virtual int bits_per_symbol () const
 Returns number of bits per symbol.
 
virtual int get_k () const
 Returns number of bits per symbol.
 
virtual int get_M () const
 Returns number of modulation symbols.
 
virtual Vec< std::complex
< double > > 
get_symbols () const
 Get the symbol values used in the modulator.
 
virtual ivec get_bits2symbols () const
 Get the bitmap, which maps input bits into symbols.
 
virtual void modulate (const ivec &symbolnumbers, Vec< std::complex< double > > &output) const
 Modulation of symbols.
 
virtual Vec< std::complex
< double > > 
modulate (const ivec &symbolnumbers) const
 Modulation of symbols.
 
virtual void demodulate (const Vec< std::complex< double > > &signal, ivec &output) const
 Demodulation of symbols.
 
virtual ivec demodulate (const Vec< std::complex< double > > &signal) const
 Demodulation of symbols.
 
virtual void modulate_bits (const bvec &bits, Vec< std::complex< double > > &output) const
 Modulation of bits.
 
virtual Vec< std::complex
< double > > 
modulate_bits (const bvec &bits) const
 Modulation of bits.
 
virtual void demodulate_bits (const Vec< std::complex< double > > &signal, bvec &bits) const
 Hard demodulation of bits.
 
virtual bvec demodulate_bits (const Vec< std::complex< double > > &signal) const
 Hard demodulation of bits.
 
virtual void demodulate_soft_bits (const Vec< std::complex< double > > &rx_symbols, double N0, vec &soft_bits, Soft_Method method=LOGMAP) const
 Soft demodulator for AWGN channels.
 
virtual vec demodulate_soft_bits (const Vec< std::complex< double > > &rx_symbols, double N0, Soft_Method method=LOGMAP) const
 Soft demodulator for AWGN channels.
 
virtual void demodulate_soft_bits (const Vec< std::complex< double > > &rx_symbols, const Vec< std::complex< double > > &channel, double N0, vec &soft_bits, Soft_Method method=LOGMAP) const
 Soft demodulator for fading channels.
 
virtual vec demodulate_soft_bits (const Vec< std::complex< double > > &rx_symbols, const Vec< std::complex< double > > &channel, double N0, Soft_Method method=LOGMAP) const
 Soft demodulator for fading channels.
 

Protected Member Functions

void calculate_softbit_matrices ()
 This function calculates the soft bit mapping matrices S0 and S1.
 

Protected Attributes

double scaling_factor
 Scaling factor used to normalize the average energy to 1.
 
bool setup_done
 Setup indicator.
 
int k
 Number of bits per modulation symbol.
 
int M
 Number of modulation symbols.
 
bmat bitmap
 Bit to symbol mapping table (size: M x k)
 
ivec bits2symbols
 Bit to symbol mapping in decimal form (size: M)
 
Vec< std::complex< double > > symbols
 Corresponding modulation symbols (size: M)
 
imat S0
 Matrix where row k contains the constellation points with '0' in bit position k.
 
imat S1
 Matrix where row k contains the constellation points with '1' in bit position k.
 

Related Functions

(Note that these are not member functions.)

typedef Modulator< double > Modulator_1D
 Definition of 1D Modulator (with real symbols)
 
typedef Modulator
< std::complex< double > > 
Modulator_2D
 Definition of 2D Modulator (with complex symbols)
 

Detailed Description

M-ary PAM modulator with complex symbols.

This class implements an M-ary PAM modulator with the following signal values: $\{-(M-1), \ldots, -3, -1, 1, 3, \ldots, (M-1)\}$. Symbol numbering is from right to left in the increasing order. The Gray encoding of bits to symbols is used.

The constellation symbols are normalized so that the average energy is equal to 1. That is, normalized with $ \sqrt{(M^2-1)/3}$.

Note
Although the constellation points can be represented in the real domain only, this class uses complex based interface to be compatible with other PSK and QAM based modulators.
See Also
PAM

Definition at line 968 of file modulator.h.

Member Function Documentation

void itpp::PAM_c::demodulate_soft_bits ( const cvec &  rx_symbols,
double  N0,
vec &  soft_bits,
Soft_Method  method = LOGMAP 
) const
virtual

Soft demodulator for AWGN channels.

This function calculates the log-likelihood ratio (LLR) of the received signal from AWGN channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation:

\[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} \right) \]

or approximate, but faster calculation is performed.

The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let $d_0 = |r_k - s_0|$ denote the distance to the closest zero point and $d_1 = |r_k - s_1|$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes

\[\frac{d_1^2 - d_0^2}{N_0}\]

This function can be used on channels where the channel gain $c = 1$.

When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor $L_c$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function.

Parameters
rx_symbolsThe received noisy constellation symbols $r_k$ (complex, but symbols are real)
N0The spectral density of the AWGN noise
soft_bitsThe soft bits calculated using the expression above
methodThe method used for demodulation (LOGMAP or APPROX)
Note
For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of Modulator_1D/Modulator_2D and Modulator_ND is not advised.

Definition at line 435 of file modulator.cpp.

References itpp::exp(), it_assert_debug, itpp::Modulator< std::complex< double > >::k, itpp::LOGMAP, itpp::Modulator< std::complex< double > >::M, itpp::max(), itpp::real(), itpp::Modulator< std::complex< double > >::S0, itpp::Modulator< std::complex< double > >::S1, itpp::Modulator< std::complex< double > >::setup_done, itpp::sqr(), itpp::Modulator< std::complex< double > >::symbols, and itpp::trunc_log().

Referenced by demodulate_soft_bits().

void itpp::PAM_c::demodulate_soft_bits ( const cvec &  rx_symbols,
const cvec &  channel,
double  N0,
vec &  soft_bits,
Soft_Method  method = LOGMAP 
) const
virtual

Soft demodulator for known fading channels.

This function calculates the log-likelihood ratio (LLR) of the received signal from fading channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation:

\[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} \right) \]

or approximate, but faster calculation is performed.

The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let $d_0 = |r_k - c_k s_0|$ denote the distance to the closest zero point and $d_1 = |r_k - c_k s_1|$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes

\[\frac{d_1^2 - d_0^2}{N_0}\]

When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor $L_c$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function.

Parameters
rx_symbolsThe received noisy constellation symbols $r_k$ (complex)
channelThe channel values $c_k$
N0The spectral density of the AWGN noise
soft_bitsThe soft bits calculated using the expression above
methodThe method used for demodulation (LOGMAP or APPROX)
Note
For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of Modulator_1D/Modulator_2D and Modulator_ND is not advised.

Definition at line 488 of file modulator.cpp.

References itpp::exp(), it_assert_debug, itpp::Modulator< std::complex< double > >::k, itpp::LOGMAP, itpp::Modulator< std::complex< double > >::M, itpp::max(), itpp::real(), itpp::Modulator< std::complex< double > >::S0, itpp::Modulator< std::complex< double > >::S1, itpp::Modulator< std::complex< double > >::setup_done, itpp::sqr(), itpp::Modulator< std::complex< double > >::symbols, and itpp::trunc_log().

virtual ivec itpp::Modulator< std::complex< double > >::get_bits2symbols ( ) const
inlinevirtualinherited

Get the bitmap, which maps input bits into symbols.

The mapping is done as follows. An input bit sequence in decimal notation is used for indexing the bits2symbols table. The indexing result denotes the symbol to be used from the symbols table, e.g.:

PSK mod(8); // assume 8-PSK modulator
cvec sym = mod.get_symbols();
ivec bits2sym = mod.get_bits2symbols();
bvec in_bits = "100" // input bits
int d = bin2dec(in_bits); // decimal representation of in_bits = 4
// mapping of d into PSK symbol using bits2sym and sym tables
std::complex<double> out_symbol = sym(bits2sym(d));

Definition at line 117 of file modulator.h.

References itpp::Modulator< T >::bits2symbols.

virtual void itpp::Modulator< std::complex< double > >::demodulate_soft_bits ( const Vec< std::complex< double > > &  rx_symbols,
double  N0,
vec &  soft_bits,
Soft_Method  method = LOGMAP 
) const
virtualinherited

Soft demodulator for AWGN channels.

This function calculates the log-likelihood ratio (LLR) of the received signal from AWGN channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation:

\[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - s_i|^2}{N_0} \right)} \right) \]

or approximate, but faster calculation is performed.

The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let $d_0 = |r_k - s_0|$ denote the distance to the closest zero point and $d_1 = |r_k - s_1|$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes

\[\frac{d_1^2 - d_0^2}{N_0}\]

This function can be used on channels where the channel gain $c_k = 1$.

When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor $L_c$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function.

Parameters
rx_symbolsThe received noisy constellation symbols
N0The spectral density of the AWGN noise
soft_bitsThe soft bits calculated using the expression above
methodThe method used for demodulation (LOGMAP or APPROX)
Note
For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of Modulator_1D/Modulator_2D and Modulator_ND is not advised.
virtual void itpp::Modulator< std::complex< double > >::demodulate_soft_bits ( const Vec< std::complex< double > > &  rx_symbols,
const Vec< std::complex< double > > &  channel,
double  N0,
vec &  soft_bits,
Soft_Method  method = LOGMAP 
) const
virtualinherited

Soft demodulator for fading channels.

This function calculates the log-likelihood ratio (LLR) of the received signal from fading channels. Depending on the soft demodulation method chosen, either full log-MAP calculation is performed (default method), according to the following equation:

\[\log \left( \frac{P(b_i=0|r)}{P(b_i=1|r)} \right) = \log \left( \frac{\sum_{s_i \in S_0} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} {\sum_{s_i \in S_1} \exp \left( -\frac{|r_k - c_k s_i|^2}{N_0} \right)} \right) \]

or approximate, but faster calculation is performed.

The approximate method finds for each bit the closest constellation points that have zero and one in the corresponding position. Let $d_0 = |r_k - c_k s_0|$ denote the distance to the closest zero point and $d_1 = |r_k - c_k s_1|$ denote the distance to the closest one point for the corresponding bit respectively. The approximate algorithm then computes

\[\frac{d_1^2 - d_0^2}{N_0}\]

When this function is to be used together with MAP-based turbo decoding algorithms then the channel reliability factor $L_c$ of the turbo decoder shall be set to 1. The output from this function can also be used by a Viterbi decoder using an AWGN based metric calculation function.

Parameters
rx_symbolsThe received noisy constellation symbols $r_k$
channelThe channel values $c_k$
N0The spectral density of the AWGN noise
soft_bitsThe soft bits calculated using the expression above
methodThe method used for demodulation (LOGMAP or APPROX)
Note
For soft demodulation it is suggested to use the N-dimensional modulator (Modulator_ND) instead, which is based on the QLLR (quantized) arithmetic and therefore is faster. Please note, however, that mixed use of Modulator_1D/Modulator_2D and Modulator_ND is not advised.

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

Generated on Sat Jul 6 2013 10:54:32 for IT++ by Doxygen 1.8.2