IT++ 4.3.1
|
M-ary QAM modulator with square lattice. More...
#include <itpp/comm/modulator.h>
Public Member Functions | |
QAM () | |
Default Constructor. | |
QAM (int M) | |
Class Constructor. | |
virtual | ~QAM () |
Destructor. | |
void | set_M (int M) |
Change the size of the signal constellation. | |
void | demodulate_bits (const cvec &signal, bvec &bits) const |
Hard demodulation of bits. | |
bvec | demodulate_bits (const cvec &signal) const |
Hard demodulation of bits. | |
virtual void | set (const Vec< std::complex< double > > &symbols, const ivec &bits2symbols) |
Set the constellation to use in the modulator. | |
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 | bits_per_symbol () const |
Returns number of bits per symbol. | |
virtual int | get_k () 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 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 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 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 | 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 | 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 | 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_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. | |
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. | |
void | calculate_softbit_matrices () |
This function calculates the soft bit mapping matrices S0 and S1. | |
Protected Attributes | |
int | L |
The square-root of M. | |
double | scaling_factor |
Scaling factor of square QAM constellation (sqrt((M-1)*2/3)) | |
bool | setup_done |
Setup indicator. | |
bool | setup_done |
Setup indicator. | |
int | k |
Number of bits per modulation symbol. | |
int | k |
Number of bits per modulation symbol. | |
int | M |
Number of modulation symbols. | |
int | M |
Number of modulation symbols. | |
bmat | bitmap |
Bit to symbol mapping table (size: M x k) | |
bmat | bitmap |
Bit to symbol mapping table (size: M x k) | |
ivec | bits2symbols |
Bit to symbol mapping in decimal form (size: M) | |
ivec | bits2symbols |
Bit to symbol mapping in decimal form (size: M) | |
Vec< std::complex< double > > | symbols |
Corresponding modulation symbols (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 | 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. | |
imat | S1 |
Matrix where row k contains the constellation points with '1' in bit position k. | |
Related Symbols | |
(Note that these are not member symbols.) | |
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) | |
M-ary QAM modulator with square lattice.
The size of the QAM constellation is \(M = 2^k\), where \(k = 1, 2, \ldots \). Symbol values in each dimension are: \(\{-(\sqrt{M}-1), \ldots, -3, -1, 1, 3, \ldots, (\sqrt{M}-1)\}\). The bitmap is Gray encoded. Symbols are normalized so that the average energy is 1. That is, normalized with \(\sqrt{2(M-1)/3}\).
Beside hard demapping, this class can also perform soft demodulation, calculating the log-MAP estimate of the individual bits. To use it properly the received symbols should be equal to:
\[r_k = c_k s_k + n_k,\]
where \(c_k\) is the real or complex channel gain, \(s_k\) is the transmitted constellation symbol, and \(n_k\) is the AWGN of the channel (with variance \(N_0\)).
It is also assumed that the channel estimates are perfect when calculating the soft bits.
Definition at line 586 of file modulator.h.
|
inline |
Default Constructor.
Definition at line 590 of file modulator.h.
|
inline |
Class Constructor.
Definition at line 592 of file modulator.h.
References itpp::Modulator< std::complex< double > >::M, and set_M().
|
inlinevirtual |
Destructor.
Definition at line 594 of file modulator.h.
void itpp::QAM::set_M | ( | int | M | ) |
Change the size of the signal constellation.
Definition at line 48 of file modulator.cpp.
References itpp::bin2dec(), itpp::Modulator< std::complex< double > >::bitmap, itpp::Modulator< std::complex< double > >::bits2symbols, itpp::Modulator< std::complex< double > >::calculate_softbit_matrices(), itpp::concat(), itpp::gray_code(), itpp::graycode(), itpp::is_even(), it_assert, itpp::Modulator< std::complex< double > >::k, L, itpp::levels2bits(), itpp::Modulator< std::complex< double > >::M, itpp::pow2i(), itpp::round_i(), scaling_factor, itpp::Modulator< std::complex< double > >::setup_done, and itpp::Modulator< std::complex< double > >::symbols.
Referenced by QAM().
void itpp::QAM::demodulate_bits | ( | const cvec & | signal, |
bvec & | bits ) const |
Hard demodulation of bits.
Definition at line 81 of file modulator.cpp.
References itpp::Modulator< std::complex< double > >::bitmap, it_assert_debug, itpp::Modulator< std::complex< double > >::k, L, itpp::round_i(), scaling_factor, and itpp::Modulator< std::complex< double > >::setup_done.
Referenced by demodulate_bits().
bvec itpp::QAM::demodulate_bits | ( | const cvec & | signal | ) | const |
Hard demodulation of bits.
Definition at line 105 of file modulator.cpp.
References demodulate_bits().
|
virtualinherited |
Set the constellation to use in the modulator.
Definition at line 86 of file modulator.h.
|
inlinevirtualinherited |
Returns number of bits per symbol.
Definition at line 89 of file modulator.h.
|
inlinevirtualinherited |
Returns number of bits per symbol.
Definition at line 89 of file modulator.h.
|
inlinevirtualinherited |
Returns number of bits per symbol.
Definition at line 92 of file modulator.h.
|
inlinevirtualinherited |
Returns number of bits per symbol.
Definition at line 92 of file modulator.h.
|
inlinevirtualinherited |
Returns number of modulation symbols.
Definition at line 95 of file modulator.h.
|
inlinevirtualinherited |
Returns number of modulation symbols.
Definition at line 95 of file modulator.h.
|
inlinevirtualinherited |
Get the symbol values used in the modulator.
Definition at line 98 of file modulator.h.
|
inlinevirtualinherited |
Get the symbol values used in the modulator.
Definition at line 98 of file modulator.h.
|
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.:
Definition at line 117 of file modulator.h.
|
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.:
Definition at line 117 of file modulator.h.
|
virtualinherited |
Modulation of symbols.
Definition at line 120 of file modulator.h.
|
virtualinherited |
Modulation of symbols.
Definition at line 122 of file modulator.h.
|
virtualinherited |
Demodulation of symbols.
Definition at line 125 of file modulator.h.
|
virtualinherited |
Demodulation of symbols.
Definition at line 127 of file modulator.h.
|
virtualinherited |
Modulation of bits.
Reimplemented in itpp::BPSK_c.
|
virtualinherited |
Modulation of bits.
Definition at line 130 of file modulator.h.
|
virtualinherited |
|
virtualinherited |
Hard demodulation of bits.
Definition at line 135 of file modulator.h.
|
virtualinherited |
Hard demodulation of bits.
Definition at line 137 of file modulator.h.
|
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.
rx_symbols | The received noisy constellation symbols |
N0 | The spectral density of the AWGN noise |
soft_bits | The soft bits calculated using the expression above |
method | The method used for demodulation (LOGMAP or APPROX) |
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.
|
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.
rx_symbols | The received noisy constellation symbols \(r_k\) |
channel | The channel values \(c_k\) |
N0 | The spectral density of the AWGN noise |
soft_bits | The soft bits calculated using the expression above |
method | The method used for demodulation (LOGMAP or APPROX) |
Modulator_1D/Modulator_2D
and
Modulator_ND
is not advised.
|
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.
rx_symbols | The received noisy constellation symbols |
N0 | The spectral density of the AWGN noise |
soft_bits | The soft bits calculated using the expression above |
method | The method used for demodulation (LOGMAP or APPROX) |
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 178 of file modulator.h.
|
virtualinherited |
Soft demodulator for AWGN channels.
Definition at line 182 of file modulator.h.
|
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.
rx_symbols | The received noisy constellation symbols \(r_k\) |
channel | The channel values \(c_k\) |
N0 | The spectral density of the AWGN noise |
soft_bits | The soft bits calculated using the expression above |
method | The method used for demodulation (LOGMAP or APPROX) |
Modulator_1D/Modulator_2D
and
Modulator_ND
is not advised. Definition at line 223 of file modulator.h.
|
virtualinherited |
Soft demodulator for fading channels.
Definition at line 228 of file modulator.h.
|
protectedinherited |
This function calculates the soft bit mapping matrices S0 and S1.
Definition at line 254 of file modulator.h.
|
Definition of 1D Modulator (with real symbols)
Definition at line 266 of file modulator.h.
|
Definition of 2D Modulator (with complex symbols)
Definition at line 272 of file modulator.h.
|
protected |
The square-root of M.
Definition at line 605 of file modulator.h.
Referenced by demodulate_bits(), and set_M().
|
protected |
Scaling factor of square QAM constellation (sqrt((M-1)*2/3))
Definition at line 607 of file modulator.h.
Referenced by demodulate_bits(), and set_M().
|
protectedinherited |
Setup indicator.
Definition at line 235 of file modulator.h.
Referenced by itpp::PAM_c::demodulate_bits(), itpp::PSK::demodulate_bits(), itpp::QAM::demodulate_bits(), itpp::PAM_c::demodulate_soft_bits(), itpp::PAM_c::demodulate_soft_bits(), itpp::PAM_c::set_M(), itpp::PSK::set_M(), and itpp::QAM::set_M().
|
protectedinherited |
Setup indicator.
Definition at line 235 of file modulator.h.
|
protectedinherited |
Number of bits per modulation symbol.
Definition at line 237 of file modulator.h.
Referenced by itpp::PAM_c::demodulate_bits(), itpp::PSK::demodulate_bits(), itpp::QAM::demodulate_bits(), itpp::PAM_c::demodulate_soft_bits(), itpp::PAM_c::demodulate_soft_bits(), itpp::QPSK::demodulate_soft_bits(), itpp::PAM_c::set_M(), itpp::PSK::set_M(), and itpp::QAM::set_M().
|
protectedinherited |
Number of bits per modulation symbol.
Definition at line 237 of file modulator.h.
|
protectedinherited |
Number of modulation symbols.
Definition at line 239 of file modulator.h.
Referenced by itpp::PAM_c::demodulate_bits(), itpp::PSK::demodulate_bits(), itpp::PAM_c::demodulate_soft_bits(), itpp::PAM_c::demodulate_soft_bits(), itpp::PAM_c::PAM_c(), itpp::PSK::PSK(), itpp::QAM::QAM(), itpp::PAM_c::set_M(), itpp::PSK::set_M(), and itpp::QAM::set_M().
|
protectedinherited |
Number of modulation symbols.
Definition at line 239 of file modulator.h.
|
protectedinherited |
Bit to symbol mapping table (size: M x k)
Definition at line 241 of file modulator.h.
Referenced by itpp::PAM_c::demodulate_bits(), itpp::PSK::demodulate_bits(), itpp::QAM::demodulate_bits(), itpp::PAM_c::set_M(), itpp::PSK::set_M(), and itpp::QAM::set_M().
|
protectedinherited |
Bit to symbol mapping table (size: M x k)
Definition at line 241 of file modulator.h.
|
protectedinherited |
Bit to symbol mapping in decimal form (size: M)
Definition at line 243 of file modulator.h.
Referenced by itpp::PAM_c::set_M(), itpp::PSK::set_M(), and itpp::QAM::set_M().
|
protectedinherited |
Bit to symbol mapping in decimal form (size: M)
Definition at line 243 of file modulator.h.
|
protectedinherited |
Corresponding modulation symbols (size: M)
Definition at line 245 of file modulator.h.
Referenced by itpp::PAM_c::demodulate_soft_bits(), itpp::PAM_c::demodulate_soft_bits(), itpp::PAM_c::set_M(), itpp::PSK::set_M(), and itpp::QAM::set_M().
|
protectedinherited |
Corresponding modulation symbols (size: M)
Definition at line 245 of file modulator.h.
|
protectedinherited |
Matrix where row k contains the constellation points with '0' in bit position k.
Definition at line 248 of file modulator.h.
Referenced by itpp::PAM_c::demodulate_soft_bits(), and itpp::PAM_c::demodulate_soft_bits().
|
protectedinherited |
Matrix where row k contains the constellation points with '0' in bit position k.
Definition at line 248 of file modulator.h.
|
protectedinherited |
Matrix where row k contains the constellation points with '1' in bit position k.
Definition at line 251 of file modulator.h.
Referenced by itpp::PAM_c::demodulate_soft_bits(), and itpp::PAM_c::demodulate_soft_bits().
|
protectedinherited |
Matrix where row k contains the constellation points with '1' in bit position k.
Definition at line 251 of file modulator.h.