stc.h
Go to the documentation of this file.
#ifndef STC_H
#define STC_H
#include <itpp/itbase.h> //IT++ base module
#include <itpp/itexports.h>
namespace itpp
{
class ITPP_EXPORT STC
{
public:
inline STC(const std::string &in_code_name,
int in_const_size,
int in_em_antenna = 0,
int in_channel_uses = 0
)
{
setup(in_code_name, in_const_size, in_em_antenna, in_channel_uses);
}
inline void setup(const std::string &in_code_name,
int in_const_size,
int in_em_antenna = 0,
int in_channel_uses = 0
)
{
code_name = code_name_from_string(in_code_name);
it_assert(in_const_size >= 2, "Constellation size should be at least two");
const_size = in_const_size;
em_antenna = in_em_antenna;
channel_uses = in_channel_uses;
Hassibi_block_code();
}
inline int get_nb_emission_antenna(void) const
{
return em_antenna;
}
inline int get_channel_uses(void) const
{
return channel_uses;
}
inline int get_nb_symbols_per_block(void) const
{
return symb_block;
}
inline itpp::cmat get_1st_gen_matrix(void) const
{
return A;
}
inline itpp::cmat get_2nd_gen_matrix(void) const
{
return B;
}
itpp::cmat encode(const itpp::cvec &symb);
private:
STC(const STC&);//not used
STC& operator=(const STC&);//not used
void Hassibi_block_code(void);
itpp::cmat diag_pow(const itpp::cmat &in_mat, double in_exp);
itpp::mat mat_pow(const itpp::mat &in_mat, int in_exp);
struct ITPP_EXPORT Code_Names
{
enum Type {Unknown, V_BLAST_MxN, imp_V_BLAST_MxN,
Alamouti_2xN, Switched_Alamouti_4xN, Double_Alamouti_4xN,
Jafarkhani_4xN, Golden_2x2, Damen_2x2, ortho34_3xN,
LD36_3xN, LD37_3xN, LD39_3xN};
Code_Names() : _t(Unknown) {}
Code_Names(Type t) : _t(t) {}
operator Type () const {return _t;}
private:
Type _t;
template<typename T> operator T () const;
};
Code_Names code_name;
int const_size;
int em_antenna;
int channel_uses;
int symb_block;
itpp::cmat A;
itpp::cmat B;
static Code_Names code_name_from_string(const std::string &name);
static std::string string_from_code_name(const Code_Names& cn);
};
inline STC::Code_Names STC::code_name_from_string(const std::string &name)
{
if (name=="V-BLAST_MxN")
{
return Code_Names::V_BLAST_MxN;
} else if (name =="imp_V-BLAST_MxN")
{
return Code_Names::imp_V_BLAST_MxN;
} else if (name =="Alamouti_2xN")
{
return Code_Names::Alamouti_2xN;
} else if (name =="Switched_Alamouti_4xN")
{
return Code_Names::Switched_Alamouti_4xN;
} else if (name =="Double_Alamouti_4xN")
{
return Code_Names::Double_Alamouti_4xN;
} else if (name =="Jafarkhani_4xN")
{
return Code_Names::Jafarkhani_4xN;
} else if (name =="Golden_2x2")
{
return Code_Names::Golden_2x2;
} else if (name =="Damen_2x2")
{
return Code_Names::Damen_2x2;
} else if (name =="34ortho_3xN")
{
return Code_Names::ortho34_3xN;
} else if (name =="36LD_3xN")
{
return Code_Names::LD36_3xN;
} else if (name =="37LD_3xN")
{
return Code_Names::LD37_3xN;
} else if (name =="39LD_3xN")
{
return Code_Names::LD39_3xN;
} else
{
return Code_Names::Unknown;
}
}
inline std::string STC::string_from_code_name(const STC::Code_Names& cn)
{
if (cn==Code_Names::V_BLAST_MxN)
{
return std::string("V-BLAST_MxN");
} else if (cn==Code_Names::imp_V_BLAST_MxN)
{
return std::string("imp_V-BLAST_MxN");
} else if (cn==Code_Names::Alamouti_2xN)
{
return std::string("Alamouti_2xN");
} else if (cn==Code_Names::Switched_Alamouti_4xN)
{
return std::string("Switched_Alamouti_4xN");
} else if (cn==Code_Names::Double_Alamouti_4xN)
{
return std::string("Double_Alamouti_4xN");
} else if (cn==Code_Names::Jafarkhani_4xN)
{
return std::string("Jafarkhani_4xN");
} else if (cn==Code_Names::Golden_2x2)
{
return std::string("Golden_2x2");
} else if (cn==Code_Names::Damen_2x2)
{
return std::string("Damen_2x2");
} else if (cn==Code_Names::ortho34_3xN)
{
return std::string("34ortho_3xN");
} else if (cn==Code_Names::LD36_3xN)
{
return std::string("36LD_3xN");
} else if (cn==Code_Names::LD37_3xN)
{
return std::string("37LD_3xN");
} else if (cn==Code_Names::LD39_3xN)
{
return std::string("39LD_3xN");
} else
{
return std::string("Unknown");
}
}
}
#endif /* STC_H_ */
it_assert
#define it_assert(t, s)
Abort if t is not true.
Definition: itassert.h:94
itpp::STC
Space Time block Codes (STC) class.
Definition: stc.h:80
itpp::STC::get_nb_emission_antenna
int get_nb_emission_antenna(void) const
Gets the number of emission antenna (for some codes this is a predefined parameter) ...
Definition: stc.h:107
itpp::STC::get_2nd_gen_matrix
itpp::cmat get_2nd_gen_matrix(void) const
Gets the second generator matrix of the ST code following Hassibi's approach.
Definition: stc.h:127
itpp::STC::get_nb_symbols_per_block
int get_nb_symbols_per_block(void) const
Gets the number of symbols per block (for all codes this is an output parameter)
Definition: stc.h:117
itpp::STC::get_channel_uses
int get_channel_uses(void) const
Gets the channel uses (for some codes this is a predefined parameter)
Definition: stc.h:112
itpp::STC::STC
STC(const std::string &in_code_name, int in_const_size, int in_em_antenna=0, int in_channel_uses=0)
Space Time Code constructor (sets up the generator matrices using Hassibi's method) ...
Definition: stc.h:84
itpp
itpp namespace
Definition: itmex.h:36
itbase.h
Include file for the IT++ base module.
itpp::STC::get_1st_gen_matrix
itpp::cmat get_1st_gen_matrix(void) const
Gets the first generator matrix of the ST code following Hassibi's approach.
Definition: stc.h:122
itpp::STC::setup
void setup(const std::string &in_code_name, int in_const_size, int in_em_antenna=0, int in_channel_uses=0)
Sets up the generator matrices using Hassibi's method (can be used to obtain new generator matrices...
Definition: stc.h:93

Generated on Thu Aug 20 2015 21:02:51 for IT++ by Doxygen 1.8.9.1