34 void STC::Hassibi_block_code(
void)
53 if (code_name==Code_Names::V_BLAST_MxN)
55 it_assert(channel_uses > 0,
"Channel uses should be strictly positive");
56 it_assert(em_antenna > 0,
"Number of emission antenna should be strictly positive");
57 symb_block = channel_uses*em_antenna;
58 A.set_size(symb_block*channel_uses, em_antenna);
60 itpp::mat temp(channel_uses, em_antenna);
63 for (tau=0; tau<channel_uses; tau++)
65 for (m=0; m<em_antenna; m++)
68 A.set_submatrix(symb_block*tau+channel_uses*m, 0,
itpp::to_cmat(temp));
74 else if (code_name == Code_Names::imp_V_BLAST_MxN)
76 it_assert(em_antenna > 0,
"Number of emission antenna should be strictly positive");
77 it_assert(channel_uses == em_antenna,
"Channel uses and the number of emission antenna must be equal");
78 symb_block = channel_uses*em_antenna;
79 std::complex<double> j(0,1);
83 P(0,em_antenna-1) = 1;
84 A.set_size(symb_block*channel_uses, em_antenna);
87 for (k=0; k<channel_uses; k++)
89 for (l=0; l<em_antenna; l++)
91 A.set_submatrix(symb_block*k+l*channel_uses, 0,
98 else if (code_name==Code_Names::Alamouti_2xN)
113 else if (code_name==Code_Names::Switched_Alamouti_4xN)
154 else if (code_name==Code_Names::Double_Alamouti_4xN)
177 else if (code_name== Code_Names::Jafarkhani_4xN)
216 else if (code_name== Code_Names::Golden_2x2)
222 std::complex<double> theta((1+
std::sqrt(5.0))/2,0);
223 std::complex<double> theta_b((1-
std::sqrt(5.0))/2,0);
224 std::complex<double> j(0,1);
225 std::complex<double> one(1,0);
226 std::complex<double> alpha = one+j*(one-theta);
227 std::complex<double> alpha_b = one+j*(one-theta_b);
228 std::complex<double>
gamma = j;
243 A(6,1) = gamma*alpha_b*theta_b/
std::sqrt(5.0);
248 else if (code_name== Code_Names::Damen_2x2)
257 else if (const_size==16)
259 else if (const_size>=256)
264 std::cout <<
"STC::LDcode: Warning! For " << string_from_code_name(code_name) <<
265 " and const. size " << const_size <<
", lambda has the "
266 "value " << lambda << std::endl;
268 std::complex<double> j(0,1);
269 std::complex<double> phi =
std::exp(j*lambda);
270 std::complex<double> theta =
std::exp(j*(lambda/2));
290 else if (code_name== Code_Names::ortho34_3xN)
323 else if (code_name== Code_Names::LD36_3xN)
392 B(4,1) = double(-1)/double(2);
394 B(5,0) = double(-1)/double(2);
396 B(5,2) = double(-1)/double(2);
398 B(6,1) = double(-1)/double(2);
400 B(7,0) = double(1)/double(2);
402 B(7,2) = double(-1)/double(2);
404 B(8,1) = double(1)/double(2);
406 B(9,0) = double(1)/double(2);
408 B(9,2) = double(1)/double(2);
410 B(10,1) = double(1)/double(2);
412 B(11,0) = double(-1)/double(2);
414 B(11,2) = double(1)/double(2);
428 else if (code_name== Code_Names::LD37_3xN)
509 else if (code_name== Code_Names::LD39_3xN)
743 int nb_subblocks = symb.length()/symb_block;
744 int tx_duration = channel_uses*nb_subblocks;
745 itpp::cmat S(tx_duration,em_antenna);
746 itpp::cmat temp(channel_uses,em_antenna);
747 std::complex<double> j(0,1);
749 for (ns=0; ns<nb_subblocks; ns++)
752 for (k=0; k<symb_block; k++)
754 temp += (A(k*channel_uses,(k+1)*channel_uses-1,0,em_antenna-1)*
755 static_cast< std::complex<double>
>(symb(k+ns*symb_block).real())+
756 j*B(k*channel_uses,(k+1)*channel_uses-1,0,em_antenna-1)*
757 static_cast< std::complex<double>
>(symb(k+ns*symb_block).imag()));
759 S.set_submatrix(ns*channel_uses, 0, temp);
764 itpp::cmat STC::diag_pow(
const itpp::cmat &in_mat,
double in_exp)
768 int dim = in_mat.rows();
769 itpp::cmat out_mat(dim,dim);
771 for (n=0; n<dim; n++)
773 out_mat(n,n) =
std::pow(in_mat(n,n), in_exp);
778 itpp::mat STC::mat_pow(
const itpp::mat &in_mat,
int in_exp)
785 itpp::mat out = in_mat;
788 for (n=1; n<abs_in_exp; n++)