33#include <itpp/itexports.h>
98 void set_precoder_generator(
const itpp::bvec &
in_prec_gen);
104 void set_generators(
const itpp::bmat &
in_gen);
111 void set_tail(
const bool &
in_tail);
113 void set_viterbi_win_len(
const int &
win_len);
115 void set_sova_scaling_factor(
const double &scaling_factor);
117 void set_sova_threshold(
const double &threshold);
123 void set_viterbi_hard_output_flag(
const bool &
flag);
130 void set_impulse_response(
const itpp::vec &
h);
134 void set_impulse_response(
const itpp::mat &H);
138 void set_impulse_response(
const itpp::cvec &
h);
161 void set_impulse_response(
const itpp::cmat &
cH);
167 void set_scrambler_pattern(
const itpp::vec &
phi);
168 void set_scrambler_pattern(
const itpp::bvec &
phi);
175 void set_mud_method(
const std::string &method);
193 void set_st_block_code(
const int &Q,
209 void set_demapper_method(
const std::string &method);
275 static double threshold(
const double &x,
const double &value);
276 static itpp::vec threshold(
const itpp::vec &
in,
const double &value);
277 static itpp::mat threshold(
const itpp::mat &
in,
const double &value);
315 const itpp::mat &
apriori_data,
const double &threshold=-5);
350 void print_err_msg(
const std::string &
msg)
const;
356 enum Type {Unknown, logMAP, maxlogMAP, SOVA, Viterbi};
357 MAP_Metrics() : _t(Unknown) {}
358 MAP_Metrics(Type t) : _t(t) {}
359 operator Type ()
const {
return _t;}
362 template<
typename T>
operator T ()
const;
364 MAP_Metrics MAP_metric;
375 double SOVA_scaling_factor;
377 double SOVA_threshold;
379 double Viterbi_scaling_factor[2];
381 bool Viterbi_hard_output_flag;
386 itpp::mat impulse_response;
388 itpp::cmat c_impulse_response;
390 itpp::bvec scrambler_pattern;
394 enum Type {Unknown, sGCD, maxlogMAP, GCD};
395 MUD_Methods() : _t(Unknown) {}
396 MUD_Methods(Type t) : _t(t) {}
397 operator Type ()
const {
return _t;}
400 template<
typename T>
operator T ()
const;
402 MUD_Methods MUD_method;
407 itpp::cvec constellation;
409 itpp::bmat bin_constellation;
426 enum Type {Unknown, GA, Hassibi_maxlogMAP, sGA, mmsePIC, zfPIC, Alamouti_maxlogMAP};
427 Demapper_Methods() : _t(Unknown) {}
428 Demapper_Methods(Type t) : _t(t) {}
429 operator Type ()
const {
return _t;}
432 template<
typename T>
operator T ()
const;
434 Demapper_Methods demapper_method;
438 void zpFIRfilter(itpp::vec&
filt,
443 void gen_chtrellis(
void);
445 void gen_hyperTrellis(
void);
457 void gen_rsctrellis(
void);
468 void gen_nsctrellis(
void);
479 void find_half_const(
int &select_half, itpp::vec &re_part,
480 itpp::bmat &re_bin_part, itpp::vec &im_part, itpp::bmat &im_bin_part);
482 void EquivRecSig(itpp::vec &x_eq,
const itpp::cmat &rec_sig);
484 void EquivCh(itpp::mat &H_eq,
const itpp::cvec &H);
486 void compute_symb_stats(itpp::vec &Es, itpp::vec &Vs,
487 int ns,
int select_half,
const itpp::vec &apriori_data,
488 const itpp::vec &re_part,
const itpp::vec &im_part,
489 const itpp::bmat &re_bin_part,
const itpp::bmat &im_bin_part);
490 static MAP_Metrics map_metric_from_string(
const std::string &in_MAP_metric);
491 static MUD_Methods mud_method_from_string(
const std::string &in_mud_method);
492 static Demapper_Methods demapper_method_from_string(
const std::string &in_dem_method);
498 MAP_metric = MAP_Metrics::maxlogMAP;
499 MUD_method = MUD_Methods::sGCD;
500 scrambler_pattern =
"0";
502 demapper_method = Demapper_Methods::GA;
503 Viterbi_win_len = 20;
504 SOVA_scaling_factor = 0.8;
506 Viterbi_scaling_factor[0] = 1.4;
507 Viterbi_scaling_factor[1] = 0.4;
508 Viterbi_hard_output_flag =
false;
511inline SISO::MAP_Metrics SISO::map_metric_from_string(
const std::string &
in_MAP_metric)
515 return MAP_Metrics::logMAP;
516 }
else if (in_MAP_metric==
"maxlogMAP")
518 return MAP_Metrics::maxlogMAP;
519 }
else if (in_MAP_metric==
"SOVA")
521 return MAP_Metrics::SOVA;
522 }
else if (in_MAP_metric==
"Viterbi")
524 return MAP_Metrics::Viterbi;
527 return MAP_Metrics::Unknown;
531inline SISO::MUD_Methods SISO::mud_method_from_string(
const std::string &in_mud_method)
533 if (in_mud_method==
"maxlogMAP")
535 return MUD_Methods::maxlogMAP;
536 }
else if (in_mud_method==
"sGCD")
538 return MUD_Methods::sGCD;
539 }
else if (in_mud_method==
"GCD")
541 return MUD_Methods::GCD;
544 return MUD_Methods::Unknown;
548inline SISO::Demapper_Methods SISO::demapper_method_from_string(
const std::string &in_dem_method)
550 if (in_dem_method==
"Hassibi_maxlogMAP")
552 return Demapper_Methods::Hassibi_maxlogMAP;
553 }
else if (in_dem_method==
"Alamouti_maxlogMAP")
555 return Demapper_Methods::Alamouti_maxlogMAP;
556 }
else if (in_dem_method==
"GA")
558 return Demapper_Methods::GA;
559 }
else if (in_dem_method==
"sGA")
561 return Demapper_Methods::sGA;
562 }
else if (in_dem_method==
"mmsePIC")
564 return Demapper_Methods::mmsePIC;
565 }
else if (in_dem_method==
"zfPIC")
567 return Demapper_Methods::zfPIC;
570 return Demapper_Methods::Unknown;
616 SOVA_scaling_factor = scaling_factor;
633 Viterbi_hard_output_flag =
flag;
643 impulse_response.set_size(1,
h.
length());
644 impulse_response.set_row(0,
h);
649 impulse_response = H;
654 c_impulse_response.set_size(1,
h.
length());
655 c_impulse_response.set_row(0,
h);
660 c_impulse_response =
cH;
666 scrambler_pattern.set_size(
phi_len);
675 scrambler_pattern =
phi;
680 MUD_method = mud_method_from_string(method);
696 constellation.set_size(
nb_symb);
697 bin_constellation.set_size(
nb_symb, nb_bits_symb);
701 bin_constellation.set_row(n,
itpp::dec2bin(nb_bits_symb, n));
706 const itpp::cmat &B,
const int &N)
709 nb_em_ant = A.cols();
711 block_duration = A.rows()/Q;
718 demapper_method = demapper_method_from_string(method);
733 print_err_msg(
"SISO::rsc: generator polynomials not initialized");
737 if (MAP_metric==MAP_Metrics::logMAP)
740 }
else if (MAP_metric==MAP_Metrics::maxlogMAP)
743 }
else if (MAP_metric==MAP_Metrics::SOVA)
747 }
else if (MAP_metric==MAP_Metrics::Viterbi)
752 print_err_msg(
"SISO::rsc: unknown MAP metric. The MAP metric should be either logMAP or maxlogMAP or SOVA or Viterbi");
768 print_err_msg(
"SISO::nsc: generator polynomials not initialized");
772 if (MAP_metric==MAP_Metrics::logMAP)
774 else if (MAP_metric==MAP_Metrics::maxlogMAP)
777 print_err_msg(
"SISO::nsc: unknown MAP metric. The MAP metric should be either logMAP or maxlogMAP");
793 if (impulse_response.size()==0)
795 print_err_msg(
"SISO::equalizer: channel impulse response not initialized");
798 if ((impulse_response.size()==1)&&(prec_gen.length()==1))
800 print_err_msg(
"SISO::equalizer: flat fading channel and no precoder. Use the soft output of the channel (no need for a priori information)");
804 if (MAP_metric==MAP_Metrics::logMAP)
806 else if (MAP_metric==MAP_Metrics::maxlogMAP)
809 print_err_msg(
"SISO::equalizer: unknown MAP metric. The MAP metric should be either logMAP or maxlogMAP");
815 if (impulse_response.size()==0)
817 print_err_msg(
"SISO::mud: channel impulse response not initialized");
822 print_err_msg(
"SISO::mud: channel impulse response must have the same number of rows as a priori info.");
826 if (MUD_method==MUD_Methods::maxlogMAP)
828 else if (MUD_method==MUD_Methods::GCD)
830 else if (MUD_method==MUD_Methods::sGCD)
833 print_err_msg(
"SISO::mud: unknown MUD method. The MUD method should be either maxlogMAP, GCD or sGCD");
839 if (c_impulse_response.size()==0)
841 print_err_msg(
"SISO::demapper: channel impulse response not initialized");
844 if ((constellation.size()==0) || (bin_constellation.size()==0))
846 print_err_msg(
"SISO::demapper: constellation not initialized");
849 if (MAP_metric==MAP_Metrics::logMAP)
851 else if (MAP_metric==MAP_Metrics::maxlogMAP)
854 print_err_msg(
"SISO::demapper: unknown MAP metric. The MAP metric should be either logMAP or maxlogMAP");
860 if (c_impulse_response.size()==0)
862 print_err_msg(
"SISO::demapper: channel impulse response not initialized");
865 if ((ST_gen1.size()==0) || (ST_gen2.size()==0))
867 print_err_msg(
"SISO::demapper: Space-Time generator polynomials not initialized");
870 if ((constellation.size()==0) || (bin_constellation.size()==0))
872 print_err_msg(
"SISO::demapper: constellation not initialized");
876 if (demapper_method==Demapper_Methods::Hassibi_maxlogMAP)
878 else if (demapper_method==Demapper_Methods::GA)
880 else if (demapper_method==Demapper_Methods::sGA)
882 else if (demapper_method==Demapper_Methods::mmsePIC)
884 else if (demapper_method==Demapper_Methods::zfPIC)
886 else if (demapper_method==Demapper_Methods::Alamouti_maxlogMAP)
889 print_err_msg(
"SISO::demapper: unknown demapper method. The demapper method should be either Hassibi_maxlogMAP, GA, sGA, mmsePIC, zfPIC or Alamouti_maxlogMAP");
892inline void SISO::print_err_msg(
const std::string &
msg)
const
897 std::cout <<
msg << std::endl;
903 if ((x>value)||(x<-value))
904 return (x>0?value:-value);
917inline itpp::mat
SISO::threshold(
const itpp::mat &in,
const double &value)
919 itpp::mat out(in.rows(),in.cols());
921 for (n=0; n<in.rows(); n++)
922 out.set_row(n,
threshold(in.get_row(n), value));
int length() const
Returns the number of data elements in the array object.
Soft Input Soft Output (SISO) modules.
void set_scrambler_pattern(const itpp::vec &phi)
Sets scrambler pattern.
void set_constellation(const int &in_nb_bits_symb, const itpp::cvec &in_constellation, const itpp::bmat &in_bin_constellation)
Sets symbol constellation.
void set_sova_scaling_factor(const double &scaling_factor)
Sets the scaling factor used to normalize the reliability value computed by the SOVA.
void set_demapper_method(const std::string &method)
Sets demapper method.
int * prevState
previous states
int * prevStates
previous states
void nsc(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data)
SISO decoder for NSC codes
int numInputSymbols
number of input symbols
void set_map_metric(const std::string &in_MAP_metric)
Sets the metric for MAP algorithm (convolutional codes and multipath channels)
void set_viterbi_win_len(const int &win_len)
Sets the length of the trellis used by the SOVA.
int numStates
number of states
static double threshold(const double &x, const double &value)
Functions used to limit values at a given +- threshold.
int stateNb
number of states
void set_tail(const bool &in_tail)
Signals whether the trellis used in the MAP algorithm is terminated or not (only for convolutional co...
int * nextState
next states
void set_generators(const itpp::bmat &in_gen)
Sets convolutional code generator polynomials.
double * PARout
parity output bit
void set_noise(const double &in_sigma2)
Sets Additive White Gaussian Noise variance for each dimension.
void set_viterbi_hard_output_flag(const bool &flag)
Sets the Viterbi algorithm hard output flag (true when only the hard output is needed)
int * nextStates
next states
void set_mud_method(const std::string &method)
Sets Multi-User Detector method.
void set_precoder_generator(const itpp::bvec &in_prec_gen)
Sets the precoder generator polynomial for turbo equalizer.
void demapper(itpp::vec &extrinsic_data, const itpp::cvec &rec_sig, const itpp::vec &apriori_data)
SISO demapper (when only a modulator is used)
void set_st_block_code(const int &Q, const itpp::cmat &A, const itpp::cmat &B, const int &N)
Sets Space-Time block code parameters.
void mud(itpp::mat &extrinsic_data, const itpp::vec &rec_sig, const itpp::mat &apriori_data)
SISO Multi-User Detector
void rsc(itpp::vec &extrinsic_coded, itpp::vec &extrinsic_data, const itpp::vec &intrinsic_coded, const itpp::vec &apriori_data)
SISO decoder for RSC codes
void set_sova_threshold(const double &threshold)
Sets the threshold value used to limit the reliability value computed by SOVA.
SISO()
SISO class constructor
void set_viterbi_scaling_factors(const double &matching_scaling_factor, const double &nonmatching_scaling_factor)
Sets the Viterbi algorithm scaling factors.
void set_impulse_response(const itpp::vec &h)
Sets channel impulse response for equalizer.
void equalizer(itpp::vec &extrinsic_data, const itpp::vec &rec_sig, const itpp::vec &apriori_data)
SISO equalizer
Binary arithmetic (boolean) class.
Include file for the IT++ base module.
ITPP_EXPORT bvec dec2bin(int length, int index)
Convert a decimal int index to bvec using length bits in the representation.