modulator_nd.h
Go to the documentation of this file.
#ifndef MODULATOR_ND_H
#define MODULATOR_ND_H
#include <itpp/base/vec.h>
#include <itpp/base/array.h>
#include <itpp/comm/llr.h>
#include <itpp/itexports.h>
#include <itpp/base/base_exports.h>
namespace itpp
{
// ----------------------------------------------------------------------
// Modulator_ND
// ----------------------------------------------------------------------
class ITPP_EXPORT Modulator_ND
{
public:
enum Soft_Demod_Method {
FULL_ENUM_LOGMAP,
FULL_ENUM_MAXLOG,
ZF_LOGMAP
};
Modulator_ND(LLR_calc_unit llrcalc_in = LLR_calc_unit()):
llrcalc(llrcalc_in), demod_initialized(false) {}
virtual ~Modulator_ND() {}
void set_llrcalc(LLR_calc_unit llrcalc_in) {
llrcalc = llrcalc_in;
};
LLR_calc_unit get_llrcalc() const {
return llrcalc;
}
int get_dim() const {
return nt;
}
ivec get_k() const {
return k;
}
ivec bits_per_symbol() const {
return k;
}
ivec get_M() const {
return M;
}
Array<ivec> get_bits2symbols() const {
return bits2symbols;
}
Array<bmat> get_bitmap() const {
return bitmap;
}
protected:
int nt;
int nb;
LLR_calc_unit llrcalc;
ivec k;
ivec M;
bool demod_initialized;
Array<bmat> bitmap;
Array<ivec> bits2symbols;
double gaussnorm;
itpp::vec hnorms;
itpp::QLLRvec Qnorms;
itpp::QLLRvec llrapr;
itpp::ivec bpos2cpos;
itpp::ivec bitcumsum;
itpp::Array<itpp::Vec<unsigned> > gray2dec;
QLLRvec probabilities(QLLR l); // some abuse of what QLLR stands for...
Array<QLLRvec> probabilities(const QLLRvec &l);
void marginalize_bits(itpp::QLLRvec& llr, Soft_Demod_Method method) const;
void demodllrbit0(itpp::QLLR& llr) const;
void demodllrbit1(itpp::QLLR& llr) const;
void demodllrbit2(itpp::QLLR& llr) const;
void demodmaxbit0(itpp::QLLR& maxllr) const;
void demodmaxbit1(itpp::QLLR& maxllr) const;
void demodmaxbit2(itpp::QLLR& maxllr) const;
void update_LLR(const Array<QLLRvec> &logP_apriori, const ivec &s,
QLLR scaled_norm, QLLRvec &num, QLLRvec &denom);
void update_LLR(const Array<QLLRvec> &logP_apriori, int s,
QLLR scaled_norm, int j, QLLRvec &num, QLLRvec &denom);
};
// ----------------------------------------------------------------------
// Modulator_NRD
// ----------------------------------------------------------------------
class ITPP_EXPORT Modulator_NRD : public Modulator_ND
{
public:
Modulator_NRD() {}
virtual ~Modulator_NRD() {}
Array<vec> get_symbols() const;
void modulate_bits(const bvec &bits, vec &symbols) const;
vec modulate_bits(const bvec &bits) const;
void init_soft_demodulator(const itpp::mat& H, const double& sigma2);
void demodulate_soft_bits(const vec &y,
const QLLRvec &LLR_apriori,
QLLRvec &LLR_aposteriori,
Soft_Demod_Method method = FULL_ENUM_LOGMAP);
void demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
const QLLRvec &LLR_apriori,
QLLRvec &LLR_aposteriori,
Soft_Demod_Method method = FULL_ENUM_LOGMAP);
QLLRvec demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
const QLLRvec &LLR_apriori,
Soft_Demod_Method method = FULL_ENUM_LOGMAP);
void demodulate_soft_bits(const vec &y, const vec &h, double sigma2,
const QLLRvec &LLR_apriori,
QLLRvec &LLR_aposteriori);
friend ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
protected:
Array<vec> symbols;
void update_norm(double &norm, int k, int sold, int snew, const vec &ytH,
const mat &HtH, const ivec &s);
void hxnormupdate(itpp::vec& Hx, unsigned& bitstring, unsigned& ind, unsigned bit);
void yxnormupdate(double& yx, itpp::QLLR& lapr, unsigned& bitstring, unsigned& ind, unsigned bit);
itpp::mat H;
itpp::Array<itpp::Array<itpp::vec> > hspacings;
itpp::Array<itpp::vec> yspacings;
};
ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
// ----------------------------------------------------------------------
// Modulator_NCD
// ----------------------------------------------------------------------
class ITPP_EXPORT Modulator_NCD : public Modulator_ND
{
public:
Modulator_NCD() {}
virtual ~Modulator_NCD() {}
Array<cvec> get_symbols() const;
void modulate_bits(const bvec &bits, cvec &symbols) const;
cvec modulate_bits(const bvec &bits) const;
void init_soft_demodulator(const itpp::cmat& H, const double& sigma2);
void demodulate_soft_bits(const cvec &y,
const QLLRvec &LLR_apriori,
QLLRvec &LLR_aposteriori,
Soft_Demod_Method method = FULL_ENUM_LOGMAP);
void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
const QLLRvec &LLR_apriori,
QLLRvec &LLR_aposteriori,
Soft_Demod_Method method = FULL_ENUM_LOGMAP);
QLLRvec demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
const QLLRvec &LLR_apriori,
Soft_Demod_Method method = FULL_ENUM_LOGMAP);
void demodulate_soft_bits(const cvec &y, const cvec &h, double sigma2,
const QLLRvec &LLR_apriori,
QLLRvec &LLR_aposteriori);
friend ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
protected:
Array<cvec> symbols;
itpp::cmat H;
itpp::Array<itpp::Array<itpp::cvec> > hspacings;
itpp::Array<itpp::vec> yspacings;
void hxnormupdate(itpp::cvec& Hx, unsigned& bitstring, unsigned& ind, unsigned bit);
void yxnormupdate(double& yx, itpp::QLLR& lapr, unsigned& bitstring, unsigned& ind, unsigned bit);
};
ITPP_EXPORT std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
// ----------------------------------------------------------------------
// ND_UPAM
// ----------------------------------------------------------------------
class ITPP_EXPORT ND_UPAM : public Modulator_NRD
{
public:
ND_UPAM(int nt = 1, int Mary = 2);
virtual ~ND_UPAM() {}
void set_M(int nt = 1, int Mary = 2);
void set_M(int nt = 1, ivec Mary = "2");
int sphere_decoding(const vec &y, const mat &H, double rmin, double rmax,
double stepup, QLLRvec &detected_bits);
private:
// Sphere decoding search with Schnorr Eucner strategy.
int sphere_search_SE(const vec &y, const mat &H, const imat &zrange,
double r, ivec &zhat);
vec spacing; // spacing between the constellation points
inline int sign_nozero_i(int a) {
return (a > 0 ? 1 : -1);
}
inline int sign_nozero_i(double a) {
return (a > 0.0 ? 1 : -1);
}
};
// ----------------------------------------------------------------------
// ND_UQAM
// ----------------------------------------------------------------------
class ITPP_EXPORT ND_UQAM : public Modulator_NCD
{
public:
ND_UQAM(int nt = 1, int Mary = 4);
virtual ~ND_UQAM() {}
void set_M(int nt = 1, int Mary = 4);
void set_M(int nt = 1, ivec Mary = "4");
void set_constellation_points(const int nth, const cvec& inConstellation, const ivec& in_bit2symbols);
protected:
ivec L;
};
// ----------------------------------------------------------------------
// ND_UPSK
// ----------------------------------------------------------------------
class ITPP_EXPORT ND_UPSK : public Modulator_NCD
{
public:
ND_UPSK(int nt = 1, int Mary = 4);
virtual ~ND_UPSK() {}
void set_M(int nt = 1, int Mary = 4);
void set_M(int nt = 1, ivec Mary = "4");
};
} // namespace itpp
#endif // #ifndef MODULATOR_ND_H
array.h
Definition of Array class (container)
base_exports.h
Import/Export definitions for some templates defined in base folder.
itpp::Array
General array class.
Definition array.h:105
itpp::Array::operator<<
std::ostream & operator<<(std::ostream &os, const Array< T > &a)
Output stream for Array<T>. T must have ostream operator<< defined.
Definition array.h:545
itpp::LLR_calc_unit
Log-likelihood algebra calculation unit.
Definition llr.h:125
itpp::Modulator_NCD
Base class for vector (MIMO) channel modulator/demodulators with complex valued components.
Definition modulator_nd.h:448
itpp::Modulator_NCD::Modulator_NCD
Modulator_NCD()
Constructor.
Definition modulator_nd.h:451
itpp::Modulator_NCD::demodulate_soft_bits
void demodulate_soft_bits(const cvec &y, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method=FULL_ENUM_LOGMAP)
Soft MAP demodulation for multidimensional channel, by "brute-force" enumeration of all constellation...
itpp::Modulator_NCD::hspacings
itpp::Array< itpp::Array< itpp::cvec > > hspacings
The spacing between different constellation points multiplied by the different H columns.
Definition modulator_nd.h:595
itpp::Modulator_NCD::yspacings
itpp::Array< itpp::vec > yspacings
The spacing between different constellation points scaled by different y elements.
Definition modulator_nd.h:597
itpp::Modulator_NCD::H
itpp::cmat H
Complex-valued channel matrix.
Definition modulator_nd.h:593
itpp::Modulator_NCD::symbols
Array< cvec > symbols
Vectors of modulation symbols (along each dimension)
Definition modulator_nd.h:591
itpp::Modulator_NCD::~Modulator_NCD
virtual ~Modulator_NCD()
Destructor.
Definition modulator_nd.h:453
itpp::Modulator_ND
Base class for an N-dimensional (ND) vector (MIMO) modulator.
Definition modulator_nd.h:64
itpp::Modulator_ND::Qnorms
itpp::QLLRvec Qnorms
Norms part depending on both H and y.
Definition modulator_nd.h:144
itpp::Modulator_ND::gaussnorm
double gaussnorm
The normalization factor in the exponent (in front of the square norm) in the Gaussian distribution.
Definition modulator_nd.h:140
itpp::Modulator_ND::bits2symbols
Array< ivec > bits2symbols
Bit pattern in decimal form ordered and the corresponding symbols (one pattern per dimension)
Definition modulator_nd.h:138
itpp::Modulator_ND::get_k
ivec get_k() const
Get number of bits per modulation symbol per dimension.
Definition modulator_nd.h:98
itpp::Modulator_ND::nt
int nt
Number of dimensions.
Definition modulator_nd.h:124
itpp::Modulator_ND::bits_per_symbol
ivec bits_per_symbol() const
Get number of bits per modulation symbol per dimension.
Definition modulator_nd.h:103
itpp::Modulator_ND::get_dim
int get_dim() const
Get number of dimensions.
Definition modulator_nd.h:93
itpp::Modulator_ND::hnorms
itpp::vec hnorms
Norms part dependent on H.
Definition modulator_nd.h:142
itpp::Modulator_ND::M
ivec M
Number of modulation symbols along each dimension.
Definition modulator_nd.h:132
itpp::Modulator_ND::bitcumsum
itpp::ivec bitcumsum
The cumulative sum of bits in the symbol vector.
Definition modulator_nd.h:150
itpp::Modulator_ND::k
ivec k
Number of bits per modulation symbol.
Definition modulator_nd.h:130
itpp::Modulator_ND::llrapr
itpp::QLLRvec llrapr
A prioi information.
Definition modulator_nd.h:146
itpp::Modulator_ND::get_llrcalc
LLR_calc_unit get_llrcalc() const
Get LLR calculation unit.
Definition modulator_nd.h:88
itpp::Modulator_ND::get_bits2symbols
Array< ivec > get_bits2symbols() const
Get bit pattern in decimal.
Definition modulator_nd.h:113
itpp::Modulator_ND::Soft_Demod_Method
Soft_Demod_Method
Soft demodulation method.
Definition modulator_nd.h:67
itpp::Modulator_ND::FULL_ENUM_MAXLOG
@ FULL_ENUM_MAXLOG
Max-Log demodulation by "brute-force" enumeration of all points.
Definition modulator_nd.h:71
itpp::Modulator_ND::FULL_ENUM_LOGMAP
@ FULL_ENUM_LOGMAP
Log-MAP demodulation by "brute-force" enumeration of all points.
Definition modulator_nd.h:69
itpp::Modulator_ND::llrcalc
LLR_calc_unit llrcalc
LLR calculation unit.
Definition modulator_nd.h:128
itpp::Modulator_ND::gray2dec
itpp::Array< itpp::Vec< unsigned > > gray2dec
The Gray to decimal mapping.
Definition modulator_nd.h:152
itpp::Modulator_ND::nb
int nb
Number of bits in the symbol vector.
Definition modulator_nd.h:126
itpp::Modulator_ND::get_M
ivec get_M() const
Get number of modulation symbols per dimension.
Definition modulator_nd.h:108
itpp::Modulator_ND::~Modulator_ND
virtual ~Modulator_ND()
Destructor.
Definition modulator_nd.h:80
itpp::Modulator_ND::Modulator_ND
Modulator_ND(LLR_calc_unit llrcalc_in=LLR_calc_unit())
Default constructor.
Definition modulator_nd.h:77
itpp::Modulator_ND::get_bitmap
Array< bmat > get_bitmap() const
Get Bit mapping table.
Definition modulator_nd.h:118
itpp::Modulator_ND::bitmap
Array< bmat > bitmap
Bit mapping table (one table per dimension)
Definition modulator_nd.h:136
itpp::Modulator_ND::set_llrcalc
void set_llrcalc(LLR_calc_unit llrcalc_in)
Set LLR calculation unit.
Definition modulator_nd.h:83
itpp::Modulator_ND::demod_initialized
bool demod_initialized
Flag indicating whether the demodulator has been initialized.
Definition modulator_nd.h:134
itpp::Modulator_ND::bpos2cpos
itpp::ivec bpos2cpos
The bit to column mapping.
Definition modulator_nd.h:148
itpp::Modulator_NRD
Base class for N-dimensional vector (MIMO) channel modulators/demodulators with real-valued component...
Definition modulator_nd.h:249
itpp::Modulator_NRD::~Modulator_NRD
virtual ~Modulator_NRD()
Destructor.
Definition modulator_nd.h:254
itpp::Modulator_NRD::update_norm
void update_norm(double &norm, int k, int sold, int snew, const vec &ytH, const mat &HtH, const ivec &s)
Update residual norm (for internal use).
itpp::Modulator_NRD::demodulate_soft_bits
void demodulate_soft_bits(const vec &y, const QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, Soft_Demod_Method method=FULL_ENUM_LOGMAP)
Soft MAP demodulation for multidimensional channel, by "brute-force" enumeration of all constellation...
itpp::Modulator_NRD::yspacings
itpp::Array< itpp::vec > yspacings
The spacing between different constellation points scaled by different y elements.
Definition modulator_nd.h:420
itpp::Modulator_NRD::H
itpp::mat H
Real channel matrix.
Definition modulator_nd.h:416
itpp::Modulator_NRD::symbols
Array< vec > symbols
Vectors of modulation symbols (along each dimension)
Definition modulator_nd.h:390
itpp::Modulator_NRD::Modulator_NRD
Modulator_NRD()
Constructor.
Definition modulator_nd.h:252
itpp::Modulator_NRD::hspacings
itpp::Array< itpp::Array< itpp::vec > > hspacings
The spacing between different constellation points multiplied by the different H columns.
Definition modulator_nd.h:418
itpp::ND_UPAM
Real-valued MIMO channel with uniform PAM along each dimension.
Definition modulator_nd.h:655
itpp::ND_UPAM::~ND_UPAM
virtual ~ND_UPAM()
Destructor.
Definition modulator_nd.h:660
itpp::ND_UPSK
Definition modulator_nd.h:769
itpp::ND_UPSK::~ND_UPSK
virtual ~ND_UPSK()
Destructor.
Definition modulator_nd.h:774
itpp::ND_UQAM
Complex MIMO channel with uniform QAM per dimension.
Definition modulator_nd.h:721
itpp::ND_UQAM::L
ivec L
the square root of M
Definition modulator_nd.h:754
itpp::ND_UQAM::~ND_UQAM
virtual ~ND_UQAM()
Destructor.
Definition modulator_nd.h:726
itpp::norm
double norm(const cvec &v)
Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2))
Definition misc_stat.cpp:77
llr.h
Class for numerically efficient log-likelihood algebra.
itpp
itpp namespace
Definition itmex.h:37
itpp::operator<<
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
Definition binary.cpp:36
vec.h
Templated Vector Class Definitions.

Generated on Mon Apr 22 2024 09:45:27 for IT++ by Doxygen 1.9.8