29 #ifndef MODULATOR_ND_H 30 #define MODULATOR_ND_H 35 #include <itpp/itexports.h> 78 llrcalc(llrcalc_in), demod_initialized(false) {}
154 QLLRvec probabilities(QLLR l);
160 void demodllrbit0(itpp::QLLR& llr)
const;
162 void demodllrbit1(itpp::QLLR& llr)
const;
164 void demodllrbit2(itpp::QLLR& llr)
const;
166 void demodmaxbit0(itpp::QLLR& maxllr)
const;
168 void demodmaxbit1(itpp::QLLR& maxllr)
const;
170 void demodmaxbit2(itpp::QLLR& maxllr)
const;
190 void update_LLR(
const Array<QLLRvec> &logP_apriori,
const ivec &s,
191 QLLR scaled_norm, QLLRvec &num, QLLRvec &denom);
213 QLLR scaled_norm,
int j, QLLRvec &num, QLLRvec &denom);
260 void modulate_bits(
const bvec &bits, vec &symbols)
const;
263 vec modulate_bits(
const bvec &bits)
const;
283 void init_soft_demodulator(
const itpp::mat& H,
const double& sigma2);
319 void demodulate_soft_bits(
const vec &y,
320 const QLLRvec &LLR_apriori,
321 QLLRvec &LLR_aposteriori,
322 Soft_Demod_Method method = FULL_ENUM_LOGMAP);
345 void demodulate_soft_bits(
const vec &y,
const mat &H,
double sigma2,
346 const QLLRvec &LLR_apriori,
347 QLLRvec &LLR_aposteriori,
348 Soft_Demod_Method method = FULL_ENUM_LOGMAP);
369 QLLRvec demodulate_soft_bits(
const vec &y,
const mat &H,
double sigma2,
370 const QLLRvec &LLR_apriori,
371 Soft_Demod_Method method = FULL_ENUM_LOGMAP);
381 void demodulate_soft_bits(
const vec &y,
const vec &h,
double sigma2,
382 const QLLRvec &LLR_apriori,
383 QLLRvec &LLR_aposteriori);
406 void update_norm(
double &
norm,
int k,
int sold,
int snew,
const vec &ytH,
407 const mat &HtH,
const ivec &s);
410 void hxnormupdate(itpp::vec& Hx,
unsigned& bitstring,
unsigned& ind,
unsigned bit);
413 void yxnormupdate(
double& yx, itpp::QLLR& lapr,
unsigned& bitstring,
unsigned& ind,
unsigned bit);
459 void modulate_bits(
const bvec &bits, cvec &symbols)
const;
462 cvec modulate_bits(
const bvec &bits)
const;
482 void init_soft_demodulator(
const itpp::cmat& H,
const double& sigma2);
515 void demodulate_soft_bits(
const cvec &y,
516 const QLLRvec &LLR_apriori,
517 QLLRvec &LLR_aposteriori,
518 Soft_Demod_Method method = FULL_ENUM_LOGMAP);
543 void demodulate_soft_bits(
const cvec &y,
const cmat &H,
double sigma2,
544 const QLLRvec &LLR_apriori,
545 QLLRvec &LLR_aposteriori,
546 Soft_Demod_Method method = FULL_ENUM_LOGMAP);
570 QLLRvec demodulate_soft_bits(
const cvec &y,
const cmat &H,
double sigma2,
571 const QLLRvec &LLR_apriori,
572 Soft_Demod_Method method = FULL_ENUM_LOGMAP);
582 void demodulate_soft_bits(
const cvec &y,
const cvec &h,
double sigma2,
583 const QLLRvec &LLR_apriori,
584 QLLRvec &LLR_aposteriori);
598 void hxnormupdate(itpp::cvec& Hx,
unsigned& bitstring,
unsigned& ind,
unsigned bit);
599 void yxnormupdate(
double& yx, itpp::QLLR& lapr,
unsigned& bitstring,
unsigned& ind,
unsigned bit);
658 ND_UPAM(
int nt = 1,
int Mary = 2);
663 void set_M(
int nt = 1,
int Mary = 2);
666 void set_M(
int nt = 1, ivec Mary =
"2");
691 int sphere_decoding(
const vec &y,
const mat &H,
double rmin,
double rmax,
692 double stepup, QLLRvec &detected_bits);
696 int sphere_search_SE(
const vec &y,
const mat &H,
const imat &zrange,
697 double r, ivec &zhat);
701 inline int sign_nozero_i(
int a) {
702 return (a > 0 ? 1 : -1);
704 inline int sign_nozero_i(
double a) {
705 return (a > 0.0 ? 1 : -1);
724 ND_UQAM(
int nt = 1,
int Mary = 4);
729 void set_M(
int nt = 1,
int Mary = 4);
732 void set_M(
int nt = 1, ivec Mary =
"4");
751 void set_constellation_points(
const int nth,
const cvec& inConstellation,
const ivec& in_bit2symbols);
772 ND_UPSK(
int nt = 1,
int Mary = 4);
777 void set_M(
int nt = 1,
int Mary = 4);
780 void set_M(
int nt = 1, ivec Mary =
"4");
786 #endif // #ifndef MODULATOR_ND_H Array< cvec > symbols
Vectors of modulation symbols (along each dimension)
virtual ~ND_UQAM()
Destructor.
itpp::ivec bitcumsum
The cumulative sum of bits in the symbol vector.
Array< ivec > get_bits2symbols() const
Get bit pattern in decimal.
ivec get_k() const
Get number of bits per modulation symbol per dimension.
int nt
Number of dimensions.
itpp::Array< itpp::vec > yspacings
The spacing between different constellation points scaled by different y elements.
Base class for N-dimensional vector (MIMO) channel modulators/demodulators with real-valued component...
LLR_calc_unit llrcalc
LLR calculation unit.
Array< ivec > bits2symbols
Bit pattern in decimal form ordered and the corresponding symbols (one pattern per dimension) ...
Array< bmat > get_bitmap() const
Get Bit mapping table.
bool demod_initialized
Flag indicating whether the demodulator has been initialized.
double norm(const cvec &v)
Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2))
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
Real-valued MIMO channel with uniform PAM along each dimension.
Complex MIMO channel with uniform QAM per dimension.
virtual ~Modulator_NCD()
Destructor.
Array< vec > symbols
Vectors of modulation symbols (along each dimension)
itpp::Array< itpp::vec > yspacings
The spacing between different constellation points scaled by different y elements.
ivec M
Number of modulation symbols along each dimension.
virtual ~Modulator_ND()
Destructor.
void set_llrcalc(LLR_calc_unit llrcalc_in)
Set LLR calculation unit.
itpp::Array< itpp::Array< itpp::cvec > > hspacings
The spacing between different constellation points multiplied by the different H columns.
int nb
Number of bits in the symbol vector.
Base class for an N-dimensional (ND) vector (MIMO) modulator.
Definition of Array class (container)
Modulator_NRD()
Constructor.
ivec get_M() const
Get number of modulation symbols per dimension.
int get_dim() const
Get number of dimensions.
virtual ~ND_UPAM()
Destructor.
Import/Export definitions for some templates defined in base folder.
ivec k
Number of bits per modulation symbol.
itpp::QLLRvec Qnorms
Norms part depending on both H and y.
Class for numerically efficient log-likelihood algebra.
itpp::QLLRvec llrapr
A prioi information.
itpp::vec hnorms
Norms part dependent on H.
virtual ~ND_UPSK()
Destructor.
Base class for vector (MIMO) channel modulator/demodulators with complex valued components.
ivec L
the square root of M
Soft_Demod_Method
Soft demodulation method.
Log-likelihood algebra calculation unit.
ivec bits_per_symbol() const
Get number of bits per modulation symbol per dimension.
Max-Log demodulation by "brute-force" enumeration of all points.
itpp::Array< itpp::Vec< unsigned > > gray2dec
The Gray to decimal mapping.
LLR_calc_unit get_llrcalc() const
Get LLR calculation unit.
Modulator_ND(LLR_calc_unit llrcalc_in=LLR_calc_unit())
Default constructor.
Array< bmat > bitmap
Bit mapping table (one table per dimension)
itpp::ivec bpos2cpos
The bit to column mapping.
double gaussnorm
The normalization factor in the exponent (in front of the square norm) in the Gaussian distribution...
itpp::cmat H
Complex-valued channel matrix.
itpp::mat H
Real channel matrix.
itpp::Array< itpp::Array< itpp::vec > > hspacings
The spacing between different constellation points multiplied by the different H columns.
Templated Vector Class Definitions.
Log-MAP demodulation by "brute-force" enumeration of all points.
Modulator_NCD()
Constructor.
virtual ~Modulator_NRD()
Destructor.