author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
8,490 |
21.04.2017 22:23:56
| -7,200 |
72fbd8d22433b00f3ca6b87846d9a017777cacbe
|
Add a new LDPC BP layered decoder: ONMS + SIMD inter frame.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"diff": "@@ -59,6 +59,10 @@ void Launcher_BFER_LDPC<B,R,Q>\nthis->opt_args[{\"dec-synd-depth\"}] =\n{\"positive_int\",\n\"successive number of iterations to validate the syndrome detection.\"};\n+ this->opt_args[{\"dec-simd\"}] =\n+ {\"string\",\n+ \"the SIMD strategy you want to use.\",\n+ \"INTER\"};\n}\ntemplate <typename B, typename R, typename Q>\n@@ -76,6 +80,10 @@ void Launcher_BFER_LDPC<B,R,Q>\nif(this->ar.exist_arg({\"dec-norm\" })) this->params.decoder.normalize_factor = this->ar.get_arg_float({\"dec-norm\" });\nif(this->ar.exist_arg({\"dec-synd-depth\"})) this->params.decoder.syndrome_depth = this->ar.get_arg_int ({\"dec-synd-depth\"});\nif(this->ar.exist_arg({\"dec-no-synd\" })) this->params.decoder.enable_syndrome = false;\n+ if(this->ar.exist_arg({\"dec-simd\" })) this->params.decoder.simd_strategy = this->ar.get_arg ({\"dec-simd\" });\n+\n+ if (this->params.decoder.simd_strategy == \"INTER\" && !this->ar.exist_arg({\"sim-inter-lvl\"}))\n+ this->params.simulation.inter_frame_level = mipp::nElReg<Q>();\n}\ntemplate <typename B, typename R, typename Q>\n@@ -104,6 +112,9 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_LDPC<B,R,Q>\nstd::string syndrome = this->params.decoder.enable_syndrome ? \"on\" : \"off\";\n+ if (!this->params.decoder.simd_strategy.empty())\n+ p.push_back(std::make_pair(\"SIMD strategy\", this->params.decoder.simd_strategy));\n+\np.push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->params.decoder.n_ite)));\nif (this->params.decoder.implem == \"ONMS\")\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"new_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"diff": "@@ -60,6 +60,10 @@ void Launcher_BFERI_LDPC<B,R,Q>\nthis->opt_args[{\"dec-synd-depth\"}] =\n{\"positive_int\",\n\"successive number of iterations to validate the syndrome detection.\"};\n+ this->opt_args[{\"dec-simd\"}] =\n+ {\"string\",\n+ \"the SIMD strategy you want to use.\",\n+ \"INTER\"};\n}\ntemplate <typename B, typename R, typename Q>\n@@ -77,6 +81,10 @@ void Launcher_BFERI_LDPC<B,R,Q>\nif(this->ar.exist_arg({\"dec-norm\" })) this->params.decoder.normalize_factor = this->ar.get_arg_float({\"dec-norm\" });\nif(this->ar.exist_arg({\"dec-synd-depth\"})) this->params.decoder.syndrome_depth = this->ar.get_arg_int ({\"dec-synd-depth\"});\nif(this->ar.exist_arg({\"dec-no-synd\" })) this->params.decoder.enable_syndrome = false;\n+ if(this->ar.exist_arg({\"dec-simd\" })) this->params.decoder.simd_strategy = this->ar.get_arg ({\"dec-simd\" });\n+\n+ if (this->params.decoder.simd_strategy == \"INTER\" && !this->ar.exist_arg({\"sim-inter-lvl\"}))\n+ this->params.simulation.inter_frame_level = mipp::nElReg<Q>();\n}\ntemplate <typename B, typename R, typename Q>\n@@ -105,6 +113,9 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI_LDPC<B,R,Q>\nstd::string syndrome = this->params.decoder.enable_syndrome ? \"on\" : \"off\";\n+ if (!this->params.decoder.simd_strategy.empty())\n+ p.push_back(std::make_pair(\"SIMD strategy\", this->params.decoder.simd_strategy));\n+\np.push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->params.decoder.n_ite)));\nif (this->params.decoder.implem == \"ONMS\")\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder.hpp",
"new_path": "src/Module/Decoder/Decoder.hpp",
"diff": "@@ -36,7 +36,6 @@ template <typename B = int, typename R = float>\nclass Decoder_i : public Module\n{\nprivate:\n- const int n_dec_waves;\nconst int n_inter_frame_rest;\nmipp::vector<R> Y_N;\n@@ -46,6 +45,7 @@ protected:\nconst int K; /*!< Number of information bits in one frame */\nconst int N; /*!< Size of one frame (= number of bits in one frame) */\nconst int simd_inter_frame_level; /*!< Number of frames absorbed by the SIMD instructions. */\n+ const int n_dec_waves;\nstd::chrono::nanoseconds d_load_total;\nstd::chrono::nanoseconds d_decod_total;\n@@ -64,11 +64,13 @@ public:\nDecoder_i(const int K, const int N, const int n_frames = 1, const int simd_inter_frame_level = 1,\nstd::string name = \"Decoder_i\")\n: Module(n_frames, name),\n- n_dec_waves((int)std::ceil((float)this->n_frames / (float)simd_inter_frame_level)),\nn_inter_frame_rest(this->n_frames % simd_inter_frame_level),\nY_N(simd_inter_frame_level * N),\nV_K(simd_inter_frame_level * K),\n- K(K), N(N), simd_inter_frame_level(simd_inter_frame_level)\n+ K(K),\n+ N(N),\n+ simd_inter_frame_level(simd_inter_frame_level),\n+ n_dec_waves((int)std::ceil((float)this->n_frames / (float)simd_inter_frame_level))\n{\nif (K <= 0)\nthrow std::invalid_argument(\"aff3ct::module::Decoder: \\\"K\\\" has to be greater than 0.\");\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"diff": "+#include <limits>\n+#include <cmath>\n+#include <iostream>\n+\n+#include \"Tools/Math/utils.h\"\n+#include \"Tools/Perf/Reorderer/Reorderer.hpp\"\n+\n+#include \"Decoder_LDPC_BP_layered_ONMS_inter.hpp\"\n+\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\n+\n+template <typename R, int F = 1> inline mipp::Reg<R> mipp_normalize(const mipp::Reg<R> val, const float factor) { return val * mipp::Reg<R>((R)factor); }\n+\n+template <> inline mipp::Reg<short> mipp_normalize<short, 1>(const mipp::Reg<short> v, const float f) { return (v >> 3); } // v * 0.125\n+template <> inline mipp::Reg<short> mipp_normalize<short, 2>(const mipp::Reg<short> v, const float f) { return (v >> 2); } // v * 0.250\n+template <> inline mipp::Reg<short> mipp_normalize<short, 3>(const mipp::Reg<short> v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n+template <> inline mipp::Reg<short> mipp_normalize<short, 4>(const mipp::Reg<short> v, const float f) { return (v >> 1); } // v * 0.500\n+template <> inline mipp::Reg<short> mipp_normalize<short, 5>(const mipp::Reg<short> v, const float f) { return (v >> 3) + (v >> 1); } // v * 0.625\n+template <> inline mipp::Reg<short> mipp_normalize<short, 6>(const mipp::Reg<short> v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\n+template <> inline mipp::Reg<short> mipp_normalize<short, 7>(const mipp::Reg<short> v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\n+template <> inline mipp::Reg<short> mipp_normalize<short, 8>(const mipp::Reg<short> v, const float f) { return v; } // v * 1.000\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::Decoder_LDPC_BP_layered_ONMS_inter(const int &K, const int &N, const int& n_ite,\n+ const AList_reader &alist_data,\n+ const mipp::vector<B> &info_bits_pos,\n+ const float normalize_factor,\n+ const float offset,\n+ const bool enable_syndrome,\n+ const int syndrome_depth,\n+ const int n_frames,\n+ const std::string name)\n+: Decoder_SISO<B,R>(K, N, n_frames, mipp::nElReg<R>(), name ),\n+ cur_wave (0 ),\n+ normalize_factor (normalize_factor ),\n+ offset ((R)offset ),\n+ contributions (alist_data.get_CN_max_degree() ),\n+ n_ite (n_ite ),\n+ n_C_nodes ((int)alist_data.get_n_CN() ),\n+ enable_syndrome (enable_syndrome ),\n+ syndrome_depth (syndrome_depth ),\n+ init_flag (false ),\n+ info_bits_pos (info_bits_pos ),\n+ CN_to_VN (alist_data.get_CN_to_VN() ),\n+ var_nodes (this->n_dec_waves, mipp::vector<mipp::Reg<R>>(N )),\n+ branches (this->n_dec_waves, mipp::vector<mipp::Reg<R>>(alist_data.get_n_branches())),\n+ Y_N_reorderered (N ),\n+ V_K_reorderered (K )\n+{\n+ if (n_ite <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"n_ite\\\" has to be greater \"\n+ \"than 0.\");\n+ if (syndrome_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"syndrome_depth\\\" has to be \"\n+ \"greater than 0.\");\n+ if (N != (int)alist_data.get_n_VN())\n+ throw std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"N\\\" is not compatible with \"\n+ \"the alist file.\");\n+\n+ if (typeid(R) == typeid(signed char))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: this decoder does not work in \"\n+ \"8-bit fixed-point.\");\n+}\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::~Decoder_LDPC_BP_layered_ONMS_inter()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::_soft_decode(const R *Y_N1, R *Y_N2)\n+{\n+ // memory zones initialization\n+ this->_load(Y_N1);\n+\n+ // actual decoding\n+ if (typeid(R) == typeid(short))\n+ {\n+ if (normalize_factor == 0.125f) this->BP_decode<1>();\n+ else if (normalize_factor == 0.250f) this->BP_decode<2>();\n+ else if (normalize_factor == 0.375f) this->BP_decode<3>();\n+ else if (normalize_factor == 0.500f) this->BP_decode<4>();\n+ else if (normalize_factor == 0.625f) this->BP_decode<5>();\n+ else if (normalize_factor == 0.750f) this->BP_decode<6>();\n+ else if (normalize_factor == 0.875f) this->BP_decode<7>();\n+ else if (normalize_factor == 1.000f) this->BP_decode<8>();\n+ else\n+ throw std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"normalize_factor\\\" can \"\n+ \"only be 0.125f, 0.250f, 0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n+ }\n+ else\n+ this->BP_decode<1>(); // float or double\n+\n+ // prepare for next round by processing extrinsic information\n+ for (auto i = 0; i < this->N; i++)\n+ this->var_nodes[cur_wave][i] -= Y_N_reorderered[i];\n+\n+ std::vector<R*> frames(mipp::nElReg<R>());\n+ for (auto f = 0; f < mipp::nElReg<R>(); f++) frames[f] = Y_N2 + f * this->N;\n+ Reorderer_static<R,mipp::nElReg<R>()>::apply_rev((R*)this->var_nodes[cur_wave].data(), frames, this->N);\n+\n+ cur_wave = (cur_wave +1) % this->n_dec_waves;\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::_load(const R *Y_N)\n+{\n+ // memory zones initialization\n+ if (this->init_flag)\n+ {\n+ const auto zero = mipp::Reg<R>((R)0);\n+ std::fill(this->branches [cur_wave].begin(), this->branches [cur_wave].end(), zero);\n+ std::fill(this->var_nodes[cur_wave].begin(), this->var_nodes[cur_wave].end(), zero);\n+\n+ if (cur_wave == this->n_dec_waves -1)\n+ this->init_flag = false;\n+ }\n+\n+ std::vector<const R*> frames(mipp::nElReg<R>());\n+ for (auto f = 0; f < mipp::nElReg<R>(); f++) frames[f] = Y_N + f * this->N;\n+ Reorderer_static<R,mipp::nElReg<R>()>::apply(frames, (R*)this->Y_N_reorderered.data(), this->N);\n+\n+ for (auto i = 0; i < (int)var_nodes[cur_wave].size(); i++)\n+ this->var_nodes[cur_wave][i] += this->Y_N_reorderered[i]; // var_nodes contain previous extrinsic information\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::_hard_decode(const R *Y_N, B *V_K)\n+{\n+ auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n+ this->_load(Y_N);\n+ auto d_load = std::chrono::steady_clock::now() - t_load;\n+\n+ auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n+ // actual decoding\n+ if (typeid(R) == typeid(short))\n+ {\n+ if (normalize_factor == 0.125f) this->BP_decode<1>();\n+ else if (normalize_factor == 0.250f) this->BP_decode<2>();\n+ else if (normalize_factor == 0.375f) this->BP_decode<3>();\n+ else if (normalize_factor == 0.500f) this->BP_decode<4>();\n+ else if (normalize_factor == 0.625f) this->BP_decode<5>();\n+ else if (normalize_factor == 0.750f) this->BP_decode<6>();\n+ else if (normalize_factor == 0.875f) this->BP_decode<7>();\n+ else if (normalize_factor == 1.000f) this->BP_decode<8>();\n+ else\n+ throw std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"normalize_factor\\\" can \"\n+ \"only be 0.125f, 0.250f, 0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n+ }\n+ else\n+ this->BP_decode<1>(); // float or double\n+ auto d_decod = std::chrono::steady_clock::now() - t_decod;\n+\n+ auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n+ this->_store(V_K);\n+ auto d_store = std::chrono::steady_clock::now() - t_store;\n+\n+ this->d_load_total += d_load;\n+ this->d_decod_total += d_decod;\n+ this->d_store_total += d_store;\n+}\n+\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::_store(B *V_K)\n+{\n+ // take the hard decision\n+ const auto zero = mipp::Reg<R>((R)0);\n+ for (auto i = 0; i < this->K; i++)\n+ {\n+ const auto k = this->info_bits_pos[i];\n+ const auto decision = zero > this->var_nodes[cur_wave][k];\n+ V_K_reorderered[i] = mipp::Reg<B>(decision.r);\n+ }\n+\n+ std::vector<B*> frames(mipp::nElReg<R>());\n+ for (auto f = 0; f < mipp::nElReg<R>(); f++) frames[f] = V_K + f * this->K;\n+ Reorderer_static<B,mipp::nElReg<R>()>::apply_rev((B*)V_K_reorderered.data(), frames, this->K);\n+\n+ // set the flag so the branches can be reset to 0 only at the beginning of the loop in iterative decoding\n+ if (cur_wave == this->n_dec_waves -1)\n+ this->init_flag = true;\n+\n+ cur_wave = (cur_wave +1) % this->n_dec_waves;\n+}\n+\n+// BP algorithm\n+template <typename B, typename R>\n+template <int F>\n+void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::BP_decode()\n+{\n+ auto cur_syndrome_depth = 0;\n+\n+ for (auto ite = 0; ite < this->n_ite; ite++)\n+ {\n+ this->BP_process<F>(this->var_nodes[cur_wave], this->branches[cur_wave]);\n+\n+ // stop criterion\n+ if (this->enable_syndrome && this->check_syndrome())\n+ {\n+ cur_syndrome_depth++;\n+ if (cur_syndrome_depth == this->syndrome_depth)\n+ break;\n+ }\n+ else\n+ cur_syndrome_depth = 0;\n+ }\n+}\n+\n+template <typename B, typename R>\n+bool Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::check_syndrome()\n+{\n+ auto syndrome = mipp::Reg<B>((B)0);\n+\n+ auto k = 0;\n+ for (auto i = 0; i < this->n_C_nodes; i++)\n+ {\n+ auto sign = mipp::Reg<B>((B)0);\n+\n+ const auto n_VN = (int)this->CN_to_VN[i].size();\n+ for (auto j = 0; j < n_VN; j++)\n+ {\n+ const auto value = this->var_nodes[cur_wave][this->CN_to_VN[i][j]] - this->branches[cur_wave][k++];\n+ const auto tmp_sign = mipp::sign(value);\n+\n+ sign ^= mipp::Reg<B>(tmp_sign.r);\n+ }\n+\n+ syndrome |= sign;\n+ }\n+\n+ auto i = 0;\n+ while (i < mipp::nElReg<B>() && syndrome[i] == 0) i++;\n+ return (i == mipp::nElReg<B>());\n+}\n+\n+// BP algorithm\n+template <typename B, typename R>\n+template <int F>\n+void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n+::BP_process(mipp::vector<mipp::Reg<R>> &var_nodes, mipp::vector<mipp::Reg<R>> &branches)\n+{\n+ auto kr = 0;\n+ auto kw = 0;\n+\n+ const auto zero = mipp::Reg<R>((R)0);\n+ for (auto i = 0; i < this->n_C_nodes; i++)\n+ {\n+ auto sign = mipp::Reg<B>((B)0);\n+ auto min1 = mipp::Reg<R>(std::numeric_limits<R>::max());\n+ auto min2 = mipp::Reg<R>(std::numeric_limits<R>::max());\n+\n+ const auto n_VN = (int)this->CN_to_VN[i].size();\n+ for (auto j = 0; j < n_VN; j++)\n+ {\n+ contributions[j] = var_nodes[this->CN_to_VN[i][j]] - branches[kr++];\n+ const auto v_abs = mipp::abs (contributions[j]);\n+ const auto c_sign = mipp::sign(contributions[j]);\n+ const auto v_temp = min1;\n+\n+ sign ^= mipp::Reg<B>(c_sign.r);\n+ min1 = mipp::min(min1, v_abs ); // 1st min\n+ min2 = mipp::min(min2, mipp::max(v_abs, v_temp)); // 2nd min\n+ }\n+\n+ auto cste1 = mipp_normalize<R,F>(min2 - offset, normalize_factor);\n+ auto cste2 = mipp_normalize<R,F>(min1 - offset, normalize_factor);\n+\n+ cste1 = mipp::blend(zero, cste1, zero > cste1); // cste1 = (cste1 < zero) ? zero : cste1;\n+ cste2 = mipp::blend(zero, cste2, zero > cste2); // cste2 = (cste2 < zero) ? zero : cste2;\n+\n+ for (auto j = 0; j < n_VN; j++)\n+ {\n+ const auto value = contributions[j];\n+ const auto v_abs = mipp::abs(value);\n+ auto v_res = mipp::blend(cste1, cste2, v_abs == min1); // auto v_res = ((v_abs == min1) ? cste1 : cste2);\n+ const auto v_sig = sign ^ mipp::Reg<B>(mipp::sign(value).r); // xor bit\n+ v_res = mipp::neg(v_res, mipp::Reg<R>(v_sig.r)); // magnitude of v_res, sign of v_sig\n+\n+ branches[kw++] = v_res;\n+ var_nodes[this->CN_to_VN[i][j]] = contributions[j] + v_res;\n+ }\n+ }\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter<B_8,Q_8>;\n+template class aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter<B_16,Q_16>;\n+template class aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter<B_32,Q_32>;\n+template class aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp",
"diff": "+#ifndef DECODER_LDPC_BP_LAYERED_ONMS_INTER_HPP_\n+#define DECODER_LDPC_BP_LAYERED_ONMS_INTER_HPP_\n+\n+#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n+\n+#include \"../../../../Decoder_SISO.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_LDPC_BP_layered_ONMS_inter : public Decoder_SISO<B,R>\n+{\n+private:\n+ int cur_wave;\n+ const float normalize_factor;\n+ const R offset;\n+ mipp::vector<mipp::Reg<R>> contributions;\n+\n+protected:\n+ const int n_ite; // number of iterations to perform\n+ const int n_C_nodes; // number of check nodes (= N - K)\n+\n+ const bool enable_syndrome;\n+ const int syndrome_depth;\n+\n+ // reset so C_to_V and V_to_C structures can be cleared only at the beginning of the loop in iterative decoding\n+ bool init_flag;\n+\n+ const mipp::vector<B> &info_bits_pos;\n+\n+ const std::vector<std::vector<unsigned int>> &CN_to_VN;\n+\n+ // data structures for iterative decoding\n+ std::vector<mipp::vector<mipp::Reg<R>>> var_nodes;\n+ std::vector<mipp::vector<mipp::Reg<R>>> branches;\n+\n+ mipp::vector<mipp::Reg<R>> Y_N_reorderered;\n+ mipp::vector<mipp::Reg<B>> V_K_reorderered;\n+\n+public:\n+ Decoder_LDPC_BP_layered_ONMS_inter(const int &K, const int &N, const int& n_ite,\n+ const tools::AList_reader &alist_data,\n+ const mipp::vector<B> &info_bits_pos,\n+ const float normalize_factor = 1.f,\n+ const float offset = 0.f,\n+ const bool enable_syndrome = true,\n+ const int syndrome_depth = 1,\n+ const int n_frames = 1,\n+ const std::string name = \"Decoder_LDPC_BP_layered_ONMS_inter\");\n+ virtual ~Decoder_LDPC_BP_layered_ONMS_inter();\n+\n+protected:\n+ // soft decode\n+ void _soft_decode(const R *Y_N1, R *Y_N2);\n+\n+ // hard decoder (load -> decode -> store)\n+ void _load (const R *Y_N);\n+ void _hard_decode(const R *Y_N, B *V_K);\n+ void _store (B *V_K);\n+\n+ // BP functions for decoding\n+ template <int F = 1>\n+ void BP_decode();\n+\n+ bool check_syndrome();\n+\n+ template <int F = 1>\n+ void BP_process(mipp::vector<mipp::Reg<R>> &var_nodes, mipp::vector<mipp::Reg<R>> &branches);\n+};\n+}\n+}\n+\n+#endif /* DECODER_LDPC_BP_LAYERED_ONMS_INTER_HPP_ */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.cpp",
"diff": "+#include <stdexcept>\n+#include <typeinfo>\n#include <limits>\n#include <cmath>\nusing namespace aff3ct::module;\nusing namespace aff3ct::tools;\n+template <typename R>\n+inline R normalize(const R val, const float factor)\n+{\n+ if (factor == 0.125f) return div8<R>(val);\n+ else if (factor == 0.250f) return div4<R>(val);\n+ else if (factor == 0.375f) return div4<R>(val) + div8<R>(val);\n+ else if (factor == 0.500f) return div2<R>(val);\n+ else if (factor == 0.625f) return div2<R>(val) + div8<R>(val);\n+ else if (factor == 0.750f) return div2<R>(val) + div4<R>(val);\n+ else if (factor == 0.875f) return div2<R>(val) + div4<R>(val) + div8<R>(val);\n+ else if (factor == 1.000f) return val;\n+ else\n+ throw std::invalid_argument(\"aff3ct::tools::normalize: \\\"factor\\\" can only be 0.125f, 0.250f, \"\n+ \"0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n+}\n+\n+template <>\n+inline float normalize(const float val, const float factor)\n+{\n+ return val * factor;\n+}\n+\n+template <>\n+inline double normalize(const double val, const float factor)\n+{\n+ return val * (double)factor;\n+}\n+\ntemplate <typename B, typename R>\nDecoder_LDPC_BP_layered_offset_normalize_min_sum<B,R>\n::Decoder_LDPC_BP_layered_offset_normalize_min_sum(const int &K, const int &N, const int& n_ite,\nconst AList_reader &alist_data,\nconst mipp::vector<B> &info_bits_pos,\nconst float normalize_factor,\n- const float offset,\n+ const R offset,\nconst bool enable_syndrome,\nconst int syndrome_depth,\nconst int n_frames,\nconst std::string name)\n: Decoder_LDPC_BP_layered<B,R>(K, N, n_ite, alist_data, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name),\n- normalize_factor((R)normalize_factor), offset((R)offset), contributions(alist_data.get_CN_max_degree())\n+ normalize_factor(normalize_factor), offset(offset), contributions(alist_data.get_CN_max_degree())\n{\n}\n@@ -56,8 +86,8 @@ void Decoder_LDPC_BP_layered_offset_normalize_min_sum<B,R>\nmin2 = std::min(min2, std::max(v_abs, v_temp)); // 2nd min\n}\n- auto cste1 = (min2 - offset) * normalize_factor;\n- auto cste2 = (min1 - offset) * normalize_factor;\n+ auto cste1 = normalize<R>(min2 - offset, normalize_factor);\n+ auto cste2 = normalize<R>(min1 - offset, normalize_factor);\ncste1 = (cste1 < 0) ? 0 : cste1;\ncste2 = (cste2 < 0) ? 0 : cste2;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp",
"diff": "@@ -13,7 +13,7 @@ template <typename B = int, typename R = float>\nclass Decoder_LDPC_BP_layered_offset_normalize_min_sum : public Decoder_LDPC_BP_layered<B,R>\n{\nprivate:\n- const R normalize_factor;\n+ const float normalize_factor;\nconst R offset;\nmipp::vector<R> contributions;\n@@ -22,7 +22,7 @@ public:\nconst tools::AList_reader &alist_data,\nconst mipp::vector<B> &info_bits_pos,\nconst float normalize_factor = 1.f,\n- const float offset = 0.f,\n+ const R offset = (R)0,\nconst bool enable_syndrome = true,\nconst int syndrome_depth = 1,\nconst int n_frames = 1,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SISO.hpp",
"new_path": "src/Module/Decoder/SISO.hpp",
"diff": "@@ -33,7 +33,6 @@ template <typename R = float>\nclass SISO_i : public Module\n{\nprivate:\n- const int n_dec_waves_siso;\nconst int n_inter_frame_rest_siso;\nmipp::vector<R> Y_N1;\n@@ -43,6 +42,7 @@ protected:\nconst int K_siso; /*!< Number of information bits in one frame */\nconst int N_siso; /*!< Size of one frame (= number of bits in one frame) */\nconst int simd_inter_frame_level_siso;\n+ const int n_dec_waves_siso;\npublic:\n/*!\n@@ -57,11 +57,13 @@ public:\nSISO_i(const int K, const int N, const int n_frames = 1, const int simd_inter_frame_level = 1,\nstd::string name = \"SISO_i\")\n: Module(n_frames, name),\n- n_dec_waves_siso((int)std::ceil((float)this->n_frames / (float)simd_inter_frame_level)),\nn_inter_frame_rest_siso(this->n_frames % simd_inter_frame_level),\nY_N1(simd_inter_frame_level * N),\nY_N2(simd_inter_frame_level * N),\n- K_siso(K), N_siso(N), simd_inter_frame_level_siso(simd_inter_frame_level)\n+ K_siso(K),\n+ N_siso(N),\n+ simd_inter_frame_level_siso(simd_inter_frame_level),\n+ n_dec_waves_siso((int)std::ceil((float)this->n_frames / (float)simd_inter_frame_level))\n{\nif (K <= 0)\nthrow std::invalid_argument(\"aff3ct::module::SISO: \\\"K\\\" has to be greater than 0.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"diff": "#include \"Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp\"\n+#include \"Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp\"\n#include \"Factory_decoder_LDPC.hpp\"\n@@ -65,16 +66,30 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nelse if (params.decoder.type == \"BP_LAYERED\")\n{\nif (params.decoder.implem == \"ONMS\")\n+ {\n+ if (params.decoder.simd_strategy.empty())\ndecoder = new Decoder_LDPC_BP_layered_offset_normalize_min_sum<B,R>(params.code.K,\nparams.code.N,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\nparams.decoder.normalize_factor,\n- params.decoder.offset,\n+ (R)params.decoder.offset,\nparams.decoder.enable_syndrome,\nparams.decoder.syndrome_depth,\nparams.simulation.inter_frame_level);\n+ else if (params.decoder.simd_strategy == \"INTER\")\n+ decoder = new Decoder_LDPC_BP_layered_ONMS_inter<B,R>(params.code.K,\n+ params.code.N,\n+ params.decoder.n_ite,\n+ alist_data,\n+ info_bits_pos,\n+ params.decoder.normalize_factor,\n+ (R)params.decoder.offset,\n+ params.decoder.enable_syndrome,\n+ params.decoder.syndrome_depth,\n+ params.simulation.inter_frame_level);\n+ }\nelse if (params.decoder.implem == \"SPA\")\ndecoder = new Decoder_LDPC_BP_layered_sum_product<B,R>(params.code.K,\nparams.code.N,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/utils.h",
"new_path": "src/Tools/Math/utils.h",
"diff": "@@ -11,16 +11,21 @@ namespace aff3ct\n{\nnamespace tools\n{\n-template <typename R> inline R div2(R val) { return val * (R)0.50; }\n+template <typename R> inline R div2(R val) { return val * (R)0.500; }\ntemplate <> inline int div2(int val) { return val >> 1; }\ntemplate <> inline short div2(short val) { return val >> 1; }\ntemplate <> inline signed char div2(signed char val) { return val >> 1; }\n-template <typename R> inline R div4(R val) { return val * (R)0.25; }\n+template <typename R> inline R div4(R val) { return val * (R)0.250; }\ntemplate <> inline int div4(int val) { return val >> 2; }\ntemplate <> inline short div4(short val) { return val >> 2; }\ntemplate <> inline signed char div4(signed char val) { return val >> 2; }\n+template <typename R> inline R div8(R val) { return val * (R)0.125; }\n+template <> inline int div8(int val) { return val >> 3; }\n+template <> inline short div8(short val) { return val >> 3; }\n+template <> inline signed char div8(signed char val) { return val >> 3; }\n+\n// init value depending on the domain\ntemplate <typename R>\nconstexpr R init_LR () { return (R)1; }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"new_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"diff": "@@ -292,6 +292,30 @@ public:\ninline Reg<T> operator> ( Reg<T> v) const { return this->cmpgt (v); }\ninline Reg<T> operator>= ( Reg<T> v) const { return this->cmpge (v); }\n+#ifndef MIPP_NO_INTRINSICS\n+ inline T& operator[](size_t index)\n+ {\n+ T *data = (T*)&this->r;\n+ return data[index % nElReg<T>()];\n+ }\n+\n+ inline const T& operator[](size_t index) const\n+ {\n+ T *data = (T*)&this->r;\n+ return data[index % nElReg<T>()];\n+ }\n+#else\n+ inline T& operator[](size_t index)\n+ {\n+ return r;\n+ }\n+\n+ inline const T& operator[](size_t index) const\n+ {\n+ return r;\n+ }\n+#endif\n+\n// ------------------------------------------------------------------------------------------------------ reduction\n#ifndef MIPP_NO_INTRINSICS\ninline Reg<T> sum () const { return Reduction<T,mipp::add>::apply(*this); }\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a new LDPC BP layered decoder: ONMS + SIMD inter frame.
|
8,490 |
22.04.2017 11:41:02
| -7,200 |
ad78be5928eab33ee610c51515025e32f6042f90
|
Improve the MIPP lib by using the right interface for operator[].
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"diff": "@@ -274,8 +274,8 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nauto cste1 = mipp_normalize<R,F>(min2 - offset, normalize_factor);\nauto cste2 = mipp_normalize<R,F>(min1 - offset, normalize_factor);\n- cste1 = mipp::blend(zero, cste1, zero > cste1); // cste1 = (cste1 < zero) ? zero : cste1;\n- cste2 = mipp::blend(zero, cste2, zero > cste2); // cste2 = (cste2 < zero) ? zero : cste2;\n+ cste1 = mipp::blend(zero, cste1, zero > cste1); // cste1 = (0 > cste1) ? cste1 : 0;\n+ cste2 = mipp::blend(zero, cste2, zero > cste2); // cste2 = (0 > cste2) ? cste2 : 0;\nfor (auto j = 0; j < n_VN; j++)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"new_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"diff": "@@ -293,27 +293,9 @@ public:\ninline Reg<T> operator>= ( Reg<T> v) const { return this->cmpge (v); }\n#ifndef MIPP_NO_INTRINSICS\n- inline T& operator[](size_t index)\n- {\n- T *data = (T*)&this->r;\n- return data[index % nElReg<T>()];\n- }\n-\n- inline const T& operator[](size_t index) const\n- {\n- T *data = (T*)&this->r;\n- return data[index % nElReg<T>()];\n- }\n+ inline const T& operator[](size_t index) const { return *((T*)&this->r + (index % nElReg<T>())); }\n#else\n- inline T& operator[](size_t index)\n- {\n- return r;\n- }\n-\n- inline const T& operator[](size_t index) const\n- {\n- return r;\n- }\n+ inline const T& operator[](size_t index) const { return r; }\n#endif\n// ------------------------------------------------------------------------------------------------------ reduction\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the MIPP lib by using the right interface for operator[].
|
8,486 |
24.04.2017 10:15:29
| -7,200 |
431a0c217d97ef8a50067b0141f398b2f85bd48e
|
Add getter for N and K.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder.hpp",
"new_path": "src/Module/Decoder/Decoder.hpp",
"diff": "@@ -176,7 +176,10 @@ public:\n{\nreturn this->simd_inter_frame_level;\n}\n-\n+ int get_N()\n+ {\n+ return this->N;\n+ }\nprotected:\nvirtual void _hard_decode(const R *Y_N, B *V_K)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"diff": "@@ -67,6 +67,6 @@ template class aff3ct::module::Decoder_NO<B_16,Q_16>;\ntemplate class aff3ct::module::Decoder_NO<B_32,Q_32>;\ntemplate class aff3ct::module::Decoder_NO<B_64,Q_64>;\n#else\n-template class aff3ct::module::Decoder_NO<B,Q>;\n+template class aff3ct::module::Decoder_NO<B,R>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/BPSK/Modulator_BPSK.cpp",
"new_path": "src/Module/Modulator/BPSK/Modulator_BPSK.cpp",
"diff": "@@ -51,9 +51,11 @@ void Modulator_BPSK<B,R,Q>\n{\nauto size = (unsigned int)(this->N_fil * this->n_frames);\nfor (unsigned i = 0; i < size; i++)\n+ {\nY_N2[i] = Y_N1[i] * (Q)two_on_square_sigma;\n}\n}\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Modulator_BPSK<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/BPSK/Modulator_BPSK.hpp",
"new_path": "src/Module/Modulator/BPSK/Modulator_BPSK.hpp",
"diff": "@@ -38,6 +38,13 @@ public:\n{\nreturn Modulator<B,R,Q>::get_buffer_size_after_filtering(N, 1, 0, 1, false);\n}\n+\n+ // void set_sigma(const R sigma)\n+ // {\n+ // this->sigma = sigma;\n+ // this->two_on_square_sigma = (R)2.0 / (sigma * sigma);\n+ // }\n+\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/Modulator.hpp",
"new_path": "src/Module/Modulator/Modulator.hpp",
"diff": "@@ -331,6 +331,16 @@ public:\nreturn ((int)(std::ceil((float)N / (float)n_b_per_s)) + tl) * max_wa_id * (complex ? 2 : 1);\n}\n+\n+ unsigned get_N()\n+ {\n+ return this->N;\n+ }\n+\n+ unsigned get_N_mod()\n+ {\n+ return this->N_mod;\n+ }\nprotected:\nvirtual void _modulate(const B *X_N1, R *X_N2)\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add getter for N and K.
|
8,490 |
24.04.2017 12:23:19
| -7,200 |
811511469befa47fb52b2e44d71ac97ff15e5fa9
|
Add a alias in mipp: copysign(a,b) = neg(a,b) + remove the multiplication in the LDPC decoder when the normalize factor is equal to 1.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"diff": "using namespace aff3ct::module;\nusing namespace aff3ct::tools;\n-template <typename R, int F = 1> inline mipp::Reg<R> mipp_normalize(const mipp::Reg<R> val, const float factor) { return val * mipp::Reg<R>((R)factor); }\n-\n-template <> inline mipp::Reg<short> mipp_normalize<short, 1>(const mipp::Reg<short> v, const float f) { return (v >> 3); } // v * 0.125\n-template <> inline mipp::Reg<short> mipp_normalize<short, 2>(const mipp::Reg<short> v, const float f) { return (v >> 2); } // v * 0.250\n-template <> inline mipp::Reg<short> mipp_normalize<short, 3>(const mipp::Reg<short> v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n-template <> inline mipp::Reg<short> mipp_normalize<short, 4>(const mipp::Reg<short> v, const float f) { return (v >> 1); } // v * 0.500\n-template <> inline mipp::Reg<short> mipp_normalize<short, 5>(const mipp::Reg<short> v, const float f) { return (v >> 3) + (v >> 1); } // v * 0.625\n-template <> inline mipp::Reg<short> mipp_normalize<short, 6>(const mipp::Reg<short> v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\n-template <> inline mipp::Reg<short> mipp_normalize<short, 7>(const mipp::Reg<short> v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\n-template <> inline mipp::Reg<short> mipp_normalize<short, 8>(const mipp::Reg<short> v, const float f) { return v; } // v * 1.000\n+template <typename R, int F = 0> inline mipp::Reg<R> simd_normalize(const mipp::Reg<R> val, const float factor) { return val * mipp::Reg<R>((R)factor); }\n+\n+template <> inline mipp::Reg<short > simd_normalize<short, 1>(const mipp::Reg<short > v, const float f) { return (v >> 3); } // v * 0.125\n+template <> inline mipp::Reg<short > simd_normalize<short, 2>(const mipp::Reg<short > v, const float f) { return (v >> 2); } // v * 0.250\n+template <> inline mipp::Reg<short > simd_normalize<short, 3>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n+template <> inline mipp::Reg<short > simd_normalize<short, 4>(const mipp::Reg<short > v, const float f) { return (v >> 1); } // v * 0.500\n+template <> inline mipp::Reg<short > simd_normalize<short, 5>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 1); } // v * 0.625\n+template <> inline mipp::Reg<short > simd_normalize<short, 6>(const mipp::Reg<short > v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\n+template <> inline mipp::Reg<short > simd_normalize<short, 7>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\n+template <> inline mipp::Reg<short > simd_normalize<short, 8>(const mipp::Reg<short > v, const float f) { return v; } // v * 1.000\n+template <> inline mipp::Reg<float > simd_normalize<float, 8>(const mipp::Reg<float > v, const float f) { return v; } // v * 1.000\n+template <> inline mipp::Reg<double> simd_normalize<double,8>(const mipp::Reg<double> v, const float f) { return v; } // v * 1.000\ntemplate <typename B, typename R>\nDecoder_LDPC_BP_layered_ONMS_inter<B,R>\n@@ -92,8 +94,11 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"normalize_factor\\\" can \"\n\"only be 0.125f, 0.250f, 0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n}\n- else\n- this->BP_decode<1>(); // float or double\n+ else // float or double\n+ {\n+ if (normalize_factor == 1.000f) this->BP_decode<8>();\n+ else this->BP_decode<0>();\n+ }\n// prepare for next round by processing extrinsic information\nfor (auto i = 0; i < this->N; i++)\n@@ -153,8 +158,12 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"normalize_factor\\\" can \"\n\"only be 0.125f, 0.250f, 0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n}\n- else\n- this->BP_decode<1>(); // float or double\n+ else // float or double\n+ {\n+ if (normalize_factor == 1.000f) this->BP_decode<8>();\n+ else this->BP_decode<0>();\n+ }\n+\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -267,23 +276,23 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nconst auto v_temp = min1;\nsign ^= mipp::Reg<B>(c_sign.r);\n- min1 = mipp::min(min1, v_abs ); // 1st min\n- min2 = mipp::min(min2, mipp::max(v_abs, v_temp)); // 2nd min\n+ min1 = mipp::min(min1, v_abs );\n+ min2 = mipp::min(min2, mipp::max(v_abs, v_temp));\n}\n- auto cste1 = mipp_normalize<R,F>(min2 - offset, normalize_factor);\n- auto cste2 = mipp_normalize<R,F>(min1 - offset, normalize_factor);\n+ auto cste1 = simd_normalize<R,F>(min2 - offset, normalize_factor);\n+ auto cste2 = simd_normalize<R,F>(min1 - offset, normalize_factor);\n- cste1 = mipp::blend(zero, cste1, zero > cste1); // cste1 = (0 > cste1) ? cste1 : 0;\n- cste2 = mipp::blend(zero, cste2, zero > cste2); // cste2 = (0 > cste2) ? cste2 : 0;\n+ cste1 = mipp::blend(zero, cste1, zero > cste1);\n+ cste2 = mipp::blend(zero, cste2, zero > cste2);\nfor (auto j = 0; j < n_VN; j++)\n{\nconst auto value = contributions[j];\nconst auto v_abs = mipp::abs(value);\n- auto v_res = mipp::blend(cste1, cste2, v_abs == min1); // auto v_res = ((v_abs == min1) ? cste1 : cste2);\n- const auto v_sig = sign ^ mipp::Reg<B>(mipp::sign(value).r); // xor bit\n- v_res = mipp::neg(v_res, mipp::Reg<R>(v_sig.r)); // magnitude of v_res, sign of v_sig\n+ auto v_res = mipp::blend(cste1, cste2, v_abs == min1);\n+ const auto v_sig = sign ^ mipp::Reg<B>(mipp::sign(value).r);\n+ v_res = mipp::copysign(v_res, mipp::Reg<R>(v_sig.r));\nbranches[kw++] = v_res;\nvar_nodes[this->CN_to_VN[i][j]] = contributions[j] + v_res;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp.h",
"new_path": "src/Tools/Perf/MIPP/mipp.h",
"diff": "@@ -451,6 +451,10 @@ inline reg pack(const reg, const reg) {\nexit(-1);\n}\n+// ------------------------------------------------------------------------------------------------------------ aliases\n+// --------------------------------------------------------------------------------------------------------------------\n+template <typename T> inline reg copysign(const reg r1, const reg r2) { return neg<T>(r1, r2); }\n+\n// --------------------------------------------------------------------------------------- myIntrinsics implementations\n// --------------------------------------------------------------------------------------------------------------------\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"new_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"diff": "@@ -169,6 +169,7 @@ public:\ninline Reg<T> sign () const { return mipp::sign <T>(r); }\ninline Reg<T> sign (const Reg<T> v) const { return mipp::sign <T>(r, v.r); }\ninline Reg<T> neg (const Reg<T> v) const { return mipp::neg <T>(r, v.r); }\n+ inline Reg<T> copysign (const Reg<T> v) const { return mipp::copysign <T>(r, v.r); }\ninline Reg<T> neg () const { return mipp::neg <T>(r); }\ninline Reg<T> abs () const { return mipp::abs <T>(r); }\ninline Reg<T> sqrt () const { return mipp::sqrt <T>(r); }\n@@ -224,6 +225,7 @@ public:\ninline Reg<T> sign () const { return (T)((T(0) < r) - (r < T(0))); }\ninline Reg<T> sign (const Reg<T> v) const { return sign(Reg<T>(r ^ v.r)); }\ninline Reg<T> neg (const Reg<T> v) const { return v.r >= 0 ? Reg<T>(r) : Reg<T>(-r); }\n+ inline Reg<T> copysign (const Reg<T> v) const { return this->neg(v); }\ninline Reg<T> neg () const { return -r; }\ninline Reg<T> abs () const { return std::abs(r); }\ninline Reg<T> sqrt () const { return (T)std::sqrt(r); }\n@@ -407,6 +409,7 @@ template <typename T> inline Reg<T> max (const Reg<T> v1, const Reg<T\ntemplate <typename T> inline Reg<T> sign (const Reg<T> v) { return v.sign(); }\ntemplate <typename T> inline Reg<T> sign (const Reg<T> v1, const Reg<T> v2) { return v1.sign(v2); }\ntemplate <typename T> inline Reg<T> neg (const Reg<T> v1, const Reg<T> v2) { return v1.neg(v2); }\n+template <typename T> inline Reg<T> copysign (const Reg<T> v1, const Reg<T> v2) { return v1.copysign(v2); }\ntemplate <typename T> inline Reg<T> neg (const Reg<T> v) { return v.neg(); }\ntemplate <typename T> inline Reg<T> abs (const Reg<T> v) { return v.abs(); }\ntemplate <typename T> inline Reg<T> sqrt (const Reg<T> v) { return v.sqrt(); }\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a alias in mipp: copysign(a,b) = neg(a,b) + remove the multiplication in the LDPC decoder when the normalize factor is equal to 1.
|
8,490 |
24.04.2017 16:51:44
| -7,200 |
c1e3fda5fd7c456337a8646b144341ba3666b6dc
|
Add a saturation in the LDPC BP decoder (inter SIMD).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.cpp",
"diff": "@@ -28,7 +28,7 @@ Decoder_LDPC_BP_flooding<B,R>\nn_branches ((int)alist_data.get_n_branches() ),\nenable_syndrome (enable_syndrome ),\nsyndrome_depth (syndrome_depth ),\n- init_flag (false ),\n+ init_flag (true ),\ninfo_bits_pos (info_bits_pos ),\nn_variables_per_parity (alist_data.get_n_VN_per_CN() ),\n@@ -36,8 +36,8 @@ Decoder_LDPC_BP_flooding<B,R>\ntranspose (alist_data.get_branches_transpose() ),\nLp_N (N, -1), // -1 in order to fail when AZCW\n- C_to_V (n_frames, mipp::vector<R>(this->n_branches, 0)),\n- V_to_C (n_frames, mipp::vector<R>(this->n_branches, 0))\n+ C_to_V (n_frames, mipp::vector<R>(this->n_branches)),\n+ V_to_C (n_frames, mipp::vector<R>(this->n_branches))\n{\nif (n_ite <= 0)\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_flooding: \\\"n_ite\\\" has to be greater than 0.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp",
"diff": "@@ -25,11 +25,11 @@ Decoder_LDPC_BP_layered<B,R>\nn_C_nodes ((int)alist_data.get_n_CN() ),\nenable_syndrome (enable_syndrome ),\nsyndrome_depth (syndrome_depth ),\n- init_flag (false ),\n+ init_flag (true ),\ninfo_bits_pos (info_bits_pos ),\nCN_to_VN (alist_data.get_CN_to_VN() ),\n- var_nodes (n_frames, mipp::vector<R>(N, 0)),\n- branches (n_frames, mipp::vector<R>(alist_data.get_n_branches(), 0))\n+ var_nodes (n_frames, mipp::vector<R>(N )),\n+ branches (n_frames, mipp::vector<R>(alist_data.get_n_branches()))\n{\nif (n_ite <= 0)\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered: \\\"n_ite\\\" has to be greater than 0.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"diff": "using namespace aff3ct::module;\nusing namespace aff3ct::tools;\n-template <typename R, int F = 0> inline mipp::Reg<R> simd_normalize(const mipp::Reg<R> val, const float factor) { return val * mipp::Reg<R>((R)factor); }\n-\n-template <> inline mipp::Reg<short > simd_normalize<short, 1>(const mipp::Reg<short > v, const float f) { return (v >> 3); } // v * 0.125\n-template <> inline mipp::Reg<short > simd_normalize<short, 2>(const mipp::Reg<short > v, const float f) { return (v >> 2); } // v * 0.250\n-template <> inline mipp::Reg<short > simd_normalize<short, 3>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n-template <> inline mipp::Reg<short > simd_normalize<short, 4>(const mipp::Reg<short > v, const float f) { return (v >> 1); } // v * 0.500\n-template <> inline mipp::Reg<short > simd_normalize<short, 5>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 1); } // v * 0.625\n-template <> inline mipp::Reg<short > simd_normalize<short, 6>(const mipp::Reg<short > v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\n-template <> inline mipp::Reg<short > simd_normalize<short, 7>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\n-template <> inline mipp::Reg<short > simd_normalize<short, 8>(const mipp::Reg<short > v, const float f) { return v; } // v * 1.000\n-template <> inline mipp::Reg<float > simd_normalize<float, 8>(const mipp::Reg<float > v, const float f) { return v; } // v * 1.000\n-template <> inline mipp::Reg<double> simd_normalize<double,8>(const mipp::Reg<double> v, const float f) { return v; } // v * 1.000\n-\ntemplate <typename B, typename R>\nDecoder_LDPC_BP_layered_ONMS_inter<B,R>\n::Decoder_LDPC_BP_layered_ONMS_inter(const int &K, const int &N, const int& n_ite,\n@@ -39,11 +26,12 @@ Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nnormalize_factor (normalize_factor ),\noffset ((R)offset ),\ncontributions (alist_data.get_CN_max_degree() ),\n+ saturation ((1 << ((sizeof(R) * 8 -2) - (int)std::log2(alist_data.get_VN_max_degree()))) -1),\nn_ite (n_ite ),\nn_C_nodes ((int)alist_data.get_n_CN() ),\nenable_syndrome (enable_syndrome ),\nsyndrome_depth (syndrome_depth ),\n- init_flag (false ),\n+ init_flag (true ),\ninfo_bits_pos (info_bits_pos ),\nCN_to_VN (alist_data.get_CN_to_VN() ),\nvar_nodes (this->n_dec_waves, mipp::vector<mipp::Reg<R>>(N ) ),\n@@ -61,9 +49,13 @@ Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"N\\\" is not compatible with \"\n\"the alist file.\");\n- if (typeid(R) == typeid(signed char))\n- throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: this decoder does not work in \"\n- \"8-bit fixed-point.\");\n+// if (typeid(R) == typeid(signed char))\n+// throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: this decoder does not work in \"\n+// \"8-bit fixed-point.\");\n+\n+ if (saturation <= 0)\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"saturation\\\" has to be \"\n+ \"greater than 0.\");\n}\ntemplate <typename B, typename R>\n@@ -80,7 +72,7 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nthis->_load(Y_N1);\n// actual decoding\n- if (typeid(R) == typeid(short))\n+ if (typeid(R) == typeid(short) || typeid(R) == typeid(signed char))\n{\nif (normalize_factor == 0.125f) this->BP_decode<1>();\nelse if (normalize_factor == 0.250f) this->BP_decode<2>();\n@@ -122,8 +114,7 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nstd::fill(this->branches [cur_wave].begin(), this->branches [cur_wave].end(), zero);\nstd::fill(this->var_nodes[cur_wave].begin(), this->var_nodes[cur_wave].end(), zero);\n- if (cur_wave == this->n_dec_waves -1)\n- this->init_flag = false;\n+ if (cur_wave == this->n_dec_waves -1) this->init_flag = false;\n}\nstd::vector<const R*> frames(mipp::nElReg<R>());\n@@ -144,7 +135,7 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n// actual decoding\n- if (typeid(R) == typeid(short))\n+ if (typeid(R) == typeid(short) || typeid(R) == typeid(signed char))\n{\nif (normalize_factor == 0.125f) this->BP_decode<1>();\nelse if (normalize_factor == 0.250f) this->BP_decode<2>();\n@@ -192,11 +183,10 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nfor (auto f = 0; f < mipp::nElReg<R>(); f++) frames[f] = V_K + f * this->K;\nReorderer_static<B,mipp::nElReg<R>()>::apply_rev((B*)V_K_reorderered.data(), frames, this->K);\n- // set the flag so the branches can be reset to 0 only at the beginning of the loop in iterative decoding\n- if (cur_wave == this->n_dec_waves -1)\n- this->init_flag = true;\n-\ncur_wave = (cur_wave +1) % this->n_dec_waves;\n+\n+ // set the flag so the branches can be reset to 0 only at the beginning of the loop in iterative decoding\n+ if (cur_wave == 0) this->init_flag = true;\n}\n// BP algorithm\n@@ -251,6 +241,42 @@ bool Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nreturn (i == mipp::nElReg<B>());\n}\n+// --------------------------------------------------------------------------------------------------------------------\n+// --------------------------------------------------------------------------------------------------------- SIMD TOOLS\n+\n+// saturation\n+template <typename R> inline mipp::Reg<R> simd_sat(const mipp::Reg<R> val, const R saturation) { return val; }\n+\n+template <> inline mipp::Reg<short > simd_sat(const mipp::Reg<short > v, const short s) { return mipp::sat(v, (short )-s, (short )+s); }\n+template <> inline mipp::Reg<signed char> simd_sat(const mipp::Reg<signed char> v, const signed char s) { return mipp::sat(v, (signed char)-s, (signed char)+s); }\n+\n+// normalization\n+template <typename R, int F = 0> inline mipp::Reg<R> simd_normalize(const mipp::Reg<R> val, const float factor) { return val * mipp::Reg<R>((R)factor); }\n+\n+template <> inline mipp::Reg<float > simd_normalize<float, 8>(const mipp::Reg<float > v, const float f) { return v; } // v * 1.000\n+template <> inline mipp::Reg<double> simd_normalize<double, 8>(const mipp::Reg<double> v, const float f) { return v; } // v * 1.000\n+\n+template <> inline mipp::Reg<short> simd_normalize<short, 1>(const mipp::Reg<short > v, const float f) { return (v >> 3); } // v * 0.125\n+template <> inline mipp::Reg<short> simd_normalize<short, 2>(const mipp::Reg<short > v, const float f) { return (v >> 2); } // v * 0.250\n+template <> inline mipp::Reg<short> simd_normalize<short, 3>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n+template <> inline mipp::Reg<short> simd_normalize<short, 4>(const mipp::Reg<short > v, const float f) { return (v >> 1); } // v * 0.500\n+template <> inline mipp::Reg<short> simd_normalize<short, 5>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 1); } // v * 0.625\n+template <> inline mipp::Reg<short> simd_normalize<short, 6>(const mipp::Reg<short > v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\n+template <> inline mipp::Reg<short> simd_normalize<short, 7>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\n+template <> inline mipp::Reg<short> simd_normalize<short, 8>(const mipp::Reg<short > v, const float f) { return v; } // v * 1.000\n+\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 1>(const mipp::Reg<signed char> v, const float f) { return (v >> 3); } // v * 0.125\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 2>(const mipp::Reg<signed char> v, const float f) { return (v >> 2); } // v * 0.250\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 3>(const mipp::Reg<signed char> v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 4>(const mipp::Reg<signed char> v, const float f) { return (v >> 1); } // v * 0.500\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 5>(const mipp::Reg<signed char> v, const float f) { return (v >> 3) + (v >> 1); } // v * 0.625\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 6>(const mipp::Reg<signed char> v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 7>(const mipp::Reg<signed char> v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\n+template <> inline mipp::Reg<signed char> simd_normalize<signed char, 8>(const mipp::Reg<signed char> v, const float f) { return v; } // v * 1.000\n+\n+// --------------------------------------------------------------------------------------------------------- SIMD TOOLS\n+// --------------------------------------------------------------------------------------------------------------------\n+\n// BP algorithm\ntemplate <typename B, typename R>\ntemplate <int F>\n@@ -293,6 +319,7 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nauto v_res = mipp::blend(cste1, cste2, v_abs == min1);\nconst auto v_sig = sign ^ mipp::Reg<B>(mipp::sign(value).r);\nv_res = mipp::copysign(v_res, mipp::Reg<R>(v_sig.r));\n+ v_res = simd_sat<R>(v_res, saturation);\nbranches[kw++] = v_res;\nvar_nodes[this->CN_to_VN[i][j]] = contributions[j] + v_res;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp",
"diff": "@@ -19,6 +19,7 @@ private:\nmipp::vector<mipp::Reg<R>> contributions;\nprotected:\n+ const R saturation;\nconst int n_ite; // number of iterations to perform\nconst int n_C_nodes; // number of check nodes (= N - K)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a saturation in the LDPC BP decoder (inter SIMD).
|
8,490 |
25.04.2017 08:55:15
| -7,200 |
9ed594f7fea698408498e85436b6e773a2cc3bba
|
Improve the saturation.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"diff": "@@ -48,11 +48,9 @@ Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nif (N != (int)alist_data.get_n_VN())\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"N\\\" is not compatible with \"\n\"the alist file.\");\n-\n-// if (typeid(R) == typeid(signed char))\n-// throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: this decoder does not work in \"\n-// \"8-bit fixed-point.\");\n-\n+ if (typeid(R) == typeid(signed char))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: this decoder does not work in \"\n+ \"8-bit fixed-point (try in 16-bit).\");\nif (saturation <= 0)\nthrow std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"saturation\\\" has to be \"\n\"greater than 0.\");\n@@ -245,17 +243,22 @@ bool Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n// --------------------------------------------------------------------------------------------------------- SIMD TOOLS\n// saturation\n-template <typename R> inline mipp::Reg<R> simd_sat(const mipp::Reg<R> val, const R saturation) { return val; }\n-\n-template <> inline mipp::Reg<short > simd_sat(const mipp::Reg<short > v, const short s) { return mipp::sat(v, (short )-s, (short )+s); }\n-template <> inline mipp::Reg<signed char> simd_sat(const mipp::Reg<signed char> v, const signed char s) { return mipp::sat(v, (signed char)-s, (signed char)+s); }\n+template <typename R>\n+inline mipp::Reg<R> simd_sat(const mipp::Reg<R> val, const R saturation)\n+{\n+ return val;\n+}\n+template <>\n+inline mipp::Reg<short> simd_sat(const mipp::Reg<short> v, const short s)\n+{\n+ return mipp::sat(v, (short)-s, (short)+s);\n+}\n// normalization\n-template <typename R, int F = 0> inline mipp::Reg<R> simd_normalize(const mipp::Reg<R> val, const float factor) { return val * mipp::Reg<R>((R)factor); }\n-\n-template <> inline mipp::Reg<float > simd_normalize<float, 8>(const mipp::Reg<float > v, const float f) { return v; } // v * 1.000\n-template <> inline mipp::Reg<double> simd_normalize<double, 8>(const mipp::Reg<double> v, const float f) { return v; } // v * 1.000\n-\n+template <typename R, int F = 0> inline mipp::Reg<R> simd_normalize(const mipp::Reg<R> val, const float factor)\n+{\n+ return val * mipp::Reg<R>((R)factor);\n+}\ntemplate <> inline mipp::Reg<short > simd_normalize<short, 1>(const mipp::Reg<short > v, const float f) { return (v >> 3); } // v * 0.125\ntemplate <> inline mipp::Reg<short > simd_normalize<short, 2>(const mipp::Reg<short > v, const float f) { return (v >> 2); } // v * 0.250\ntemplate <> inline mipp::Reg<short > simd_normalize<short, 3>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n@@ -264,15 +267,8 @@ template <> inline mipp::Reg<short> simd_normalize<short, 5>(const mipp::Reg<sho\ntemplate <> inline mipp::Reg<short > simd_normalize<short, 6>(const mipp::Reg<short > v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\ntemplate <> inline mipp::Reg<short > simd_normalize<short, 7>(const mipp::Reg<short > v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\ntemplate <> inline mipp::Reg<short > simd_normalize<short, 8>(const mipp::Reg<short > v, const float f) { return v; } // v * 1.000\n-\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 1>(const mipp::Reg<signed char> v, const float f) { return (v >> 3); } // v * 0.125\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 2>(const mipp::Reg<signed char> v, const float f) { return (v >> 2); } // v * 0.250\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 3>(const mipp::Reg<signed char> v, const float f) { return (v >> 3) + (v >> 2); } // v * 0.375\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 4>(const mipp::Reg<signed char> v, const float f) { return (v >> 1); } // v * 0.500\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 5>(const mipp::Reg<signed char> v, const float f) { return (v >> 3) + (v >> 1); } // v * 0.625\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 6>(const mipp::Reg<signed char> v, const float f) { return (v >> 2) + (v >> 1); } // v * 0.750\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 7>(const mipp::Reg<signed char> v, const float f) { return (v >> 3) + (v >> 2) + (v >> 1); } // v * 0.825\n-template <> inline mipp::Reg<signed char> simd_normalize<signed char, 8>(const mipp::Reg<signed char> v, const float f) { return v; } // v * 1.000\n+template <> inline mipp::Reg<float > simd_normalize<float, 8>(const mipp::Reg<float > v, const float f) { return v; } // v * 1.000\n+template <> inline mipp::Reg<double> simd_normalize<double,8>(const mipp::Reg<double> v, const float f) { return v; } // v * 1.000\n// --------------------------------------------------------------------------------------------------------- SIMD TOOLS\n// --------------------------------------------------------------------------------------------------------------------\n@@ -306,8 +302,8 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nmin2 = mipp::min(min2, mipp::max(v_abs, v_temp));\n}\n- auto cste1 = simd_normalize<R,F>(min2 - offset, normalize_factor);\n- auto cste2 = simd_normalize<R,F>(min1 - offset, normalize_factor);\n+ auto cste1 = simd_sat<R>(simd_normalize<R,F>(min2 - offset, normalize_factor), saturation);\n+ auto cste2 = simd_sat<R>(simd_normalize<R,F>(min1 - offset, normalize_factor), saturation);\ncste1 = mipp::blend(zero, cste1, zero > cste1);\ncste2 = mipp::blend(zero, cste2, zero > cste2);\n@@ -319,7 +315,6 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nauto v_res = mipp::blend(cste1, cste2, v_abs == min1);\nconst auto v_sig = sign ^ mipp::Reg<B>(mipp::sign(value).r);\nv_res = mipp::copysign(v_res, mipp::Reg<R>(v_sig.r));\n- v_res = simd_sat<R>(v_res, saturation);\nbranches[kw++] = v_res;\nvar_nodes[this->CN_to_VN[i][j]] = contributions[j] + v_res;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the saturation.
|
8,490 |
25.04.2017 09:53:33
| -7,200 |
daf1296407b5199ba0fd30541459ebcd38863945
|
Add cast instruction to mipp.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"diff": "@@ -226,9 +226,7 @@ bool Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nfor (auto j = 0; j < n_VN; j++)\n{\nconst auto value = this->var_nodes[cur_wave][this->CN_to_VN[i][j]] - this->branches[cur_wave][k++];\n- const auto tmp_sign = mipp::sign(value);\n-\n- sign ^= mipp::Reg<B>(tmp_sign.r);\n+ sign ^= mipp::cast<R,B>(mipp::sign(value));\n}\nsyndrome |= sign;\n@@ -297,7 +295,7 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nconst auto c_sign = mipp::sign(contributions[j]);\nconst auto v_temp = min1;\n- sign ^= mipp::Reg<B>(c_sign.r);\n+ sign ^= mipp::cast<R,B>(c_sign);\nmin1 = mipp::min(min1, v_abs );\nmin2 = mipp::min(min2, mipp::max(v_abs, v_temp));\n}\n@@ -313,8 +311,8 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nconst auto value = contributions[j];\nconst auto v_abs = mipp::abs(value);\nauto v_res = mipp::blend(cste1, cste2, v_abs == min1);\n- const auto v_sig = sign ^ mipp::Reg<B>(mipp::sign(value).r);\n- v_res = mipp::copysign(v_res, mipp::Reg<R>(v_sig.r));\n+ const auto v_sig = sign ^ mipp::cast<R,B>(mipp::sign(value));\n+ v_res = mipp::copysign(v_res, mipp::cast<B,R>(v_sig));\nbranches[kw++] = v_res;\nvar_nodes[this->CN_to_VN[i][j]] = contributions[j] + v_res;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"diff": "@@ -29,13 +29,7 @@ void Decoder_NO<B,R>\nfor (auto i = 0; i < vec_loop_size; i += mipp::nElReg<R>())\n{\nconst auto r_Y_N = mipp::Reg<R>(&Y_N[i]);\n-\n- // s[i] = Y_N[i] < 0;\n-#if defined(MIPP_NO_INTRINSICS) && defined(_MSC_VER)\n- const auto r_s = mipp::Reg<B>((B)r_Y_N.sign().r) >> (sizeof(B) * 8 - 1);\n-#else\n- const auto r_s = mipp::Reg<B>(r_Y_N.sign().r) >> (sizeof(B) * 8 - 1);\n-#endif\n+ const auto r_s = mipp::cast<R,B>(r_Y_N.sign()) >> (sizeof(B) * 8 - 1); // s[i] = Y_N[i] < 0;\nr_s.store(&V_K[i]);\n}\nfor (auto i = vec_loop_size; i < this->K; i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"new_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"diff": "@@ -250,12 +250,14 @@ public:\n#ifndef MIPP_NO_INTRINSICS\ntemplate <typename T2> inline Reg<T2> cvt () const { return mipp::cvt<T,T2>(r); }\ntemplate <typename T2> inline Reg<T2> pack(const Reg<T> v) const { return mipp::pack<T,T2>(r, v.r); }\n+ template <typename T2> inline Reg<T2> cast() const { return Reg<T2>(this->r); }\n#else\ntemplate <typename T2> inline Reg<T2> cvt () const { return (T2)r; }\ntemplate <typename T2> inline Reg<T2> pack(const Reg<T> v) const\n{\nthrow std::runtime_error(\"mipp::Reg::pack: non-sense in sequential mode.\");\n}\n+ template <typename T2> inline Reg<T2> cast() const { return Reg<T2>((T2)this->r); }\n#endif\ninline Reg<T> operator~ ( ) { return this->notb(); }\n@@ -295,7 +297,7 @@ public:\ninline Reg<T> operator>= ( Reg<T> v) const { return this->cmpge (v); }\n#ifndef MIPP_NO_INTRINSICS\n- inline const T& operator[](size_t index) const { return *((T*)&this->r + (index % nElReg<T>())); }\n+ inline const T& operator[](size_t index) const { return *((T*)&this->r + index); }\n#else\ninline const T& operator[](size_t index) const { return r; }\n#endif\n@@ -448,3 +450,9 @@ template <typename T1, typename T2>\ninline Reg<T2> pack(const Reg<T1> v1, const Reg<T1> v2) {\nreturn v1.template pack<T2>(v2);\n}\n+\n+template <typename T1, typename T2>\n+inline Reg<T2> cast(const Reg<T1> v)\n+{\n+ return v.template cast<T2>();\n+}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add cast instruction to mipp.
|
8,490 |
25.04.2017 16:40:36
| -7,200 |
9f55353503d584d028589c8f78d3ca87073f47e4
|
Add 16-bit support for BP flooding ONMS.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -160,7 +160,7 @@ _aff3ct() {\n${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" ]]\nthen\nopts=\"$opts --dec-type -D --dec-implem --dec-ite -i --cde-alist-path \\\n- --dec-no-synd --dec-off --dec-norm --dec-synd-depth\"\n+ --dec-no-synd --dec-off --dec-norm --dec-synd-depth --dec-simd\"\nfi\n# add contents of Launcher_BFER_uncoded.cpp\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.cpp",
"diff": "using namespace aff3ct::module;\nusing namespace aff3ct::tools;\n+template <typename R>\n+inline R normalize(const R val, const float factor)\n+{\n+ if (factor == 0.125f) return div8<R>(val);\n+ else if (factor == 0.250f) return div4<R>(val);\n+ else if (factor == 0.375f) return div4<R>(val) + div8<R>(val);\n+ else if (factor == 0.500f) return div2<R>(val);\n+ else if (factor == 0.625f) return div2<R>(val) + div8<R>(val);\n+ else if (factor == 0.750f) return div2<R>(val) + div4<R>(val);\n+ else if (factor == 0.875f) return div2<R>(val) + div4<R>(val) + div8<R>(val);\n+ else if (factor == 1.000f) return val;\n+ else\n+ throw std::invalid_argument(\"aff3ct::module::normalize: \\\"factor\\\" can only be 0.125f, 0.250f, \"\n+ \"0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n+}\n+\n+template <>\n+inline float normalize(const float val, const float factor)\n+{\n+ return val * factor;\n+}\n+\n+template <>\n+inline double normalize(const double val, const float factor)\n+{\n+ return val * (double)factor;\n+}\n+\ntemplate <typename B, typename R>\nDecoder_LDPC_BP_flooding_offset_normalize_min_sum<B,R>\n::Decoder_LDPC_BP_flooding_offset_normalize_min_sum(const int &K, const int &N, const int& n_ite,\nconst AList_reader &alist_data,\nconst mipp::vector<B> &info_bits_pos,\nconst float normalize_factor,\n- const float offset,\n+ const R offset,\nconst bool enable_syndrome,\nconst int syndrome_depth,\nconst int n_frames,\nconst std::string name)\n: Decoder_LDPC_BP_flooding<B,R>(K, N, n_ite, alist_data, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name),\n- normalize_factor((R)normalize_factor), offset((R)offset)\n+ normalize_factor(normalize_factor), offset(offset)\n{\n+ if (typeid(R) == typeid(signed char))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_flooding_offset_normalize_min_sum: this decoder \"\n+ \"does not work in 8-bit fixed-point (try in 16-bit).\");\n}\ntemplate <typename B, typename R>\n@@ -82,8 +113,8 @@ bool Decoder_LDPC_BP_flooding_offset_normalize_min_sum<B,R>\nmin2 = std::min(min2, std::max(v_abs, v_temp)); // 2nd min\n}\n- auto cste1 = (min2 - offset) * normalize_factor;\n- auto cste2 = (min1 - offset) * normalize_factor;\n+ auto cste1 = normalize<R>(min2 - offset, normalize_factor);\n+ auto cste2 = normalize<R>(min1 - offset, normalize_factor);\ncste1 = (cste1 < 0) ? 0 : cste1;\ncste2 = (cste2 < 0) ? 0 : cste2;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.hpp",
"diff": "@@ -11,7 +11,7 @@ template <typename B = int, typename R = float>\nclass Decoder_LDPC_BP_flooding_offset_normalize_min_sum : public Decoder_LDPC_BP_flooding<B,R>\n{\nprivate:\n- const R normalize_factor;\n+ const float normalize_factor;\nconst R offset;\npublic:\n@@ -19,7 +19,7 @@ public:\nconst tools::AList_reader &alist_data,\nconst mipp::vector<B> &info_bits_pos,\nconst float normalize_factor = 1.f,\n- const float offset = 0.f,\n+ const R offset = (R)0,\nconst bool enable_syndrome = true,\nconst int syndrome_depth = 1,\nconst int n_frames = 1,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.cpp",
"diff": "@@ -22,7 +22,7 @@ inline R normalize(const R val, const float factor)\nelse if (factor == 0.875f) return div2<R>(val) + div4<R>(val) + div8<R>(val);\nelse if (factor == 1.000f) return val;\nelse\n- throw std::invalid_argument(\"aff3ct::tools::normalize: \\\"factor\\\" can only be 0.125f, 0.250f, \"\n+ throw std::invalid_argument(\"aff3ct::module::normalize: \\\"factor\\\" can only be 0.125f, 0.250f, \"\n\"0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n}\n@@ -52,6 +52,9 @@ Decoder_LDPC_BP_layered_offset_normalize_min_sum<B,R>\n: Decoder_LDPC_BP_layered<B,R>(K, N, n_ite, alist_data, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name),\nnormalize_factor(normalize_factor), offset(offset), contributions(alist_data.get_CN_max_degree())\n{\n+ if (typeid(R) == typeid(signed char))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_offset_normalize_min_sum: this decoder \"\n+ \"does not work in 8-bit fixed-point (try in 16-bit).\");\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"diff": "@@ -31,7 +31,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nalist_data,\ninfo_bits_pos,\nparams.decoder.normalize_factor,\n- params.decoder.offset,\n+ (R)params.decoder.offset,\nparams.decoder.enable_syndrome,\nparams.decoder.syndrome_depth,\nparams.simulation.inter_frame_level);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add 16-bit support for BP flooding ONMS.
|
8,490 |
25.04.2017 17:18:40
| -7,200 |
7b525be96554100c191b48d04ba42abd571eccfc
|
Do not display warning when negative value in the Argument_reader.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "@@ -61,6 +61,11 @@ bool Arguments_reader\nn_req_arg++;\n}\nvalid_arg = this->sub_parse_arguments(this->m_optional_args, i) || valid_arg;\n+\n+ // do not display warning when negative value\n+ try { std::stoi(this->m_argv[i]); if (!valid_arg) valid_arg = true; }\n+ catch (std::exception const& e) {}\n+\nif (!valid_arg && this->m_argv[i][0] == '-')\nwarnings.push_back(\"Unknown argument \\\"\" + this->m_argv[i] + \"\\\".\");\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Do not display warning when negative value in the Argument_reader.
|
8,490 |
26.04.2017 09:02:15
| -7,200 |
4b78ac6962c23d53f01ebd7c5615af70d67b3e59
|
Update the BCH curves.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/1023_983_4.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/1023_983_4.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"1023\" -K \"983\" -T \"4\" --mGF \"10\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"500\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (1023,983,4)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"1023\" -K \"983\" -T \"4\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"500\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (1023,983,4)\"\nCurve name:\nBCH (1023,983,4)\n# -------------------------------------------------\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/255_231_3.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/255_231_3.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"231\" -T \"3\" --mGF \"8\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,231,3)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"231\" -T \"3\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,231,3)\"\nCurve name:\nBCH (255,231,3)\n# -------------------------------------------------\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/255_239_2.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/255_239_2.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"239\" -T \"2\" --mGF \"8\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,239,2)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"239\" -T \"2\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,239,2)\"\nCurve name:\nBCH (255,239,2)\n# -------------------------------------------------\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/31_11_4.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/31_11_4.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"31\" -K \"11\" -T \"4\" --mGF \"5\" -m \"0\" -M \"9\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (31,11,4)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"31\" -K \"11\" -T \"4\" -m \"0\" -M \"9\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (31,11,4)\"\nCurve name:\nBCH (31,11,4)\n# -------------------------------------------------\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/31_11_5.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/31_11_5.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"31\" -K \"11\" -T \"5\" --mGF \"5\" -m \"0\" -M \"8.251\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (31,11,5)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"31\" -K \"11\" -T \"5\" -m \"0\" -M \"8.251\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (31,11,5)\"\nCurve name:\nBCH (31,11,5)\n# -------------------------------------------------\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the BCH curves.
|
8,490 |
26.04.2017 09:10:25
| -7,200 |
d759ec0e4ff7a4b4974c5230781a032ae6d815df
|
Remove some remaining exit calls in the SCL fast decoders.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"diff": "@@ -719,8 +719,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ns[new_path][off_s + bit_flips[2 * old_path +1]] = !s[old_path][off_s + bit_flips[2 * old_path +1]] ? b : 0;\nbreak;\ndefault:\n- std::cout << tools::bold_red(\"(EE) Flip bits error on rate 1 node.\") << std::endl;\n- std::exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_MEM_fast_sys: flip bits error on rate 1 node.\");\nbreak;\n}\n}\n@@ -1152,8 +1151,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\ns[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\ndefault:\n- std::cout << tools::bold_red(\"(EE) Flip bits error on SPC node.\") << std::endl;\n- std::exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_MEM_fast_sys: flip bits error on SPC node.\");\nbreak;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"diff": "@@ -655,8 +655,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ns[new_path][off_s + bit_flips[2 * old_path +1]] = !s[old_path][off_s + bit_flips[2 * old_path +1]] ? b : 0;\nbreak;\ndefault:\n- std::cout << tools::bold_red(\"(EE) Flip bits error on rate 1 node.\") << std::endl;\n- std::exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_fast_sys: flip bits error on rate 1 node.\");\nbreak;\n}\n}\n@@ -1088,8 +1087,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\ns[new_path][off_s + bit_flips[4 * old_path +3]] = s[old_path][off_s + bit_flips[4 * old_path +3]] ? 0 : b;\nbreak;\ndefault:\n- std::cout << tools::bold_red(\"(EE) Flip bits error on SPC node.\") << std::endl;\n- std::exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_fast_sys: flip bits error on SPC node.\");\nbreak;\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove some remaining exit calls in the SCL fast decoders.
|
8,490 |
26.04.2017 10:18:02
| -7,200 |
45aa19edea47ca980816da232c53d3df247208ce
|
Fix arg. order in mipp.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"new_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"diff": "@@ -238,7 +238,7 @@ public:\ninline Reg<T> fmadd (const Reg<T> v1, const Reg<T> v2) const { return r * v1.r + v2.r; }\ninline Reg<T> fnmadd (const Reg<T> v1, const Reg<T> v2) const { return -(r * v1.r + v2.r); }\ninline Reg<T> fmsub (const Reg<T> v1, const Reg<T> v2) const { return r * v1.r - v2.r; }\n- inline Reg<T> blend (const Reg<T> v1, const Reg<T> m ) const { return (m.r) ? v1.r : r; }\n+ inline Reg<T> blend (const Reg<T> v1, const Reg<T> m ) const { return (m.r) ? r : v1.r; }\ninline Reg<T> rot () const { return r; }\ninline Reg<T> rotr () const { return r; }\ninline Reg<T> div2 () const { return mipp_scop::div2<T>(r); }\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix arg. order in mipp.
|
8,483 |
28.04.2017 09:52:59
| -7,200 |
f33a8a1ee0a14abf6e8b6a65b24e5f78284e1706
|
Correction in the CPM BCJR when filling the extrinsic
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/CPM/BCJR/CPM_BCJR.hpp",
"new_path": "src/Module/Modulator/CPM/BCJR/CPM_BCJR.hpp",
"diff": "@@ -14,7 +14,10 @@ class CPM_BCJR\n{\nprotected:\nconst CPM_parameters<SIN,SOUT>& cpm; // all CPM parameters\n- const int frame_size; // size of a frame with tail bits\n+ const int n_symbols; // size of a frame (in symbols) from the channel (with tail bits)\n+ const int chn_size; // size of a frame (wave form probas) from the channel (with tail bits)\n+ const int dec_size; // size of a frame (bits proba) from the decoder\n+ const int ext_size; // size of a frame (bits proba) from the bcjr\nmipp::vector<Q> symb_apriori_prob;\nmipp::vector<Q> gamma;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/CPM/BCJR/CPM_BCJR.hxx",
"new_path": "src/Module/Modulator/CPM/BCJR/CPM_BCJR.hxx",
"diff": "@@ -56,16 +56,19 @@ inline void BCJR_normalize(signed char *metrics, const int &i, const int &n_stat\ntemplate <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\nCPM_BCJR<SIN,SOUT,Q,MAX>\n-::CPM_BCJR(const CPM_parameters<SIN,SOUT>& _cpm, const int _frame_size)\n+::CPM_BCJR(const CPM_parameters<SIN,SOUT>& _cpm, const int _n_symbols)\n: cpm (_cpm ),\n- frame_size (_frame_size ),\n-\n- symb_apriori_prob(frame_size * cpm.m_order),\n- gamma (frame_size * cpm.max_st_id * cpm.m_order),\n- alpha (frame_size * cpm.max_st_id ),\n- beta (frame_size * cpm.max_st_id ),\n- proba_msg_symb (frame_size * cpm.m_order),\n- proba_msg_bits (frame_size * cpm.n_b_per_s* 2 )\n+ n_symbols (_n_symbols ),\n+ chn_size ( n_symbols * cpm.max_wa_id ),\n+ dec_size ((n_symbols - cpm.tl) * cpm.n_b_per_s ),\n+ ext_size ( dec_size ),\n+\n+ symb_apriori_prob(n_symbols * cpm.m_order),\n+ gamma (n_symbols * cpm.max_st_id * cpm.m_order),\n+ alpha (n_symbols * cpm.max_st_id ),\n+ beta (n_symbols * cpm.max_st_id ),\n+ proba_msg_symb (n_symbols * cpm.m_order),\n+ proba_msg_bits (n_symbols * cpm.n_b_per_s * 2 )\n{\n}\n@@ -79,9 +82,13 @@ template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::decode(const mipp::vector<Q> &Lch_N, mipp::vector<Q> &Le_N)\n{\n- if (Le_N.size() * 2 > proba_msg_bits.size())\n- throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Le_N.size()\\\" * 2 has to be equal or smaller than \"\n- \"\\\"proba_msg_bits.size()\\\".\");\n+ if ((int)Lch_N.size() != chn_size)\n+ throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Lch_N.size()\\\" has to be equal to \"\n+ \"\\\"n_symbols\\\" * \\\"cpm.max_wa_id\\\".\");\n+\n+ if ((int)Le_N.size() != ext_size)\n+ throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Le_N.size()\\\" has to be equal to \"\n+ \"(\\\"n_symbols\\\" - \\\"cpm.tl\\\") * \\\"cpm.n_b_per_s\\\".\");\nthis->decode(Lch_N.data(), Le_N.data());\n}\n@@ -102,21 +109,21 @@ template <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::decode(const mipp::vector<Q> &Lch_N, const mipp::vector<Q> &Ldec_N, mipp::vector<Q> &Le_N)\n{\n- if (Ldec_N.size() != (symb_apriori_prob.size()/cpm.m_order - cpm.tl) * cpm.n_b_per_s)\n- throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Ldec_N.size()\\\" has to be equal to \"\n- \"(\\\"symb_apriori_prob.size()\\\" / \\\"cpm.m_order\\\" - \\\"cpm.tl\\\") * \\\"cpm.n_b_per_s\\\".\");\n+ if ((int)Lch_N.size() != chn_size)\n+ throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Lch_N.size()\\\" has to be equal to \"\n+ \"\\\"n_symbols\\\" * \\\"cpm.max_wa_id\\\".\");\n- if (Le_N.size() * 2 > proba_msg_bits.size())\n- throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Le_N.size()\\\" * 2 has to be equal or smaller than \"\n- \"\\\"proba_msg_bits.size()\\\".\");\n+ if ((int)Ldec_N.size() != dec_size)\n+ throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Ldec_N.size()\\\" has to be equal to \"\n+ \"(\\\"n_symbols\\\" - \\\"cpm.tl\\\") * \\\"cpm.n_b_per_s\\\".\");\n- if (Le_N.size() != Ldec_N.size())\n- throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Le_N.size()\\\" * 2 has to be equal to \\\"Ldec_N.size()\\\".\");\n+ if ((int)Le_N.size() != ext_size)\n+ throw std::length_error(\"aff3ct::module::CPM_BCJR: \\\"Le_N.size()\\\" has to be equal to \"\n+ \"(\\\"n_symbols\\\" - \\\"cpm.tl\\\") * \\\"cpm.n_b_per_s\\\".\");\nthis->decode(Lch_N.data(), Ldec_N.data(), Le_N.data());\n}\n-\ntemplate <typename SIN, typename SOUT, typename Q, tools::proto_max<Q> MAX>\nvoid CPM_BCJR<SIN,SOUT,Q,MAX>\n::decode(const Q *Lch_N, const Q *Ldec_N, Q *Le_N)\n@@ -154,10 +161,10 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nstd::fill(alpha.begin(), alpha.end(), negative_inf<Q>());\nstd::fill(beta .begin(), beta .end(), negative_inf<Q>());\nalpha[ cpm.allowed_states[0]] = 0;\n- beta [(frame_size -1) * cpm.max_st_id +cpm.allowed_states[0]] = 0;\n+ beta [(n_symbols -1) * cpm.max_st_id +cpm.allowed_states[0]] = 0;\n// compute gamma\n- for (auto i = 0; i < frame_size; i++)\n+ for (auto i = 0; i < n_symbols; i++)\nfor (auto st = 0; st < cpm.n_st; st++)\nfor (auto tr = 0; tr < cpm.m_order; tr++)\ngamma[(i * cpm.max_st_id + cpm.allowed_states[st]) * cpm.m_order + tr] =\n@@ -166,7 +173,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n// compute alpha and beta\n- for (auto i = 1; i < frame_size; i++)\n+ for (auto i = 1; i < n_symbols; i++)\n{\nfor (auto st = 0; st < cpm.n_st; st++)\n{\n@@ -180,15 +187,15 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n// compute the beta nodes\nfor (auto tr = 0; tr < cpm.m_order; tr++)\n- beta [(frame_size - (i +1)) * cpm.max_st_id + cpm.allowed_states[st]] =\n- MAX(beta [(frame_size - (i +1)) * cpm.max_st_id + cpm.allowed_states[st]],\n- beta [(frame_size - (i +0)) * cpm.max_st_id + cpm.trellis_next_state[cpm.allowed_states[st]*cpm.m_order +tr]] +\n- gamma[((frame_size- i) * cpm.max_st_id + cpm.allowed_states[st]) * cpm.m_order + tr]);\n+ beta [(n_symbols - (i +1)) * cpm.max_st_id + cpm.allowed_states[st]] =\n+ MAX(beta [(n_symbols - (i +1)) * cpm.max_st_id + cpm.allowed_states[st]],\n+ beta [(n_symbols - (i +0)) * cpm.max_st_id + cpm.trellis_next_state[cpm.allowed_states[st]*cpm.m_order +tr]] +\n+ gamma[((n_symbols- i) * cpm.max_st_id + cpm.allowed_states[st]) * cpm.m_order + tr]);\n}\n// normalize alpha and beta vectors (not impact on the decoding performances)\nBCJR_normalize<Q,MAX>(&alpha[ (i +0) * cpm.max_st_id], i, cpm.max_st_id);\n- BCJR_normalize<Q,MAX>(&beta [(frame_size - (i +1)) * cpm.max_st_id], i, cpm.max_st_id);\n+ BCJR_normalize<Q,MAX>(&beta [(n_symbols - (i +1)) * cpm.max_st_id], i, cpm.max_st_id);\n}\n}\n@@ -198,7 +205,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n{\nstd::fill(proba_msg_symb.begin(), proba_msg_symb.end(), negative_inf<Q>());\n- for (auto i = 0; i < frame_size; i++)\n+ for (auto i = 0; i < n_symbols; i++)\nfor (auto tr = 0; tr < cpm.m_order; tr++)\nfor (auto st = 0; st < cpm.n_st; st++)\nproba_msg_symb [ i * cpm.m_order + tr] =\n@@ -215,7 +222,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n// initialize proba_msg_bits\nstd::fill(proba_msg_bits.begin(), proba_msg_bits.end(), negative_inf<Q>());\n- for (auto i = 0; i < frame_size; i++)\n+ for (auto i = 0; i < n_symbols; i++)\n{\nfor (auto b = 0; b < cpm.n_b_per_s; b++)\nfor (auto tr = 0; tr < cpm.m_order; tr++)\n@@ -233,7 +240,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n::compute_ext(Q *Le_N)\n{\n// remove tail bits\n- for (auto i = 0; i < frame_size - cpm.tl; i ++)\n+ for (auto i = 0; i < (n_symbols - cpm.tl)*cpm.n_b_per_s; i ++)\n// processing aposteriori and substracting a priori to directly obtain extrinsic\nLe_N[i] = proba_msg_bits[i*2] - proba_msg_bits[i*2 +1];\n}\n@@ -243,7 +250,7 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n::compute_ext(const Q *Ldec_N, Q *Le_N)\n{\n// remove tail bits\n- for (auto i = 0; i < frame_size - cpm.tl; i ++)\n+ for (auto i = 0; i < (n_symbols - cpm.tl)*cpm.n_b_per_s; i ++)\n// processing aposteriori and substracting a priori to directly obtain extrinsic\nLe_N[i] = proba_msg_bits[i*2] - (proba_msg_bits[i*2+1] + Ldec_N[i]);\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Correction in the CPM BCJR when filling the extrinsic
|
8,490 |
28.04.2017 17:36:48
| -7,200 |
6e8653fc14e6438f86399406995411f5678af514
|
Replace N by N_code.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Polar/Simulation_BFER_polar.cpp",
"new_path": "src/Simulation/BFER/Code/Polar/Simulation_BFER_polar.cpp",
"diff": "@@ -24,7 +24,7 @@ template <typename B, typename R, typename Q>\nSimulation_BFER_polar<B,R,Q>\n::Simulation_BFER_polar(const parameters& params)\n: Simulation_BFER<B,R,Q>(params),\n- frozen_bits((int)std::exp2(this->params.code.m)),\n+ frozen_bits(this->params.code.N_code),\nis_generated_decoder((params.decoder.implem.find(\"_SNR\") != std::string::npos)),\nfb_generator(nullptr)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Uncoded/Simulation_BFER_uncoded.cpp",
"new_path": "src/Simulation/BFER/Code/Uncoded/Simulation_BFER_uncoded.cpp",
"diff": "@@ -42,14 +42,14 @@ template <typename B, typename R, typename Q>\nEncoder<B>* Simulation_BFER_uncoded<B,R,Q>\n::build_encoder(const int tid)\n{\n- return new Encoder_NO<B>(this->params.code.K, this->params.code.N, this->params.simulation.inter_frame_level);\n+ return new Encoder_NO<B>(this->params.code.K, this->params.code.N_code, this->params.simulation.inter_frame_level);\n}\ntemplate <typename B, typename R, typename Q>\nDecoder<B,Q>* Simulation_BFER_uncoded<B,R,Q>\n::build_decoder(const int tid)\n{\n- return new Decoder_NO<B,Q>(this->params.code.K, this->params.code.N, this->params.simulation.inter_frame_level);\n+ return new Decoder_NO<B,Q>(this->params.code.K, this->params.code.N_code, this->params.simulation.inter_frame_level);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.cpp",
"new_path": "src/Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.cpp",
"diff": "@@ -19,7 +19,7 @@ template <typename B, typename R, typename Q>\nSimulation_BFERI_polar<B,R,Q>\n::Simulation_BFERI_polar(const parameters& params)\n: Simulation_BFERI<B,R,Q>(params),\n- frozen_bits((int)std::exp2(this->params.code.m)),\n+ frozen_bits(this->params.code.N_code),\nfb_generator(nullptr),\ndecoder_siso(params.simulation.n_threads, nullptr)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Code/Uncoded/Simulation_BFERI_uncoded.cpp",
"new_path": "src/Simulation/BFERI/Code/Uncoded/Simulation_BFERI_uncoded.cpp",
"diff": "@@ -49,14 +49,14 @@ template <typename B, typename R, typename Q>\nSISO<Q>* Simulation_BFERI_uncoded<B,R,Q>\n::build_siso(const int tid)\n{\n- return new Decoder_NO<B,Q>(this->params.code.K, this->params.code.N, this->params.simulation.inter_frame_level);\n+ return new Decoder_NO<B,Q>(this->params.code.K, this->params.code.N_code, this->params.simulation.inter_frame_level);\n}\ntemplate <typename B, typename R, typename Q>\nDecoder<B,Q>* Simulation_BFERI_uncoded<B,R,Q>\n::build_decoder(const int tid)\n{\n- return new Decoder_NO<B,Q>(this->params.code.K, this->params.code.N, this->params.simulation.inter_frame_level);\n+ return new Decoder_NO<B,Q>(this->params.code.K, this->params.code.N_code, this->params.simulation.inter_frame_level);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_encoder_common.cpp",
"new_path": "src/Tools/Factory/Factory_encoder_common.cpp",
"diff": "@@ -16,13 +16,13 @@ Encoder<B>* Factory_encoder_common<B>\n// build the encoder\nif (params.encoder.type == \"NO\")\n- encoder = new Encoder_NO<B>(params.code.K, params.code.N + params.code.tail_length, params.simulation.inter_frame_level);\n+ encoder = new Encoder_NO<B>(params.code.K, params.code.N_code + params.code.tail_length, params.simulation.inter_frame_level);\nelse if (params.encoder.type == \"AZCW\")\n- encoder = new Encoder_AZCW<B>(params.code.K, params.code.N + params.code.tail_length, params.simulation.inter_frame_level);\n+ encoder = new Encoder_AZCW<B>(params.code.K, params.code.N_code + params.code.tail_length, params.simulation.inter_frame_level);\nelse if (params.encoder.type == \"COSET\")\n- encoder = new Encoder_coset<B>(params.code.K, params.code.N + params.code.tail_length, seed, params.simulation.inter_frame_level);\n+ encoder = new Encoder_coset<B>(params.code.K, params.code.N_code + params.code.tail_length, seed, params.simulation.inter_frame_level);\nelse if (params.encoder.type == \"USER\")\n- encoder = new Encoder_user<B>(params.code.K, params.code.N + params.code.tail_length, params.encoder.path, params.simulation.inter_frame_level);\n+ encoder = new Encoder_user<B>(params.code.K, params.code.N_code + params.code.tail_length, params.encoder.path, params.simulation.inter_frame_level);\nreturn encoder;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace N by N_code.
|
8,490 |
28.04.2017 17:37:20
| -7,200 |
9fc65b95f47ae9a37cbb43e81bab3f6cbe7b565d
|
Fix wrong deinterleaver method name.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Interleaver.hpp",
"new_path": "src/Module/Interleaver/Interleaver.hpp",
"diff": "@@ -165,7 +165,7 @@ public:\n}\ntemplate <typename D>\n- inline void _deinterleave(const D *interleaved_vec, D *natural_vec,\n+ inline void deinterleave(const D *interleaved_vec, D *natural_vec,\nconst bool frame_reordering = false,\nconst int n_frames = -1) const\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix wrong deinterleaver method name.
|
8,490 |
28.04.2017 17:38:46
| -7,200 |
4b1a5544cb535d5f333ed8c8f6f6021437f81df8
|
Improve the TLM wrapper: 0-copy + exceptions management.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/SC_CRC.hpp",
"new_path": "src/Module/CRC/SC_CRC.hpp",
"diff": "@@ -30,13 +30,11 @@ public:\nprivate:\nSC_CRC<B> &crc;\n- mipp::vector<B> U_K;\npublic:\nSC_CRC_module(SC_CRC<B> &crc, const sc_core::sc_module_name name = \"SC_CRC_module\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\n- crc(crc),\n- U_K(crc.K * crc.n_frames)\n+ crc(crc)\n{\ns_in.register_b_transport(this, &SC_CRC_module::b_transport);\n}\n@@ -44,16 +42,16 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(B)) == (int)U_K.size());\n+ if (crc.K * crc.n_frames != (int)(trans.get_data_length() / sizeof(B)))\n+ throw std::length_error(\"aff3ct::module::CRC: TLM input data size is invalid.\");\n- const B* buffer_in = (B*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + U_K.size(), U_K.begin());\n+ const auto U_K = (B*)trans.get_data_ptr();\ncrc.build(U_K);\ntlm::tlm_generic_payload payload;\n- payload.set_data_ptr((unsigned char*)U_K.data());\n- payload.set_data_length(U_K.size() * sizeof(B));\n+ payload.set_data_ptr((unsigned char*)U_K);\n+ payload.set_data_length(trans.get_data_length());\nsc_core::sc_time zero_time(sc_core::SC_ZERO_TIME);\ns_out->b_transport(payload, zero_time);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/SC_Channel.hpp",
"new_path": "src/Module/Channel/SC_Channel.hpp",
"diff": "@@ -30,14 +30,12 @@ public:\nprivate:\nSC_Channel<R> &channel;\n- mipp::vector<R> X_N;\nmipp::vector<R> Y_N;\npublic:\nSC_Channel_module(SC_Channel<R> &channel, const sc_core::sc_module_name name = \"SC_Channel_module\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\nchannel(channel),\n- X_N(channel.N * channel.n_frames),\nY_N(channel.N * channel.n_frames)\n{\ns_in.register_b_transport(this, &SC_Channel_module::b_transport);\n@@ -46,12 +44,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == X_N.size());\n+ if (channel.N * channel.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::Channel: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + X_N.size(), X_N.begin());\n+ const auto X_N = (R*)trans.get_data_ptr();\n- channel.add_noise(X_N, Y_N);\n+ channel.add_noise(X_N, Y_N.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N.data());\n@@ -83,7 +81,6 @@ public:\nconst sc_core::sc_module_name name = \"SC_Channel_module_wg\")\n: sc_module(name), s_in(\"s_in\"), s_out1(\"s_out1\"), s_out2(\"s_out2\"),\nchannel(channel),\n- X_N(channel.N * channel.n_frames),\nY_N(channel.N * channel.n_frames),\nH_N(channel.N * channel.n_frames)\n{\n@@ -93,12 +90,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == X_N.size());\n+ if (channel.N * channel.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::Channel: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + X_N.size(), X_N.begin());\n+ const auto X_N = (R*)trans.get_data_ptr();\n- channel.add_noise(X_N, Y_N, H_N);\n+ channel.add_noise(X_N, Y_N.data(), H_N.data());\ntlm::tlm_generic_payload payload1;\npayload1.set_data_ptr((unsigned char*)H_N.data());\n@@ -126,8 +123,8 @@ public:\nSC_Channel_module_wg<R> *module_wg;\npublic:\n- SC_Channel(const int N, const int n_frames = 1, const std::string name = \"SC_Channel\")\n- : Channel_i<R>(N, n_frames, name), module(nullptr), module_wg(nullptr) {}\n+ SC_Channel(const int N, const R sigma, const int n_frames = 1, const std::string name = \"SC_Channel\")\n+ : Channel_i<R>(N, sigma, n_frames, name), module(nullptr), module_wg(nullptr) {}\nvirtual ~SC_Channel()\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/SPU_Channel.hpp",
"new_path": "src/Module/Channel/SPU_Channel.hpp",
"diff": "@@ -22,8 +22,8 @@ private:\nstatic starpu_codelet spu_cl_add_noise_wg;\npublic:\n- SPU_Channel(const int N, const int n_frames = 1, const std::string name = \"SPU_Channel\")\n- : Channel_i<R>(N, n_frames, name) {}\n+ SPU_Channel(const int N, const R sigma, const int n_frames = 1, const std::string name = \"SPU_Channel\")\n+ : Channel_i<R>(N, sigma, n_frames, name) {}\nvirtual ~SPU_Channel()\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/SC_Coset.hpp",
"new_path": "src/Module/Coset/SC_Coset.hpp",
"diff": "@@ -31,16 +31,14 @@ public:\nprivate:\nSC_Coset<B,D> &coset;\n- mipp::vector<B> ref;\n- mipp::vector<D> in_data;\n+ B *ref;\nmipp::vector<D> out_data;\npublic:\nSC_Coset_module(SC_Coset<B,D> &coset, const sc_core::sc_module_name name = \"SC_Coset_module\")\n: sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"), s_out(\"s_out\"),\ncoset (coset),\n- ref (coset.size * coset.n_frames),\n- in_data (coset.size * coset.n_frames),\n+ ref (nullptr),\nout_data(coset.size * coset.n_frames)\n{\ns_in1.register_b_transport(this, &SC_Coset_module::b_transport_ref);\n@@ -50,20 +48,23 @@ public:\nprivate:\nvoid b_transport_ref(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(B)) == ref.size());\n+ if (coset.size * coset.n_frames != (int)(trans.get_data_length() / sizeof(B)))\n+ throw std::length_error(\"aff3ct::module::Coset: TLM input data size is invalid.\");\n- const B* buffer_in = (B*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + ref.size(), ref.begin());\n+ ref = (B*)trans.get_data_ptr();\n}\nvoid b_transport_data(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(D)) == in_data.size());\n+ if (ref == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Coset: TLM \\\"ref\\\" pointer can't be NULL.\");\n- const D* buffer_in = (D*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + in_data.size(), in_data.begin());\n+ if (coset.size * coset.n_frames != (int)(trans.get_data_length() / sizeof(D)))\n+ throw std::length_error(\"aff3ct::module::Coset: TLM input data size is invalid.\");\n- coset.apply(ref, in_data, out_data);\n+ const auto in_data = (D*)trans.get_data_ptr();\n+\n+ coset.apply(ref, in_data, out_data.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)out_data.data());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_Decoder.hpp",
"new_path": "src/Module/Decoder/SC_Decoder.hpp",
"diff": "@@ -30,34 +30,26 @@ public:\nprivate:\nSC_Decoder<B,R> &decoder;\n- mipp::vector<R> Y_N;\nmipp::vector<B> V_K;\npublic:\nSC_Decoder_module(SC_Decoder<B,R> &decoder, const sc_core::sc_module_name name = \"SC_Decoder_module\")\n: sc_module(name), s_in (\"s_in\"), s_out(\"s_out\"),\ndecoder(decoder),\n- Y_N(decoder.N * decoder.n_frames),\nV_K(decoder.K * decoder.n_frames)\n{\ns_in.register_b_transport(this, &SC_Decoder_module::b_transport);\n}\n- void resize_buffers()\n- {\n- if ((int)Y_N.size() != decoder.N * decoder.n_frames) Y_N.resize(decoder.N * decoder.n_frames);\n- if ((int)V_K.size() != decoder.K * decoder.n_frames) V_K.resize(decoder.K * decoder.n_frames);\n- }\n-\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == Y_N.size());\n+ if (decoder.N * decoder.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::Decoder: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N.size(), Y_N.begin());\n+ const auto Y_N = (R*)trans.get_data_ptr();\n- decoder.hard_decode(Y_N, V_K);\n+ decoder.hard_decode(Y_N, V_K.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)V_K.data());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_SISO.hpp",
"new_path": "src/Module/Decoder/SC_SISO.hpp",
"diff": "@@ -30,33 +30,26 @@ public:\nprivate:\nSC_SISO<R> &siso;\n- mipp::vector<R> Y_N1, Y_N2;\n+ mipp::vector<R> Y_N2;\npublic:\nSC_SISO_module(SC_SISO<R> &siso, const sc_core::sc_module_name name = \"SC_SISO_module\")\n: sc_module(name), s_in (\"s_in\"), s_out(\"s_out\"),\nsiso(siso),\n- Y_N1(siso.N_siso * siso.n_frames),\nY_N2(siso.N_siso * siso.n_frames)\n{\ns_in.register_b_transport(this, &SC_SISO_module::b_transport);\n}\n- void resize_buffers()\n- {\n- if ((int)Y_N1.size() != siso.N_siso * siso.n_frames) Y_N1.resize(siso.N_siso * siso.n_frames);\n- if ((int)Y_N2.size() != siso.N_siso * siso.n_frames) Y_N2.resize(siso.N_siso * siso.n_frames);\n- }\n-\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == Y_N1.size());\n+ if (siso.N_siso * siso.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::SISO: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ const auto Y_N1 = (R*)trans.get_data_ptr();\n- siso.soft_decode(Y_N1, Y_N2);\n+ siso.soft_decode(Y_N1, Y_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N2.data());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/SC_Encoder.hpp",
"new_path": "src/Module/Encoder/SC_Encoder.hpp",
"diff": "@@ -30,14 +30,12 @@ public:\nprivate:\nSC_Encoder<B> &encoder;\n- mipp::vector<B> U_K;\nmipp::vector<B> X_N;\npublic:\nSC_Encoder_module(SC_Encoder<B> &encoder, const sc_core::sc_module_name name = \"SC_Encoder_module\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\nencoder(encoder),\n- U_K(encoder.K * encoder.n_frames),\nX_N(encoder.N * encoder.n_frames)\n{\ns_in.register_b_transport(this, &SC_Encoder_module::b_transport);\n@@ -46,12 +44,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(B)) == (int)U_K.size());\n+ if (encoder.K * encoder.n_frames != (int)(trans.get_data_length() / sizeof(B)))\n+ throw std::length_error(\"aff3ct::module::Encoder: TLM input data size is invalid.\");\n- const B* buffer_in = (B*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + U_K.size(), U_K.begin());\n+ const auto U_K = (B*)trans.get_data_ptr();\n- encoder.encode(U_K, X_N);\n+ encoder.encode(U_K, X_N.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)X_N.data());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"new_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"diff": "@@ -30,24 +30,20 @@ public:\nprivate:\nSC_Interleaver<T> &interleaver;\n- mipp::vector<char > natural_vec_1, interleaved_vec_1;\n- mipp::vector<short > natural_vec_2, interleaved_vec_2;\n- mipp::vector<int > natural_vec_4, interleaved_vec_4;\n- mipp::vector<long long> natural_vec_8, interleaved_vec_8;\n+ mipp::vector<char > vec_1;\n+ mipp::vector<short > vec_2;\n+ mipp::vector<int > vec_4;\n+ mipp::vector<long long> vec_8;\npublic:\nSC_Interleaver_module_interleaver(SC_Interleaver<T> &interleaver,\nconst sc_core::sc_module_name name = \"SC_Interleaver_module_interleaver\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\ninterleaver(interleaver),\n- natural_vec_1 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_1(interleaver.pi.size() * interleaver.n_frames),\n- natural_vec_2 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_2(interleaver.pi.size() * interleaver.n_frames),\n- natural_vec_4 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_4(interleaver.pi.size() * interleaver.n_frames),\n- natural_vec_8 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_8(interleaver.pi.size() * interleaver.n_frames)\n+ vec_1(interleaver.size() * interleaver.n_frames),\n+ vec_2(interleaver.size() * interleaver.n_frames),\n+ vec_4(interleaver.size() * interleaver.n_frames),\n+ vec_8(interleaver.size() * interleaver.n_frames)\n{\ns_in.register_b_transport(this, &SC_Interleaver_module_interleaver::b_transport);\n}\n@@ -59,12 +55,12 @@ private:\nswitch (size_of_data)\n{\n- case 1: _b_transport<char >(trans, t, natural_vec_1, interleaved_vec_1); break;\n- case 2: _b_transport<short >(trans, t, natural_vec_2, interleaved_vec_2); break;\n- case 4: _b_transport<int >(trans, t, natural_vec_4, interleaved_vec_4); break;\n- case 8: _b_transport<long long>(trans, t, natural_vec_8, interleaved_vec_8); break;\n+ case 1: _b_transport<char >(trans, t, vec_1); break;\n+ case 2: _b_transport<short >(trans, t, vec_2); break;\n+ case 4: _b_transport<int >(trans, t, vec_4); break;\n+ case 8: _b_transport<long long>(trans, t, vec_8); break;\ndefault:\n- std::cerr << \"(EE) Unrecognized type of data, exiting.\" << std::endl; std::exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Interleaver: TLM unrecognized type of data.\");\nbreak;\n}\n}\n@@ -72,15 +68,14 @@ private:\ntemplate <typename D>\nvoid _b_transport(tlm::tlm_generic_payload& trans,\nsc_core::sc_time& t,\n- mipp::vector<D> &natural_vec,\nmipp::vector<D> &interleaved_vec)\n{\n- assert((trans.get_data_length() / sizeof(D)) == natural_vec.size());\n+ if (interleaver.size() * interleaver.n_frames != (trans.get_data_length() / sizeof(D)))\n+ throw std::length_error(\"aff3ct::module::Interleaver: TLM input data size is invalid.\");\n- const D* buffer_in = (D*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + natural_vec.size(), natural_vec.begin());\n+ const auto natural_vec = (D*)trans.get_data_ptr();\n- interleaver.interleave(natural_vec, interleaved_vec);\n+ interleaver.interleave(natural_vec, interleaved_vec.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)interleaved_vec.data());\n@@ -102,24 +97,20 @@ public:\nprivate:\nSC_Interleaver<T> &interleaver;\n- mipp::vector<char > natural_vec_1, interleaved_vec_1;\n- mipp::vector<short > natural_vec_2, interleaved_vec_2;\n- mipp::vector<int > natural_vec_4, interleaved_vec_4;\n- mipp::vector<long long> natural_vec_8, interleaved_vec_8;\n+ mipp::vector<char > vec_1;\n+ mipp::vector<short > vec_2;\n+ mipp::vector<int > vec_4;\n+ mipp::vector<long long> vec_8;\npublic:\nSC_Interleaver_module_deinterleaver(SC_Interleaver<T> &interleaver,\nconst sc_core::sc_module_name name = \"SC_Interleaver_module_deinterleaver\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\ninterleaver(interleaver),\n- natural_vec_1 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_1(interleaver.pi.size() * interleaver.n_frames),\n- natural_vec_2 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_2(interleaver.pi.size() * interleaver.n_frames),\n- natural_vec_4 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_4(interleaver.pi.size() * interleaver.n_frames),\n- natural_vec_8 (interleaver.pi.size() * interleaver.n_frames),\n- interleaved_vec_8(interleaver.pi.size() * interleaver.n_frames)\n+ vec_1(interleaver.pi.size() * interleaver.n_frames),\n+ vec_2(interleaver.pi.size() * interleaver.n_frames),\n+ vec_4(interleaver.pi.size() * interleaver.n_frames),\n+ vec_8(interleaver.pi.size() * interleaver.n_frames)\n{\ns_in.register_b_transport(this, &SC_Interleaver_module_deinterleaver::b_transport);\n}\n@@ -130,12 +121,12 @@ private:\nint size_of_data = trans.get_data_length() / (interleaver.pi.size() * interleaver.n_frames);\nswitch (size_of_data)\n{\n- case 1: _b_transport<char >(trans, t, interleaved_vec_1, natural_vec_1); break;\n- case 2: _b_transport<short >(trans, t, interleaved_vec_2, natural_vec_2); break;\n- case 4: _b_transport<int >(trans, t, interleaved_vec_4, natural_vec_4); break;\n- case 8: _b_transport<long long>(trans, t, interleaved_vec_8, natural_vec_8); break;\n+ case 1: _b_transport<char >(trans, t, vec_1); break;\n+ case 2: _b_transport<short >(trans, t, vec_2); break;\n+ case 4: _b_transport<int >(trans, t, vec_4); break;\n+ case 8: _b_transport<long long>(trans, t, vec_8); break;\ndefault:\n- std::cerr << \"(EE) Unrecognized type of data, exiting.\" << std::endl; std::exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Interleaver: TLM unrecognized type of data.\");\nbreak;\n}\n}\n@@ -143,15 +134,14 @@ private:\ntemplate <typename D>\nvoid _b_transport(tlm::tlm_generic_payload& trans,\nsc_core::sc_time& t,\n- mipp::vector<D> &interleaved_vec,\nmipp::vector<D> &natural_vec)\n{\n- assert((trans.get_data_length() / sizeof(D)) == interleaved_vec.size());\n+ if (interleaver.size() * interleaver.n_frames != (trans.get_data_length() / sizeof(D)))\n+ throw std::length_error(\"aff3ct::module::Interleaver: TLM input data size is invalid.\");\n- const D* buffer_in = (D*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + interleaved_vec.size(), interleaved_vec.begin());\n+ const auto interleaved_vec = (D*)trans.get_data_ptr();\n- interleaver.deinterleave(interleaved_vec, natural_vec);\n+ interleaver.deinterleave(interleaved_vec, natural_vec.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)natural_vec.data());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SC_Modulator.hpp",
"new_path": "src/Module/Modulator/SC_Modulator.hpp",
"diff": "@@ -30,7 +30,6 @@ public:\nprivate:\nSC_Modulator<B,R,Q> &modulator;\n- mipp::vector<B> X_N1;\nmipp::vector<R> X_N2;\npublic:\n@@ -38,7 +37,6 @@ public:\nconst sc_core::sc_module_name name = \"SC_Modulator_module_modulator\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\nmodulator(modulator),\n- X_N1(modulator.N * modulator.n_frames),\nX_N2(modulator.N_mod * modulator.n_frames)\n{\ns_in.register_b_transport(this, &SC_Modulator_module_modulator::b_transport);\n@@ -47,12 +45,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(B)) == X_N1.size());\n+ if (modulator.N * modulator.n_frames != (int)(trans.get_data_length() / sizeof(B)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- const B* buffer_in = (B*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + X_N1.size(), X_N1.begin());\n+ const auto X_N1 = (B*)trans.get_data_ptr();\n- modulator.modulate(X_N1, X_N2);\n+ modulator.modulate(X_N1, X_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)X_N2.data());\n@@ -74,14 +72,13 @@ public:\nprivate:\nSC_Modulator<B,R,Q> &modulator;\n- mipp::vector<R> Y_N1, Y_N2;\n+ mipp::vector<R> Y_N2;\npublic:\nSC_Modulator_module_filterer(SC_Modulator<B,R,Q> &modulator,\nconst sc_core::sc_module_name name = \"SC_Modulator_module_filterer\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\nmodulator(modulator),\n- Y_N1(modulator.N_mod * modulator.n_frames),\nY_N2(modulator.N_fil * modulator.n_frames)\n{\ns_in.register_b_transport(this, &SC_Modulator_module_filterer::b_transport);\n@@ -90,12 +87,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == Y_N1.size());\n+ if (modulator.N_mod * modulator.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ const auto Y_N1 = (R*)trans.get_data_ptr();\n- modulator.filter(Y_N1, Y_N2);\n+ modulator.filter(Y_N1, Y_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N2.data());\n@@ -117,14 +114,13 @@ public:\nprivate:\nSC_Modulator<B,R,Q> &modulator;\n- mipp::vector<Q> Y_N1, Y_N2;\n+ mipp::vector<Q> Y_N2;\npublic:\nSC_Modulator_module_demodulator(SC_Modulator<B,R,Q> &modulator,\nconst sc_core::sc_module_name name = \"SC_Modulator_module_demodulator\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\nmodulator(modulator),\n- Y_N1(modulator.N_fil * modulator.n_frames),\nY_N2(modulator.N * modulator.n_frames)\n{\ns_in.register_b_transport(this, &SC_Modulator_module_demodulator::b_transport);\n@@ -133,12 +129,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(Q)) == Y_N1.size());\n+ if (modulator.N_fil * modulator.n_frames != (int)(trans.get_data_length() / sizeof(Q)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- const Q* buffer_in = (Q*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ const auto Y_N1 = (Q*)trans.get_data_ptr();\n- modulator.demodulate(Y_N1, Y_N2);\n+ modulator.demodulate(Y_N1, Y_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N2.data());\n@@ -161,17 +157,16 @@ public:\nprivate:\nSC_Modulator<B,R,Q> &modulator;\n- mipp::vector<Q> Y_N1, Y_N2;\n- mipp::vector<R> H_N;\n+ R *H_N;\n+ mipp::vector<Q> Y_N2;\npublic:\nSC_Modulator_module_demodulator_wg(SC_Modulator<B,R,Q> &modulator,\nconst sc_core::sc_module_name name = \"SC_Modulator_module_demodulator_wg\")\n: sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"), s_out(\"s_out\"),\nmodulator(modulator),\n- Y_N1(modulator.N_fil * modulator.n_frames),\n- Y_N2(modulator.N * modulator.n_frames),\n- H_N (modulator.N_fil * modulator.n_frames)\n+ H_N(nullptr),\n+ Y_N2(modulator.N * modulator.n_frames)\n{\ns_in1.register_b_transport(this, &SC_Modulator_module_demodulator_wg::b_transport1);\ns_in2.register_b_transport(this, &SC_Modulator_module_demodulator_wg::b_transport2);\n@@ -180,20 +175,23 @@ public:\nprivate:\nvoid b_transport1(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == H_N.size());\n+ if (modulator.N_fil * modulator.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + H_N.size(), H_N.begin());\n+ H_N = (R*)trans.get_data_ptr();\n}\nvoid b_transport2(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(Q)) == Y_N1.size());\n+ if (H_N == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Modulator: TLM \\\"H_N\\\" pointer can't be NULL.\");\n+\n+ if (modulator.N_fil * modulator.n_frames != (int)(trans.get_data_length() / sizeof(Q)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- const Q* buffer_in = (Q*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ const auto Y_N1 = (Q*)trans.get_data_ptr();\n- modulator.demodulate_with_gains(Y_N1, H_N, Y_N2);\n+ modulator.demodulate_with_gains(Y_N1, H_N, Y_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N2.data());\n@@ -216,15 +214,15 @@ public:\nprivate:\nSC_Modulator<B,R,Q> &modulator;\n- mipp::vector<Q> Y_N1, Y_N2, Y_N3;\n+ Q *Y_N1;\n+ mipp::vector<Q> Y_N3;\npublic:\nSC_Modulator_module_tdemodulator(SC_Modulator<B,R,Q> &modulator,\nconst sc_core::sc_module_name name = \"SC_Modulator_module_tdemodulator\")\n: sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"), s_out(\"s_out\"),\nmodulator(modulator),\n- Y_N1(modulator.N_fil * modulator.n_frames),\n- Y_N2(modulator.N * modulator.n_frames),\n+ Y_N1(nullptr),\nY_N3(modulator.N * modulator.n_frames)\n{\ns_in1.register_b_transport(this, &SC_Modulator_module_tdemodulator::b_transport1);\n@@ -234,14 +232,12 @@ public:\nprivate:\nvoid b_transport1(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(Q)) == Y_N1.size());\n+ if (modulator.N_fil * modulator.n_frames != (int)(trans.get_data_length() / sizeof(Q)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- const Q* buffer_in = (Q*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ Y_N1 = (Q*)trans.get_data_ptr();\n- std::fill(Y_N2.begin(), Y_N2.end(), 0);\n- modulator.demodulate(Y_N1, Y_N2, Y_N3);\n- // modulator.demodulate(Y_N1, Y_N3); // optim to avoid the 0 init\n+ modulator.demodulate(Y_N1, Y_N3.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N3.data());\n@@ -253,12 +249,15 @@ private:\nvoid b_transport2(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(Q)) == Y_N2.size());\n+ if (Y_N1 == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Modulator: TLM \\\"Y_N1\\\" pointer can't be NULL.\");\n- const Q* buffer_in = (Q*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N2.size(), Y_N2.begin());\n+ if (modulator.N * modulator.n_frames != (int)(trans.get_data_length() / sizeof(Q)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- modulator.demodulate(Y_N1, Y_N2, Y_N3);\n+ const auto Y_N2 = (Q*)trans.get_data_ptr();\n+\n+ modulator.demodulate(Y_N1, Y_N2, Y_N3.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N3.data());\n@@ -282,18 +281,18 @@ public:\nprivate:\nSC_Modulator<B,R,Q> &modulator;\n- mipp::vector<Q> Y_N1, Y_N2, Y_N3;\n- mipp::vector<R> H_N;\n+ R *H_N;\n+ Q *Y_N1;\n+ mipp::vector<Q> Y_N3;\npublic:\nSC_Modulator_module_tdemodulator_wg(SC_Modulator<B,R,Q> &modulator,\nconst sc_core::sc_module_name name = \"SC_Modulator_module_tdemodulator_wg\")\n: sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"), s_in3(\"s_in3\"), s_out(\"s_out\"),\nmodulator(modulator),\n- Y_N1(modulator.N_fil * modulator.n_frames),\n- Y_N2(modulator.N * modulator.n_frames),\n- Y_N3(modulator.N * modulator.n_frames),\n- H_N (modulator.N_fil * modulator.n_frames)\n+ H_N (nullptr),\n+ Y_N1(nullptr),\n+ Y_N3(modulator.N * modulator.n_frames)\n{\ns_in1.register_b_transport(this, &SC_Modulator_module_tdemodulator_wg::b_transport1);\ns_in2.register_b_transport(this, &SC_Modulator_module_tdemodulator_wg::b_transport2);\n@@ -303,22 +302,23 @@ public:\nprivate:\nvoid b_transport1(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == H_N.size());\n+ if (modulator.N_fil * modulator.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + H_N.size(), H_N.begin());\n+ H_N = (R*)trans.get_data_ptr();\n}\nvoid b_transport2(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(Q)) == Y_N1.size());\n+ if (H_N == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Modulator: TLM \\\"H_N\\\" pointer can't be NULL.\");\n- const Q* buffer_in = (Q*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ if (modulator.N_fil * modulator.n_frames != (int)(trans.get_data_length() / sizeof(Q)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- std::fill(Y_N2.begin(), Y_N2.end(), 0);\n- modulator.demodulate_with_gains(Y_N1, H_N, Y_N2, Y_N3);\n- // modulator.demodulate(Y_N1, H_N, Y_N3); // optim to avoid the 0 init\n+ Y_N1 = (Q*)trans.get_data_ptr();\n+\n+ modulator.demodulate_with_gains(Y_N1, H_N, Y_N3.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N3.data());\n@@ -330,12 +330,18 @@ private:\nvoid b_transport3(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(Q)) == Y_N2.size());\n+ if (H_N == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Modulator: TLM \\\"H_N\\\" pointer can't be NULL.\");\n+\n+ if (Y_N1 == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Modulator: TLM \\\"Y_N1\\\" pointer can't be NULL.\");\n- const Q* buffer_in = (Q*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N2.size(), Y_N2.begin());\n+ if (modulator.N * modulator.n_frames != (int)(trans.get_data_length() / sizeof(Q)))\n+ throw std::length_error(\"aff3ct::module::Modulator: TLM input data size is invalid.\");\n- modulator.demodulate_with_gains(Y_N1, H_N, Y_N2, Y_N3);\n+ const auto Y_N2 = (Q*)trans.get_data_ptr();\n+\n+ modulator.demodulate_with_gains(Y_N1, H_N, Y_N2, Y_N3.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N3.data());\n@@ -365,19 +371,20 @@ public:\nSC_Modulator_module_tdemodulator_wg<B,R,Q> *module_tdemod_wg;\npublic:\n- SC_Modulator(const int N, const int N_mod, const int N_fil, const int n_frames = 1,\n+ SC_Modulator(const int N, const int N_mod, const int N_fil, const R sigma, const int n_frames = 1,\nconst std::string name = \"SC_Modulator\")\n- : Modulator_i<B,R,Q>(N, N_mod, N_fil, n_frames, name),\n+ : Modulator_i<B,R,Q>(N, N_mod, N_fil, sigma, n_frames, name),\nmodule_mod(nullptr), module_filt(nullptr), module_demod(nullptr), module_demod_wg(nullptr),\nmodule_tdemod(nullptr), module_tdemod_wg(nullptr) {}\n- SC_Modulator(const int N, const int N_mod, const int n_frames = 1, const std::string name = \"SC_Modulator\")\n- : Modulator_i<B,R,Q>(N, N_mod, n_frames, name),\n+ SC_Modulator(const int N, const int N_mod, const R sigma, const int n_frames = 1,\n+ const std::string name = \"SC_Modulator\")\n+ : Modulator_i<B,R,Q>(N, N_mod, sigma, n_frames, name),\nmodule_mod(nullptr), module_filt(nullptr), module_demod(nullptr), module_demod_wg(nullptr),\nmodule_tdemod(nullptr), module_tdemod_wg(nullptr) {}\n- SC_Modulator(const int N, const int n_frames = 1, const std::string name = \"SC_Modulator\")\n- : Modulator_i<B,R,Q>(N, n_frames, name),\n+ SC_Modulator(const int N, const R sigma, const int n_frames = 1, const std::string name = \"SC_Modulator\")\n+ : Modulator_i<B,R,Q>(N, sigma, n_frames, name),\nmodule_mod(nullptr), module_filt(nullptr), module_demod(nullptr), module_demod_wg(nullptr),\nmodule_tdemod(nullptr), module_tdemod_wg(nullptr) {}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SPU_Modulator.hpp",
"new_path": "src/Module/Modulator/SPU_Modulator.hpp",
"diff": "@@ -26,15 +26,16 @@ private:\nstatic starpu_codelet spu_cl_tdemodulate_wg;\npublic:\n- SPU_Modulator(const int N, const int N_mod, const int N_fil, const int n_frames = 1,\n+ SPU_Modulator(const int N, const int N_mod, const int N_fil, const R sigma, const int n_frames = 1,\nconst std::string name = \"SPU_Modulator\")\n- : Modulator_i<B,R,Q>(N, N_mod, N_fil, n_frames, name) {}\n+ : Modulator_i<B,R,Q>(N, N_mod, N_fil, sigma, n_frames, name) {}\n- SPU_Modulator(const int N, const int N_mod, const int n_frames = 1, const std::string name = \"SPU_Modulator\")\n- : Modulator_i<B,R,Q>(N, N_mod, n_frames, name) {}\n+ SPU_Modulator(const int N, const int N_mod, const R sigma, const int n_frames = 1,\n+ const std::string name = \"SPU_Modulator\")\n+ : Modulator_i<B,R,Q>(N, N_mod, sigma, n_frames, name) {}\n- SPU_Modulator(const int N, const int n_frames = 1, const std::string name = \"SPU_Modulator\")\n- : Modulator_i<B,R,Q>(N, n_frames, name) {}\n+ SPU_Modulator(const int N, const R sigma, const int n_frames = 1, const std::string name = \"SPU_Modulator\")\n+ : Modulator_i<B,R,Q>(N, sigma, n_frames, name) {}\nvirtual ~SPU_Modulator() {}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/SC_Monitor.hpp",
"new_path": "src/Module/Monitor/SC_Monitor.hpp",
"diff": "@@ -30,16 +30,14 @@ public:\nprivate:\nSC_Monitor<B,R> &monitor;\n- mipp::vector<B> V_K;\n- mipp::vector<B> U_K;\n+ B *U_K;\npublic:\nSC_Monitor_module(SC_Monitor<B,R> &monitor,\nconst sc_core::sc_module_name name = \"SC_Monitor_module\")\n: sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"),\nmonitor(monitor),\n- V_K(monitor.K * monitor.n_frames),\n- U_K(monitor.K * monitor.n_frames)\n+ U_K(nullptr)\n{\ns_in1.register_b_transport(this, &SC_Monitor_module::b_transport_source);\ns_in2.register_b_transport(this, &SC_Monitor_module::b_transport_decoder);\n@@ -48,18 +46,21 @@ public:\nprivate:\nvoid b_transport_source(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(B)) == U_K.size());\n+ if (monitor.K * monitor.n_frames != (int)(trans.get_data_length() / sizeof(B)))\n+ throw std::length_error(\"aff3ct::module::Monitor: TLM input data size is invalid.\");\n- const B* buffer_in = (B*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + U_K.size(), U_K.begin());\n+ U_K = (B*)trans.get_data_ptr();\n}\nvoid b_transport_decoder(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(B)) == V_K.size());\n+ if (U_K == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Monitor: TLM \\\"U_K\\\" pointer can't be NULL.\");\n- const B* buffer_in = (B*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + V_K.size(), V_K.begin());\n+ if (monitor.K * monitor.n_frames != (int)(trans.get_data_length() / sizeof(B)))\n+ throw std::length_error(\"aff3ct::module::Monitor: TLM input data size is invalid.\");\n+\n+ const auto V_K = (B*)trans.get_data_ptr();\nmonitor.check_errors(U_K, V_K);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"new_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"diff": "@@ -30,14 +30,13 @@ public:\nprivate:\nSC_Puncturer<B,Q> &puncturer;\n- mipp::vector<B> X_N1, X_N2;\n+ mipp::vector<B> X_N2;\npublic:\nSC_Puncturer_module_puncturer(SC_Puncturer<B,Q> &puncturer,\nconst sc_core::sc_module_name name = \"SC_Puncturer_module_puncturer\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\npuncturer(puncturer),\n- X_N1(puncturer.N_code * puncturer.n_frames),\nX_N2(puncturer.N * puncturer.n_frames)\n{\ns_in.register_b_transport(this, &SC_Puncturer_module_puncturer::b_transport);\n@@ -46,12 +45,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(B)) == X_N1.size());\n+ if (puncturer.N_code * puncturer.n_frames != (int)(trans.get_data_length() / sizeof(B)))\n+ throw std::length_error(\"aff3ct::module::Puncturer: TLM input data size is invalid.\");\n- const B* buffer_in = (B*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + X_N1.size(), X_N1.begin());\n+ const auto X_N1 = (B*)trans.get_data_ptr();\n- puncturer.puncture(X_N1, X_N2);\n+ puncturer.puncture(X_N1, X_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)X_N2.data());\n@@ -73,14 +72,13 @@ public:\nprivate:\nSC_Puncturer<B,Q> &puncturer;\n- mipp::vector<Q> Y_N1, Y_N2;\n+ mipp::vector<Q> Y_N2;\npublic:\nSC_Puncturer_module_depuncturer(SC_Puncturer<B,Q> &puncturer,\nconst sc_core::sc_module_name name = \"SC_Puncturer_module_depuncturer\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\npuncturer(puncturer),\n- Y_N1(puncturer.N * puncturer.n_frames),\nY_N2(puncturer.N_code * puncturer.n_frames)\n{\ns_in.register_b_transport(this, &SC_Puncturer_module_depuncturer::b_transport);\n@@ -89,12 +87,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(Q)) == (int)Y_N1.size());\n+ if (puncturer.N * puncturer.n_frames != (int)(trans.get_data_length() / sizeof(Q)))\n+ throw std::length_error(\"aff3ct::module::Puncturer: TLM input data size is invalid.\");\n- const Q* buffer_in = (Q*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ const auto Y_N1 = (Q*)trans.get_data_ptr();\n- puncturer.depuncture(Y_N1, Y_N2);\n+ puncturer.depuncture(Y_N1, Y_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N2.data());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"new_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"diff": "@@ -30,14 +30,12 @@ public:\nprivate:\nSC_Quantizer<R,Q> &quantizer;\n- mipp::vector<R> Y_N1;\nmipp::vector<Q> Y_N2;\npublic:\nSC_Quantizer_module(SC_Quantizer<R,Q> &quantizer, const sc_core::sc_module_name name = \"SC_Quantizer_module\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"),\nquantizer(quantizer),\n- Y_N1(quantizer.N * quantizer.n_frames),\nY_N2(quantizer.N * quantizer.n_frames)\n{\ns_in.register_b_transport(this, &SC_Quantizer_module::b_transport);\n@@ -46,12 +44,12 @@ public:\nprivate:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\n- assert((trans.get_data_length() / sizeof(R)) == Y_N1.size());\n+ if (quantizer.N * quantizer.n_frames != (int)(trans.get_data_length() / sizeof(R)))\n+ throw std::length_error(\"aff3ct::module::Quantizer: TLM input data size is invalid.\");\n- const R* buffer_in = (R*)trans.get_data_ptr();\n- std::copy(buffer_in, buffer_in + Y_N1.size(), Y_N1.begin());\n+ const auto Y_N1 = (R*)trans.get_data_ptr();\n- quantizer.process(Y_N1, Y_N2);\n+ quantizer.process(Y_N1, Y_N2.data());\ntlm::tlm_generic_payload payload;\npayload.set_data_ptr((unsigned char*)Y_N2.data());\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the TLM wrapper: 0-copy + exceptions management.
|
8,490 |
28.04.2017 17:49:13
| -7,200 |
36f1240f9c13fbfc5cb77222d34218278f6284a0
|
Replace cassert includes by stdexcept ones.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/SC_CRC.hpp",
"new_path": "src/Module/CRC/SC_CRC.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/SC_Channel.hpp",
"new_path": "src/Module/Channel/SC_Channel.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/SC_Coset.hpp",
"new_path": "src/Module/Coset/SC_Coset.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_Decoder.hpp",
"new_path": "src/Module/Decoder/SC_Decoder.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_SISO.hpp",
"new_path": "src/Module/Decoder/SC_SISO.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/SC_Encoder.hpp",
"new_path": "src/Module/Encoder/SC_Encoder.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"new_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SC_Modulator.hpp",
"new_path": "src/Module/Modulator/SC_Modulator.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/SC_Monitor.hpp",
"new_path": "src/Module/Monitor/SC_Monitor.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"new_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"new_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"diff": "#ifdef SYSTEMC\n#include <vector>\n#include <string>\n-#include <cassert>\n+#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/SC_Source.hpp",
"new_path": "src/Module/Source/SC_Source.hpp",
"diff": "#include <vector>\n#include <string>\n#include <systemc>\n-#include <cassert>\n#include <tlm>\n#include <tlm_utils/simple_initiator_socket.h>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace cassert includes by stdexcept ones.
|
8,490 |
28.04.2017 21:43:47
| -7,200 |
cd9d6a3287ab4b1c1c52d20ce15cff6cab441c75
|
Improve a little bit the SC_Debug class.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/SystemC/SC_Debug.hpp",
"new_path": "src/Tools/SystemC/SC_Debug.hpp",
"diff": "@@ -54,12 +54,8 @@ private:\nft.display_bit_vector(data_in);\nstd::cout << std::endl;\n- tlm::tlm_generic_payload payload;\n- payload.set_data_ptr((unsigned char*)data_in.data());\n- payload.set_data_length(data_in.size() * sizeof(T));\n-\nsc_core::sc_time zero_time(sc_core::SC_ZERO_TIME);\n- s_out->b_transport(payload, zero_time);\n+ s_out->b_transport(trans, zero_time);\n}\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve a little bit the SC_Debug class.
|
8,490 |
30.04.2017 12:53:21
| -7,200 |
7d6ef991b1fb8835c7adf518a7aaf47bdbed1d2d
|
Fix C++17 warning: remove the register keyword.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "@@ -41,7 +41,7 @@ void Decoder_BCH<B, R>\nauto d_load = std::chrono::steady_clock::now() - t_load;\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- register int i, j, u, q, t2, count = 0, syn_error = 0;\n+ int i, j, u, q, t2, count = 0, syn_error = 0;\nt2 = 2 * t;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix C++17 warning: remove the register keyword.
|
8,490 |
02.05.2017 10:46:26
| -7,200 |
ad6b3c2e6babcbbf28a66b3f6b34e53fa6d7aaaa
|
Remove useless "main.h" file + adapt "main.cpp" file.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Display/bash_tools.h>\n// #include <Tools/MSVC/dirent.h>\n#include <Tools/params.h>\n-// #include <main.h>\n-\n//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n#include <Tools/Threads/Barrier.hpp>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include <iostream>\n#include <exception>\n#include <map>\n+#include <string>\n#ifdef ENABLE_MPI\n#include <mpi.h>\n#endif\n+#ifdef SYSTEMC\n+#include <systemc>\n+#endif\n+\n#include \"Tools/types.h\"\n#include \"Tools/params.h\"\n#include \"Tools/Arguments_reader.hpp\"\n#include \"Launcher/BFER/BCH/Launcher_BFER_BCH.hpp\"\n#include \"Launcher/BFER/Uncoded/Launcher_BFER_uncoded.hpp\"\n-\n#include \"Launcher/BFERI/Polar/Launcher_BFERI_polar.hpp\"\n#include \"Launcher/BFERI/RSC/Launcher_BFERI_RSC.hpp\"\n#include \"Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.hpp\"\n#include \"Launcher/GEN/Polar/Launcher_GEN_polar.hpp\"\n-#include \"main.h\"\n-\nusing namespace aff3ct::launcher;\nusing namespace aff3ct::tools;\n@@ -328,8 +330,8 @@ int sc_main(int argc, char **argv)\nstart_simu<B_64,R_64,Q_64,QD_64>(argc, (const char**)argv, code_type, simu_type); break;\n#endif\ndefault:\n- std::cerr << bold_red(\"(EE) Unsupported number of bits.\") << std::endl;\n- exit(EXIT_FAILURE);\n+ std::cerr << bold_red(\"(EE) Unsupported bit precision.\") << std::endl;\n+ return EXIT_FAILURE;\nbreak;\n}\n#else\n"
},
{
"change_type": "DELETE",
"old_path": "src/main.h",
"new_path": null,
"diff": "-/*!\n- * \\file\n- * \\brief It all starts here!\n- *\n- * \\section LICENSE\n- * This file is under MIT license (https://opensource.org/licenses/MIT).\n- */\n-#ifndef MAIN_H_\n-#define MAIN_H_\n-\n-#include <string>\n-\n-#ifdef SYSTEMC\n-#include <systemc>\n-#endif\n-\n-/*!\n- * \\brief Print the version of the binary (code version, compiler version, operating system, type of SIMD, ...).\n- */\n-void print_version();\n-\n-/*!\n- * \\brief Read arguments from command line and fill code_type, simu_type and prec.\n- *\n- * \\param argc : number of arguments from the command line.\n- * \\param argv : array of arguments from the command line.\n- * \\param code_type: the type of the code (POLAR, TURBO, LDPC, etc.).\n- * \\param simu_type: the type of the simulation (BFER, BFERI, EXIT, GEN, etc.).\n- * \\param prec : the precision of the simulation to run (8, 16, 32 or 64 bits).\n- */\n-#ifdef MULTI_PREC\n-void read_arguments(const int argc, const char** argv, std::string &code_type, std::string &simu_type, int &prec);\n-#else\n-void read_arguments(const int argc, const char** argv, std::string &code_type, std::string &simu_type);\n-#endif\n-\n-/**\n- * \\brief Allocate an exit simulation.\n- *\n- * \\tparam B : type of the bits in the simulation.\n- * \\tparam R : type of the reals (floating-point representation) in the simulation.\n- * \\tparam Q : type of the quantified reals (fixed-point representation) in the simulation.\n- * \\tparam QD: type of the quantified reals (fixed-point representation) in the decoder (can be used or not depending\n- * on the code and the simulation type).\n- *\n- * \\param argc : number of arguments from the command line.\n- * \\param argv : array of arguments from the command line.\n- * \\param code_type: the type of the code (POLAR, TURBO, LDPC, etc.).\n- * \\param simu_type: the type of the simulation (BFER, BFERI, EXIT, GEN, etc.).\n- *\n- * \\return an Simulation_EXIT object.\n- */\n-template <typename B, typename R, typename Q, typename QD>\n-aff3ct::launcher::Launcher<B,R,Q>* create_exit_simu(const int argc, const char **argv,\n- std::string code_type, std::string simu_type);\n-\n-/*!\n- * \\brief Start the simulation by calling a Launcher (the Launcher depends on the code_type and the simu_type).\n- *\n- * \\tparam B : type of the bits in the simulation.\n- * \\tparam R : type of the reals (floating-point representation) in the simulation.\n- * \\tparam Q : type of the quantified reals (fixed-point representation) in the simulation.\n- * \\tparam QD: type of the quantified reals (fixed-point representation) in the decoder (can be used or not depending\n- * on the code and the simulation type).\n- *\n- * \\param argc : number of arguments from the command line.\n- * \\param argv : array of arguments from the command line.\n- * \\param code_type: the type of the code (POLAR, TURBO, LDPC, etc.).\n- * \\param simu_type: the type of the simulation (BFER, BFERI, EXIT, GEN, etc.).\n- */\n-template <typename B, typename R, typename Q, typename QD>\n-void start_simu(const int argc, const char **argv, std::string code_type, std::string simu_type);\n-\n-/**\n- * \\brief The first function called in the program!\n- *\n- * \\param argc: number of arguments from the command line.\n- * \\param argv: array of arguments from the command line.\n- *\n- * \\return EXIT_SUCCESS if no errors.\n- */\n-#ifndef SYSTEMC\n-int main(int argc, char **argv);\n-#else\n-int sc_main(int argc, char **argv);\n-#endif\n-\n-#endif /* MAIN_H_ */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove useless "main.h" file + adapt "main.cpp" file.
|
8,490 |
02.05.2017 11:26:15
| -7,200 |
97033550c094cab9d16e1ffd9044c9c319ee7c10
|
Remove useless "SC_HAS_PROCESS" macro calls.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/SC_CRC.hpp",
"new_path": "src/Module/CRC/SC_CRC.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_CRC;\ntemplate <typename B = int>\nclass SC_CRC_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_CRC_module);\n-\npublic:\ntlm_utils::simple_target_socket <SC_CRC_module> s_in;\ntlm_utils::simple_initiator_socket<SC_CRC_module> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/SC_Channel.hpp",
"new_path": "src/Module/Channel/SC_Channel.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Channel;\ntemplate <typename R = float>\nclass SC_Channel_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Channel_module);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Channel_module> s_in;\ntlm_utils::simple_initiator_socket<SC_Channel_module> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/SC_Coset.hpp",
"new_path": "src/Module/Coset/SC_Coset.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Coset;\ntemplate <typename B, typename D>\nclass SC_Coset_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Coset_module);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Coset_module> s_in1;\ntlm_utils::simple_target_socket <SC_Coset_module> s_in2;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_Decoder.hpp",
"new_path": "src/Module/Decoder/SC_Decoder.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Decoder;\ntemplate <typename B = int, typename R = float>\nclass SC_Decoder_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Decoder_module);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Decoder_module> s_in;\ntlm_utils::simple_initiator_socket<SC_Decoder_module> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_SISO.hpp",
"new_path": "src/Module/Decoder/SC_SISO.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_SISO;\ntemplate <typename R = float>\nclass SC_SISO_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_SISO_module);\n-\npublic:\ntlm_utils::simple_target_socket <SC_SISO_module> s_in;\ntlm_utils::simple_initiator_socket<SC_SISO_module> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/SC_Encoder.hpp",
"new_path": "src/Module/Encoder/SC_Encoder.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Encoder;\ntemplate <typename B = int>\nclass SC_Encoder_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Encoder_module);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Encoder_module> s_in;\ntlm_utils::simple_initiator_socket<SC_Encoder_module> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"new_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Interleaver;\ntemplate <typename T = int>\nclass SC_Interleaver_module_interleaver : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Interleaver_module_interleaver);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Interleaver_module_interleaver> s_in;\ntlm_utils::simple_initiator_socket<SC_Interleaver_module_interleaver> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SC_Modulator.hpp",
"new_path": "src/Module/Modulator/SC_Modulator.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Modulator;\ntemplate <typename B = int, typename R = float, typename Q = R>\nclass SC_Modulator_module_modulator : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Modulator_module_modulator);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Modulator_module_modulator> s_in;\ntlm_utils::simple_initiator_socket<SC_Modulator_module_modulator> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/SC_Monitor.hpp",
"new_path": "src/Module/Monitor/SC_Monitor.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Monitor;\ntemplate <typename B = int, typename R = float>\nclass SC_Monitor_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Monitor_module);\n-\npublic:\ntlm_utils::simple_target_socket<SC_Monitor_module> s_in1;\ntlm_utils::simple_target_socket<SC_Monitor_module> s_in2;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"new_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Puncturer;\ntemplate <typename B, typename Q>\nclass SC_Puncturer_module_puncturer : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Puncturer_module_puncturer);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Puncturer_module_puncturer> s_in;\ntlm_utils::simple_initiator_socket<SC_Puncturer_module_puncturer> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"new_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"diff": "@@ -22,8 +22,6 @@ class SC_Quantizer;\ntemplate <typename R, typename Q>\nclass SC_Quantizer_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Quantizer_module);\n-\npublic:\ntlm_utils::simple_target_socket <SC_Quantizer_module> s_in;\ntlm_utils::simple_initiator_socket<SC_Quantizer_module> s_out;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/SC_Source.hpp",
"new_path": "src/Module/Source/SC_Source.hpp",
"diff": "@@ -20,7 +20,7 @@ class SC_Source;\ntemplate <typename B = int>\nclass SC_Source_module : public sc_core::sc_module\n{\n- SC_HAS_PROCESS(SC_Source_module);\n+ SC_HAS_PROCESS(SC_Source_module); // required because of the \"SC_THREAD\" call in the constructor\npublic:\ntlm_utils::simple_initiator_socket<SC_Source_module> s_out;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove useless "SC_HAS_PROCESS" macro calls.
|
8,490 |
02.05.2017 14:17:50
| -7,200 |
58f98573ba454da132525bb0ecf6f46e83feb6fe
|
Compile the SystemC tools with the SystemC modules.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/SystemC/SC_Debug.hpp",
"new_path": "src/Tools/SystemC/SC_Debug.hpp",
"diff": "-#ifdef SYSTEMC\n+#if defined(SYSTEMC) || defined(SYSTEMC_MODULE)\n#ifndef SC_DEBUG_HPP_\n#define SC_DEBUG_HPP_\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/SystemC/SC_Dummy.hpp",
"new_path": "src/Tools/SystemC/SC_Dummy.hpp",
"diff": "-#ifdef SYSTEMC\n+#if defined(SYSTEMC) || defined(SYSTEMC_MODULE)\n#ifndef SC_DUMMY_HPP_\n#define SC_DUMMY_HPP_\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/SystemC/SC_Duplicator.hpp",
"new_path": "src/Tools/SystemC/SC_Duplicator.hpp",
"diff": "-#ifdef SYSTEMC\n+#if defined(SYSTEMC) || defined(SYSTEMC_MODULE)\n#ifndef SC_DUPLICATOR_HPP_\n#define SC_DUPLICATOR_HPP_\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/SystemC/SC_Predicate.hpp",
"new_path": "src/Tools/SystemC/SC_Predicate.hpp",
"diff": "-#ifdef SYSTEMC\n+#if defined(SYSTEMC) || defined(SYSTEMC_MODULE)\n#ifndef SC_PREDICATE_HPP_\n#define SC_PREDICATE_HPP_\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/SystemC/SC_Router.hpp",
"new_path": "src/Tools/SystemC/SC_Router.hpp",
"diff": "-#ifdef SYSTEMC\n+#if defined(SYSTEMC) || defined(SYSTEMC_MODULE)\n#ifndef SC_ROUTER_HPP_\n#define SC_ROUTER_HPP_\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Compile the SystemC tools with the SystemC modules.
|
8,490 |
02.05.2017 14:35:24
| -7,200 |
269e50a065033b280f8773369a7b1bd56867a8d8
|
Fix wrong includes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n#include <Module/Interleaver/Random/Interleaver_random.hpp>\n#include <Module/Interleaver/Golden/Interleaver_golden.hpp>\n-#include <Module/Interleaver/SPU_Interleaver.hpp>\n+// #include <Module/Interleaver/SPU_Interleaver.hpp>\n#include <Module/Interleaver/Row_column/Interleaver_row_column.hpp>\n-#include <Module/Interleaver/SC_Interleaver.hpp>\n+// #include <Module/Interleaver/SC_Interleaver.hpp>\n#include <Module/Interleaver/User/Interleaver_user.hpp>\n#include <Module/Interleaver/Random_column/Interleaver_random_column.hpp>\n#include <Module/Interleaver/Interleaver.hpp>\n#include <Module/Interleaver/NO/Interleaver_NO.hpp>\n#include <Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp>\n#include <Module/Interleaver/LTE/Interleaver_LTE.hpp>\n-#include <Module/Modulator/SC_Modulator.hpp>\n+// #include <Module/Modulator/SC_Modulator.hpp>\n#include <Module/Modulator/BPSK/Modulator_BPSK_fast.hpp>\n#include <Module/Modulator/BPSK/Modulator_BPSK.hpp>\n#include <Module/Modulator/PSK/Modulator_PSK.hpp>\n#include <Module/Modulator/User/Modulator_user.hpp>\n#include <Module/Modulator/QAM/Modulator_QAM.hpp>\n#include <Module/Modulator/PAM/Modulator_PAM.hpp>\n-#include <Module/Modulator/SPU_Modulator.hpp>\n+// #include <Module/Modulator/SPU_Modulator.hpp>\n#include <Module/Modulator/Modulator.hpp>\n#include <Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp>\n-#include <Module/Puncturer/SPU_Puncturer.hpp>\n+// #include <Module/Puncturer/SPU_Puncturer.hpp>\n#include <Module/Puncturer/Puncturer.hpp>\n#include <Module/Puncturer/NO/Puncturer_NO.hpp>\n-#include <Module/Puncturer/SC_Puncturer.hpp>\n+// #include <Module/Puncturer/SC_Puncturer.hpp>\n#include <Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n#include <Module/Encoder/Encoder_sys.hpp>\n#include <Module/Encoder/Polar/Encoder_polar.hpp>\n#include <Module/Encoder/RSC/Encoder_RSC_sys.hpp>\n#include <Module/Encoder/RSC/Encoder_RSC_generic_sys.hpp>\n#include <Module/Encoder/RSC/Encoder_RSC3_CPE_sys.hpp>\n-#include <Module/Encoder/SC_Encoder.hpp>\n-#include <Module/Encoder/SPU_Encoder.hpp>\n+// #include <Module/Encoder/SC_Encoder.hpp>\n+// #include <Module/Encoder/SPU_Encoder.hpp>\n#include <Module/Encoder/Repetition/Encoder_repetition_sys.hpp>\n#include <Module/Encoder/LDPC/Encoder_LDPC.hpp>\n#include <Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp>\n#include <Module/Channel/Additive/AWGN/GSL/Channel_AWGN_GSL_LLR.hpp>\n#include <Module/Channel/Additive/AWGN/GSL/Channel_AWGN_GSL_LR.hpp>\n#include <Module/Channel/Additive/User/Channel_additive_user.hpp>\n-#include <Module/Channel/SPU_Channel.hpp>\n+// #include <Module/Channel/SPU_Channel.hpp>\n#include <Module/Channel/User/Channel_user.hpp>\n#include <Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp>\n-#include <Module/Channel/SC_Channel.hpp>\n+// #include <Module/Channel/SC_Channel.hpp>\n#include <Module/Channel/NO/Channel_NO.hpp>\n#include <Module/Decoder/Decoder.hpp>\n#include <Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp>\n// #include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N256_K64_SNR30.hpp>\n// #include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N2048_K1755_SNR35.hpp>\n#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp>\n-#include <Module/Decoder/SPU_Decoder.hpp>\n+// #include <Module/Decoder/SPU_Decoder.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std_json.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_AVX.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_SSE.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hpp>\n-#include <Module/Decoder/SPU_SISO.hpp>\n+// #include <Module/Decoder/SPU_SISO.hpp>\n#include <Module/Decoder/SISO.hpp>\n#include <Module/Decoder/Repetition/Decoder_repetition_fast.hpp>\n#include <Module/Decoder/Repetition/Decoder_repetition_std.hpp>\n#include <Module/Decoder/Repetition/Decoder_repetition.hpp>\n-#include <Module/Decoder/SC_SISO.hpp>\n+// #include <Module/Decoder/SC_SISO.hpp>\n#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp>\n#include <Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp>\n#include <Module/Decoder/Decoder_SISO.hpp>\n#include <Module/Decoder/NO/Decoder_NO.hpp>\n#include <Module/Decoder/RA/Decoder_RA.hpp>\n-#include <Module/Decoder/SC_Decoder.hpp>\n+// #include <Module/Decoder/SC_Decoder.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo_naive.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo_fast.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo.hpp>\n#include <Module/Decoder/Turbo/CRC/Self_corrected/Decoder_turbo_naive_CA_self_corrected.hpp>\n#include <Module/Decoder/Turbo/CRC/Decoder_turbo_fast_CA.hpp>\n#include <Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.hpp>\n-#include <Module/Coset/SPU_Coset.hpp>\n+// #include <Module/Coset/SPU_Coset.hpp>\n#include <Module/Coset/Real/Coset_real.hpp>\n#include <Module/Coset/Coset.hpp>\n-#include <Module/Coset/SC_Coset.hpp>\n+// #include <Module/Coset/SC_Coset.hpp>\n#include <Module/Coset/Bit/Coset_bit.hpp>\n-#include <Module/Source/SC_Source.hpp>\n+// #include <Module/Source/SC_Source.hpp>\n#include <Module/Source/Random/Source_random_fast.hpp>\n#include <Module/Source/Random/Source_random.hpp>\n#include <Module/Source/AZCW/Source_AZCW.hpp>\n-#include <Module/Source/SPU_Source.hpp>\n+// #include <Module/Source/SPU_Source.hpp>\n#include <Module/Source/Source.hpp>\n#include <Module/Source/User/Source_user.hpp>\n#include <Module/Monitor/Standard/Monitor_reduction_mpi.hpp>\n#include <Module/Monitor/Standard/Monitor_std.hpp>\n#include <Module/Monitor/Standard/Monitor_reduction.hpp>\n#include <Module/Monitor/Monitor.hpp>\n-#include <Module/Monitor/SC_Monitor.hpp>\n-#include <Module/Monitor/SPU_Monitor.hpp>\n+// #include <Module/Monitor/SC_Monitor.hpp>\n+// #include <Module/Monitor/SPU_Monitor.hpp>\n#include <Module/Quantizer/Fast/Quantizer_fast.hpp>\n#include <Module/Quantizer/Standard/Quantizer_standard.hpp>\n#include <Module/Quantizer/Quantizer.hpp>\n-#include <Module/Quantizer/SC_Quantizer.hpp>\n+// #include <Module/Quantizer/SC_Quantizer.hpp>\n#include <Module/Quantizer/Tricky/Quantizer_tricky.hpp>\n-#include <Module/Quantizer/SPU_Quantizer.hpp>\n+// #include <Module/Quantizer/SPU_Quantizer.hpp>\n#include <Module/Quantizer/NO/Quantizer_NO.hpp>\n-#include <Module/CRC/SPU_CRC.hpp>\n-#include <Module/CRC/SC_CRC.hpp>\n+// #include <Module/CRC/SPU_CRC.hpp>\n+// #include <Module/CRC/SC_CRC.hpp>\n#include <Module/CRC/Polynomial/CRC_polynomial.hpp>\n#include <Module/CRC/Polynomial/CRC_polynomial_double.hpp>\n#include <Module/CRC/Polynomial/CRC_polynomial_fast.hpp>\n#include <Simulation/GEN/Code/Polar/Generation_polar.hpp>\n#include <Simulation/BFER/Standard/STD_Simulation_BFER.hpp>\n#include <Simulation/BFER/Simulation_BFER.hpp>\n-#include <Simulation/BFER/StarPU/SPU_Simulation_BFER.hpp>\n-#include <Simulation/BFER/SystemC/SC_Simulation_BFER.hpp>\n+// #include <Simulation/BFER/StarPU/SPU_Simulation_BFER.hpp>\n+// #include <Simulation/BFER/SystemC/SC_Simulation_BFER.hpp>\n#include <Simulation/BFER/Code/Polar/Simulation_BFER_polar.hpp>\n#include <Simulation/BFER/Code/RSC/Simulation_BFER_RSC.hpp>\n#include <Simulation/BFER/Code/Repetition/Simulation_BFER_repetition.hpp>\n#include <Simulation/BFER/Code/RA/Simulation_BFER_RA.hpp>\n#include <Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.hpp>\n#include <Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp>\n-#include <Simulation/BFERI/SystemC/SC_Simulation_BFERI.hpp>\n+// #include <Simulation/BFERI/SystemC/SC_Simulation_BFERI.hpp>\n#include <Simulation/BFERI/Simulation_BFERI.hpp>\n#include <Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.hpp>\n#include <Simulation/BFERI/Code/RSC/Simulation_BFERI_RSC.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix wrong includes.
|
8,490 |
02.05.2017 15:47:18
| -7,200 |
8a96e29c22a86ba226d80cb6dd0cf3951d5a2159
|
Remove the register keyword.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/Galois.cpp",
"new_path": "src/Tools/Math/Galois.cpp",
"diff": "@@ -57,7 +57,7 @@ void Galois\nvoid Galois\n::Generate_GF()\n{\n- register int i, mask;\n+ int i, mask;\nmask = 1;\nalpha_to[m] = 0;\n@@ -86,8 +86,8 @@ void Galois\nvoid Galois\n::Compute_BCH_Generator_Polynomial()\n{\n- register int ii, jj, ll, kaux;\n- register int test, aux, nocycles, root, noterms, rdncy;\n+ int ii, jj, ll, kaux;\n+ int test, aux, nocycles, root, noterms, rdncy;\nint cycle[1024][21], size[1024], min[1024], zeros[1024];\n/* Generate cycle sets modulo n, n = 2**m - 1 */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove the register keyword.
|
8,483 |
03.05.2017 11:25:03
| -7,200 |
c93cf547d38bf11dca7b57aec83dcb64f48891b8
|
Change the frame tracing to allow a dynamic control of the precision of the displayed real numbers when debugging.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"new_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"diff": "@@ -16,6 +16,7 @@ Launcher_BFER<B,R,Q>\nthis->params.simulation .benchs = 0;\nthis->params.simulation .debug = false;\nthis->params.simulation .debug_limit = 0;\n+ this->params.simulation .debug_precision = 5;\nthis->params.simulation .time_report = false;\nthis->params.simulation .trace_path = \"\";\n#if !defined(STARPU) && !defined(SYSTEMC)\n@@ -47,6 +48,9 @@ void Launcher_BFER<B,R,Q>\nthis->opt_args[{\"sim-debug\", \"d\"}] =\n{\"\",\n\"enable debug mode: print array values after each step.\"};\n+ this->opt_args[{\"sim-debug-prec\"}] =\n+ {\"positive_int\",\n+ \"set the precision of real elements when displayed in debug mode.\"};\nthis->opt_args[{\"sim-debug-limit\"}] =\n{\"positive_int\",\n\"set the max number of elements to display in the debug mode.\"};\n@@ -116,6 +120,11 @@ void Launcher_BFER<B,R,Q>\nthis->params.simulation.debug = true;\nthis->params.simulation.debug_limit = this->ar.get_arg_int({\"sim-debug-limit\"});\n}\n+ if(this->ar.exist_arg({\"sim-debug-prec\"}))\n+ {\n+ this->params.simulation.debug = true;\n+ this->params.simulation.debug_precision = this->ar.get_arg_int({\"sim-debug-prec\"});\n+ }\nif (this->params.simulation.debug &&\n!(this->ar.exist_arg({\"sim-threads\", \"t\"}) && this->ar.get_arg_int({\"sim-threads\", \"t\"}) > 0))\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -16,6 +16,7 @@ Launcher_BFERI<B,R,Q>\nthis->params.simulation .benchs = 0;\nthis->params.simulation .debug = false;\nthis->params.simulation .debug_limit = 0;\n+ this->params.simulation .debug_precision = 5;\nthis->params.simulation .time_report = false;\nthis->params.simulation .trace_path = \"\";\n#if !defined(STARPU) && !defined(SYSTEMC)\n@@ -51,6 +52,9 @@ void Launcher_BFERI<B,R,Q>\nthis->opt_args[{\"sim-debug\", \"d\"}] =\n{\"\",\n\"enable debug mode: print array values after each step.\"};\n+ this->opt_args[{\"sim-debug-prec\"}] =\n+ {\"positive_int\",\n+ \"set the precision of real elements when displayed in debug mode.\"};\nthis->opt_args[{\"sim-debug-limit\"}] =\n{\"positive_int\",\n\"set the max number of elements to display in the debug mode.\"};\n@@ -143,6 +147,11 @@ void Launcher_BFERI<B,R,Q>\nthis->params.simulation.debug = true;\nthis->params.simulation.debug_limit = this->ar.get_arg_int({\"sim-debug-limit\"});\n}\n+ if(this->ar.exist_arg({\"sim-debug-prec\"}))\n+ {\n+ this->params.simulation.debug = true;\n+ this->params.simulation.debug_precision = this->ar.get_arg_int({\"sim-debug-prec\"});\n+ }\nif (this->params.simulation.debug &&\n!(this->ar.exist_arg({\"sim-threads\", \"t\"}) && this->ar.get_arg_int({\"sim-threads\", \"t\"}) > 0))\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "#include \"Tools/Algo/Bit_packer.hpp\"\n#include \"Tools/Perf/Reorderer/Reorderer.hpp\"\n#include \"Tools/Perf/Transpose/transpose_selector.h\"\n-#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Decoder_polar_SC_fast_sys.hpp\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -494,7 +494,7 @@ void Simulation_BFER<B,R,Q>\n{\nusing namespace std::chrono;\n- Frame_trace<B> ft(simu->params.simulation.debug_limit); // frame trace to display the vectors\n+ Frame_trace<B> ft(simu->params.simulation.debug_limit, simu->params.simulation.debug_precision); // frame trace to display the vectors\n// simulation loop\nauto t_simu = steady_clock::now();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -470,7 +470,7 @@ void Simulation_BFERI<B,R,Q>\n{\nusing namespace std::chrono;\n- Frame_trace<B> ft(simu->params.simulation.debug_limit); // frame trace to display the vectors\n+ Frame_trace<B> ft(simu->params.simulation.debug_limit, simu->params.simulation.debug_precision); // frame trace to display the vectors\n// simulation loop\nauto t_simu = steady_clock::now();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Frame_trace/Frame_trace.hpp",
"new_path": "src/Tools/Display/Frame_trace/Frame_trace.hpp",
"diff": "@@ -29,6 +29,7 @@ private:\nstd::ostream &stream; /*!< Stream to trace the frame(s). */\nconst int n_bits; /*!< Number of bits to display per frame (if n_bits = 0, display all the bits of the frame). */\n+ const int prec; /*!< Number of characters used to display the number if real vectors */\npublic:\n/*!\n@@ -37,8 +38,8 @@ public:\n* \\param n_bits: number of bits to display per frame (if n_bits = 0, display all the bits of the frame).\n* \\param stream: stream to trace the frame(s).\n*/\n- Frame_trace(const int n_bits = 0, std::ostream &stream = std::cout)\n- : stream(stream), n_bits(n_bits)\n+ Frame_trace(const int n_bits = 0, const int prec = 5, std::ostream &stream = std::cout)\n+ : stream(stream), n_bits(n_bits), prec(prec)\n{\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx",
"new_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx",
"diff": "@@ -54,7 +54,7 @@ void Frame_trace<B>\nif (row_width == vec.size())\n{\nfor (auto i = 0; i < n_bits; i++)\n- stream << std::setw(5) << i << \"|\";\n+ stream << std::setw(prec+2) << i << \"|\";\nif (n_bits < (int)vec.size())\nstream << \" ...\";\n@@ -81,16 +81,19 @@ template <typename B> template <typename D>\nvoid Frame_trace<B>\n::display_value(D value, debug_version version)\n{\n+ std::stringstream sstream;\n+ std::string value_string;\n+\nswitch(version)\n{\ncase BIT:\n- stream << std::setw(5) << ((value == 0) ? (int) 0 : (int) 1) << \"|\";\n+ stream << std::setw(prec+2) << ((value == 0) ? (int) 0 : (int) 1) << \"|\";\nbreak;\ncase REAL:\n- if (value >= 0)\n- stream << std::setprecision(2) << std::setw(5) << +value << \"|\";\n- else\n- stream << std::setprecision(1) << std::setw(5) << +value << \"|\";\n+ sstream << std::setprecision(prec) << std::setw(prec+2) << value;\n+ value_string = sstream.str().substr(0, prec+2);\n+\n+ stream << value_string << \"|\";\nbreak;\n}\n}\n@@ -105,25 +108,23 @@ void Frame_trace<B>\nswitch(version)\n{\ncase BIT:\n+ value_string.append(prec+1, ' ');\nif (value == 0)\nif (ref == 0)\n- stream << tools::bold_green (\" 0\") << \"|\";\n+ stream << tools::bold_green (value_string + \"0\") << \"|\";\nelse\n- stream << tools::bold_orange(\" 0\") << \"|\";\n+ stream << tools::bold_orange(value_string + \"0\") << \"|\";\nelse\nif (ref == 0)\n- stream << tools::bold_orange(\" 1\") << \"|\";\n+ stream << tools::bold_orange(value_string + \"1\") << \"|\";\nelse\n- stream << tools::bold_green (\" 1\") << \"|\";\n+ stream << tools::bold_green (value_string + \"1\") << \"|\";\nbreak;\ncase REAL:\n- if(value >= 0)\n- sstream << std::fixed << std::setprecision(2) << std::setw(5) << +value;\n- else\n- sstream << std::fixed << std::setprecision(1) << std::setw(5) << +value;\n+ sstream << std::setprecision(prec) << std::setw(prec+2) << value;\n- value_string = sstream.str();\n+ value_string = sstream.str().substr(0, prec+2);\nif (value >= 0)\nif (ref == 0)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -29,6 +29,7 @@ struct simulation_parameters\nbool time_report;\nint benchs;\nint debug_limit;\n+ int debug_precision;\nint n_threads;\nint inter_frame_level;\nint seed;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "@@ -296,7 +296,7 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\n}\ncatch (std::exception const& e)\n{\n- std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the launcher.\") << std::endl\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when running the launcher.\") << std::endl\n<< bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change the frame tracing to allow a dynamic control of the precision of the displayed real numbers when debugging.
|
8,490 |
03.05.2017 15:35:27
| -7,200 |
a9528ad5c9ca8989d9de59ee77a7d4d0996c337b
|
Fix cmake issue on MacOSX.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -6,6 +6,13 @@ project (aff3ct)\nset (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} \"${CMAKE_SOURCE_DIR}/cmake/Modules/\")\nset (CMAKE_MACOSX_RPATH 1)\n+# Enable C++11\n+if (\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"AppleClang\")\n+ set (CMAKE_CXX_STANDARD 14)\n+else ()\n+ set (CMAKE_CXX_STANDARD 11)\n+endif()\n+\n# Specify bin and lib paths\nset (EXECUTABLE_OUTPUT_PATH bin/)\nset (LIBRARY_OUTPUT_PATH lib/)\n@@ -164,13 +171,13 @@ endif (ENABLE_MPI)\n# Enable C++11 and pthread\nif (\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"AppleClang\")\n- add_definitions (-std=c++1y -Wno-overloaded-virtual)\n+ add_definitions (-Wno-overloaded-virtual)\naff3ct_link_libraries (-lpthread)\nelseif (\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"GNU\")\n- add_definitions (-std=c++11 -pthread)\n+ add_definitions (-pthread)\naff3ct_link_libraries (-lpthread)\nelseif (\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Intel\")\n- add_definitions (-std=c++11 -pthread)\n+ add_definitions (-pthread)\naff3ct_link_libraries (-pthread)\nendif()\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix cmake issue on MacOSX.
|
8,490 |
03.05.2017 16:30:40
| -7,200 |
76100bb93f51531a67a2cabb81656903654c7279
|
Add the possibility to compile AFF3CT exec or libs.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -38,6 +38,8 @@ assign_source_group(${source_files})\n# Command line options\noption (ENABLE_EXEC \"Enable to compile AFF3CT executable\" ON )\n+option (ENABLE_STATIC_LIB \"Enable to compile AFF3CT static library\" OFF)\n+option (ENABLE_SHARED_LIB \"Enable to compile AFF3CT shared library\" OFF)\noption (ENABLE_GSL \"Enable GSL support\" OFF)\noption (ENABLE_MKL \"Enable MKL support\" OFF)\noption (ENABLE_SYSTEMC \"Enable SystemC support\" OFF)\n@@ -70,17 +72,25 @@ if (ENABLE_EXEC)\nendif (ENABLE_EXEC)\n# Library\n+if (ENABLE_SHARED_LIB)\nadd_library (aff3ct-shared-lib SHARED $<TARGET_OBJECTS:aff3ct-obj>)\nset_target_properties (aff3ct-shared-lib PROPERTIES OUTPUT_NAME aff3ct)\n+endif (ENABLE_SHARED_LIB)\n+if (ENABLE_STATIC_LIB)\nadd_library (aff3ct-static-lib STATIC $<TARGET_OBJECTS:aff3ct-obj>)\nset_target_properties (aff3ct-static-lib PROPERTIES OUTPUT_NAME aff3ct)\n+endif (ENABLE_STATIC_LIB)\nmacro (aff3ct_link_libraries lib)\nif (ENABLE_EXEC)\ntarget_link_libraries (aff3ct-bin ${lib})\nendif (ENABLE_EXEC)\n+ if (ENABLE_SHARED_LIB)\ntarget_link_libraries (aff3ct-shared-lib ${lib})\n+ endif (ENABLE_SHARED_LIB)\n+ if (ENABLE_STATIC_LIB)\ntarget_link_libraries (aff3ct-static-lib ${lib})\n+ endif (ENABLE_STATIC_LIB)\nendmacro()\n# GSL\n@@ -154,22 +164,30 @@ if (ENABLE_MPI)\nif (ENABLE_EXEC)\nset_target_properties(aff3ct-bin PROPERTIES COMPILE_FLAGS \"${MPI_CXX_COMPILE_FLAGS}\")\nendif (ENABLE_EXEC)\n+ if (ENABLE_SHARED_LIB)\nset_target_properties(aff3ct-shared-lib PROPERTIES COMPILE_FLAGS \"${MPI_CXX_COMPILE_FLAGS}\")\n+ endif (ENABLE_SHARED_LIB)\n+ if (ENABLE_STATIC_LIB)\nset_target_properties(aff3ct-static-lib PROPERTIES COMPILE_FLAGS \"${MPI_CXX_COMPILE_FLAGS}\")\n+ endif (ENABLE_STATIC_LIB)\nendif (MPI_CXX_COMPILE_FLAGS)\nif (MPI_CXX_LINK_FLAGS)\nif (ENABLE_EXEC)\nset_target_properties(aff3ct-bin PROPERTIES LINK_FLAGS \"${MPI_CXX_LINK_FLAGS}\")\nendif (ENABLE_EXEC)\n+ if (ENABLE_SHARED_LIB)\nset_target_properties(aff3ct-shared-lib PROPERTIES LINK_FLAGS \"${MPI_CXX_LINK_FLAGS}\")\n+ endif (ENABLE_SHARED_LIB)\n+ if (ENABLE_STATIC_LIB)\nset_target_properties(aff3ct-static-lib PROPERTIES LINK_FLAGS \"${MPI_CXX_LINK_FLAGS}\")\n+ endif (ENABLE_STATIC_LIB)\nendif (MPI_CXX_LINK_FLAGS)\nendif (MPI_CXX_FOUND)\nendif (ENABLE_MPI)\n-# Enable C++11 and pthread\n+# Enable pthread\nif (\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"AppleClang\")\nadd_definitions (-Wno-overloaded-virtual)\naff3ct_link_libraries (-lpthread)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the possibility to compile AFF3CT exec or libs.
|
8,490 |
04.05.2017 17:15:22
| -7,200 |
260ff2acd1903b0acfe771b62597a421d10fd125
|
Fix bad template.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"diff": "@@ -61,6 +61,6 @@ template class aff3ct::module::Decoder_NO<B_16,Q_16>;\ntemplate class aff3ct::module::Decoder_NO<B_32,Q_32>;\ntemplate class aff3ct::module::Decoder_NO<B_64,Q_64>;\n#else\n-template class aff3ct::module::Decoder_NO<B,R>;\n+template class aff3ct::module::Decoder_NO<B,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad template.
|
8,490 |
07.05.2017 09:04:31
| -7,200 |
cb2485d0ba1c563aa945bd231720af58461862d1
|
Fix bad N val for turbo codes and puncturer no.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Turbo/Factory_puncturer_turbo.cpp",
"new_path": "src/Tools/Factory/Turbo/Factory_puncturer_turbo.cpp",
"diff": "@@ -19,7 +19,9 @@ Puncturer<B,Q>* Factory_puncturer_turbo<B,Q>\nparams.encoder.buffered,\nparams.simulation.inter_frame_level);\nelse\n- puncturer = new Puncturer_NO<B,Q>(params.code.K, params.code.N, params.simulation.inter_frame_level);\n+ puncturer = new Puncturer_NO<B,Q>(params.code.K,\n+ params.code.N + params.code.tail_length,\n+ params.simulation.inter_frame_level);\nreturn puncturer;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad N val for turbo codes and puncturer no.
|
8,490 |
09.05.2017 09:09:21
| -7,200 |
2b4ff9242aa59cd935cbe78dd42359c215fc82c9
|
Do not start non-SIMD INTER frame decoder with the --dec-simd INTER option.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"diff": "@@ -22,7 +22,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nif (params.encoder.systematic)\n{\n- if (params.decoder.type == \"BP\" || params.decoder.type == \"BP_FLOODING\")\n+ if ((params.decoder.type == \"BP\" || params.decoder.type == \"BP_FLOODING\") && params.decoder.simd_strategy.empty())\n{\nif (params.decoder.implem == \"ONMS\")\ndecoder = new Decoder_LDPC_BP_flooding_offset_normalize_min_sum<B,R>(params.code.K,\n@@ -90,7 +90,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.decoder.syndrome_depth,\nparams.simulation.inter_frame_level);\n}\n- else if (params.decoder.implem == \"SPA\")\n+ else if (params.decoder.implem == \"SPA\" && params.decoder.simd_strategy.empty())\ndecoder = new Decoder_LDPC_BP_layered_sum_product<B,R>(params.code.K,\nparams.code.N,\nparams.decoder.n_ite,\n@@ -99,7 +99,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.decoder.enable_syndrome,\nparams.decoder.syndrome_depth,\nparams.simulation.inter_frame_level);\n- else if (params.decoder.implem == \"LSPA\")\n+ else if (params.decoder.implem == \"LSPA\" && params.decoder.simd_strategy.empty())\ndecoder = new Decoder_LDPC_BP_layered_log_sum_product<B,R>(params.code.K,\nparams.code.N,\nparams.decoder.n_ite,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Do not start non-SIMD INTER frame decoder with the --dec-simd INTER option.
|
8,490 |
10.05.2017 14:07:58
| -7,200 |
362b8ce3afbf3c7884730208a376cb6ccf9944fb
|
Do not allocate SIMD buffer when it is not needed.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder.hpp",
"new_path": "src/Module/Decoder/Decoder.hpp",
"diff": "@@ -65,8 +65,8 @@ public:\nstd::string name = \"Decoder_i\")\n: Module(n_frames, name),\nn_inter_frame_rest(this->n_frames % simd_inter_frame_level),\n- Y_N(simd_inter_frame_level * N),\n- V_K(simd_inter_frame_level * K),\n+ Y_N(n_inter_frame_rest ? simd_inter_frame_level * N : 0),\n+ V_K(n_inter_frame_rest ? simd_inter_frame_level * K : 0),\nK(K),\nN(N),\nsimd_inter_frame_level(simd_inter_frame_level),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SISO.hpp",
"new_path": "src/Module/Decoder/SISO.hpp",
"diff": "@@ -58,8 +58,8 @@ public:\nstd::string name = \"SISO_i\")\n: Module(n_frames, name),\nn_inter_frame_rest_siso(this->n_frames % simd_inter_frame_level),\n- Y_N1(simd_inter_frame_level * N),\n- Y_N2(simd_inter_frame_level * N),\n+ Y_N1(n_inter_frame_rest_siso ? simd_inter_frame_level * N : 0),\n+ Y_N2(n_inter_frame_rest_siso ? simd_inter_frame_level * N : 0),\nK_siso(K),\nN_siso(N),\nsimd_inter_frame_level_siso(simd_inter_frame_level),\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Do not allocate SIMD buffer when it is not needed.
|
8,490 |
11.05.2017 17:07:15
| -7,200 |
3f8b48454047a1f54d607c6b9032d9ed8b4c1339
|
Add a new K_info param + put N_code where needed.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -346,6 +346,7 @@ void Launcher<B,R,Q>\n// ---------------------------------------------------------------------------------------------------------- code\nparams.code.type = ar.get_arg ({\"cde-type\" }); // required\n+ params.code.K_info = ar.get_arg_int({\"cde-info-bits\", \"K\"}); // required\nparams.code.K = ar.get_arg_int({\"cde-info-bits\", \"K\"}); // required\nparams.code.N = ar.get_arg_int({\"cde-size\", \"N\"}); // required\nparams.code.N_code = ar.get_arg_int({\"cde-size\", \"N\"});\n@@ -436,6 +437,7 @@ int Launcher<B,R,Q>\n{\nthis->store_args();\n+ params.code.K_info -= params.crc.size;\nparams.code.N_mod = Factory_modulator<B,R,Q>::get_buffer_size_after_modulation(params, params.code.N);\nparams.code.N_fil = Factory_modulator<B,R,Q>::get_buffer_size_after_filtering (params, params.code.N);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -29,7 +29,7 @@ Simulation_BFER<B,R,Q>\nthreads(this->params.simulation.n_threads -1),\n- U_K1(this->params.simulation.n_threads, mipp::vector<B>((params.code.K - params.crc.size) * params.simulation.inter_frame_level)),\n+ U_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nU_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\nX_N1(this->params.simulation.n_threads, mipp::vector<B>(params.code.N_code * params.simulation.inter_frame_level)),\nX_N2(this->params.simulation.n_threads, mipp::vector<B>(params.code.N * params.simulation.inter_frame_level)),\n@@ -41,7 +41,7 @@ Simulation_BFER<B,R,Q>\nY_N4(this->params.simulation.n_threads, mipp::vector<Q>(params.code.N * params.simulation.inter_frame_level)),\nY_N5(this->params.simulation.n_threads, mipp::vector<Q>(params.code.N_code * params.simulation.inter_frame_level)),\nV_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\n- V_K2(this->params.simulation.n_threads, mipp::vector<B>((params.code.K - params.crc.size) * params.simulation.inter_frame_level)),\n+ V_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nmonitor_red(nullptr),\nterminal (nullptr),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"diff": "@@ -27,7 +27,7 @@ Simulation_BFER<B,R,Q>\ntask_names(this->params.simulation.n_threads, std::vector<std::string>(15)),\nframe_id(0),\n- U_K1(this->params.simulation.n_threads, mipp::vector<B>((params.code.K - params.crc.size) * params.simulation.inter_frame_level)),\n+ U_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nU_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\nX_N1(this->params.simulation.n_threads, mipp::vector<B>(params.code.N_code * params.simulation.inter_frame_level)),\nX_N2(this->params.simulation.n_threads, mipp::vector<B>(params.code.N * params.simulation.inter_frame_level)),\n@@ -39,7 +39,7 @@ Simulation_BFER<B,R,Q>\nY_N4(this->params.simulation.n_threads, mipp::vector<Q>(params.code.N * params.simulation.inter_frame_level)),\nY_N5(this->params.simulation.n_threads, mipp::vector<Q>(params.code.N_code * params.simulation.inter_frame_level)),\nV_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\n- V_K2(this->params.simulation.n_threads, mipp::vector<B>((params.code.K - params.crc.size) * params.simulation.inter_frame_level)),\n+ V_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nspu_U_K1(this->params.simulation.n_threads),\nspu_U_K2(this->params.simulation.n_threads),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -27,7 +27,7 @@ Simulation_BFERI<B,R,Q>\nthreads(params.simulation.n_threads -1),\n- U_K1(params.simulation.n_threads, mipp::vector<B>((params.code.K - params.crc.size) * params.simulation.inter_frame_level)),\n+ U_K1(params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nU_K2(params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\nX_N1(params.simulation.n_threads, mipp::vector<B>(params.code.N * params.simulation.inter_frame_level)),\nX_N2(params.simulation.n_threads, mipp::vector<B>(params.code.N * params.simulation.inter_frame_level)),\n@@ -41,7 +41,7 @@ Simulation_BFERI<B,R,Q>\nY_N6(params.simulation.n_threads, mipp::vector<Q>(params.code.N * params.simulation.inter_frame_level)),\nY_N7(params.simulation.n_threads, mipp::vector<Q>(params.code.N * params.simulation.inter_frame_level)),\nV_K1(params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\n- V_K2(params.simulation.n_threads, mipp::vector<B>((params.code.K - params.crc.size) * params.simulation.inter_frame_level)),\n+ V_K2(params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nmonitor_red(nullptr),\nterminal (nullptr),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.cpp",
"new_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.cpp",
"diff": "@@ -16,7 +16,7 @@ Decoder<B,R>* Factory_decoder_BCH<B,R>\nif (params.decoder.type == \"ALGEBRAIC\")\nif (params.decoder.implem == \"STD\")\ndecoder = new Decoder_BCH<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.code.m,\nparams.code.t,\nGF,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/BCH/Factory_encoder_BCH.cpp",
"new_path": "src/Tools/Factory/BCH/Factory_encoder_BCH.cpp",
"diff": "@@ -13,7 +13,7 @@ Encoder<B>* Factory_encoder_BCH<B>\n// build the encoder\nif (params.encoder.systematic)\n- encoder = new Encoder_BCH<B>(params.code.K, params.code.N, params.code.m, GF, params.simulation.inter_frame_level);\n+ encoder = new Encoder_BCH<B>(params.code.K, params.code.N_code, params.code.m, GF, params.simulation.inter_frame_level);\nreturn encoder;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_CRC.cpp",
"new_path": "src/Tools/Factory/Factory_CRC.cpp",
"diff": "@@ -20,16 +20,16 @@ CRC<B>* Factory_CRC<B>\n// build the crc\nif (!params.crc.poly.empty() && params.decoder.simd_strategy == \"INTER\")\n- crc = new CRC_polynomial_inter<B>(params.code.K - params.crc.size, params.crc.poly, params.crc.size, params.simulation.inter_frame_level);\n+ crc = new CRC_polynomial_inter<B>(params.code.K_info, params.crc.poly, params.crc.size, params.simulation.inter_frame_level);\nelse if (!params.crc.poly.empty())\n{\nif (params.crc.type == \"FAST\")\n- crc = new CRC_polynomial_fast<B>(params.code.K - params.crc.size, params.crc.poly, params.crc.size, params.simulation.inter_frame_level);\n+ crc = new CRC_polynomial_fast<B>(params.code.K_info, params.crc.poly, params.crc.size, params.simulation.inter_frame_level);\nelse\n- crc = new CRC_polynomial<B>(params.code.K - params.crc.size, params.crc.poly, params.crc.size, params.simulation.inter_frame_level);\n+ crc = new CRC_polynomial<B>(params.code.K_info, params.crc.poly, params.crc.size, params.simulation.inter_frame_level);\n}\nelse\n- crc = new CRC_NO<B>(params.code.K - params.crc.size, params.simulation.inter_frame_level);\n+ crc = new CRC_NO<B>(params.code.K_info, params.simulation.inter_frame_level);\nreturn crc;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_source.cpp",
"new_path": "src/Tools/Factory/Factory_source.cpp",
"diff": "@@ -16,13 +16,13 @@ Source<B>* Factory_source<B>\n// build the generator\nif (params.source.type == \"RAND_FAST\")\n- source = new Source_random_fast<B>(params.code.K - params.crc.size, seed, params.simulation.inter_frame_level);\n+ source = new Source_random_fast<B>(params.code.K_info, seed, params.simulation.inter_frame_level);\nelse if (params.source.type == \"RAND\")\n- source = new Source_random<B>(params.code.K - params.crc.size, seed, params.simulation.inter_frame_level);\n+ source = new Source_random<B>(params.code.K_info, seed, params.simulation.inter_frame_level);\nelse if (params.source.type == \"AZCW\")\n- source = new Source_AZCW<B>(params.code.K - params.crc.size, params.simulation.inter_frame_level);\n+ source = new Source_AZCW<B>(params.code.K_info, params.simulation.inter_frame_level);\nelse if (params.source.type == \"USER\")\n- source = new Source_user<B>(params.code.K - params.crc.size, params.source.path, params.simulation.inter_frame_level);\n+ source = new Source_user<B>(params.code.K_info, params.source.path, params.simulation.inter_frame_level);\nreturn source;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"diff": "@@ -26,7 +26,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\n{\nif (params.decoder.implem == \"ONMS\")\ndecoder = new Decoder_LDPC_BP_flooding_offset_normalize_min_sum<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n@@ -37,7 +37,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"GALA\")\ndecoder = new Decoder_LDPC_BP_flooding_Gallager_A<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n@@ -46,7 +46,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"SPA\")\ndecoder = new Decoder_LDPC_BP_flooding_sum_product<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n@@ -55,7 +55,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"LSPA\")\ndecoder = new Decoder_LDPC_BP_flooding_log_sum_product<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n@@ -69,7 +69,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\n{\nif (params.decoder.simd_strategy.empty())\ndecoder = new Decoder_LDPC_BP_layered_offset_normalize_min_sum<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n@@ -80,7 +80,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.simulation.inter_frame_level);\nelse if (params.decoder.simd_strategy == \"INTER\")\ndecoder = new Decoder_LDPC_BP_layered_ONMS_inter<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n@@ -92,7 +92,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\n}\nelse if (params.decoder.implem == \"SPA\" && params.decoder.simd_strategy.empty())\ndecoder = new Decoder_LDPC_BP_layered_sum_product<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n@@ -101,7 +101,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"LSPA\" && params.decoder.simd_strategy.empty())\ndecoder = new Decoder_LDPC_BP_layered_log_sum_product<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.decoder.n_ite,\nalist_data,\ninfo_bits_pos,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"diff": "@@ -17,11 +17,11 @@ Encoder_LDPC<B>* Factory_encoder_LDPC<B>\nif (params.encoder.systematic)\n{\nif (params.encoder.type == \"LDPC\")\n- encoder = new Encoder_LDPC<B>(params.code.K, params.code.N, AList_reader(params.encoder.path), params.simulation.inter_frame_level);\n+ encoder = new Encoder_LDPC<B>(params.code.K, params.code.N_code, AList_reader(params.encoder.path), params.simulation.inter_frame_level);\nelse if (params.encoder.type == \"LDPC_H\")\n- encoder = new Encoder_LDPC_from_H<B>(params.code.K, params.code.N, AList_reader(params.code.alist_path), params.simulation.inter_frame_level);\n+ encoder = new Encoder_LDPC_from_H<B>(params.code.K, params.code.N_code, AList_reader(params.code.alist_path), params.simulation.inter_frame_level);\nelse if (params.encoder.type == \"LDPC_DVBS2\")\n- encoder = new Encoder_LDPC_DVBS2<B>(params.code.K, params.code.N, params.simulation.inter_frame_level);\n+ encoder = new Encoder_LDPC_DVBS2<B>(params.code.K, params.code.N_code, params.simulation.inter_frame_level);\n}\nreturn encoder;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RSC/Factory_encoder_RSC.cpp",
"new_path": "src/Tools/Factory/RSC/Factory_encoder_RSC.cpp",
"diff": "@@ -12,7 +12,7 @@ Encoder_RSC_sys<B>* Factory_encoder_RSC<B>\n{\nEncoder_RSC_sys<B> *encoder = nullptr;\n- const auto N = (params.code.type.find(\"TURBO\") != std::string::npos) ? 2*params.code.K + params.code.tail_length/2 : params.code.N;\n+ const auto N = (params.code.type.find(\"TURBO\") != std::string::npos) ? 2*params.code.K + params.code.tail_length/2 : params.code.N_code;\n// build the encoder\nif (params.encoder.systematic)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Repetition/Factory_decoder_repetition.cpp",
"new_path": "src/Tools/Factory/Repetition/Factory_decoder_repetition.cpp",
"diff": "@@ -18,12 +18,12 @@ Decoder<B,R>* Factory_decoder_repetition<B,R>\n{\nif (params.decoder.implem == \"STD\")\ndecoder = new Decoder_repetition_std<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.encoder.buffered,\nparams.simulation.inter_frame_level);\nelse if (params.decoder.implem == \"FAST\")\ndecoder = new Decoder_repetition_fast<B,R>(params.code.K,\n- params.code.N,\n+ params.code.N_code,\nparams.encoder.buffered,\nparams.simulation.inter_frame_level);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Repetition/Factory_encoder_repetition.cpp",
"new_path": "src/Tools/Factory/Repetition/Factory_encoder_repetition.cpp",
"diff": "@@ -13,7 +13,7 @@ Encoder_sys<B>* Factory_encoder_repetition<B>\n// build the encoder\nif (params.encoder.systematic)\n- encoder = new Encoder_repetition_sys<B>(params.code.K, params.code.N, params.encoder.buffered, params.simulation.inter_frame_level);\n+ encoder = new Encoder_repetition_sys<B>(params.code.K, params.code.N_code, params.encoder.buffered, params.simulation.inter_frame_level);\nreturn encoder;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -44,6 +44,7 @@ struct code_parameters\nstd::string awgn_fb_path;\nfloat sigma; // not noise var, used to set a fixed snr value for frozen bits construction (in polar codes)\nbool coset; // true = enable coset approach\n+ int K_info;\nint K;\nint N;\nint N_code;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a new K_info param + put N_code where needed.
|
8,490 |
11.05.2017 18:03:31
| -7,200 |
25028447ab6d7737fbf5a32cd20ecc7582676785
|
Add missing includes + cosmetics.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -156,7 +156,7 @@ void Simulation_BFER<B,R,Q>\n{\n#ifdef ENABLE_MPI\n// build a monitor to compute BER/FER (reduce the other monitors)\n- simu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K - simu->params.crc .size,\n+ simu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K_info,\nsimu->params.code.N,\nsimu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\n@@ -166,7 +166,7 @@ void Simulation_BFER<B,R,Q>\nsimu->params.simulation.inter_frame_level);\n#else\n// build a monitor to compute BER/FER (reduce the other monitors)\n- simu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K - simu->params.crc .size,\n+ simu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K_info,\nsimu->params.code.N,\nsimu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.hpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.hpp",
"diff": "#ifndef SIMULATION_BFER_HPP_\n#define SIMULATION_BFER_HPP_\n+#include <map>\n#include <thread>\n#include <chrono>\n#include <vector>\n+#include <utility>\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Tools/params.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"diff": "@@ -144,7 +144,7 @@ void Simulation_BFER<B,R,Q>\nconst auto n_fra = simu->decoder[tid]->get_n_frames();\n// build a monitor to compute BER/FER (reduce the other monitors)\n- simu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K - simu->params.crc .size,\n+ simu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K_info,\nsimu->params.code.N,\nsimu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -157,7 +157,7 @@ void Simulation_BFERI<B,R,Q>\n{\n#ifdef ENABLE_MPI\n// build a monitor to compute BER/FER (reduce the other monitors)\n- simu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K - simu->params.crc .size,\n+ simu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K_info,\nsimu->params.code.N,\nsimu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\n@@ -167,7 +167,7 @@ void Simulation_BFERI<B,R,Q>\nsimu->params.simulation.inter_frame_level);\n#else\n// build a monitor to compute BER/FER (reduce the other monitors)\n- simu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K - simu->params.crc .size,\n+ simu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K_info,\nsimu->params.code.N,\nsimu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\n@@ -175,7 +175,7 @@ void Simulation_BFERI<B,R,Q>\nsimu->params.simulation.inter_frame_level);\n#endif\n// build the terminal to display the BER/FER\n- simu->terminal = simu->build_terminal(tid);\n+ simu->terminal = simu->build_terminal();\nSimulation::check_errors(simu->terminal, \"Terminal\");\n}\n}\n@@ -795,7 +795,7 @@ void Simulation_BFERI<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nTerminal* Simulation_BFERI<B,R,Q>\n-::build_terminal(const int tid)\n+::build_terminal()\n{\nthis->durations_red[std::make_pair(11, \"Decoder\")] = std::chrono::nanoseconds(0);\nconst auto &d_dec = this->durations_red[std::make_pair(11, \"Decoder\")];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp",
"diff": "#ifndef SIMULATION_BFERI_HPP_\n#define SIMULATION_BFERI_HPP_\n+#include <map>\n#include <thread>\n#include <chrono>\n#include <vector>\n+#include <utility>\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Tools/params.h\"\n@@ -47,6 +49,8 @@ protected:\n// objects\nmodule::Monitor_reduction<B,R> *monitor_red;\n+\n+ // terminal (for the output of the code)\ntools::Terminal *terminal;\n// time points and durations\n@@ -76,7 +80,7 @@ private:\nvoid time_reduction(const bool is_snr_done = false );\nvoid time_report (std::ostream &stream = std::clog);\n- tools::Terminal* build_terminal(const int tid = 0);\n+ tools::Terminal* build_terminal();\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add missing includes + cosmetics.
|
8,490 |
11.05.2017 18:05:22
| -7,200 |
5028a6003b4ea952724eaae29e779a4d3b0e114a
|
Remove dead include.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "// #include <Module/CRC/SPU_CRC.hpp>\n// #include <Module/CRC/SC_CRC.hpp>\n#include <Module/CRC/Polynomial/CRC_polynomial.hpp>\n-#include <Module/CRC/Polynomial/CRC_polynomial_double.hpp>\n#include <Module/CRC/Polynomial/CRC_polynomial_fast.hpp>\n#include <Module/CRC/Polynomial/CRC_polynomial_inter.hpp>\n#include <Module/CRC/NO/CRC_NO.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove dead include.
|
8,483 |
12.05.2017 11:41:16
| -7,200 |
54840912efd2489944ddbc327780cc77d220090d
|
Correction of the frame trace displayer to allow a nice display of scientific numbers (too big numbers to be displayed normally)
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx",
"new_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx",
"diff": "@@ -91,7 +91,12 @@ void Frame_trace<B>\nbreak;\ncase REAL:\nsstream << std::setprecision(prec) << std::setw(prec+2) << value;\n- value_string = sstream.str().substr(0, prec+2);\n+ value_string = sstream.str();\n+ size_t pos = value_string.find('e');\n+ if (pos != std::string::npos) // then scientific notation has been used (too big number)\n+ value_string = value_string.substr(0, prec-2) + value_string.substr(pos);\n+ else\n+ value_string = value_string.substr(0, prec+2);\nstream << value_string << \"|\";\nbreak;\n@@ -123,8 +128,12 @@ void Frame_trace<B>\ncase REAL:\nsstream << std::setprecision(prec) << std::setw(prec+2) << value;\n-\n- value_string = sstream.str().substr(0, prec+2);\n+ value_string = sstream.str();\n+ size_t pos = value_string.find('e');\n+ if (pos != std::string::npos) // then scientific notation has been used (too big number)\n+ value_string = value_string.substr(0, prec-2) + value_string.substr(pos);\n+ else\n+ value_string = value_string.substr(0, prec+2);\nif (value >= 0)\nif (ref == 0)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Correction of the frame trace displayer to allow a nice display of scientific numbers (too big numbers to be displayed normally)
|
8,490 |
15.05.2017 17:40:27
| -7,200 |
cfd4b189743bbb1b88c3a42c394060076fb272e1
|
Fix bad legend display.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.cpp",
"diff": "@@ -119,7 +119,6 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->bind_sockets_debug();\nsc_core::sc_start(); // start simulation\n- this->terminal->legend(std::cout);\nfor (auto i = 0; i < 7; i++)\nif (this->dbg_B[i] != nullptr)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad legend display.
|
8,490 |
22.05.2017 16:49:04
| -7,200 |
2e32099a97ed5da8edffbeb88b8db5a7d5d61ac0
|
Fix a bug: bad use of frame_id param.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/NO/Encoder_NO.cpp",
"new_path": "src/Module/Encoder/NO/Encoder_NO.cpp",
"diff": "@@ -21,7 +21,7 @@ Encoder_NO<B>\ntemplate <typename B>\nvoid Encoder_NO<B>\n-::encode(const B *U_K, B *X_N, const int frame_id)\n+::encode(const B *U_K, B *X_N)\n{\nstd::copy(U_K, U_K + this->N * this->n_frames, X_N);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/NO/Encoder_NO.hpp",
"new_path": "src/Module/Encoder/NO/Encoder_NO.hpp",
"diff": "@@ -14,7 +14,7 @@ public:\nEncoder_NO(const int K, const int N, const int n_frames = 1, const std::string name = \"Encoder_NO\");\nvirtual ~Encoder_NO();\n- void encode(const B *U_K, B *X_N, const int frame_id); using Encoder<B>::encode;\n+ void encode(const B *U_K, B *X_N); using Encoder<B>::encode;\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a bug: bad use of frame_id param.
|
8,490 |
22.05.2017 16:49:49
| -7,200 |
c3775bc44fc1b1ecda2332d505874ed349f32927
|
Fix a bug: template issue on Monitor.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"diff": "@@ -280,7 +280,7 @@ void SPU_Simulation_BFER_std<B,R,Q>\ntask_names[tid][13] = \"crc::extract_\" + str_id; task_extract_crc->name = task_names[tid][13].c_str();\nSTARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_extract_crc), \"task_submit::crc::extract\");\n- auto task_check_err = Monitor<B,R>::spu_task_check_errors(this->monitor[tid], spu_U_K1[tid], spu_V_K2[tid]);\n+ auto task_check_err = Monitor<B>::spu_task_check_errors(this->monitor[tid], spu_U_K1[tid], spu_V_K2[tid]);\ntask_check_err->priority = STARPU_MIN_PRIO +14;\ntask_names[tid][14] = \"mnt::check_errors_\" + str_id; task_check_err->name = task_names[tid][14].c_str();\nSTARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_check_err), \"task_submit::mnt::check_errors\");\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a bug: template issue on Monitor.
|
8,490 |
22.05.2017 16:50:19
| -7,200 |
8c76be4b19f1965ccee216c4144c71f6d9cf0143
|
Improve the time report.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"diff": "@@ -13,6 +13,7 @@ Monitor_reduction<B>\n::Monitor_reduction(const int size, const unsigned max_fe, std::vector<Monitor<B>*> monitors, const int n_frames,\nconst std::string name)\n: Monitor_std<B> (size, max_fe, n_frames, name),\n+ n_analyzed_frames_historic(0 ),\nmonitors (monitors )\n{\nif (monitors.size() == 0)\n@@ -40,6 +41,13 @@ unsigned long long Monitor_reduction<B>\nreturn cur_fra;\n}\n+template <typename B>\n+unsigned long long Monitor_reduction<B>\n+::get_n_analyzed_fra_historic() const\n+{\n+ return n_analyzed_frames_historic;\n+}\n+\ntemplate <typename B>\nunsigned long long Monitor_reduction<B>\n::get_n_fe() const\n@@ -66,6 +74,7 @@ template <typename B>\nvoid Monitor_reduction<B>\n::reset()\n{\n+ n_analyzed_frames_historic += this->get_n_analyzed_fra();\nMonitor_std<B>::reset();\nfor (auto m : monitors)\nm->reset();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp",
"diff": "@@ -15,6 +15,7 @@ template <typename B = int>\nclass Monitor_reduction : public Monitor_std<B>\n{\nprivate:\n+ unsigned long long n_analyzed_frames_historic;\nstd::vector<Monitor<B>*> monitors;\npublic:\n@@ -22,6 +23,7 @@ public:\nconst std::string name = \"Monitor_reduction\");\nvirtual ~Monitor_reduction();\n+ unsigned long long get_n_analyzed_fra_historic() const;\nunsigned long long get_n_analyzed_fra () const;\nunsigned long long get_n_fe () const;\nunsigned long long get_n_be () const;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -285,7 +285,7 @@ void Simulation_BFER<B,R,Q>\nmax_chars = std::max(max_chars, (int)duration.first.second.length());\nstream << \"#\" << std::endl;\n- stream << \"# \" << bold_underlined(\"Time report:\") << std::endl;\n+ stream << \"# \" << bold_underlined(\"Time report\") << \" (the time of the threads is cumulated)\" << std::endl;\nauto prev_sec = 0.f;\nfor (auto& duration : durations_sum)\n@@ -313,8 +313,21 @@ void Simulation_BFER<B,R,Q>\nstream << \"# \" << key << str_spaces << \": \"\n<< std::setw(9) << std::fixed << std::setprecision(3) << cur_sec << \" sec (\"\n- << std::setw(5) << std::fixed << std::setprecision(2) << cur_pc << \"%)\"\n- << std::endl;\n+ << std::setw(5) << std::fixed << std::setprecision(2) << cur_pc << \"%)\";\n+\n+ if (data_sizes.find(duration.first) != data_sizes.end())\n+ {\n+ const auto n_bits_per_fra = data_sizes[duration.first] / params.simulation.inter_frame_level;\n+ const auto n_fra = this->monitor_red->get_n_analyzed_fra_historic();\n+ const auto mbps = ((float)(n_bits_per_fra * n_fra) / cur_sec) * 0.000001f;\n+ const auto inter_lvl = (float)params.simulation.inter_frame_level;\n+ const auto lat = (((float)duration.second.count() * 0.001f) / (float)n_fra) * inter_lvl;\n+\n+ stream << \" - \" << std::setw(9) << mbps << \" Mb/s\"\n+ << \" - \" << std::setw(9) << lat << \" us\";\n+ }\n+\n+ stream << std::endl;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"diff": "@@ -62,6 +62,9 @@ protected:\nstd::map<std::pair<int, std::string>, std::chrono::nanoseconds> durations_red;\nstd::map<std::pair<int, std::string>, std::chrono::nanoseconds> durations_sum;\n+ // size of the data\n+ std::map<std::pair<int, std::string>, unsigned> data_sizes;\n+\npublic:\nSimulation_BFER(const tools::parameters& params, tools::Codec<B,Q> &codec);\nvirtual ~Simulation_BFER();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "@@ -46,6 +46,22 @@ Simulation_BFER_std_threads<B,R,Q>\n<< bold_yellow(\" Each thread will play the same frames. Please run with one thread.\")\n<< std::endl;\n}\n+\n+ this->data_sizes[std::make_pair( 0, \"Source\" )] = this->U_K1[0].size();\n+ this->data_sizes[std::make_pair( 1, \"CRC build\" )] = this->U_K2[0].size();\n+ this->data_sizes[std::make_pair( 2, \"Encoder\" )] = this->X_N1[0].size();\n+ this->data_sizes[std::make_pair( 3, \"Puncturer\" )] = this->X_N2[0].size();\n+ this->data_sizes[std::make_pair( 4, \"Modulator\" )] = this->X_N3[0].size();\n+ this->data_sizes[std::make_pair( 5, \"Channel\" )] = this->Y_N1[0].size();\n+ this->data_sizes[std::make_pair( 6, \"Filter\" )] = this->Y_N2[0].size();\n+ this->data_sizes[std::make_pair( 7, \"Demodulator\" )] = this->Y_N3[0].size();\n+ this->data_sizes[std::make_pair( 8, \"Quantizer\" )] = this->Y_N4[0].size();\n+ this->data_sizes[std::make_pair( 9, \"Depuncturer\" )] = this->Y_N5[0].size();\n+ this->data_sizes[std::make_pair(10, \"Coset real\" )] = this->Y_N5[0].size();\n+ this->data_sizes[std::make_pair(11, \"Decoder\" )] = this->V_K1[0].size();\n+ this->data_sizes[std::make_pair(15, \"Coset bit\" )] = this->V_K1[0].size();\n+ this->data_sizes[std::make_pair(16, \"CRC extract\" )] = this->V_K2[0].size();\n+ this->data_sizes[std::make_pair(17, \"Check errors\")] = this->V_K2[0].size();\n}\ntemplate <typename B, typename R, typename Q>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the time report.
|
8,490 |
23.05.2017 14:35:11
| -7,200 |
068f36cfce9e66b36a7c75937b68992aeced3f9b
|
Fix Rayleigh channel.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"diff": "@@ -37,16 +37,16 @@ void Channel_Rayleigh_LLR<R>\nif (this->complex)\n{\n- for (auto i = 0; i < (this->N * this->n_frames) / 2 ; i++)\n+ for (auto i = 0; i < this->N * this->n_frames; i += 2)\n{\n- const auto h_re = this->gains[2*i ];\n- const auto h_im = this->gains[2*i +1];\n+ const auto h_re = H_N[i ] = this->gains[i ];\n+ const auto h_im = H_N[i +1] = this->gains[i +1];\n- const auto n_re = this->noise[2*i ];\n- const auto n_im = this->noise[2*i +1];\n+ const auto n_re = this->noise[i ];\n+ const auto n_im = this->noise[i +1];\n- Y_N[2*i ] = h_re * X_N[2*i ] - h_im * X_N[2*i +1] + n_re;\n- Y_N[2*i +1] = h_re * X_N[2*i +1] + h_im * X_N[2*i ] + n_im;\n+ Y_N[i ] = (X_N[i ] * h_re - X_N[i +1] * h_im) + n_re;\n+ Y_N[i +1] = (X_N[i +1] * h_re + X_N[i ] * h_im) + n_im;\n}\n}\nelse\n@@ -57,7 +57,7 @@ void Channel_Rayleigh_LLR<R>\nconst auto h_im = this->gains[2*i +1];\nH_N[i] = std::sqrt(h_re * h_re + h_im * h_im);\n- Y_N[i] = H_N[i] * X_N[i] + this->noise[i];\n+ Y_N[i] = X_N[i] * H_N[i] + this->noise[i];\n}\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix Rayleigh channel.
|
8,490 |
23.05.2017 14:53:19
| -7,200 |
cce59005a9e6f8e10fd9a1bdd941e81b782de971
|
Update aff3ct header file.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Code/Polar/API/functions_polar_inter.h>\n#include <Tools/Code/Polar/API/functions_polar_intra_32bit.h>\n#include <Tools/Code/Polar/decoder_polar_functions.h>\n+#include <Tools/Code/Polar/fb_extract.h>\n#include <Tools/Perf/MIPP/math/sse_mathfun.h>\n#include <Tools/Perf/MIPP/math/avx_mathfun.h>\n#include <Tools/Perf/MIPP/math/neon_mathfun.h>\n// #include <Tools/MSVC/dirent.h>\n#include <Tools/params.h>\n+\n//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n#include <Tools/Threads/Barrier.hpp>\n#include <Tools/Math/Galois.hpp>\n#include <Tools/Algo/Tree/Binary_node.hpp>\n#include <Tools/Algo/Tree/Binary_tree.hpp>\n#include <Tools/Algo/Tree/Binary_tree_metric.hpp>\n+#include <Tools/Algo/Noise/Fast/Noise_fast.hpp>\n+#include <Tools/Algo/Noise/Standard/Noise_std.hpp>\n+#include <Tools/Algo/Noise/MKL/Noise_MKL.hpp>\n+#include <Tools/Algo/Noise/Noise.hpp>\n+#include <Tools/Algo/Noise/GSL/Noise_GSL.hpp>\n#include <Tools/Algo/Predicate_ite.hpp>\n#include <Tools/Algo/Bit_packer.hpp>\n#include <Tools/SystemC/SC_Router.hpp>\n#include <Tools/Arguments_reader.hpp>\n#include <Tools/Perf/Reorderer/Reorderer.hpp>\n#include <Tools/Display/Frame_trace/Frame_trace.hpp>\n+#include <Tools/Display/Dumper/Dumper.hpp>\n+#include <Tools/Display/Dumper/Dumper_reduction.hpp>\n#include <Tools/Display/Terminal/Terminal.hpp>\n#include <Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n#include <Tools/Display/Terminal/BFER/Terminal_BFER_legacy.hpp>\n#include <Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n+#include <Tools/Codec/Polar/Codec_polar.hpp>\n+#include <Tools/Codec/Codec_SISO.hpp>\n+#include <Tools/Codec/RSC/Codec_RSC.hpp>\n+#include <Tools/Codec/Codec.hpp>\n+#include <Tools/Codec/Repetition/Codec_repetition.hpp>\n+#include <Tools/Codec/LDPC/Codec_LDPC.hpp>\n+#include <Tools/Codec/Uncoded/Codec_uncoded.hpp>\n+#include <Tools/Codec/BCH/Codec_BCH.hpp>\n+#include <Tools/Codec/RA/Codec_RA.hpp>\n+#include <Tools/Codec/Turbo/Codec_turbo.hpp>\n#include <Module/Interleaver/Random/Interleaver_random.hpp>\n#include <Module/Interleaver/Golden/Interleaver_golden.hpp>\n// #include <Module/Interleaver/SPU_Interleaver.hpp>\n#include <Module/Encoder/Turbo/Encoder_turbo.hpp>\n#include <Module/Encoder/Turbo/Encoder_turbo_legacy.hpp>\n#include <Module/Channel/Channel.hpp>\n-#include <Module/Channel/Additive/AWGN/Fast/Channel_AWGN_fast_LR.hpp>\n-#include <Module/Channel/Additive/AWGN/Fast/Channel_AWGN_fast_LLR.hpp>\n-#include <Module/Channel/Additive/AWGN/Standard/Channel_AWGN_std_LLR.hpp>\n-#include <Module/Channel/Additive/AWGN/Standard/Channel_AWGN_std_LR.hpp>\n-#include <Module/Channel/Additive/AWGN/MKL/Channel_AWGN_MKL_LLR.hpp>\n-#include <Module/Channel/Additive/AWGN/MKL/Channel_AWGN_MKL_LR.hpp>\n-#include <Module/Channel/Additive/AWGN/GSL/Channel_AWGN_GSL_LLR.hpp>\n-#include <Module/Channel/Additive/AWGN/GSL/Channel_AWGN_GSL_LR.hpp>\n-#include <Module/Channel/Additive/User/Channel_additive_user.hpp>\n+#include <Module/Channel/AWGN/Channel_AWGN_LLR.hpp>\n// #include <Module/Channel/SPU_Channel.hpp>\n#include <Module/Channel/User/Channel_user.hpp>\n#include <Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp>\n#include <Module/Decoder/Repetition/Decoder_repetition.hpp>\n// #include <Module/Decoder/SC_SISO.hpp>\n#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp>\n#include <Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp>\n#include <Simulation/EXIT/Code/Polar/Simulation_EXIT_polar.hpp>\n#include <Simulation/EXIT/Code/RSC/Simulation_EXIT_RSC.hpp>\n#include <Simulation/GEN/Code/Polar/Generation_polar.hpp>\n-#include <Simulation/BFER/Standard/STD_Simulation_BFER.hpp>\n+#include <Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.hpp>\n+#include <Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.hpp>\n+#include <Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.hpp>\n+#include <Simulation/BFER/Standard/Simulation_BFER_std.hpp>\n+#include <Simulation/BFER/Iterative/Simulation_BFER_ite.hpp>\n+#include <Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp>\n+#include <Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.hpp>\n#include <Simulation/BFER/Simulation_BFER.hpp>\n-// #include <Simulation/BFER/StarPU/SPU_Simulation_BFER.hpp>\n-// #include <Simulation/BFER/SystemC/SC_Simulation_BFER.hpp>\n-#include <Simulation/BFER/Code/Polar/Simulation_BFER_polar.hpp>\n-#include <Simulation/BFER/Code/RSC/Simulation_BFER_RSC.hpp>\n-#include <Simulation/BFER/Code/Repetition/Simulation_BFER_repetition.hpp>\n-#include <Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.hpp>\n-#include <Simulation/BFER/Code/Uncoded/Simulation_BFER_uncoded.hpp>\n-#include <Simulation/BFER/Code/BCH/Simulation_BFER_BCH.hpp>\n-#include <Simulation/BFER/Code/RA/Simulation_BFER_RA.hpp>\n-#include <Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.hpp>\n-#include <Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp>\n-// #include <Simulation/BFERI/SystemC/SC_Simulation_BFERI.hpp>\n-#include <Simulation/BFERI/Simulation_BFERI.hpp>\n-#include <Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.hpp>\n-#include <Simulation/BFERI/Code/RSC/Simulation_BFERI_RSC.hpp>\n-#include <Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.hpp>\n-#include <Simulation/BFERI/Code/Uncoded/Simulation_BFERI_uncoded.hpp>\n// #include <aff3ct.hpp>\n#include <Generator/Polar/SC/Generator_polar_SC_sys.hpp>\n#include <Generator/Polar/Generator_polar.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update aff3ct header file.
|
8,490 |
23.05.2017 15:26:42
| -7,200 |
e1e14f91eb01d1d0e0f77917aef48dbfdd88a707
|
Replace --dmod-ite param by --sim-ite.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -87,7 +87,7 @@ _aff3ct() {\nopts=\"$opts --sim-benchs -b --sim-debug -d --sim-debug-fe \\\n--sim-debug-limit \\\n--snr-sim-trace-path --sim-time-report --cde-coset -c --itl-type \\\n- --itl-path --itl-cols --itl-uni --dmod-ite -I --mnt-max-fe -e \\\n+ --itl-path --itl-cols --itl-uni --sim-ite -I --mnt-max-fe -e \\\n--term-type\"\nfi\n@@ -201,7 +201,7 @@ _aff3ct() {\n--sim-benchs | -b | --sim-debug-limit | --sim-debug-prec | \\\n--mnt-max-fe | -e | \\\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | -I | \\\n- --dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n+ --sim-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n--sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n--itl-cols | --dec-synd-depth | --pct-pattern | \\\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -18,6 +18,7 @@ Launcher_BFERI<B,R,Q>\nthis->params.simulation .debug_limit = 0;\nthis->params.simulation .debug_precision = 5;\nthis->params.simulation .time_report = false;\n+ this->params.simulation .n_ite = 15;\n#if !defined(STARPU) && !defined(SYSTEMC)\nthis->params.simulation .n_threads = std::thread::hardware_concurrency() ? std::thread::hardware_concurrency() : 1;\n#endif\n@@ -30,7 +31,6 @@ Launcher_BFERI<B,R,Q>\nthis->params.interleaver.n_cols = 4;\nthis->params.interleaver.uniform = false;\nthis->params.demodulator.max = \"MAX\";\n- this->params.demodulator.n_ite = 30;\nthis->params.monitor .n_frame_errors = 100;\nthis->params.monitor .err_track_enable = false;\nthis->params.monitor .err_track_revert = false;\n@@ -64,6 +64,9 @@ void Launcher_BFERI<B,R,Q>\n{\"string\",\n\"select the type of SNR: symbol energy or information bit energy.\",\n\"ES, EB\"};\n+ this->opt_args[{\"sim-ite\", \"I\"}] =\n+ {\"positive_int\",\n+ \"number of global turbo iterations between the demodulator and the decoder.\"};\n// ---------------------------------------------------------------------------------------------------------- code\nthis->opt_args[{\"cde-coset\", \"c\"}] =\n@@ -97,11 +100,6 @@ void Launcher_BFERI<B,R,Q>\n{\"\",\n\"enable the regeneration of the interleaver for each new frame.\"};\n- // --------------------------------------------------------------------------------------------------- demodulator\n- this->opt_args[{\"dmod-ite\", \"I\"}] =\n- {\"positive_int\",\n- \"number of iterations in the turbo demodulation.\"};\n-\n// ------------------------------------------------------------------------------------------------------- monitor\nthis->opt_args[{\"mnt-max-fe\", \"e\"}] =\n{\"positive_int\",\n@@ -132,6 +130,7 @@ void Launcher_BFERI<B,R,Q>\n// ---------------------------------------------------------------------------------------------------- simulation\nif(this->ar.exist_arg({\"sim-benchs\", \"b\"})) this->params.simulation.benchs = this->ar.get_arg_int({\"sim-benchs\", \"b\"});\nif(this->ar.exist_arg({\"sim-snr-type\", \"E\"})) this->params.simulation.snr_type = this->ar.get_arg ({\"sim-snr-type\", \"E\"});\n+ if(this->ar.exist_arg({\"sim-ite\", \"I\"})) this->params.simulation.n_ite = this->ar.get_arg_int({\"sim-ite\", \"I\"});\nif(this->ar.exist_arg({\"sim-time-report\" })) this->params.simulation.time_report = true;\nif(this->ar.exist_arg({\"sim-debug\", \"d\"})) this->params.simulation.debug = true;\nif(this->ar.exist_arg({\"sim-debug-limit\" }))\n@@ -171,12 +170,8 @@ void Launcher_BFERI<B,R,Q>\nif(this->ar.exist_arg({\"itl-cols\"})) this->params.interleaver.n_cols = this->ar.get_arg_int({\"itl-cols\"});\nif(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.uniform = true;\n- // --------------------------------------------------------------------------------------------------- demodulator\n- if(this->ar.exist_arg({\"dmod-ite\", \"I\"})) this-> params.demodulator.n_ite = this->ar.get_arg_int({\"dmod-ite\", \"I\"});\n-\n// ------------------------------------------------------------------------------------------------------- monitor\nif(this->ar.exist_arg({\"mnt-max-fe\", \"e\"})) this->params.monitor.n_frame_errors = this->ar.get_arg_int({\"mnt-max-fe\", \"e\"});\n-\nif(this->ar.exist_arg({\"mnt-err-trk-rev\" })) this->params.monitor.err_track_revert = true;\nif(this->ar.exist_arg({\"mnt-err-trk\" })) this->params.monitor.err_track_enable = true;\nif(this->ar.exist_arg({\"mnt-err-trk-path\"})) this->params.monitor.err_track_path = this->ar.get_arg({\"mnt-err-trk-path\"});\n@@ -216,6 +211,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\nauto p = Launcher<B,R,Q>::header_simulation();\np.push_back(std::make_pair(\"Multi-threading (t)\", threads));\n+ p.push_back(std::make_pair(\"Global iterations (I)\", std::to_string(this->params.simulation.n_ite)));\nreturn p;\n}\n@@ -270,17 +266,6 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\nreturn p;\n}\n-template <typename B, typename R, typename Q>\n-std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\n-::header_demodulator()\n-{\n- auto p = Launcher<B,R,Q>::header_demodulator();\n-\n- p.push_back(std::make_pair(\"Turbo demod. iterations (I)\", std::to_string(this->params.demodulator.n_ite)));\n-\n- return p;\n-}\n-\ntemplate <typename B, typename R, typename Q>\nstd::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\n::header_decoder()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.hpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.hpp",
"diff": "@@ -27,7 +27,6 @@ protected:\nvirtual std::vector<std::pair<std::string,std::string>> header_code ();\nvirtual std::vector<std::pair<std::string,std::string>> header_encoder ();\nvirtual std::vector<std::pair<std::string,std::string>> header_interleaver();\n- virtual std::vector<std::pair<std::string,std::string>> header_demodulator();\nvirtual std::vector<std::pair<std::string,std::string>> header_decoder ();\nvirtual std::vector<std::pair<std::string,std::string>> header_monitor ();\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"diff": "@@ -117,7 +117,7 @@ template <typename B, typename R, typename Q>\nvoid SC_Simulation_BFER_ite<B,R,Q>\n::_launch()\n{\n- Predicate_ite p(this->params.demodulator.n_ite);\n+ Predicate_ite p(this->params.simulation.n_ite);\nthis->duplicator[0] = new SC_Duplicator( \"Duplicator0\");\nthis->duplicator[1] = new SC_Duplicator( \"Duplicator1\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -35,6 +35,7 @@ struct simulation_parameters\nint seed;\nint mpi_rank;\nint mpi_size;\n+ int n_ite; // number of demodulations/decoding sessions to perform in the BFERI simulations\n};\nstruct code_parameters\n@@ -113,7 +114,6 @@ struct demodulator_parameters\n{\nstd::string max; // max to use in the demodulation (MAX = max, MAXL = max_linear, MAXS = max_star)\nbool no_sig2; // do not divide by (sig^2) / 2 in the demodulation\n- int n_ite; // number of demodulations/decoding sessions to perform in the BFERI simulations\n};\nstruct channel_parameters\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it10_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it10_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 10 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAX NMS, 10 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it20_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it20_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 20 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAX NMS, 20 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it30_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_NMS_MAX_it30_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 30 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAX NMS, 30 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it10_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it10_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 10 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAXS SPA, 10 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it20_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it20_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 20 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAXS SPA, 20 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it30_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPF/gsm_BPF_SPA_MAXS_it30_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 30 --dec-type BP_FLOODING --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPF MAXS SPA, 30 glob. ite.\nTrace:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace --dmod-ite param by --sim-ite.
|
8,490 |
29.05.2017 11:36:14
| -7,200 |
189eae89c39b6ad2bac01835ef9bc6fbecb5924b
|
Fix SystemC BFER simu (iterative).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"diff": "@@ -388,7 +388,13 @@ Interleaver<int>* SC_Simulation_BFER_ite<B,R,Q>\nconst auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.interleaver.seed;\n// build the objects\n- this->interleaver_e = Factory_interleaver<int>::build(this->params, this->params.code.N, seed);\n+ this->interleaver_e = Factory_interleaver<int>::build(this->params.interleaver.type,\n+ this->params.code.N_code,\n+ this->params.interleaver.path,\n+ this->params.interleaver.uniform,\n+ this->params.interleaver.n_cols,\n+ seed,\n+ this->params.simulation.inter_frame_level);\nSimulation::check_errors(this->interleaver_e, \"Interleaver<int>\");\nthis->interleaver_e->init();\n@@ -396,18 +402,24 @@ Interleaver<int>* SC_Simulation_BFER_ite<B,R,Q>\nif (this->interleaver_e->is_uniform())\nthis->monitor[tid]->add_handler_check(std::bind(&Interleaver<int>::refresh, this->interleaver_e));\n- return Factory_interleaver<int>::build(this->params, this->params.code.N, seed);\n+ return Factory_interleaver<int>::build(this->params.interleaver.type,\n+ this->params.code.N_code,\n+ this->params.interleaver.path,\n+ this->params.interleaver.uniform,\n+ this->params.interleaver.n_cols,\n+ seed,\n+ this->params.simulation.inter_frame_level);\n}\ntemplate <typename B, typename R, typename Q>\nCoset<B,Q>* SC_Simulation_BFER_ite<B,R,Q>\n::build_coset_real(const int tid)\n{\n- this->coset_real_i = Factory_coset_real<B,Q>::build(this->params);\n+ this->coset_real_i = Simulation_BFER_ite<B,R,Q>::build_coset_real(tid);\nSimulation::check_errors(this->coset_real_i, \"Coset<B,Q>\");\nthis->coset_real_i->rename(\"Coset_real_i\");\n- return Factory_coset_real<B,Q>::build(this->params);\n+ return Simulation_BFER_ite<B,R,Q>::build_coset_real(tid);\n}\n// ==================================================================================== explicit template instantiation\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix SystemC BFER simu (iterative).
|
8,490 |
29.05.2017 14:58:21
| -7,200 |
e9ea5ceead00d3c291a2400548b134b93b0d0f6c
|
Move the seeds generation to the builder method in the simus.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -49,13 +49,18 @@ template <typename B, typename R, typename Q>\nvoid Simulation_BFER_ite<B,R,Q>\n::build_communication_chain(const int tid)\n{\n+ const auto seed_src = rd_engine_seed[tid]();\n+ const auto seed_itl = this->params.interleaver.uniform ? rd_engine_seed[tid]() : this->params.interleaver.seed;\n+ const auto seed_enc = rd_engine_seed[tid]();\n+ const auto seed_chn = rd_engine_seed[tid]();\n+\n// build the objects\n- source [tid] = build_source (tid);\n+ source [tid] = build_source (tid, seed_src);\ncrc [tid] = build_crc (tid );\n- encoder [tid] = build_encoder (tid);\n- interleaver[tid] = build_interleaver(tid);\n+ encoder [tid] = build_encoder (tid, seed_enc);\n+ interleaver[tid] = build_interleaver(tid, seed_itl);\nmodulator [tid] = build_modulator (tid );\n- channel [tid] = build_channel (tid);\n+ channel [tid] = build_channel (tid, seed_chn);\nquantizer [tid] = build_quantizer (tid );\ncoset_real [tid] = build_coset_real (tid );\nsiso [tid] = build_siso (tid );\n@@ -98,12 +103,12 @@ void Simulation_BFER_ite<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nSource<B>* Simulation_BFER_ite<B,R,Q>\n-::build_source(const int tid)\n+::build_source(const int tid, const int seed)\n{\nreturn Factory_source<B>::build(this->params.source.type,\nthis->params.code.K_info,\nthis->params.source.path,\n- rd_engine_seed[tid](),\n+ seed,\nthis->params.simulation.inter_frame_level);\n}\n@@ -120,7 +125,7 @@ CRC<B>* Simulation_BFER_ite<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nEncoder<B>* Simulation_BFER_ite<B,R,Q>\n-::build_encoder(const int tid)\n+::build_encoder(const int tid, const int seed)\n{\ntry\n{\n@@ -132,16 +137,15 @@ Encoder<B>* Simulation_BFER_ite<B,R,Q>\nthis->params.code.K,\nthis->params.code.N_code,\nthis->params.encoder.path,\n- rd_engine_seed[tid](),\n+ seed,\nthis->params.simulation.inter_frame_level);\n}\n}\ntemplate <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFER_ite<B,R,Q>\n-::build_interleaver(const int tid)\n+::build_interleaver(const int tid, const int seed)\n{\n- const auto seed = (this->params.interleaver.uniform) ? rd_engine_seed[tid]() : this->params.interleaver.seed;\nreturn Factory_interleaver<int>::build(this->params.interleaver.type,\nthis->params.code.N_code,\nthis->params.interleaver.path,\n@@ -173,14 +177,14 @@ Modulator<B,R,Q>* Simulation_BFER_ite<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nChannel<R>* Simulation_BFER_ite<B,R,Q>\n-::build_channel(const int tid)\n+::build_channel(const int tid, const int seed)\n{\nreturn Factory_channel<R>::build(this->params.channel.type,\nthis->params.code.N_mod,\nthis->sigma,\nthis->params.modulator.complex,\nthis->params.channel.path,\n- rd_engine_seed[tid](),\n+ seed,\nthis->params.simulation.inter_frame_level);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.hpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.hpp",
"diff": "@@ -54,12 +54,12 @@ protected:\nvirtual void build_communication_chain(const int tid = 0);\nvirtual void release_objects();\n- virtual module::Source <B >* build_source (const int tid = 0);\n+ virtual module::Source <B >* build_source (const int tid = 0, const int seed = 0);\nvirtual module::CRC <B >* build_crc (const int tid = 0 );\n- virtual module::Encoder <B >* build_encoder (const int tid = 0);\n- virtual module::Interleaver<int >* build_interleaver(const int tid = 0);\n+ virtual module::Encoder <B >* build_encoder (const int tid = 0, const int seed = 0);\n+ virtual module::Interleaver<int >* build_interleaver(const int tid = 0, const int seed = 0);\nvirtual module::Modulator <B,R,Q>* build_modulator (const int tid = 0 );\n- virtual module::Channel <R >* build_channel (const int tid = 0);\n+ virtual module::Channel <R >* build_channel (const int tid = 0, const int seed = 0);\nvirtual module::Quantizer <R,Q >* build_quantizer (const int tid = 0 );\nvirtual module::SISO <Q >* build_siso (const int tid = 0 );\nvirtual module::Coset <B,Q >* build_coset_real (const int tid = 0 );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"diff": "@@ -383,31 +383,16 @@ void SC_Simulation_BFER_ite<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nInterleaver<int>* SC_Simulation_BFER_ite<B,R,Q>\n-::build_interleaver(const int tid)\n+::build_interleaver(const int tid, const int seed)\n{\n- const auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.interleaver.seed;\n-\n// build the objects\n- this->interleaver_e = Factory_interleaver<int>::build(this->params.interleaver.type,\n- this->params.code.N_code,\n- this->params.interleaver.path,\n- this->params.interleaver.uniform,\n- this->params.interleaver.n_cols,\n- seed,\n- this->params.simulation.inter_frame_level);\n-\n+ this->interleaver_e = Simulation_BFER_ite<B,R,Q>::build_interleaver(tid, seed);\nthis->interleaver_e->init();\nthis->interleaver_e->rename(\"Interleaver_e\");\nif (this->interleaver_e->is_uniform())\nthis->monitor[tid]->add_handler_check(std::bind(&Interleaver<int>::refresh, this->interleaver_e));\n- return Factory_interleaver<int>::build(this->params.interleaver.type,\n- this->params.code.N_code,\n- this->params.interleaver.path,\n- this->params.interleaver.uniform,\n- this->params.interleaver.n_cols,\n- seed,\n- this->params.simulation.inter_frame_level);\n+ return Simulation_BFER_ite<B,R,Q>::build_interleaver(tid, seed);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.hpp",
"new_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.hpp",
"diff": "@@ -39,7 +39,7 @@ protected:\nvirtual void release_objects();\nvirtual void _launch();\n- virtual module::Interleaver<int>* build_interleaver(const int tid = 0);\n+ virtual module::Interleaver<int>* build_interleaver(const int tid = 0, const int seed = 0);\nvirtual module::Coset <B,Q>* build_coset_real (const int tid = 0 );\nprivate:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -50,14 +50,19 @@ template <typename B, typename R, typename Q>\nvoid Simulation_BFER_std<B,R,Q>\n::build_communication_chain(const int tid)\n{\n+ const auto seed_src = rd_engine_seed[tid]();\n+ const auto seed_itl = this->params.interleaver.uniform ? rd_engine_seed[tid]() : this->params.interleaver.seed;\n+ const auto seed_enc = rd_engine_seed[tid]();\n+ const auto seed_chn = rd_engine_seed[tid]();\n+\n// build the objects\n- source [tid] = build_source (tid);\n+ source [tid] = build_source (tid, seed_src);\ncrc [tid] = build_crc (tid );\n- interleaver[tid] = build_interleaver(tid);\n- encoder [tid] = build_encoder (tid);\n+ interleaver[tid] = build_interleaver(tid, seed_itl);\n+ encoder [tid] = build_encoder (tid, seed_enc);\npuncturer [tid] = build_puncturer (tid );\nmodulator [tid] = build_modulator (tid );\n- channel [tid] = build_channel (tid);\n+ channel [tid] = build_channel (tid, seed_chn);\nquantizer [tid] = build_quantizer (tid );\ncoset_real [tid] = build_coset_real (tid );\ndecoder [tid] = build_decoder (tid );\n@@ -95,12 +100,12 @@ void Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nSource<B>* Simulation_BFER_std<B,R,Q>\n-::build_source(const int tid)\n+::build_source(const int tid, const int seed)\n{\nreturn Factory_source<B>::build(this->params.source.type,\nthis->params.code.K_info,\nthis->params.source.path,\n- rd_engine_seed[tid](),\n+ seed,\nthis->params.simulation.inter_frame_level);\n}\n@@ -117,7 +122,7 @@ CRC<B>* Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nEncoder<B>* Simulation_BFER_std<B,R,Q>\n-::build_encoder(const int tid)\n+::build_encoder(const int tid, const int seed)\n{\ntry\n{\n@@ -129,7 +134,7 @@ Encoder<B>* Simulation_BFER_std<B,R,Q>\nthis->params.code.K,\nthis->params.code.N_code,\nthis->params.encoder.path,\n- rd_engine_seed[tid](),\n+ seed,\nthis->params.simulation.inter_frame_level);\n}\n}\n@@ -152,9 +157,8 @@ Puncturer<B,Q>* Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFER_std<B,R,Q>\n-::build_interleaver(const int tid)\n+::build_interleaver(const int tid, const int seed)\n{\n- const auto seed = (this->params.interleaver.uniform) ? rd_engine_seed[tid]() : this->params.interleaver.seed;\nreturn this->codec.build_interleaver(tid, seed);\n}\n@@ -180,14 +184,14 @@ Modulator<B,R,R>* Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nChannel<R>* Simulation_BFER_std<B,R,Q>\n-::build_channel(const int tid)\n+::build_channel(const int tid, const int seed)\n{\nreturn Factory_channel<R>::build(this->params.channel.type,\nthis->params.code.N_mod,\nthis->sigma,\nthis->params.modulator.complex,\nthis->params.channel.path,\n- rd_engine_seed[tid](),\n+ seed,\nthis->params.simulation.inter_frame_level);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.hpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.hpp",
"diff": "@@ -54,13 +54,13 @@ protected:\nvirtual void build_communication_chain(const int tid = 0);\nvirtual void release_objects();\n- virtual module::Source <B >* build_source (const int tid = 0);\n+ virtual module::Source <B >* build_source (const int tid = 0, const int seed = 0);\nvirtual module::CRC <B >* build_crc (const int tid = 0 );\n- virtual module::Encoder <B >* build_encoder (const int tid = 0);\n- virtual module::Interleaver<int >* build_interleaver(const int tid = 0);\n+ virtual module::Encoder <B >* build_encoder (const int tid = 0, const int seed = 0);\n+ virtual module::Interleaver<int >* build_interleaver(const int tid = 0, const int seed = 0);\nvirtual module::Puncturer <B,Q >* build_puncturer (const int tid = 0 );\nvirtual module::Modulator <B,R,R>* build_modulator (const int tid = 0 );\n- virtual module::Channel <R >* build_channel (const int tid = 0);\n+ virtual module::Channel <R >* build_channel (const int tid = 0, const int seed = 0);\nvirtual module::Quantizer <R,Q >* build_quantizer (const int tid = 0 );\nvirtual module::Coset <B,Q >* build_coset_real (const int tid = 0 );\nvirtual module::Decoder <B,Q >* build_decoder (const int tid = 0 );\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move the seeds generation to the builder method in the simus.
|
8,490 |
29.05.2017 15:06:29
| -7,200 |
753d2d7285f3445cb857777ce361bb91fe989532
|
Fix bad AZCW encoder prototype.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/AZCW/Encoder_AZCW.cpp",
"new_path": "src/Module/Encoder/AZCW/Encoder_AZCW.cpp",
"diff": "@@ -17,14 +17,14 @@ Encoder_AZCW<B>\ntemplate <typename B>\nvoid Encoder_AZCW<B>\n-::encode(const B *U_K, B *X_N, const int frame_id)\n+::encode(const B *U_K, B *X_N)\n{\nstd::fill(X_N, X_N + this->N * this->n_frames, (B)0);\n}\ntemplate <typename B>\nvoid Encoder_AZCW<B>\n-::encode_sys(const B *U_K, B *par, const int frame_id)\n+::encode_sys(const B *U_K, B *par)\n{\nstd::fill(par, par + (this->N - this->K) * this->n_frames, (B)0);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/AZCW/Encoder_AZCW.hpp",
"new_path": "src/Module/Encoder/AZCW/Encoder_AZCW.hpp",
"diff": "@@ -16,8 +16,8 @@ public:\nEncoder_AZCW(const int K, const int N, const int n_frames = 1, const std::string name = \"Encoder_AZCW\");\nvirtual ~Encoder_AZCW();\n- void encode (const B *U_K, B *X_N, const int frame_id); using Encoder_sys<B>::encode;\n- void encode_sys(const B *U_K, B *par, const int frame_id); using Encoder_sys<B>::encode_sys;\n+ void encode (const B *U_K, B *X_N); using Encoder_sys<B>::encode;\n+ void encode_sys(const B *U_K, B *par); using Encoder_sys<B>::encode_sys;\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad AZCW encoder prototype.
|
8,490 |
30.05.2017 09:47:35
| -7,200 |
6cb68f9578d01f68c0ffd63579e0ba0e015e3bad
|
Refacto the EXIT simu + clean code.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/EXIT/Launcher_EXIT.hpp",
"new_path": "src/Launcher/EXIT/Launcher_EXIT.hpp",
"diff": "@@ -13,7 +13,7 @@ template <typename B = int, typename R = float, typename Q = R>\nclass Launcher_EXIT : public Launcher<B,R,Q>\n{\nprotected:\n- tools::Codec_SISO<B,Q> *codec;\n+ tools::Codec_SISO<B,R> *codec;\npublic:\nLauncher_EXIT(const int argc, const char **argv, std::ostream &stream = std::cout);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp",
"new_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp",
"diff": "@@ -99,7 +99,7 @@ Simulation* Launcher_EXIT_polar<B,R,Q>\n::build_simu()\n{\nthis->codec = new Codec_polar<B,R>(this->params);\n- return new Simulation_EXIT<B,R,Q>(this->params, *this->codec);\n+ return new Simulation_EXIT<B,R>(this->params, *this->codec);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/EXIT/RSC/Launcher_EXIT_RSC.cpp",
"new_path": "src/Launcher/EXIT/RSC/Launcher_EXIT_RSC.cpp",
"diff": "@@ -108,7 +108,7 @@ Simulation* Launcher_EXIT_RSC<B,R,Q,QD>\n::build_simu()\n{\nthis->codec = new Codec_RSC<B,R,R>(this->params);\n- return new Simulation_EXIT<B,R,Q>(this->params, *this->codec);\n+ return new Simulation_EXIT<B,R>(this->params, *this->codec);\n}\ntemplate <typename B, typename R, typename Q, typename QD>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "+#include <cmath>\n#include <algorithm>\n#include \"Tools/Math/utils.h\"\n@@ -14,8 +15,8 @@ using namespace aff3ct::module;\nusing namespace aff3ct::tools;\nusing namespace aff3ct::simulation;\n-template <typename B, typename R, typename Q>\n-Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Simulation_EXIT<B,R>\n::Simulation_EXIT(const parameters& params, tools::Codec_SISO<B,R> &codec)\n: Simulation(),\n@@ -24,9 +25,8 @@ Simulation_EXIT<B,R,Q>\nH_N (params.code.N),\nB_K (params.code.K),\nB_N (params.code.N),\n- X_K1 (params.code.K),\nX_N1 (params.code.N),\n- X_K2 (params.code.K),\n+ X_K (params.code.K),\nX_N2 (params.code.N),\nY_N (params.code.N),\nY_K (params.code.K),\n@@ -61,41 +61,37 @@ Simulation_EXIT<B,R,Q>\nsiso (nullptr),\nterminal (nullptr)\n{\n- if (typeid(R) != typeid(Q))\n- std::clog << bold_yellow(\"(WW) EXIT simulation does not use fixed-point representation!\") << std::endl;\n-\n#ifdef ENABLE_MPI\nstd::clog << bold_yellow(\"(WW) This simulation is not MPI ready, the same computations will be launched \")\n<< bold_yellow(\"on each MPI processes.\") << std::endl;\n#endif\n}\n-template <typename B, typename R, typename Q>\n-Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Simulation_EXIT<B,R>\n::~Simulation_EXIT()\n{\nrelease_objects();\n}\n-template <typename B, typename R, typename Q>\n-void Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+void Simulation_EXIT<B,R>\n::build_communication_chain()\n{\nrelease_objects();\n- // build the objects\n- source = build_source ( );\n- encoder = build_encoder ( );\n- modulator = build_modulator ( );\n- modulator_a = build_modulator_a( );\n-\nconst auto N_mod = this->params.code.N_mod;\n- const auto K_mod = Factory_modulator<B,R,Q>::get_buffer_size_after_modulation(params.modulator.type,\n+ const auto K_mod = Factory_modulator<B,R>::get_buffer_size_after_modulation(params.modulator.type,\nparams.code.K,\nparams.modulator.bits_per_symbol,\nparams.modulator.upsample_factor,\nparams.modulator.cpm_L);\n+ // build the objects\n+ source = build_source ( );\n+ encoder = build_encoder ( );\n+ modulator = build_modulator ( );\n+ modulator_a = build_modulator_a( );\nchannel = build_channel (N_mod);\nchannel_a = build_channel_a (K_mod);\nsiso = build_siso ( );\n@@ -104,16 +100,15 @@ void Simulation_EXIT<B,R,Q>\nif (siso->get_n_frames() > 1)\nthrow std::runtime_error(\"aff3ct::simulation::Simulation_EXIT: inter frame is not supported.\");\n-\n- if (X_K2 .size() != (unsigned)K_mod) X_K2 .resize(K_mod);\n+ if (X_K .size() != (unsigned)K_mod) X_K .resize(K_mod);\nif (X_N2 .size() != (unsigned)N_mod) X_N2 .resize(N_mod);\nif (La_K1 .size() != (unsigned)K_mod) La_K1 .resize(K_mod);\nif (Lch_N1.size() != (unsigned)N_mod) Lch_N1.resize(N_mod);\nif (H_N .size() != (unsigned)N_mod) H_N .resize(N_mod);\n}\n-template <typename B, typename R, typename Q>\n-void Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+void Simulation_EXIT<B,R>\n::launch()\n{\nbool first_loop = true;\n@@ -159,13 +154,11 @@ void Simulation_EXIT<B,R,Q>\n}\n}\n-template <typename B, typename R, typename Q>\n-void Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+void Simulation_EXIT<B,R>\n::simulation_loop()\n{\nusing namespace std::chrono;\n-\n- // simulation loop\nauto t_simu = steady_clock::now();\nLe_buff.clear();\n@@ -180,11 +173,8 @@ void Simulation_EXIT<B,R,Q>\n// encode\nencoder->encode(B_K, X_N1);\n- // X_K used to generate La_K vector\n- X_K1 = B_K;\n-\n// modulate\n- modulator_a->modulate(X_K1, X_K2);\n+ modulator_a->modulate(B_K, X_K );\nmodulator ->modulate(X_N1, X_N2);\n//if sig_a = 0, La_K = 0, no noise to add\n@@ -193,12 +183,12 @@ void Simulation_EXIT<B,R,Q>\n// Rayleigh channel\nif (params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- channel_a->add_noise(X_K2, La_K1, H_N);\n+ channel_a ->add_noise (X_K, La_K1, H_N );\nmodulator_a->demodulate_with_gains( La_K1, H_N, La_K2);\n}\nelse // additive channel (AWGN, USER, NO)\n{\n- channel_a ->add_noise (X_K2, La_K1);\n+ channel_a ->add_noise (X_K, La_K1 );\nmodulator_a->demodulate( La_K1, La_K2);\n}\n}\n@@ -239,12 +229,12 @@ void Simulation_EXIT<B,R,Q>\n}\n// measure mutual information and store it in I_A, I_E, sig_a_array\n- I_A = measure_mutual_info_avg (La_buff, B_buff) / (params.code.K * n_trials);\n- I_E = measure_mutual_info_histo(Le_buff, B_buff, 1000);\n+ I_A = Simulation_EXIT<B,R>::measure_mutual_info_avg (La_buff, B_buff) / (params.code.K * n_trials);\n+ I_E = Simulation_EXIT<B,R>::measure_mutual_info_histo(Le_buff, B_buff);\n}\n-template <typename B, typename R, typename Q>\n-double Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+double Simulation_EXIT<B,R>\n::measure_mutual_info_avg(const mipp::vector<R>& llrs, const mipp::vector<B>& bits)\n{\ndouble I_A = 0;\n@@ -253,17 +243,18 @@ double Simulation_EXIT<B,R,Q>\nfor (int j = 0; j < size; j++)\n{\nsymb = -2 * (double)bits[j] +1;\n- I_A += (1 - log2(1 + std::exp(-symb * (double)llrs[j])));\n+ I_A += (1 - std::log2(1 + std::exp(-symb * (double)llrs[j])));\n}\nreturn(I_A);\n}\n-template <typename B, typename R, typename Q>\n-double Simulation_EXIT<B,R,Q>\n-::measure_mutual_info_histo(const mipp::vector<R>& llrs, const mipp::vector<B>& bits, const int N)\n+template <typename B, typename R>\n+double Simulation_EXIT<B,R>\n+::measure_mutual_info_histo(const mipp::vector<R>& llrs, const mipp::vector<B>& bits)\n{\n- const double Inf = 10000000;\n+// const double inf = 10000000;\n+ const double inf = std::numeric_limits<double>::infinity();\nint vec_length = (int)bits.size();\n@@ -274,7 +265,7 @@ double Simulation_EXIT<B,R,Q>\ndouble tmp;\ndouble I_E = 0.0;\n- double bin_width = 0.0f;\n+ double bin_width = 0.0;\ndouble llr_0_variance = 0.0;\ndouble llr_1_variance = 0.0;\ndouble llr_0_max, llr_0_min, llr_1_max, llr_1_min;\n@@ -291,8 +282,8 @@ double Simulation_EXIT<B,R,Q>\nelse\n{\n// determine the min and max value for llrs / 0 and llrs / 1\n- llr_0_max = llr_1_max = -Inf;\n- llr_0_min = llr_1_min = +Inf;\n+ llr_0_max = llr_1_max = -inf;\n+ llr_0_min = llr_1_min = +inf;\nfor (int i = 0; i < vec_length; i++)\n{\n@@ -314,7 +305,7 @@ double Simulation_EXIT<B,R,Q>\n{\nfor (int i = 0; i < vec_length; i++)\n{\n- if ((double)llrs[i] != -Inf && (double)llrs[i] != Inf)\n+ if ((double)llrs[i] != -inf && (double)llrs[i] != inf)\n{\nif ((int)bits[i] == 0)\nllr_0_mean = llr_0_mean + (double)llrs[i];\n@@ -327,7 +318,7 @@ double Simulation_EXIT<B,R,Q>\nfor (int i = 0; i < vec_length; i++)\n{\n- if ((double)llrs[i] != -Inf && (double)llrs[i] != Inf)\n+ if ((double)llrs[i] != -inf && (double)llrs[i] != inf)\n{\nif ((int)bits[i] == 0)\nllr_0_variance = llr_0_variance + std::pow(((double)llrs[i] - llr_0_mean), 2);\n@@ -365,9 +356,9 @@ double Simulation_EXIT<B,R,Q>\nstd::vector<std::vector<double> > pdf(2, std::vector<double>(bin_count));\nfor (int i = 0; i < vec_length; i++)\n{\n- if ((double)llrs[i] == -Inf)\n+ if ((double)llrs[i] == -inf)\nhistogram[(int)bits[i]][0] += 1;\n- else if ((double)llrs[i] == Inf)\n+ else if ((double)llrs[i] == inf)\nhistogram[(int)bits[i]][bin_count - 1] += 1;\nelse\n{\n@@ -401,8 +392,8 @@ double Simulation_EXIT<B,R,Q>\n// ---------------------------------------------------------------------------------------------------- virtual methods\n-template <typename B, typename R, typename Q>\n-void Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+void Simulation_EXIT<B,R>\n::release_objects()\n{\nif (source != nullptr) { delete source; source = nullptr; }\n@@ -415,8 +406,8 @@ void Simulation_EXIT<B,R,Q>\nif (terminal != nullptr) { delete terminal; terminal = nullptr; }\n}\n-template <typename B, typename R, typename Q>\n-Source<B>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Source<B>* Simulation_EXIT<B,R>\n::build_source()\n{\nreturn Factory_source<B>::build(this->params.source.type,\n@@ -425,8 +416,8 @@ Source<B>* Simulation_EXIT<B,R,Q>\nthis->params.simulation.seed);\n}\n-template <typename B, typename R, typename Q>\n-Encoder<B>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Encoder<B>* Simulation_EXIT<B,R>\n::build_encoder()\n{\ntry\n@@ -443,8 +434,8 @@ Encoder<B>* Simulation_EXIT<B,R,Q>\n}\n}\n-template <typename B, typename R, typename Q>\n-Modulator<B,R,R>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Modulator<B,R,R>* Simulation_EXIT<B,R>\n::build_modulator()\n{\nreturn Factory_modulator<B,R>::build(this->params.modulator.type,\n@@ -462,8 +453,8 @@ Modulator<B,R,R>* Simulation_EXIT<B,R,Q>\nthis->params.demodulator.no_sig2);\n}\n-template <typename B, typename R, typename Q>\n-Modulator<B,R,R>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Modulator<B,R,R>* Simulation_EXIT<B,R>\n::build_modulator_a()\n{\nreturn Factory_modulator<B,R>::build(this->params.modulator.type,\n@@ -481,8 +472,8 @@ Modulator<B,R,R>* Simulation_EXIT<B,R,Q>\nthis->params.demodulator.no_sig2);\n}\n-template <typename B, typename R, typename Q>\n-Channel<R>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Channel<R>* Simulation_EXIT<B,R>\n::build_channel(const int size)\n{\nreturn Factory_channel<R>::build(this->params.channel.type,\n@@ -494,8 +485,8 @@ Channel<R>* Simulation_EXIT<B,R,Q>\nthis->params.simulation.inter_frame_level);\n}\n-template <typename B, typename R, typename Q>\n-Channel<R>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Channel<R>* Simulation_EXIT<B,R>\n::build_channel_a(const int size)\n{\nreturn Factory_channel<R>::build(this->params.channel.type,\n@@ -507,8 +498,8 @@ Channel<R>* Simulation_EXIT<B,R,Q>\nthis->params.simulation.inter_frame_level);\n}\n-template <typename B, typename R, typename Q>\n-SISO<R>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+SISO<R>* Simulation_EXIT<B,R>\n::build_siso()\n{\nreturn this->codec.build_siso();\n@@ -516,8 +507,8 @@ SISO<R>* Simulation_EXIT<B,R,Q>\n// ------------------------------------------------------------------------------------------------- non-virtual method\n-template <typename B, typename R, typename Q>\n-Terminal_EXIT<B,R>* Simulation_EXIT<B,R,Q>\n+template <typename B, typename R>\n+Terminal_EXIT<B,R>* Simulation_EXIT<B,R>\n::build_terminal()\n{\nreturn new Terminal_EXIT<B,R>(params.code.N, snr, sig_a, t_snr, cur_trial, n_trials, I_A, I_E);\n@@ -526,11 +517,11 @@ Terminal_EXIT<B,R>* Simulation_EXIT<B,R,Q>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class aff3ct::simulation::Simulation_EXIT<B_8,R_8,Q_8>;\n-template class aff3ct::simulation::Simulation_EXIT<B_16,R_16,Q_16>;\n-template class aff3ct::simulation::Simulation_EXIT<B_32,R_32,Q_32>;\n-template class aff3ct::simulation::Simulation_EXIT<B_64,R_64,Q_64>;\n+template class aff3ct::simulation::Simulation_EXIT<B_8,R_8>;\n+template class aff3ct::simulation::Simulation_EXIT<B_16,R_16>;\n+template class aff3ct::simulation::Simulation_EXIT<B_32,R_32>;\n+template class aff3ct::simulation::Simulation_EXIT<B_64,R_64>;\n#else\n-template class aff3ct::simulation::Simulation_EXIT<B,R,Q>;\n+template class aff3ct::simulation::Simulation_EXIT<B,R>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"diff": "@@ -21,7 +21,7 @@ namespace aff3ct\n{\nnamespace simulation\n{\n-template <typename B = int, typename R = float, typename Q = R>\n+template <typename B = int, typename R = float>\nclass Simulation_EXIT : public Simulation\n{\nprotected:\n@@ -33,8 +33,8 @@ protected:\nmipp::vector<R> H_N;\n// data vectors\n- mipp::vector<B> B_K, B_N, X_K1, X_N1;\n- mipp::vector<R> X_K2, X_N2;\n+ mipp::vector<B> B_K, B_N, X_N1;\n+ mipp::vector<R> X_K, X_N2;\nmipp::vector<R> Y_N, Y_K;\nmipp::vector<R> La_K1;\nmipp::vector<R> Lch_N1;\n@@ -80,7 +80,7 @@ private:\nvoid simulation_loop ();\nstatic double measure_mutual_info_avg (const mipp::vector<R>& llrs, const mipp::vector<B>& bits);\n- static double measure_mutual_info_histo(const mipp::vector<R>& llrs, const mipp::vector<B>& bits, const int N);\n+ static double measure_mutual_info_histo(const mipp::vector<R>& llrs, const mipp::vector<B>& bits);\nprotected:\nvirtual void release_objects ();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Refacto the EXIT simu + clean code.
|
8,490 |
30.05.2017 10:16:33
| -7,200 |
28ad2bb5698b5bcf2a429968c8622d6185bda4b9
|
Fix a bug with the puncturer in the simulation.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -158,9 +158,16 @@ Puncturer<B,Q>* Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFER_std<B,R,Q>\n::build_interleaver(const int tid, const int seed)\n+{\n+ try\n{\nreturn this->codec.build_interleaver(tid, seed);\n}\n+ catch (std::exception const&)\n+ {\n+ return nullptr;\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nModulator<B,R,R>* Simulation_BFER_std<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Codec.hpp",
"new_path": "src/Tools/Codec/Codec.hpp",
"diff": "@@ -39,17 +39,17 @@ public:\nvirtual module::Interleaver<int>* build_interleaver(const int tid = 0, const int seed = 0)\n{\n- return nullptr;\n+ throw std::runtime_error(\"aff3ct::tools::Codec: impossible to build the interleaver.\");\n}\nvirtual module::Puncturer<B,Q>* build_puncturer(const int tid = 0)\n{\n- return nullptr;\n+ throw std::runtime_error(\"aff3ct::tools::Codec: impossible to build the puncturer.\");\n}\nvirtual module::Encoder<B>* build_encoder(const int tid = 0, const module::Interleaver<int>* itl = nullptr)\n{\n- return nullptr;\n+ throw std::runtime_error(\"aff3ct::tools::Codec: impossible to build the encoder.\");\n}\nvirtual module::Decoder<B,Q>* build_decoder(const int tid = 0, const module::Interleaver<int>* itl = nullptr,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a bug with the puncturer in the simulation.
|
8,490 |
30.05.2017 11:53:01
| -7,200 |
a12f98a5ae238ed51cb4da2964dd9b03fa277f86
|
Add a new add_users mode in the channels.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp",
"new_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp",
"diff": "@@ -7,9 +7,10 @@ using namespace aff3ct::module;\ntemplate <typename R>\nChannel_AWGN_LLR<R>\n-::Channel_AWGN_LLR(const int N, const R sigma, tools::Noise<R> *noise_generator, const int n_frames,\n- const std::string name)\n+::Channel_AWGN_LLR(const int N, const R sigma, tools::Noise<R> *noise_generator, const bool add_users,\n+ const int n_frames, const std::string name)\n: Channel<R>(N, sigma, n_frames, name),\n+ add_users(add_users),\nnoise_generator(noise_generator)\n{\nif (noise_generator == nullptr)\n@@ -26,12 +27,27 @@ Channel_AWGN_LLR<R>\ntemplate <typename R>\nvoid Channel_AWGN_LLR<R>\n::add_noise(const R *X_N, R *Y_N)\n+{\n+ if (add_users)\n+ {\n+ noise_generator->generate(this->noise.data(), this->N, this->sigma);\n+\n+ std::fill(Y_N, Y_N + this->N, (R)0);\n+ for (auto f = 0; f < this->n_frames; f++)\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N[i] += X_N[f * this->N +i];\n+\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N[i] += this->noise[i];\n+ }\n+ else\n{\nnoise_generator->generate(this->noise, this->sigma);\nfor (auto i = 0; i < this->N * this->n_frames; i++)\nY_N[i] = X_N[i] + this->noise[i];\n}\n+}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.hpp",
"new_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.hpp",
"diff": "@@ -14,11 +14,12 @@ template <typename R = float>\nclass Channel_AWGN_LLR : public Channel<R> // flat Rayleigh fading channel\n{\nprivate:\n+ const bool add_users;\ntools::Noise<R> *noise_generator;\npublic:\nChannel_AWGN_LLR(const int N, const R sigma, tools::Noise<R> *noise_generator = new tools::Noise_std<R>(),\n- const int n_frames = 1, const std::string name = \"Channel_AWGN_LLR\");\n+ const bool add_users = false, const int n_frames = 1, const std::string name = \"Channel_AWGN_LLR\");\nvirtual ~Channel_AWGN_LLR();\nvoid add_noise(const R *X_N, R *Y_N); using Channel<R>::add_noise;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/NO/Channel_NO.cpp",
"new_path": "src/Module/Channel/NO/Channel_NO.cpp",
"diff": "@@ -4,8 +4,8 @@ using namespace aff3ct::module;\ntemplate <typename R>\nChannel_NO<R>\n-::Channel_NO(const int N, const int n_frames, const std::string name)\n-: Channel<R>(N, (R)1, n_frames, name)\n+::Channel_NO(const int N, const bool add_users, const int n_frames, const std::string name)\n+: Channel<R>(N, (R)1, n_frames, name), add_users(add_users)\n{\n}\n@@ -19,6 +19,14 @@ template <typename R>\nvoid Channel_NO<R>\n::add_noise(const R *X_N, R *Y_N)\n{\n+ if (add_users)\n+ {\n+ std::fill(Y_N, Y_N + this->N, (R)0);\n+ for (auto f = 0; f < this->n_frames; f++)\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N[i] += X_N[f * this->N +i];\n+ }\n+ else\nstd::copy(X_N, X_N + this->N * this->n_frames, Y_N);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/NO/Channel_NO.hpp",
"new_path": "src/Module/Channel/NO/Channel_NO.hpp",
"diff": "@@ -13,8 +13,12 @@ namespace module\ntemplate <typename R = float>\nclass Channel_NO : public Channel<R>\n{\n+protected:\n+ const bool add_users;\n+\npublic:\n- Channel_NO(const int N, const int n_frames = 1, const std::string name = \"Channel_NO\");\n+ Channel_NO(const int N, const bool add_users = false, const int n_frames = 1,\n+ const std::string name = \"Channel_NO\");\nvirtual ~Channel_NO();\nvoid add_noise(const R *X_N, R *Y_N); using Channel<R>::add_noise;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"diff": "@@ -8,9 +8,10 @@ using namespace aff3ct::module;\ntemplate <typename R>\nChannel_Rayleigh_LLR<R>\n::Channel_Rayleigh_LLR(const int N, const R sigma, const bool complex, tools::Noise<R> *noise_generator,\n- const int n_frames, const std::string name)\n+ const bool add_users, const int n_frames, const std::string name)\n: Channel<R>(N, sigma, n_frames, name),\ncomplex(complex),\n+ add_users(add_users),\ngains(complex ? N * n_frames : 2 * N * n_frames),\nnoise_generator(noise_generator)\n{\n@@ -31,6 +32,46 @@ Channel_Rayleigh_LLR<R>\ntemplate <typename R>\nvoid Channel_Rayleigh_LLR<R>\n::add_noise(const R *X_N, R *Y_N, R *H_N)\n+{\n+ if (add_users)\n+ {\n+ noise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\n+ noise_generator->generate(this->noise.data(), this->N, this->sigma);\n+\n+ std::fill(Y_N, Y_N + this->N, (R)0);\n+\n+ if (this->complex)\n+ {\n+ for (auto f = 0; f < this->n_frames; f++)\n+ {\n+ for (auto i = 0; i < this->N; i += 2)\n+ {\n+ const auto h_re = H_N[f * this->N +i ] = this->gains[f * this->N +i ];\n+ const auto h_im = H_N[f * this->N +i +1] = this->gains[f * this->N +i +1];\n+\n+ Y_N[i ] += X_N[f * this->N +i ] * h_re - X_N[f * this->N +i +1] * h_im;\n+ Y_N[i +1] += X_N[f * this->N +i +1] * h_re + X_N[f * this->N +i ] * h_im;\n+ }\n+ }\n+ }\n+ else\n+ {\n+ for (auto f = 0; f < this->n_frames; f++)\n+ {\n+ for (auto i = 0; i < this->N; i++)\n+ {\n+ const auto h_re = this->gains[f * this->N * 2 + 2*i ];\n+ const auto h_im = this->gains[f * this->N * 2 + 2*i +1];\n+\n+ H_N[f * this->N +i] = std::sqrt(h_re * h_re + h_im * h_im);\n+ Y_N[i] += X_N[f * this->N +i] * H_N[f * this->N +i];\n+ }\n+ }\n+ }\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N[i] += this->noise[i];\n+ }\n+ else\n{\nnoise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\nnoise_generator->generate(this->noise, this->sigma);\n@@ -61,6 +102,7 @@ void Channel_Rayleigh_LLR<R>\n}\n}\n}\n+}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp",
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp",
"diff": "@@ -15,13 +15,14 @@ class Channel_Rayleigh_LLR : public Channel<R> // flat Rayleigh fading channel\n{\nprivate:\nconst bool complex;\n+ const bool add_users;\nmipp::vector<R> gains;\ntools::Noise<R> *noise_generator;\npublic:\nChannel_Rayleigh_LLR(const int N, const R sigma, const bool complex,\n- tools::Noise<R> *noise_generator = new tools::Noise_std<R>(), const int n_frames = 1,\n- const std::string name = \"Channel_Rayleigh_LLR\");\n+ tools::Noise<R> *noise_generator = new tools::Noise_std<R>(), const bool add_users = false,\n+ const int n_frames = 1, const std::string name = \"Channel_Rayleigh_LLR\");\nvirtual ~Channel_Rayleigh_LLR();\nvirtual void add_noise(const R *X_N, R *Y_N, R *H_N); using Channel<R>::add_noise;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/User/Channel_user.cpp",
"new_path": "src/Module/Channel/User/Channel_user.cpp",
"diff": "@@ -7,8 +7,9 @@ using namespace aff3ct::module;\ntemplate <typename R>\nChannel_user<R>\n-::Channel_user(const int N, const std::string filename, const int n_frames, const std::string name)\n-: Channel<R>(N, (R)1, n_frames, name), noise_buff(), noise_counter(0)\n+::Channel_user(const int N, const std::string filename, const bool add_users, const int n_frames,\n+ const std::string name)\n+: Channel<R>(N, (R)1, n_frames, name), add_users(add_users), noise_buff(), noise_counter(0)\n{\nif (filename.empty())\nthrow std::invalid_argument(\"aff3ct::module::Channel_user: path to the file should not be empty.\");\n@@ -59,19 +60,40 @@ Channel_user<R>\ntemplate <typename R>\nvoid Channel_user<R>\n-::_add_noise(const R *X_N, R *Y_N, const int frame_id)\n+::add_noise(const R *X_N, R *Y_N)\n{\n- auto noise = this->noise.data() + this->N * frame_id;\n+ if (add_users)\n+ {\n+ std::fill(Y_N, Y_N + this->N, (R)0);\n+ for (auto f = 0; f < this->n_frames; f++)\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N[i] += X_N[f * this->N +i];\n+\n+ for (auto f = 0; f < this->n_frames; f++)\n+ {\n+ std::copy(this->noise_buff[this->noise_counter].begin(),\n+ this->noise_buff[this->noise_counter].end (),\n+ this->noise.data() + f * this->N);\n+\n+ this->noise_counter = (this->noise_counter +1) % (int)this->noise_buff.size();\n+ }\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N[i] += this->noise[i];\n+ }\n+ else\n+ for (auto f = 0; f < this->n_frames; f++)\n+ {\nstd::copy(this->noise_buff[this->noise_counter].begin(),\nthis->noise_buff[this->noise_counter].end (),\n- noise);\n+ this->noise.data() + f * this->N);\nfor (auto i = 0; i < this->N; i++)\n- Y_N[i] = X_N[i] + noise[i];\n+ Y_N[f * this->N +i] = X_N[f * this->N +i] + this->noise[f * this->N +i];\nthis->noise_counter = (this->noise_counter +1) % (int)this->noise_buff.size();\n}\n+}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/User/Channel_user.hpp",
"new_path": "src/Module/Channel/User/Channel_user.hpp",
"diff": "@@ -14,16 +14,17 @@ template <typename R = float>\nclass Channel_user : public Channel<R>\n{\nprivate:\n+ const bool add_users;\nmipp::vector<mipp::vector<R>> noise_buff;\nint noise_counter;\npublic:\n- Channel_user(const int N, const std::string filename, const int n_frames = 1,\n+ Channel_user(const int N, const std::string filename, const bool add_users = false, const int n_frames = 1,\nconst std::string name = \"Channel_user\");\nvirtual ~Channel_user();\nprotected:\n- void _add_noise(const R *X_N, R *Y_N, const int frame_id);\n+ void add_noise(const R *X_N, R *Y_N); using Channel<R>::add_noise;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -179,10 +179,12 @@ template <typename B, typename R, typename Q>\nChannel<R>* Simulation_BFER_ite<B,R,Q>\n::build_channel(const int tid, const int seed)\n{\n+ const auto add_users = false;\nreturn Factory_channel<R>::build(this->params.channel.type,\nthis->params.code.N_mod,\nthis->sigma,\nthis->params.modulator.complex,\n+ add_users,\nthis->params.channel.path,\nseed,\nthis->params.simulation.inter_frame_level);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -193,10 +193,12 @@ template <typename B, typename R, typename Q>\nChannel<R>* Simulation_BFER_std<B,R,Q>\n::build_channel(const int tid, const int seed)\n{\n+ const auto add_users = false;\nreturn Factory_channel<R>::build(this->params.channel.type,\nthis->params.code.N_mod,\nthis->sigma,\nthis->params.modulator.complex,\n+ add_users,\nthis->params.channel.path,\nseed,\nthis->params.simulation.inter_frame_level);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -476,10 +476,12 @@ template <typename B, typename R>\nChannel<R>* Simulation_EXIT<B,R>\n::build_channel(const int size)\n{\n+ const auto add_users = false;\nreturn Factory_channel<R>::build(this->params.channel.type,\nsize,\nthis->sigma,\nthis->params.modulator.complex,\n+ add_users,\nthis->params.channel.path,\nparams.simulation.seed,\nthis->params.simulation.inter_frame_level);\n@@ -489,10 +491,12 @@ template <typename B, typename R>\nChannel<R>* Simulation_EXIT<B,R>\n::build_channel_a(const int size)\n{\n+ const auto add_users = false;\nreturn Factory_channel<R>::build(this->params.channel.type,\nsize,\n2.f / sig_a,\nthis->params.modulator.complex,\n+ add_users,\nthis->params.channel.path,\nparams.simulation.seed,\nthis->params.simulation.inter_frame_level);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_channel.cpp",
"new_path": "src/Tools/Factory/Factory_channel.cpp",
"diff": "@@ -25,23 +25,24 @@ Channel<R>* Factory_channel<R>\nconst int N,\nconst R sigma,\nconst bool complex,\n+ const bool add_users,\nconst std::string path,\nconst int seed,\nconst int n_frames)\n{\n- if (type == \"AWGN\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_std <R>(seed), n_frames);\n- else if (type == \"AWGN_FAST\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_fast<R>(seed), n_frames);\n- else if (type == \"RAYLEIGH\" ) return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_std <R>(seed), n_frames);\n- else if (type == \"RAYLEIGH_FAST\") return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_fast<R>(seed), n_frames);\n- else if (type == \"USER\" ) return new Channel_user <R>(N, path, n_frames);\n- else if (type == \"NO\" ) return new Channel_NO <R>(N, n_frames);\n+ if (type == \"AWGN\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_std <R>(seed), add_users, n_frames);\n+ else if (type == \"AWGN_FAST\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_fast<R>(seed), add_users, n_frames);\n+ else if (type == \"RAYLEIGH\" ) return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_std <R>(seed), add_users, n_frames);\n+ else if (type == \"RAYLEIGH_FAST\") return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_fast<R>(seed), add_users, n_frames);\n+ else if (type == \"USER\" ) return new Channel_user <R>(N, path, add_users, n_frames);\n+ else if (type == \"NO\" ) return new Channel_NO <R>(N, add_users, n_frames);\n#ifdef CHANNEL_MKL\n- else if (type == \"AWGN_MKL\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_MKL <R>(seed), n_frames);\n- else if (type == \"RAYLEIGH_MKL\" ) return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_MKL <R>(seed), n_frames);\n+ else if (type == \"AWGN_MKL\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_MKL <R>(seed), add_users, n_frames);\n+ else if (type == \"RAYLEIGH_MKL\" ) return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_MKL <R>(seed), add_users, n_frames);\n#endif\n#ifdef CHANNEL_GSL\n- else if (type == \"AWGN_GSL\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_GSL <R>(seed), n_frames);\n- else if (type == \"RAYLEIGH_GSL\" ) return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_GSL <R>(seed), n_frames);\n+ else if (type == \"AWGN_GSL\" ) return new Channel_AWGN_LLR <R>(N, sigma, new tools::Noise_GSL <R>(seed), add_users, n_frames);\n+ else if (type == \"RAYLEIGH_GSL\" ) return new Channel_Rayleigh_LLR<R>(N, sigma, complex, new tools::Noise_GSL <R>(seed), add_users, n_frames);\n#endif\nthrow std::runtime_error(\"aff3ct::tools::Factory_channel: the factory could not allocate the object.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_channel.hpp",
"new_path": "src/Tools/Factory/Factory_channel.hpp",
"diff": "@@ -18,6 +18,7 @@ struct Factory_channel : public Factory\nconst int N,\nconst R sigma,\nconst bool complex,\n+ const bool add_users = false,\nconst std::string path = \"\",\nconst int seed = 0,\nconst int n_frames = 1);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a new add_users mode in the channels.
|
8,490 |
30.05.2017 12:00:59
| -7,200 |
aae84355fbd4a27504e372cc79e317ee7e4a8311
|
Little optim in the channels.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp",
"new_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp",
"diff": "@@ -28,7 +28,7 @@ template <typename R>\nvoid Channel_AWGN_LLR<R>\n::add_noise(const R *X_N, R *Y_N)\n{\n- if (add_users)\n+ if (add_users && this->n_frames > 1)\n{\nnoise_generator->generate(this->noise.data(), this->N, this->sigma);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/NO/Channel_NO.cpp",
"new_path": "src/Module/Channel/NO/Channel_NO.cpp",
"diff": "@@ -19,7 +19,7 @@ template <typename R>\nvoid Channel_NO<R>\n::add_noise(const R *X_N, R *Y_N)\n{\n- if (add_users)\n+ if (add_users && this->n_frames > 1)\n{\nstd::fill(Y_N, Y_N + this->N, (R)0);\nfor (auto f = 0; f < this->n_frames; f++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"diff": "@@ -33,7 +33,7 @@ template <typename R>\nvoid Channel_Rayleigh_LLR<R>\n::add_noise(const R *X_N, R *Y_N, R *H_N)\n{\n- if (add_users)\n+ if (add_users && this->n_frames > 1)\n{\nnoise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\nnoise_generator->generate(this->noise.data(), this->N, this->sigma);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/User/Channel_user.cpp",
"new_path": "src/Module/Channel/User/Channel_user.cpp",
"diff": "@@ -62,7 +62,7 @@ template <typename R>\nvoid Channel_user<R>\n::add_noise(const R *X_N, R *Y_N)\n{\n- if (add_users)\n+ if (add_users && this->n_frames > 1)\n{\nstd::fill(Y_N, Y_N + this->N, (R)0);\nfor (auto f = 0; f < this->n_frames; f++)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Little optim in the channels.
|
8,488 |
30.05.2017 12:46:27
| 14,400 |
2328c58c6c2fcb44ac2db8b53c2d3841d16efcb3
|
Add SCMA files.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hpp",
"diff": "+#ifndef MODULATOR_SCMA_HPP_\n+#define MODULATOR_SCMA_HPP_\n+\n+#include <complex>\n+#include <vector>\n+#include \"Tools/Perf/MIPP/mipp.h\"\n+#include \"modulator_SCMA_functions.hpp\"\n+\n+#include \"../Modulator.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+/*\n+ * Constructor / Destructor\n+ */\n+template <typename B = int, typename R = float, typename Q = R, tools::proto_psi<Q> PSI = tools::psi_0>\n+class Modulator_SCMA : public Modulator<B,R,Q>\n+{\n+private:\n+ const static std::complex<float> CB[6][4][4];\n+ const int re_user[4][3] = {{1,2,4},{0,2,5},{1,3,5},{0,3,4}};\n+ Q arr_phi[4][4][4][4] = {}; // probability functions\n+\n+ const bool disable_sig2;\n+ const R two_on_square_sigma;\n+ const R n0; // 1 / n0 = 179.856115108\n+ const int n_ite;\n+\n+public:\n+ Modulator_SCMA(const int N, const R sigma, const bool disable_sig2 = false, const int n_ite = 1,\n+ const std::string name = \"Modulator_SCMA\");\n+ virtual ~Modulator_SCMA();\n+\n+ virtual void modulate (const B* X_N1, R* X_N2);\n+ virtual void demodulate (const Q *Y_N1, Q *Y_N2);\n+ virtual void demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\n+ virtual void _filter (const R *Y_N1, R *Y_N2);\n+\n+ virtual void set_n_frames(const int n_frames);\n+\n+\n+ static int size_mod(const int N, const int bps)\n+ {\n+ if(bps != 3)\n+ throw std::invalid_argument(\"aff3ct::module::Modulator_SCMA: \\\"bit_per_symbol\\\" value is invalid.\");\n+\n+ return (8 * ((N + 1) / 2));\n+ }\n+\n+ static int size_fil(const int N, const int bps)\n+ {\n+ return size_mod(N,bps);\n+ }\n+\n+private:\n+ Q phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch);\n+ Q phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch, const R* H_N);\n+ void demodulate_batch(const Q* Y_N1, Q* Y_N2, unsigned batch);\n+};\n+}\n+}\n+\n+#include \"Modulator_SCMA.hxx\"\n+\n+#endif /* MODULATOR_SCMA_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hxx",
"diff": "+#include <cassert>\n+\n+#include \"Tools/Display/bash_tools.h\"\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+const std::complex<float> Modulator_SCMA<B,R,Q,PSI>::CB[6][4][4] =\n+{\n+ { // codebook1 (code layer 1)\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { -0.1815f, -0.1318f }, { -0.6351f, -0.4615f }, { 0.6351f, 0.4615f }, { 0.1815f, 0.1318f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { 0.7851f, 0.0000f }, { -0.2243f, 0.0000f }, { 0.2243f, 0.0000f }, { -0.7851f, 0.0000f } }\n+ },\n+ { // codebook2 (code layer 2)\n+ { { 0.7851f, 0.0000f }, { -0.2243f, 0.0000f }, { 0.2243f, 0.0000f }, { -0.7851f, 0.0000f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { -0.1815f, -0.1318f }, { -0.6351f, -0.4615f }, { 0.6351f, 0.4615f }, { 0.1815f, 0.1318f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } }\n+ },\n+ { // codebook3 (code layer 3)\n+ { { -0.6351f, 0.4615f }, { 0.1815f, -0.1318f }, { -0.1815f, 0.1318f }, { 0.6351f, -0.4615f } },\n+ { { 0.1392f, -0.1759f }, { 0.4873f, -0.6156f }, { -0.4873f, 0.6156f }, { -0.1392f, 0.1759f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { 0.0000f, 0.0000f }, { 00000.f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } }\n+ },\n+ { // codebook4 (code layer 4)\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { 0.7851f, 0.0000f }, { -0.2243f, 0.0000f }, { 0.2243f, 0.0000f }, { -0.7851f, 0.0000f } },\n+ { { -0.0055f, -0.2242f }, { -0.0193f, -0.7848f }, { 0.0193f, 0.7848f }, { 0.0055f, 0.2242f } }\n+ },\n+ { // codebook5 (code layer 5)\n+ { { -0.0055f, -0.2242f }, { -0.0193f, -0.7848f }, { 0.0193f, 0.7848f }, { 0.0055f, 0.2242f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { -0.6351f, 0.4615f }, { 0.1815f, -0.1318f }, { -0.1815f, 0.1318f }, { 0.6351f, -0.4615f } }\n+ },\n+ { // codebook6 (code layer 6)\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+ { { 0.7851f, 0.0000f }, { -0.2243f, 0.0000f }, { 0.2243f, 0.0000f }, { -0.7851f, 0.0000f } },\n+ { { 0.1392f, -0.1759f }, { 0.4873f, -0.6156f }, { -0.4873f, 0.6156f }, { -0.1392f, 0.1759f } },\n+ { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } }\n+ },\n+};\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+Modulator_SCMA<B,R,Q,PSI>\n+::Modulator_SCMA(const int N, const R sigma, const bool disable_sig2, const int n_ite, const std::string name)\n+: Modulator<B,R,Q>(N,\n+ Modulator_SCMA<B,R,Q,PSI>::size_mod(N, 3),\n+ Modulator_SCMA<B,R,Q,PSI>::size_fil(N, 3),\n+ sigma,\n+ 6,\n+ name),\n+ disable_sig2 (disable_sig2 ),\n+ two_on_square_sigma((R)2.0 / (sigma * sigma)),\n+ n0 ((R)2.0 * sigma * sigma ),\n+ n_ite (n_ite )\n+{\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+Modulator_SCMA<B,R,Q,PSI>\n+::~Modulator_SCMA()\n+{\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+void Modulator_SCMA<B,R,Q,PSI>\n+::modulate(const B* X_N1, R* X_N2)\n+{\n+ const auto N_mod = 8 * ((this->N + 1) / 2);\n+\n+ for (auto f = 0 ; f < this->n_frames ; f++)\n+ {\n+\n+ for (auto j = 0 ; j < this->N / 2 ; j++)\n+ {\n+ unsigned idx = 0;\n+\n+ for (auto i = 0 ; i < 2 ; i++)\n+ idx += (1 << i) * X_N1[f * this->N + 2 * j + i];\n+\n+ for (auto i = 0 ; i < 4 ; i++)\n+ {\n+ X_N2[f * N_mod + 8 * j + 2 * i ] = CB[f][i][idx].real();\n+ X_N2[f * N_mod + 8 * j + 2 * i +1] = CB[f][i][idx].imag();\n+ }\n+ }\n+\n+\n+ }\n+\n+ if(this->N % 2 == 1)\n+ {\n+ for (auto f = 0 ; f < this->n_frames ; f++)\n+ {\n+ unsigned idx = X_N1[f * this->N + this->N - 1];\n+\n+ for (auto i = 0 ; i < 4 ; i++)\n+ {\n+ X_N2[f * N_mod + 8 * (this->N / 2) + 2 * i ] = CB[f][i][idx].real();\n+ X_N2[f * N_mod + 8 * (this->N / 2) + 2 * i +1] = CB[f][i][idx].imag();\n+ }\n+ }\n+\n+ }\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+void Modulator_SCMA<B,R,Q,PSI>\n+::demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2)\n+{\n+ assert(typeid(R) == typeid(Q));\n+ assert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n+\n+ for (unsigned batch = 0 ; batch < this->N / 2 ; batch++)\n+ {\n+ // filling array_phi luts\n+ for (auto i = 0; i < 4; i++)\n+ for (auto j = 0; j < 4; j++)\n+ for (auto k = 0; k < 4; k++)\n+ for (auto re = 0; re < 4; re++)\n+ arr_phi[re][i][j][k] = phi(Y_N1, i, j, k, re, batch, H_N);\n+\n+\n+ demodulate_batch(Y_N1,Y_N2,batch);\n+\n+ }\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+void Modulator_SCMA<B,R,Q,PSI>\n+::demodulate(const Q *Y_N1, Q *Y_N2)\n+{\n+ assert(typeid(R) == typeid(Q));\n+ assert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n+\n+ for (unsigned batch = 0 ; batch < this->N / 2 ; batch++)\n+ {\n+ // filling array_phi luts\n+ for (auto i = 0; i < 4; i++)\n+ for (auto j = 0; j < 4; j++)\n+ for (auto k = 0; k < 4; k++)\n+ for (auto re = 0; re < 4; re++)\n+ arr_phi[re][i][j][k] = phi(Y_N1, i, j, k, re, batch);\n+\n+ demodulate_batch(Y_N1,Y_N2,batch);\n+ }\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+void Modulator_SCMA<B,R,Q,PSI>\n+::demodulate_batch(const Q* Y_N1, Q* Y_N2, unsigned batch)\n+{\n+ assert(typeid(R) == typeid(Q));\n+ assert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n+\n+ // declarations\n+\n+ Q msg_user_res[6][4][4] = {};\n+ Q msg_res_user[4][6][4] = {};\n+ Q guess[6][4] = {};\n+\n+\n+ // initial probability of each codeword/user\n+ for (auto i = 0; i < 4; i++)\n+ {\n+ msg_user_res[0][1][i] = 0.25;\n+ msg_user_res[0][3][i] = 0.25;\n+ msg_user_res[1][0][i] = 0.25;\n+ msg_user_res[1][2][i] = 0.25;\n+ msg_user_res[2][0][i] = 0.25;\n+ msg_user_res[2][1][i] = 0.25;\n+ msg_user_res[3][2][i] = 0.25;\n+ msg_user_res[3][3][i] = 0.25;\n+ msg_user_res[4][0][i] = 0.25;\n+ msg_user_res[4][3][i] = 0.25;\n+ msg_user_res[5][1][i] = 0.25;\n+ msg_user_res[5][2][i] = 0.25;\n+ }\n+\n+ // starting iteration\n+ for (auto itrr = 0; itrr < n_ite; itrr++)\n+ {\n+ // resource to user messaging\n+ // initialization\n+ for (auto i = 0; i < 4; i++)\n+ {\n+ msg_res_user[0][1][i] = 0;\n+ msg_res_user[0][2][i] = 0;\n+ msg_res_user[0][4][i] = 0;\n+ msg_res_user[1][0][i] = 0;\n+ msg_res_user[1][2][i] = 0;\n+ msg_res_user[1][5][i] = 0;\n+ msg_res_user[2][1][i] = 0;\n+ msg_res_user[2][3][i] = 0;\n+ msg_res_user[2][5][i] = 0;\n+ msg_res_user[3][0][i] = 0;\n+ msg_res_user[3][3][i] = 0;\n+ msg_res_user[3][4][i] = 0;\n+ }\n+\n+ for (auto i = 0; i < 4; i++) // codeword index\n+ for (auto j = 0; j < 4; j++)\n+ for (auto k = 0; k < 4; k++)\n+ for(auto re = 0 ; re < 4 ; re++)\n+ {\n+ msg_res_user[re][re_user[re][0]][i] = msg_res_user[re][re_user[re][0]][i]\n+ + arr_phi[re][i][j][k]\n+ * msg_user_res[re_user[re][1]][re][j]\n+ * msg_user_res[re_user[re][2]][re][k];\n+ msg_res_user[re][re_user[re][1]][i] = msg_res_user[re][re_user[re][1]][i]\n+ + arr_phi[re][j][i][k]\n+ * msg_user_res[re_user[re][0]][re][j]\n+ * msg_user_res[re_user[re][2]][re][k];\n+ msg_res_user[re][re_user[re][2]][i] = msg_res_user[re][re_user[re][2]][i]\n+ + arr_phi[re][j][k][i]\n+ * msg_user_res[re_user[re][0]][re][j]\n+ * msg_user_res[re_user[re][1]][re][k];\n+ }\n+\n+ // user to resource messaging\n+ for (auto i = 0 ; i < 4 ; i++)\n+ {\n+ msg_user_res[0][1][i] = msg_res_user[3][0][i] / (msg_res_user[3][0][0] + msg_res_user[3][0][1] + msg_res_user[3][0][2] + msg_res_user[3][0][3]);\n+ msg_user_res[0][3][i] = msg_res_user[1][0][i] / (msg_res_user[1][0][0] + msg_res_user[1][0][1] + msg_res_user[1][0][2] + msg_res_user[1][0][3]);\n+ msg_user_res[1][0][i] = msg_res_user[2][1][i] / (msg_res_user[2][1][0] + msg_res_user[2][1][1] + msg_res_user[2][1][2] + msg_res_user[2][1][3]);\n+ msg_user_res[1][2][i] = msg_res_user[0][1][i] / (msg_res_user[0][1][0] + msg_res_user[0][1][1] + msg_res_user[0][1][2] + msg_res_user[0][1][3]);\n+ msg_user_res[2][0][i] = msg_res_user[1][2][i] / (msg_res_user[1][2][0] + msg_res_user[1][2][1] + msg_res_user[1][2][2] + msg_res_user[1][2][3]);\n+ msg_user_res[2][1][i] = msg_res_user[0][2][i] / (msg_res_user[0][2][0] + msg_res_user[0][2][1] + msg_res_user[0][2][2] + msg_res_user[0][2][3]);\n+ msg_user_res[3][2][i] = msg_res_user[3][3][i] / (msg_res_user[3][3][0] + msg_res_user[3][3][1] + msg_res_user[3][3][2] + msg_res_user[3][3][3]);\n+ msg_user_res[3][3][i] = msg_res_user[2][3][i] / (msg_res_user[2][3][0] + msg_res_user[2][3][1] + msg_res_user[2][3][2] + msg_res_user[2][3][3]);\n+ msg_user_res[4][0][i] = msg_res_user[3][4][i] / (msg_res_user[3][4][0] + msg_res_user[3][4][1] + msg_res_user[3][4][2] + msg_res_user[3][4][3]);\n+ msg_user_res[4][3][i] = msg_res_user[0][4][i] / (msg_res_user[0][4][0] + msg_res_user[0][4][1] + msg_res_user[0][4][2] + msg_res_user[0][4][3]);\n+ msg_user_res[5][1][i] = msg_res_user[2][5][i] / (msg_res_user[2][5][0] + msg_res_user[2][5][1] + msg_res_user[2][5][2] + msg_res_user[2][5][3]);\n+ msg_user_res[5][2][i] = msg_res_user[1][5][i] / (msg_res_user[1][5][0] + msg_res_user[1][5][1] + msg_res_user[1][5][2] + msg_res_user[1][5][3]);\n+ }\n+ }\n+ // end of iterations\n+\n+ // guess at each user\n+ for (auto i = 0; i < 4; i++) //codeword index\n+ {\n+ guess[0][i] = msg_res_user[3][0][i] * msg_res_user[1][0][i];\n+ guess[1][i] = msg_res_user[2][1][i] * msg_res_user[0][1][i];\n+ guess[2][i] = msg_res_user[0][2][i] * msg_res_user[1][2][i];\n+ guess[3][i] = msg_res_user[2][3][i] * msg_res_user[3][3][i];\n+ guess[4][i] = msg_res_user[3][4][i] * msg_res_user[0][4][i];\n+ guess[5][i] = msg_res_user[1][5][i] * msg_res_user[2][5][i];\n+ }\n+\n+ // LLRs computation\n+ Y_N2[0 * this->N + batch *2 +0] = std::log(guess[0][0] + guess[0][2]) - std::log(guess[0][1] + guess[0][3]);\n+ Y_N2[1 * this->N + batch *2 +0] = std::log(guess[1][0] + guess[1][2]) - std::log(guess[1][1] + guess[1][3]);\n+ Y_N2[2 * this->N + batch *2 +0] = std::log(guess[2][0] + guess[2][2]) - std::log(guess[2][1] + guess[2][3]);\n+ Y_N2[3 * this->N + batch *2 +0] = std::log(guess[3][0] + guess[3][2]) - std::log(guess[3][1] + guess[3][3]);\n+ Y_N2[4 * this->N + batch *2 +0] = std::log(guess[4][0] + guess[4][2]) - std::log(guess[4][1] + guess[4][3]);\n+ Y_N2[5 * this->N + batch *2 +0] = std::log(guess[5][0] + guess[5][2]) - std::log(guess[5][1] + guess[5][3]);\n+\n+\n+ if((this->N % 2) != 1 || batch != ((this->N_mod * this->n_frames) / 8 - 1) )\n+ {\n+ Y_N2[0 * this->N + batch *2 +1] = std::log(guess[0][0] + guess[0][1]) - std::log(guess[0][2] + guess[0][3]);\n+ Y_N2[1 * this->N + batch *2 +1] = std::log(guess[1][0] + guess[1][1]) - std::log(guess[1][2] + guess[1][3]);\n+ Y_N2[2 * this->N + batch *2 +1] = std::log(guess[2][0] + guess[2][1]) - std::log(guess[2][2] + guess[2][3]);\n+ Y_N2[3 * this->N + batch *2 +1] = std::log(guess[3][0] + guess[3][1]) - std::log(guess[3][2] + guess[3][3]);\n+ Y_N2[4 * this->N + batch *2 +1] = std::log(guess[4][0] + guess[4][1]) - std::log(guess[4][2] + guess[4][3]);\n+ Y_N2[5 * this->N + batch *2 +1] = std::log(guess[5][0] + guess[5][1]) - std::log(guess[5][2] + guess[5][3]);\n+ }\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+void Modulator_SCMA<B,R,Q,PSI>\n+::set_n_frames(const int n_frames)\n+{\n+ if (n_frames != 6)\n+ {\n+ std::clog << tools::bold_red(\"(EE) SCMA modulator works only with 6 frames, exiting.\") << std::endl;\n+ std::exit(EXIT_FAILURE);\n+ }\n+}\n+\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+Q Modulator_SCMA<B,R,Q,PSI>\n+::phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch)\n+{\n+ Q phi;\n+ std::complex<Q> tmp;\n+\n+ auto Y_N = std::complex<Q>(Y_N1[batch *8 + 2*re], Y_N1[batch*8 + 2*re +1]);\n+\n+ const auto CB0 = std::complex<Q>((Q)CB[re_user[re][0]][re][i].real(), (Q)CB[re_user[re][0]][re][i].imag());\n+ const auto CB1 = std::complex<Q>((Q)CB[re_user[re][1]][re][j].real(), (Q)CB[re_user[re][1]][re][j].imag());\n+ const auto CB2 = std::complex<Q>((Q)CB[re_user[re][2]][re][k].real(), (Q)CB[re_user[re][2]][re][k].imag());\n+\n+ tmp = Y_N - (CB0 + CB1 + CB2);\n+\n+ phi = PSI(tmp, n0);\n+\n+ return phi;\n+}\n+\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+Q Modulator_SCMA<B,R,Q,PSI>\n+::phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch, const R* H_N)\n+{\n+ Q phi;\n+ std::complex<Q> tmp;\n+ const auto Nmod = size_mod(this->N,3);\n+\n+ const auto Y_N = std::complex<Q>(Y_N1[batch *8 + 2*re], Y_N1[batch*8 + 2*re +1]);\n+\n+ const auto H_N0 = std::complex<Q>((Q)H_N[re_user[re][0]* Nmod + 8 * batch + 2*re], (Q)H_N[re_user[re][0]* Nmod + 8 * batch + 2*re +1]);\n+ const auto H_N1 = std::complex<Q>((Q)H_N[re_user[re][1]* Nmod + 8 * batch + 2*re], (Q)H_N[re_user[re][1]* Nmod + 8 * batch + 2*re +1]);\n+ const auto H_N2 = std::complex<Q>((Q)H_N[re_user[re][2]* Nmod + 8 * batch + 2*re], (Q)H_N[re_user[re][2]* Nmod + 8 * batch + 2*re +1]);\n+\n+ const auto CB0 = std::complex<Q>((Q)CB[re_user[re][0]][re][i].real(), (Q)CB[re_user[re][0]][re][i].imag());\n+ const auto CB1 = std::complex<Q>((Q)CB[re_user[re][1]][re][j].real(), (Q)CB[re_user[re][1]][re][j].imag());\n+ const auto CB2 = std::complex<Q>((Q)CB[re_user[re][2]][re][k].real(), (Q)CB[re_user[re][2]][re][k].imag());\n+\n+ tmp = Y_N - (H_N0 * CB0 + H_N1 * CB1 + H_N2 * CB2);\n+\n+ phi = PSI(tmp, n0);\n+\n+ return phi;\n+}\n+\n+/*\n+ * Filter\n+ */\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+void Modulator_SCMA<B,R,Q,PSI>\n+::_filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil, Y_N2);\n+}\n+\n+}\n+}\n+\n+// template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+// const std::complex<float> Modulator_SCMA<B,R,Q,PSI>::CB[6][4][4] =\n+// {\n+// { // codebook2 (code layer 2)\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { -0.1980f * 0.5816f, -0.3724f * 0.5816f }, { 0.6337f * 0.5816f, 1.1918f * 0.5816f }, { -0.6337f * 0.5816f, -1.1918f* 0.5816f }, { 1.1980f * 0.5816f , 0.3724f *0.5816f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { -1.3498f * 0.5816f, 0.0000f * 0.5816f }, { -0.4218f * 0.5816f, 0.0000f * 0.5816f }, { 0.4218f * 0.5816f, 0.0000f* 0.5816f }, { 1.3498f * 0.5816f , 0.0000f *0.5816f } }\n+// },\n+// { // codebook1 (code layer 1)\n+// { { -1.3498f * 0.5816f, 0.0000f * 0.5816f }, { -0.4218f * 0.5816f, 0.0000f * 0.5816f }, { 0.4218f * 0.5816f, 0.0000f* 0.5816f }, { 1.3498f * 0.5816f , 0.0000f *0.5816f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { -0.1980f * 0.5816f, -0.3724f * 0.5816f }, { 0.6337f * 0.5816f, 1.1918f * 0.5816f }, { -0.6337f * 0.5816f, -1.1918f* 0.5816f }, { 1.1980f * 0.5816f , 0.3724f *0.5816f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } }\n+// },\n+// { // codebook3 (code layer 3)\n+// { { -0.6337f * 0.5816f, -1.1918f * 0.5816f }, { -0.1980f * 0.5816f, -0.3724f * 0.5816f }, { 0.1980f * 0.5816f, 0.3724f* 0.5816f }, { 0.6337f * 0.5816f , 1.1918f *0.5816f } },\n+// { { 0.2109f * 0.5816f, -0.3653f * 0.5816f }, { -0.6749f * 0.5816f, 1.1690f * 0.5816f }, { 0.6749f * 0.5816f, -1.1690f* 0.5816f }, { -0.2109f * 0.5816f , 0.3653f *0.5816f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { 0.0000f, 0.0000f }, { 00000.f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } }\n+// },\n+// { // codebook4 (code layer 4)\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { -1.3498f * 0.5816f, 0.0000f * 0.5816f }, { -0.4218f * 0.5816f, 0.0000f * 0.5816f }, { 0.4218f * 0.5816f, 0.0000f* 0.5816f }, { 1.3498f * 0.5816f , 0.0000f *0.5816f } },\n+// { { 0.2109f * 0.5816f, -0.3653f * 0.5816f }, { -0.6749f * 0.5816f, 1.1690f * 0.5816f }, { 0.6749f * 0.5816f, -1.1690f* 0.5816f }, { -0.2109f * 0.5816f , 0.3653f *0.5816f } },\n+// },\n+// { // codebook5 (code layer 5)\n+// { { 0.2109f * 0.5816f, -0.3653f * 0.5816f }, { -0.6749f * 0.5816f, 1.1690f * 0.5816f }, { 0.6749f * 0.5816f, -1.1690f* 0.5816f }, { -0.2109f * 0.5816f , 0.3653f *0.5816f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { -0.6337f * 0.5816f, -1.1918f * 0.5816f }, { -0.1980f * 0.5816f, -0.3724f * 0.5816f }, { 0.1980f * 0.5816f, 0.3724f* 0.5816f }, { 0.6337f * 0.5816f , 1.1918f *0.5816f } }\n+// },\n+// { // codebook6 (code layer 6)\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } },\n+// { { -1.3498f * 0.5816f, 0.0000f * 0.5816f }, { -0.4218f * 0.5816f, 0.0000f * 0.5816f }, { 0.4218f * 0.5816f, 0.0000f* 0.5816f }, { 1.3498f * 0.5816f , 0.0000f *0.5816f } },\n+// { { 0.2109f * 0.5816f, -0.3653f * 0.5816f }, { -0.6749f * 0.5816f, 1.1690f * 0.5816f }, { 0.6749f * 0.5816f, -1.1690f* 0.5816f }, { -0.2109f * 0.5816f , 0.3653f *0.5816f } },\n+// { { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f }, { 0.0000f, 0.0000f } }\n+// },\n+// };\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Modulator/SCMA/modulator_SCMA_functions.hpp",
"diff": "+#ifndef MODULATOR_SCMA_FUNCTIONS_HPP\n+#define MODULATOR_SCMA_FUNCTIONS_HPP\n+\n+#include <complex>\n+\n+#ifndef _MSC_VER\n+#ifndef __forceinline\n+#define __forceinline inline __attribute__((always_inline))\n+#endif\n+#endif\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+// -------------------------------------------------------------------------- special function prototypes for templates\n+template <typename R>\n+using proto_psi = R (*)(const std::complex<R>& d, const R& n0);\n+\n+// ------------------------------------------------------------------------------------------- special function headers\n+\n+template <typename R>\n+__forceinline R psi_0(const std::complex<R>& d, const R& n0);\n+\n+template <typename R>\n+__forceinline R psi_1(const std::complex<R>& d, const R& n0);\n+\n+template <typename R>\n+__forceinline R psi_2(const std::complex<R>& d, const R& n0);\n+\n+template <typename R>\n+__forceinline R psi_3(const std::complex<R>& d, const R& n0);\n+\n+}\n+}\n+\n+#include \"modulator_SCMA_functions.hxx\"\n+\n+#endif /* MODULATOR_SCMA_FUNCTIONS_HPP */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Modulator/SCMA/modulator_SCMA_functions.hxx",
"diff": "+namespace aff3ct\n+{\n+namespace tools\n+{\n+template <typename R>\n+inline R psi_0(const std::complex<R>& d, const R& n0)\n+{\n+ return std::exp(-std::norm(d) / n0);\n+}\n+\n+template <typename R>\n+inline R psi_1(const std::complex<R>& d, const R& n0)\n+{\n+ return 1 / (std::norm(d) + n0);\n+}\n+\n+template <typename R>\n+inline R psi_2(const std::complex<R>& d, const R& n0)\n+{\n+ return 1 / (8 * std::pow(std::norm(d),2) + n0);\n+}\n+\n+template <typename R>\n+inline R psi_3(const std::complex<R>& d, const R& n0)\n+{\n+ return 1 / (4 * std::pow(std::norm(d),2) + n0);\n+}\n+}\n+}\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add SCMA files.
|
8,488 |
30.05.2017 15:38:22
| 14,400 |
0ecbc9495d330ea2c79b442b3cc1b345c1420ac3
|
Integrate SCMA.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -76,6 +76,8 @@ Launcher<B,R,Q>\nparams.modulator .complex = true;\nparams.demodulator.max = \"MAXSS\";\nparams.demodulator.no_sig2 = false;\n+ params.demodulator.psi = \"PSI0\";\n+ params.demodulator.n_ite = 1;\nparams.channel .domain = \"LLR\";\nparams.channel .type = \"AWGN\";\nparams.channel .path = \"\";\n@@ -187,7 +189,7 @@ void Launcher<B,R,Q>\nopt_args[{\"mod-type\"}] =\n{\"string\",\n\"type of the modulation to use in the simulation.\",\n- \"BPSK, BPSK_FAST, PSK, PAM, QAM, CPM, USER\"};\n+ \"BPSK, BPSK_FAST, PSK, PAM, QAM, CPM, USER, SCMA\"};\nopt_args[{\"mod-bps\"}] =\n{\"positive_int\",\n\"select the number of bits per symbol (default is 1).\"};\n@@ -229,6 +231,13 @@ void Launcher<B,R,Q>\nopt_args[{\"dmod-no-sig2\"}] =\n{\"\",\n\"turn off the division by sigma square in the demodulation.\"};\n+ opt_args[{\"dmod-psi\"}] =\n+ {\"string\",\n+ \"select the type of the psi function to use in the SCMA demodulation.\",\n+ \"PSI0, PSI1, PSI2, PSI3\"};\n+ opt_args[{\"dmod-ite\"}] =\n+ {\"positive int\",\n+ \"select the number of iteration in the demodulator.\"};\n// ------------------------------------------------------------------------------------------------------- channel\nstd::string chan_avail = \"NO, USER, AWGN, AWGN_FAST, RAYLEIGH, RAYLEIGH_FAST\";\n@@ -399,9 +408,15 @@ void Launcher<B,R,Q>\nif (params.modulator.type == \"BPSK\" || params.modulator.type == \"BPSK_FAST\")\nparams.modulator.bits_per_symbol = 1;\n+ // force the number of bits per symbol to 3 when SCMA mod\n+ if (params.modulator.type == \"SCMA\")\n+ params.modulator.bits_per_symbol = 3;\n+\n// --------------------------------------------------------------------------------------------------- demodulator\nif(ar.exist_arg({\"dmod-no-sig2\"})) params.demodulator.no_sig2 = true;\n+ if(ar.exist_arg({\"dmod-ite\" })) params.demodulator.n_ite = ar.get_arg_int({\"dmod-ite\"});\nif(ar.exist_arg({\"dmod-max\" })) params.demodulator.max = ar.get_arg ({\"dmod-max\"});\n+ if(ar.exist_arg({\"dmod-psi\" })) params.demodulator.psi = ar.get_arg ({\"dmod-psi\"});\n// ------------------------------------------------------------------------------------------------------- channel\nif(ar.exist_arg({\"chn-type\" })) params.channel.type = ar.get_arg({\"chn-type\" });\n@@ -638,11 +653,19 @@ std::vector<std::pair<std::string,std::string>> Launcher<B,R,Q>\nstd::string demod_sig2 = (params.demodulator.no_sig2) ? \"off\" : \"on\";\nstd::string demod_max = (params.modulator.type == \"BPSK\" ) ||\n- (params.modulator.type == \"BPSK_FAST\") ?\n+ (params.modulator.type == \"BPSK_FAST\") ||\n+ (params.modulator.type == \"SCMA\" ) ?\n\"unused\" : params.demodulator.max;\n+ std::string demod_ite = std::to_string(params.demodulator.n_ite);\n+ std::string demod_psi = params.demodulator.psi;\np.push_back(std::make_pair(\"Sigma square\", demod_sig2));\np.push_back(std::make_pair(\"Max type\", demod_max ));\n+ if (params.modulator.type == \"SCMA\")\n+ {\n+ p.push_back(std::make_pair(\"Number of iterations\", demod_ite ));\n+ p.push_back(std::make_pair(\"Psi function\", demod_psi ));\n+ }\nreturn p;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hpp",
"new_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hpp",
"diff": "@@ -36,28 +36,29 @@ public:\nvirtual void modulate (const B* X_N1, R* X_N2);\nvirtual void demodulate (const Q *Y_N1, Q *Y_N2);\nvirtual void demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\n- virtual void _filter (const R *Y_N1, R *Y_N2);\n+ virtual void _filter (const R *Y_N1, R *Y_N2, const int frame_id);\nvirtual void set_n_frames(const int n_frames);\n- static int size_mod(const int N, const int bps)\n+ static int size_mod(const int N)\n{\n- if(bps != 3)\n- throw std::invalid_argument(\"aff3ct::module::Modulator_SCMA: \\\"bit_per_symbol\\\" value is invalid.\");\n+ // TODO move elsewhere\n+ // if(bps != 3)\n+ // throw std::invalid_argument(\"aff3ct::module::Modulator_SCMA: \\\"bit_per_symbol\\\" value is invalid.\");\nreturn (8 * ((N + 1) / 2));\n}\n- static int size_fil(const int N, const int bps)\n+ static int size_fil(const int N)\n{\n- return size_mod(N,bps);\n+ return size_mod(N);\n}\nprivate:\n- Q phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch);\n- Q phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch, const R* H_N);\n- void demodulate_batch(const Q* Y_N1, Q* Y_N2, unsigned batch);\n+ Q phi(const Q* Y_N1, int i, int j, int k, int re, int batch);\n+ Q phi(const Q* Y_N1, int i, int j, int k, int re, int batch, const R* H_N);\n+ void demodulate_batch(const Q* Y_N1, Q* Y_N2, int batch);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hxx",
"new_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hxx",
"diff": "#include <cassert>\n+#include <iomanip>\n#include \"Tools/Display/bash_tools.h\"\nnamespace aff3ct\n@@ -50,8 +51,8 @@ template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\nModulator_SCMA<B,R,Q,PSI>\n::Modulator_SCMA(const int N, const R sigma, const bool disable_sig2, const int n_ite, const std::string name)\n: Modulator<B,R,Q>(N,\n- Modulator_SCMA<B,R,Q,PSI>::size_mod(N, 3),\n- Modulator_SCMA<B,R,Q,PSI>::size_fil(N, 3),\n+ Modulator_SCMA<B,R,Q,PSI>::size_mod(N),\n+ Modulator_SCMA<B,R,Q,PSI>::size_fil(N),\nsigma,\n6,\nname),\n@@ -76,7 +77,6 @@ void Modulator_SCMA<B,R,Q,PSI>\nfor (auto f = 0 ; f < this->n_frames ; f++)\n{\n-\nfor (auto j = 0 ; j < this->N / 2 ; j++)\n{\nunsigned idx = 0;\n@@ -90,8 +90,6 @@ void Modulator_SCMA<B,R,Q,PSI>\nX_N2[f * N_mod + 8 * j + 2 * i +1] = CB[f][i][idx].imag();\n}\n}\n-\n-\n}\nif(this->N % 2 == 1)\n@@ -106,7 +104,6 @@ void Modulator_SCMA<B,R,Q,PSI>\nX_N2[f * N_mod + 8 * (this->N / 2) + 2 * i +1] = CB[f][i][idx].imag();\n}\n}\n-\n}\n}\n@@ -117,7 +114,7 @@ void Modulator_SCMA<B,R,Q,PSI>\nassert(typeid(R) == typeid(Q));\nassert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n- for (unsigned batch = 0 ; batch < this->N / 2 ; batch++)\n+ for (auto batch = 0 ; batch < this->N / 2 ; batch++)\n{\n// filling array_phi luts\nfor (auto i = 0; i < 4; i++)\n@@ -139,7 +136,7 @@ void Modulator_SCMA<B,R,Q,PSI>\nassert(typeid(R) == typeid(Q));\nassert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n- for (unsigned batch = 0 ; batch < this->N / 2 ; batch++)\n+ for (auto batch = 0 ; batch < this->N / 2 ; batch++)\n{\n// filling array_phi luts\nfor (auto i = 0; i < 4; i++)\n@@ -154,7 +151,7 @@ void Modulator_SCMA<B,R,Q,PSI>\ntemplate <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\nvoid Modulator_SCMA<B,R,Q,PSI>\n-::demodulate_batch(const Q* Y_N1, Q* Y_N2, unsigned batch)\n+::demodulate_batch(const Q* Y_N1, Q* Y_N2, int batch)\n{\nassert(typeid(R) == typeid(Q));\nassert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n@@ -287,7 +284,7 @@ void Modulator_SCMA<B,R,Q,PSI>\ntemplate <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\nQ Modulator_SCMA<B,R,Q,PSI>\n-::phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch)\n+::phi(const Q* Y_N1, int i, int j, int k, int re, int batch)\n{\nQ phi;\nstd::complex<Q> tmp;\n@@ -307,11 +304,11 @@ Q Modulator_SCMA<B,R,Q,PSI>\ntemplate <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\nQ Modulator_SCMA<B,R,Q,PSI>\n-::phi(const Q* Y_N1, int i, int j, int k, int re, unsigned batch, const R* H_N)\n+::phi(const Q* Y_N1, int i, int j, int k, int re, int batch, const R* H_N)\n{\nQ phi;\nstd::complex<Q> tmp;\n- const auto Nmod = size_mod(this->N,3);\n+ const auto Nmod = size_mod(this->N);\nconst auto Y_N = std::complex<Q>(Y_N1[batch *8 + 2*re], Y_N1[batch*8 + 2*re +1]);\n@@ -335,7 +332,7 @@ Q Modulator_SCMA<B,R,Q,PSI>\n*/\ntemplate <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\nvoid Modulator_SCMA<B,R,Q,PSI>\n-::_filter(const R *Y_N1, R *Y_N2)\n+::_filter(const R *Y_N1, R *Y_N2, const int frame_id)\n{\nstd::copy(Y_N1, Y_N1 + this->N_fil, Y_N2);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -172,14 +172,15 @@ Modulator<B,R,Q>* Simulation_BFER_ite<B,R,Q>\nthis->params.modulator.mapping,\nthis->params.modulator.wave_shape,\nthis->params.demodulator.no_sig2,\n- this->params.simulation.inter_frame_level);\n+ this->params.simulation.inter_frame_level,\n+ this->params.demodulator.n_ite);\n}\ntemplate <typename B, typename R, typename Q>\nChannel<R>* Simulation_BFER_ite<B,R,Q>\n::build_channel(const int tid, const int seed)\n{\n- const auto add_users = false;\n+ const auto add_users = (this->params.modulator.type == \"SCMA\");\nreturn Factory_channel<R>::build(this->params.channel.type,\nthis->params.code.N_mod,\nthis->sigma,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -186,14 +186,15 @@ Modulator<B,R,R>* Simulation_BFER_std<B,R,Q>\nthis->params.modulator.mapping,\nthis->params.modulator.wave_shape,\nthis->params.demodulator.no_sig2,\n- this->params.simulation.inter_frame_level);\n+ this->params.simulation.inter_frame_level,\n+ this->params.demodulator.n_ite);\n}\ntemplate <typename B, typename R, typename Q>\nChannel<R>* Simulation_BFER_std<B,R,Q>\n::build_channel(const int tid, const int seed)\n{\n- const auto add_users = false;\n+ const auto add_users = (this->params.modulator.type == \"SCMA\");\nreturn Factory_channel<R>::build(this->params.channel.type,\nthis->params.code.N_mod,\nthis->sigma,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -450,7 +450,8 @@ Modulator<B,R,R>* Simulation_EXIT<B,R>\nthis->params.modulator.cpm_p,\nthis->params.modulator.mapping,\nthis->params.modulator.wave_shape,\n- this->params.demodulator.no_sig2);\n+ this->params.demodulator.no_sig2,\n+ this->params.demodulator.n_ite);\n}\ntemplate <typename B, typename R>\n@@ -469,14 +470,15 @@ Modulator<B,R,R>* Simulation_EXIT<B,R>\nthis->params.modulator.cpm_p,\nthis->params.modulator.mapping,\nthis->params.modulator.wave_shape,\n- this->params.demodulator.no_sig2);\n+ this->params.demodulator.no_sig2,\n+ this->params.demodulator.n_ite);\n}\ntemplate <typename B, typename R>\nChannel<R>* Simulation_EXIT<B,R>\n::build_channel(const int size)\n{\n- const auto add_users = false;\n+ const auto add_users = (this->params.modulator.type == \"SCMA\");\nreturn Factory_channel<R>::build(this->params.channel.type,\nsize,\nthis->sigma,\n@@ -491,7 +493,7 @@ template <typename B, typename R>\nChannel<R>* Simulation_EXIT<B,R>\n::build_channel_a(const int size)\n{\n- const auto add_users = false;\n+ const auto add_users = (this->params.modulator.type == \"SCMA\");\nreturn Factory_channel<R>::build(this->params.channel.type,\nsize,\n2.f / sig_a,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_modulator.cpp",
"new_path": "src/Tools/Factory/Factory_modulator.cpp",
"diff": "#include \"Module/Modulator/QAM/Modulator_QAM.hpp\"\n#include \"Module/Modulator/PSK/Modulator_PSK.hpp\"\n#include \"Module/Modulator/CPM/Modulator_CPM.hpp\"\n+#include \"Module/Modulator/SCMA/Modulator_SCMA.hpp\"\n#include \"Module/Modulator/User/Modulator_user.hpp\"\n#include \"Factory_modulator.hpp\"\n@@ -28,10 +29,12 @@ Modulator<B,R,Q>* Factory_modulator<B,R,Q>\nconst std::string mapping,\nconst std::string wave,\nconst bool no_sig2,\n- const int n_frames)\n+ const int n_frames,\n+ const int n_ite)\n{\nif (type == \"BPSK\" ) return new Modulator_BPSK <B,R,Q >(N, sigma, no_sig2, n_frames);\nelse if (type == \"BPSK_FAST\") return new Modulator_BPSK_fast<B,R,Q >(N, sigma, no_sig2, n_frames);\n+ else if (type == \"SCMA\" ) return new Modulator_SCMA <B,R,Q >(N, sigma, no_sig2, n_ite );\nelse if (type == \"PAM\" ) return new Modulator_PAM <B,R,Q,MAX>(N, sigma, bps, no_sig2, n_frames);\nelse if (type == \"QAM\" ) return new Modulator_QAM <B,R,Q,MAX>(N, sigma, bps, no_sig2, n_frames);\nelse if (type == \"PSK\" ) return new Modulator_PSK <B,R,Q,MAX>(N, sigma, bps, no_sig2, n_frames);\n@@ -56,12 +59,13 @@ Modulator<B,R,Q>* Factory_modulator<B,R,Q>\nconst std::string mapping,\nconst std::string wave,\nconst bool no_sig2,\n- const int n_frames)\n+ const int n_frames,\n+ const int n_ite)\n{\n- if (max_type == \"MAX\" ) return _build<max <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames);\n- else if (max_type == \"MAXL\" ) return _build<max_linear <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames);\n- else if (max_type == \"MAXS\" ) return _build<max_star <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames);\n- else if (max_type == \"MAXSS\") return _build<max_star_safe<Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames);\n+ if (max_type == \"MAX\" ) return _build<max <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\n+ else if (max_type == \"MAXL\" ) return _build<max_linear <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\n+ else if (max_type == \"MAXS\" ) return _build<max_star <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\n+ else if (max_type == \"MAXSS\") return _build<max_star_safe<Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\nthrow std::runtime_error(\"aff3ct::tools::Factory_modulator: the factory could not allocate the object.\");\n}\n@@ -76,6 +80,7 @@ int Factory_modulator<B,R,Q>\n{\nif (type == \"BPSK\" ) return Modulator_BPSK <B,R,Q>::size_mod(N );\nelse if (type == \"BPSK_FAST\") return Modulator_BPSK_fast<B,R,Q>::size_mod(N );\n+ else if (type == \"SCMA\" ) return Modulator_SCMA <B,R,Q>::size_mod(N );\nelse if (type == \"PAM\" ) return Modulator_PAM <B,R,Q>::size_mod(N, bps );\nelse if (type == \"QAM\" ) return Modulator_QAM <B,R,Q>::size_mod(N, bps );\nelse if (type == \"PSK\" ) return Modulator_PSK <B,R,Q>::size_mod(N, bps );\n@@ -95,6 +100,7 @@ int Factory_modulator<B,R,Q>\n{\nif (type == \"BPSK\" ) return Modulator_BPSK <B,R,Q>::size_fil(N );\nelse if (type == \"BPSK_FAST\") return Modulator_BPSK_fast<B,R,Q>::size_fil(N );\n+ else if (type == \"SCMA\" ) return Modulator_SCMA <B,R,Q>::size_fil(N );\nelse if (type == \"PAM\" ) return Modulator_PAM <B,R,Q>::size_fil(N, bps );\nelse if (type == \"QAM\" ) return Modulator_QAM <B,R,Q>::size_fil(N, bps );\nelse if (type == \"PSK\" ) return Modulator_PSK <B,R,Q>::size_fil(N, bps );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_modulator.hpp",
"new_path": "src/Tools/Factory/Factory_modulator.hpp",
"diff": "@@ -29,7 +29,8 @@ struct Factory_modulator : public Factory\nconst std::string mapping = \"NATURAL\",\nconst std::string wave = \"GMSK\",\nconst bool no_sig2 = false,\n- const int n_frames = 1);\n+ const int n_frames = 1,\n+ const int n_ite = 1);\nstatic int get_buffer_size_after_modulation(const std::string type,\nconst int N,\n@@ -57,7 +58,8 @@ private:\nconst std::string mapping = \"NATURAL\",\nconst std::string wave = \"GMSK\",\nconst bool no_sig2 = false,\n- const int n_frames = 1);\n+ const int n_frames = 1,\n+ const int n_ite = 1);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -114,6 +114,8 @@ struct demodulator_parameters\n{\nstd::string max; // max to use in the demodulation (MAX = max, MAXL = max_linear, MAXS = max_star)\nbool no_sig2; // do not divide by (sig^2) / 2 in the demodulation\n+ std::string psi; // psi function to use in the SCMA demodulation (PSI0, PSI1, PSI2, PSI3)\n+ int n_ite; // number of demodulations/decoding sessions to perform in the BFERI simulations\n};\nstruct channel_parameters\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Integrate SCMA.
|
8,488 |
31.05.2017 09:45:10
| 14,400 |
f9302c327f0a5e56c199663b1ec848999fe272a9
|
Add PSI functions selection.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -410,7 +410,12 @@ void Launcher<B,R,Q>\n// force the number of bits per symbol to 3 when SCMA mod\nif (params.modulator.type == \"SCMA\")\n+ {\nparams.modulator.bits_per_symbol = 3;\n+ if(params.simulation.inter_frame_level != 6)\n+ throw std::invalid_argument(\"aff3ct::launcher::Launcher: sim_inter_lvl must be equal to 6 with SCMA mod\");\n+ }\n+\n// --------------------------------------------------------------------------------------------------- demodulator\nif(ar.exist_arg({\"dmod-no-sig2\"})) params.demodulator.no_sig2 = true;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -163,6 +163,7 @@ Modulator<B,R,Q>* Simulation_BFER_ite<B,R,Q>\nthis->params.code.N,\nthis->sigma,\nthis->params.demodulator.max,\n+ this->params.demodulator.psi,\nthis->params.modulator.bits_per_symbol,\nthis->params.modulator.const_path,\nthis->params.modulator.upsample_factor,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -177,6 +177,7 @@ Modulator<B,R,R>* Simulation_BFER_std<B,R,Q>\nthis->params.code.N,\nthis->sigma,\nthis->params.demodulator.max,\n+ this->params.demodulator.psi,\nthis->params.modulator.bits_per_symbol,\nthis->params.modulator.const_path,\nthis->params.modulator.upsample_factor,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -442,6 +442,7 @@ Modulator<B,R,R>* Simulation_EXIT<B,R>\nthis->params.code.N,\nthis->sigma,\nthis->params.demodulator.max,\n+ this->params.demodulator.psi,\nthis->params.modulator.bits_per_symbol,\nthis->params.modulator.const_path,\nthis->params.modulator.upsample_factor,\n@@ -462,6 +463,7 @@ Modulator<B,R,R>* Simulation_EXIT<B,R>\nthis->params.code.K,\n2.f / sig_a,\nthis->params.demodulator.max,\n+ this->params.demodulator.psi,\nthis->params.modulator.bits_per_symbol,\nthis->params.modulator.const_path,\nthis->params.modulator.upsample_factor,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_modulator.cpp",
"new_path": "src/Tools/Factory/Factory_modulator.cpp",
"diff": "@@ -34,7 +34,6 @@ Modulator<B,R,Q>* Factory_modulator<B,R,Q>\n{\nif (type == \"BPSK\" ) return new Modulator_BPSK <B,R,Q >(N, sigma, no_sig2, n_frames);\nelse if (type == \"BPSK_FAST\") return new Modulator_BPSK_fast<B,R,Q >(N, sigma, no_sig2, n_frames);\n- else if (type == \"SCMA\" ) return new Modulator_SCMA <B,R,Q >(N, sigma, no_sig2, n_ite );\nelse if (type == \"PAM\" ) return new Modulator_PAM <B,R,Q,MAX>(N, sigma, bps, no_sig2, n_frames);\nelse if (type == \"QAM\" ) return new Modulator_QAM <B,R,Q,MAX>(N, sigma, bps, no_sig2, n_frames);\nelse if (type == \"PSK\" ) return new Modulator_PSK <B,R,Q,MAX>(N, sigma, bps, no_sig2, n_frames);\n@@ -44,12 +43,31 @@ Modulator<B,R,Q>* Factory_modulator<B,R,Q>\nthrow std::runtime_error(\"aff3ct::tools::Factory_modulator: the factory could not allocate the object.\");\n}\n+template <typename B, typename R, typename Q>\n+Modulator<B,R,Q>* Factory_modulator<B,R,Q>\n+::_build_scma(const std::string type,\n+ const int N,\n+ const float sigma,\n+ const std::string psi_type,\n+ const bool no_sig2,\n+ const int n_frames,\n+ const int n_ite)\n+{\n+ if (psi_type == \"PSI0\") return new Modulator_SCMA <B,R,Q,psi_0<Q>>(N, sigma, no_sig2, n_ite);\n+ else if (psi_type == \"PSI1\") return new Modulator_SCMA <B,R,Q,psi_1<Q>>(N, sigma, no_sig2, n_ite);\n+ else if (psi_type == \"PSI2\") return new Modulator_SCMA <B,R,Q,psi_2<Q>>(N, sigma, no_sig2, n_ite);\n+ else if (psi_type == \"PSI3\") return new Modulator_SCMA <B,R,Q,psi_3<Q>>(N, sigma, no_sig2, n_ite);\n+\n+ throw std::runtime_error(\"aff3ct::tools::Factory_modulator: the factory could not allocate the object.\");\n+}\n+\ntemplate <typename B, typename R, typename Q>\nModulator<B,R,Q>* Factory_modulator<B,R,Q>\n::build(const std::string type,\nconst int N,\nconst float sigma,\nconst std::string max_type,\n+ const std::string psi_type,\nconst int bps,\nconst std::string path,\nconst int upf,\n@@ -61,11 +79,18 @@ Modulator<B,R,Q>* Factory_modulator<B,R,Q>\nconst bool no_sig2,\nconst int n_frames,\nconst int n_ite)\n+{\n+ if (type == \"SCMA\")\n+ {\n+ return _build_scma(type, N, sigma, psi_type, no_sig2, n_frames, n_ite);\n+ }\n+ else\n{\nif (max_type == \"MAX\" ) return _build<max <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\nelse if (max_type == \"MAXL\" ) return _build<max_linear <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\nelse if (max_type == \"MAXS\" ) return _build<max_star <Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\nelse if (max_type == \"MAXSS\") return _build<max_star_safe<Q>>(type, N, sigma, bps, path, upf, cpm_L, cpm_k, cpm_p, mapping, wave, no_sig2, n_frames, n_ite);\n+ }\nthrow std::runtime_error(\"aff3ct::tools::Factory_modulator: the factory could not allocate the object.\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_modulator.hpp",
"new_path": "src/Tools/Factory/Factory_modulator.hpp",
"diff": "@@ -20,6 +20,7 @@ struct Factory_modulator : public Factory\nconst int N,\nconst float sigma,\nconst std::string max_type = \"MAX\",\n+ const std::string psi_type = \"PSI0\",\nconst int bps = 1,\nconst std::string path = \"\",\nconst int upf = 5,\n@@ -60,6 +61,14 @@ private:\nconst bool no_sig2 = false,\nconst int n_frames = 1,\nconst int n_ite = 1);\n+\n+ static module::Modulator<B,R,Q>* _build_scma(const std::string type,\n+ const int N,\n+ const float sigma,\n+ const std::string psi_type,\n+ const bool no_sig2,\n+ const int n_frames,\n+ const int n_ite);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add PSI functions selection.
|
8,490 |
31.05.2017 19:11:09
| -7,200 |
faeb6bc653ad9b0c701f15fba11a2eaa9dde7aee
|
Move the SCMA function in the Tools folder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hpp",
"new_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hpp",
"diff": "#include <complex>\n#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"modulator_SCMA_functions.hpp\"\n+#include \"Tools/Code/SCMA/modulator_SCMA_functions.hpp\"\n#include \"../Modulator.hpp\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hxx",
"new_path": "src/Module/Modulator/SCMA/Modulator_SCMA.hxx",
"diff": "@@ -66,6 +66,8 @@ Modulator_SCMA<B,R,Q,PSI>\nthrow std::invalid_argument(\"aff3ct::module::Modulator_SCMA: \\\"n_frames\\\" has to be equal to 6.\");\nif (bps != 3)\nthrow std::invalid_argument(\"aff3ct::module::Modulator_SCMA: \\\"bps\\\" has to be equal to 3.\");\n+ if (n_ite <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Modulator_SCMA: \\\"n_ite\\\" has to be greater than 0.\");\n}\ntemplate <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n"
},
{
"change_type": "RENAME",
"old_path": "src/Module/Modulator/SCMA/modulator_SCMA_functions.hpp",
"new_path": "src/Tools/Code/SCMA/modulator_SCMA_functions.hpp",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "src/Module/Modulator/SCMA/modulator_SCMA_functions.hxx",
"new_path": "src/Tools/Code/SCMA/modulator_SCMA_functions.hxx",
"diff": "+#include <cmath>\n+\n+#include \"modulator_SCMA_functions.hpp\"\n+\nnamespace aff3ct\n{\nnamespace tools\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_modulator.cpp",
"new_path": "src/Tools/Factory/Factory_modulator.cpp",
"diff": "#include \"Module/Modulator/SCMA/Modulator_SCMA.hpp\"\n#include \"Module/Modulator/User/Modulator_user.hpp\"\n+#include \"Tools/Code/SCMA/modulator_SCMA_functions.hpp\"\n+\n#include \"Factory_modulator.hpp\"\nusing namespace aff3ct::module;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move the SCMA function in the Tools folder.
|
8,490 |
01.06.2017 10:13:26
| -7,200 |
46ec84f27c7c10dc4ed4aad7803fdf6d2a13fd7f
|
Add a set_seed method to the noise objects + add new constructors for AWGN and Rayleigh channels.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp",
"new_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp",
"diff": "@@ -17,6 +17,16 @@ Channel_AWGN_LLR<R>\nthrow std::invalid_argument(\"aff3ct::module::Channel_AWGN_LLR: \\\"noise_generator\\\" can't be NULL.\");\n}\n+template <typename R>\n+Channel_AWGN_LLR<R>\n+::Channel_AWGN_LLR(const int N, const R sigma, const int seed, const bool add_users, const int n_frames,\n+ const std::string name)\n+: Channel<R>(N, sigma, n_frames, name),\n+ add_users(add_users),\n+ noise_generator(new tools::Noise_std<R>(seed))\n+{\n+}\n+\ntemplate <typename R>\nChannel_AWGN_LLR<R>\n::~Channel_AWGN_LLR()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.hpp",
"new_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.hpp",
"diff": "@@ -20,6 +20,10 @@ private:\npublic:\nChannel_AWGN_LLR(const int N, const R sigma, tools::Noise<R> *noise_generator = new tools::Noise_std<R>(),\nconst bool add_users = false, const int n_frames = 1, const std::string name = \"Channel_AWGN_LLR\");\n+\n+ Channel_AWGN_LLR(const int N, const R sigma, const int seed, const bool add_users = false, const int n_frames = 1,\n+ const std::string name = \"Channel_AWGN_LLR\");\n+\nvirtual ~Channel_AWGN_LLR();\nvoid add_noise(const R *X_N, R *Y_N); using Channel<R>::add_noise;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"diff": "@@ -22,6 +22,20 @@ Channel_Rayleigh_LLR<R>\nthrow std::invalid_argument(\"aff3ct::module::Channel_Rayleigh_LLR: \\\"noise_generator\\\" can't be NULL.\");\n}\n+template <typename R>\n+Channel_Rayleigh_LLR<R>\n+::Channel_Rayleigh_LLR(const int N, const R sigma, const bool complex, const int seed, const bool add_users,\n+ const int n_frames, const std::string name)\n+: Channel<R>(N, sigma, n_frames, name),\n+ complex(complex),\n+ add_users(add_users),\n+ gains(complex ? N * n_frames : 2 * N * n_frames),\n+ noise_generator(new tools::Noise_std<R>(seed))\n+{\n+ if (complex && N % 2)\n+ throw std::invalid_argument(\"aff3ct::module::Channel_Rayleigh_LLR: \\\"N\\\" has to be divisible by 2.\");\n+}\n+\ntemplate <typename R>\nChannel_Rayleigh_LLR<R>\n::~Channel_Rayleigh_LLR()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp",
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp",
"diff": "@@ -23,6 +23,8 @@ public:\nChannel_Rayleigh_LLR(const int N, const R sigma, const bool complex,\ntools::Noise<R> *noise_generator = new tools::Noise_std<R>(), const bool add_users = false,\nconst int n_frames = 1, const std::string name = \"Channel_Rayleigh_LLR\");\n+ Channel_Rayleigh_LLR(const int N, const R sigma, const bool complex, const int seed, const bool add_users = false,\n+ const int n_frames = 1, const std::string name = \"Channel_Rayleigh_LLR\");\nvirtual ~Channel_Rayleigh_LLR();\nvirtual void add_noise(const R *X_N, R *Y_N, R *H_N); using Channel<R>::add_noise;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp",
"new_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp",
"diff": "@@ -12,10 +12,7 @@ Noise_fast<R>\nmt19937(seed),\nmt19937_simd()\n{\n- mipp::vector<int> seeds(mipp::nElReg<int>());\n- for (auto i = 0; i < mipp::nElReg<int>(); i++)\n- seeds[i] = mt19937.rand();\n- mt19937_simd.seed(seeds.data());\n+ this->set_seed(seed);\n}\ntemplate <typename R>\n@@ -24,6 +21,16 @@ Noise_fast<R>\n{\n}\n+template <typename R>\n+void Noise_fast<R>\n+::set_seed(const int seed)\n+{\n+ mipp::vector<int> seeds(mipp::nElReg<int>());\n+ for (auto i = 0; i < mipp::nElReg<int>(); i++)\n+ seeds[i] = mt19937.rand();\n+ mt19937_simd.seed(seeds.data());\n+}\n+\ntemplate <typename R>\nmipp::Reg<R> Noise_fast<R>\n::get_random_simd()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/Fast/Noise_fast.hpp",
"new_path": "src/Tools/Algo/Noise/Fast/Noise_fast.hpp",
"diff": "@@ -23,6 +23,7 @@ public:\nNoise_fast(const int seed = 0);\nvirtual ~Noise_fast();\n+ virtual void set_seed(const int seed);\nvirtual void generate(R *noise, const unsigned length, const R sigma);\nprivate:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/GSL/Noise_GSL.cpp",
"new_path": "src/Tools/Algo/Noise/GSL/Noise_GSL.cpp",
"diff": "@@ -12,10 +12,17 @@ Noise_GSL<R>\n: Noise<R>(),\nrng(gsl_rng_alloc(gsl_rng_mt19937))\n{\n- gsl_rng_set(rng, seed);\n-\nif (rng == nullptr)\nthrow std::runtime_error(\"aff3ct::module::Noise_GSL: \\\"rng\\\" can't be null.\");\n+\n+ this->set_seed(seed);\n+}\n+\n+template <typename R>\n+void Noise_GSL<R>\n+::set_seed(const int seed)\n+{\n+ gsl_rng_set(rng, seed);\n}\ntemplate <typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/GSL/Noise_GSL.hpp",
"new_path": "src/Tools/Algo/Noise/GSL/Noise_GSL.hpp",
"diff": "@@ -22,6 +22,7 @@ public:\nNoise_GSL(const int seed = 0);\nvirtual ~Noise_GSL();\n+ virtual void set_seed(const int seed);\nvirtual void generate(R *noise, const unsigned length, const R sigma);\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.cpp",
"new_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.cpp",
"diff": "@@ -9,20 +9,29 @@ using namespace aff3ct::tools;\ntemplate <typename R>\nNoise_MKL<R>\n::Noise_MKL(const int seed)\n-: Noise<R>()\n+: Noise<R>(), stream_state(nullptr)\n{\n- //vslNewStream(&stream_state, VSL_BRNG_MT2203, seed);\n- vslNewStream(&stream_state, VSL_BRNG_SFMT19937, seed);\n-\n- if (stream_state == nullptr)\n- throw std::runtime_error(\"aff3ct::module::Noise_MKL: \\\"stream_state\\\" can't be null.\");\n+ this->set_seed(const int seed);\n}\ntemplate <typename R>\nNoise_MKL<R>\n::~Noise_MKL()\n{\n- vslDeleteStream(&stream_state);\n+ vslDeleteStream(stream_state);\n+}\n+\n+template <typename R>\n+void Noise_std<R>\n+::set_seed(const int seed)\n+{\n+ if (stream_state != nullptr) vslDeleteStream(stream_state);\n+\n+ //vslNewStream(stream_state, VSL_BRNG_MT2203, seed);\n+ vslNewStream(stream_state, VSL_BRNG_SFMT19937, seed);\n+\n+ if (stream_state == nullptr)\n+ throw std::runtime_error(\"aff3ct::module::Noise_MKL: \\\"stream_state\\\" can't be null.\");\n}\ntemplate <typename R>\n@@ -42,14 +51,14 @@ void Noise_MKL<float>\n::generate(float *noise, const unsigned length, const float sigma)\n{\nvsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\n- stream_state,\n+ *stream_state,\nlength,\nnoise,\n0.0,\nsigma);\n/*\nvsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF,\n- stream_state,\n+ *stream_state,\nlength,\nnoise,\n0.0,\n@@ -68,14 +77,14 @@ void Noise_MKL<double>\n::generate(double *noise, const unsigned length, const double sigma)\n{\nvdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\n- stream_state,\n+ *stream_state,\nlength,\nnoise,\n0.0,\nsigma);\n/*\nvdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF,\n- stream_state,\n+ *stream_state,\nlength,\nnoise,\n0.0,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.hpp",
"new_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.hpp",
"diff": "@@ -15,12 +15,13 @@ template <typename R = float>\nclass Noise_MKL : public Noise<R>\n{\nprivate:\n- VSLStreamStatePtr stream_state;\n+ VSLStreamStatePtr* stream_state;\npublic:\nChannel_AWGN_MKL_LLR(const int seed = 0);\nvirtual ~Channel_AWGN_MKL_LLR();\n+ virtual void set_seed(const int seed);\nvirtual void generate(R *noise, const unsigned length, const R sigma);\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/Noise.hpp",
"new_path": "src/Tools/Algo/Noise/Noise.hpp",
"diff": "@@ -24,7 +24,9 @@ public:\nthis->generate(noise.data(), noise.size(), sigma);\n}\n+ virtual void set_seed(const int seed) = 0;\nvirtual void generate(R *noise, const unsigned length, const R sigma) = 0;\n+\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/Standard/Noise_std.cpp",
"new_path": "src/Tools/Algo/Noise/Standard/Noise_std.cpp",
"diff": "@@ -10,7 +10,7 @@ Noise_std<R>\n::Noise_std(const int seed)\n: Noise<R>()\n{\n- rd_engine.seed(seed);\n+ this->set_seed(seed);\n}\ntemplate <typename R>\n@@ -19,6 +19,13 @@ Noise_std<R>\n{\n}\n+template <typename R>\n+void Noise_std<R>\n+::set_seed(const int seed)\n+{\n+ rd_engine.seed(seed);\n+}\n+\ntemplate <typename R>\nvoid Noise_std<R>\n::generate(R *noise, const unsigned length, const R sigma)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/Standard/Noise_std.hpp",
"new_path": "src/Tools/Algo/Noise/Standard/Noise_std.hpp",
"diff": "@@ -21,6 +21,7 @@ public:\nNoise_std(const int seed = 0);\nvirtual ~Noise_std();\n+ virtual void set_seed(const int seed);\nvirtual void generate(R *noise, const unsigned length, const R sigma);\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a set_seed method to the noise objects + add new constructors for AWGN and Rayleigh channels.
|
8,490 |
01.06.2017 10:26:46
| -7,200 |
1658b8c84b262c3962296165d50828db7f9e8fa0
|
Simplify the Encoder_NO and the Decoder_NO.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"diff": "@@ -6,11 +6,9 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_NO<B,R>\n-::Decoder_NO(const int K, const int N, const int n_frames, const std::string name)\n-: Decoder_SISO<B,R>(K, N, n_frames, 1, name)\n+::Decoder_NO(const int K, const int n_frames, const std::string name)\n+: Decoder_SISO<B,R>(K, K, n_frames, 1, name)\n{\n- if (N != K)\n- throw std::invalid_argument(\"aff3ct::module::Decoder_NO: \\\"K\\\" and \\\"N\\\" have to be equal.\");\n}\ntemplate <typename B, typename R>\n@@ -21,19 +19,19 @@ Decoder_NO<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_NO<B,R>\n-::_hard_decode(const R *Y_N, B *V_K, const int frame_id)\n+::_hard_decode(const R *Y_K, B *V_K, const int frame_id)\n{\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n// take the hard decision\nauto vec_loop_size = (this->K / mipp::nElReg<R>()) * mipp::nElReg<R>();\nfor (auto i = 0; i < vec_loop_size; i += mipp::nElReg<R>())\n{\n- const auto r_Y_N = mipp::Reg<R>(&Y_N[i]);\n- const auto r_s = mipp::cast<R,B>(r_Y_N.sign()) >> (sizeof(B) * 8 - 1); // s[i] = Y_N[i] < 0;\n+ const auto r_Y_N = mipp::Reg<R>(&Y_K[i]);\n+ const auto r_s = mipp::cast<R,B>(r_Y_N.sign()) >> (sizeof(B) * 8 - 1); // s[i] = Y_Ki] < 0;\nr_s.store(&V_K[i]);\n}\nfor (auto i = vec_loop_size; i < this->K; i++)\n- V_K[i] = Y_N[i] < 0;\n+ V_K[i] = Y_K[i] < 0;\nauto d_store = std::chrono::steady_clock::now() - t_store;\nthis->d_store_total += d_store;\n@@ -48,9 +46,9 @@ void Decoder_NO<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_NO<B,R>\n-::_soft_decode(const R *Y_N1, R *Y_N2, const int frame_id)\n+::_soft_decode(const R *Y_K1, R *Y_K2, const int frame_id)\n{\n- std::copy(Y_N1, Y_N1 + this->N, Y_N2);\n+ std::copy(Y_K1, Y_K1 + this->K, Y_K2);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.hpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.hpp",
"diff": "@@ -11,13 +11,13 @@ template <typename B = int, typename R = float>\nclass Decoder_NO : public Decoder_SISO<B,R>\n{\npublic:\n- Decoder_NO(const int K, const int N, const int n_frames = 1, const std::string name = \"Decoder_NO\");\n+ Decoder_NO(const int K, const int n_frames = 1, const std::string name = \"Decoder_NO\");\nvirtual ~Decoder_NO();\nprotected:\n- void _hard_decode(const R *Y_N, B *V_K, const int frame_id);\n+ void _hard_decode(const R *Y_K, B *V_K, const int frame_id);\nvoid _soft_decode(const R *sys, const R *par, R *ext, const int frame_id);\n- void _soft_decode(const R *Y_N1, R *Y_N2, const int frame_id);\n+ void _soft_decode(const R *Y_K1, R *Y_K2, const int frame_id);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/NO/Encoder_NO.cpp",
"new_path": "src/Module/Encoder/NO/Encoder_NO.cpp",
"diff": "@@ -6,11 +6,9 @@ using namespace aff3ct::module;\ntemplate <typename B>\nEncoder_NO<B>\n-::Encoder_NO(const int K, const int N, const int n_frames, const std::string name)\n-: Encoder<B>(K, N, n_frames, name)\n+::Encoder_NO(const int K, const int n_frames, const std::string name)\n+: Encoder<B>(K, K, n_frames, name)\n{\n- if (this->K != this->N)\n- throw std::length_error(\"aff3ct::module::Encoder_NO: \\\"K\\\" and \\\"N\\\" have to be equal.\");\n}\ntemplate <typename B>\n@@ -21,9 +19,9 @@ Encoder_NO<B>\ntemplate <typename B>\nvoid Encoder_NO<B>\n-::encode(const B *U_K, B *X_N)\n+::encode(const B *U_K, B *X_K)\n{\n- std::copy(U_K, U_K + this->N * this->n_frames, X_N);\n+ std::copy(U_K, U_K + this->K * this->n_frames, X_K);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/NO/Encoder_NO.hpp",
"new_path": "src/Module/Encoder/NO/Encoder_NO.hpp",
"diff": "@@ -11,10 +11,10 @@ template <typename B = int>\nclass Encoder_NO : public Encoder<B>\n{\npublic:\n- Encoder_NO(const int K, const int N, const int n_frames = 1, const std::string name = \"Encoder_NO\");\n+ Encoder_NO(const int K, const int n_frames = 1, const std::string name = \"Encoder_NO\");\nvirtual ~Encoder_NO();\n- void encode(const B *U_K, B *X_N); using Encoder<B>::encode;\n+ void encode(const B *U_K, B *X_K); using Encoder<B>::encode;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Uncoded/Codec_uncoded.cpp",
"new_path": "src/Tools/Codec/Uncoded/Codec_uncoded.cpp",
"diff": "+#include <stdexcept>\n+\n#include \"Module/Encoder/NO/Encoder_NO.hpp\"\n#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n@@ -11,6 +13,8 @@ Codec_uncoded<B,Q>\n::Codec_uncoded(const parameters& params)\n: Codec_SISO<B,Q>(params)\n{\n+ if (params.code.K != params.code.N_code)\n+ throw std::invalid_argument(\"aff3ct::tools::Codec_uncoded: \\\"K\\\" has to be equal to \\\"N_code\\\".\");\n}\ntemplate <typename B, typename Q>\n@@ -24,7 +28,6 @@ Encoder<B>* Codec_uncoded<B,Q>\n::build_encoder(const int tid, const module::Interleaver<int>* itl)\n{\nreturn new Encoder_NO<B>(this->params.code.K,\n- this->params.code.N_code,\nthis->params.simulation.inter_frame_level);\n}\n@@ -33,7 +36,6 @@ SISO<Q>* Codec_uncoded<B,Q>\n::build_siso(const int tid, const module::Interleaver<int>* itl, module::CRC<B>* crc)\n{\nreturn new Decoder_NO<B,Q>(this->params.code.K,\n- this->params.code.N_code,\nthis->params.simulation.inter_frame_level);\n}\n@@ -42,7 +44,6 @@ Decoder<B,Q>* Codec_uncoded<B,Q>\n::build_decoder(const int tid, const module::Interleaver<int>* itl, module::CRC<B>* crc)\n{\nreturn new Decoder_NO<B,Q>(this->params.code.K,\n- this->params.code.N_code,\nthis->params.simulation.inter_frame_level);\n}\n@@ -51,9 +52,8 @@ void Codec_uncoded<B,Q>\n::extract_sys_par(const mipp::vector<Q> &Y_N, mipp::vector<Q> &sys, mipp::vector<Q> &par)\n{\nconst auto K = this->params.code.K;\n- const auto N = this->params.code.N_code;\n- if ((int)Y_N.size() != N * this->params.simulation.inter_frame_level)\n+ if ((int)Y_N.size() != K * this->params.simulation.inter_frame_level)\nthrow std::length_error(\"aff3ct::tools::Codec_uncoded: invalid \\\"Y_N\\\" size.\");\nif ((int)sys.size() != K * this->params.simulation.inter_frame_level)\nthrow std::length_error(\"aff3ct::tools::Codec_uncoded: invalid \\\"sys\\\" size.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_encoder_common.cpp",
"new_path": "src/Tools/Factory/Factory_encoder_common.cpp",
"diff": "@@ -19,7 +19,7 @@ Encoder<B>* Factory_encoder_common<B>\nconst int seed,\nconst int n_frames)\n{\n- if (type == \"NO\" ) return new Encoder_NO <B>(K, N, n_frames);\n+ if (type == \"NO\" ) return new Encoder_NO <B>(K, n_frames);\nelse if (type == \"AZCW\" ) return new Encoder_AZCW <B>(K, N, n_frames);\nelse if (type == \"COSET\") return new Encoder_coset<B>(K, N, seed, n_frames);\nelse if (type == \"USER\" ) return new Encoder_user <B>(K, N, path, n_frames);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Simplify the Encoder_NO and the Decoder_NO.
|
8,490 |
01.06.2017 10:38:05
| -7,200 |
d6670f4aba0d3c5bfbe4b47ddeb56d90d29ff223
|
Remove the possibility to choose between LR and LLR: all the simus are now in LLR.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -44,7 +44,7 @@ _aff3ct() {\n${codetype} == \"POLAR\" && ${simutype} == \"GEN\" ]]\nthen\nopts=\"$opts --sim-snr-min -m --snr-min-max -M --sim-snr-step -s \\\n- --sim-snr-type -E --sim-stop-time --sim-threads -t --sim-domain \\\n+ --sim-snr-type -E --sim-stop-time --sim-threads -t \\\n--sim-prec -p --sim-inter-lvl --cde-info-bits -K --cde-size -N \\\n--src-type --src-path --enc-type --enc-path --mod-type --mod-bps\\\n--mod-ups --mod-cpm-ws --mod-cpm-map --mod-cpm-L --mod-cpm-p \\\n@@ -304,11 +304,6 @@ _aff3ct() {\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --sim-domain)\n- local params=\"LR LLR\"\n- COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n- ;;\n-\n--itl-type)\nlocal params\ncase \"${simutype}\" in\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -78,7 +78,6 @@ Launcher<B,R,Q>\nparams.demodulator.no_sig2 = false;\nparams.demodulator.psi = \"PSI0\";\nparams.demodulator.n_ite = 1;\n- params.channel .domain = \"LLR\";\nparams.channel .type = \"AWGN\";\nparams.channel .path = \"\";\nparams.channel .block_fading = \"NO\";\n@@ -137,10 +136,6 @@ void Launcher<B,R,Q>\n{\"positive_int\",\n\"set the task concurrency level (default is 1, no concurrency).\"};\n#endif\n- opt_args[{\"sim-domain\"}] =\n- {\"string\",\n- \"choose the domain in which you want to compute.\",\n- \"LR, LLR\"};\n#ifdef MULTI_PREC\nopt_args[{\"sim-prec\", \"p\"}] =\n{\"positive_int\",\n@@ -318,7 +313,6 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"sim-type\" })) params.simulation.type = ar.get_arg ({\"sim-type\" });\nif(ar.exist_arg({\"sim-pyber\" })) params.simulation.pyber = ar.get_arg ({\"sim-pyber\" });\nif(ar.exist_arg({\"sim-snr-step\", \"s\"})) params.simulation.snr_step = ar.get_arg_float({\"sim-snr-step\", \"s\"});\n- if(ar.exist_arg({\"sim-domain\" })) params.channel.domain = ar.get_arg ({\"sim-domain\" });\nif(ar.exist_arg({\"sim-inter-lvl\" })) params.simulation.inter_frame_level = ar.get_arg_int ({\"sim-inter-lvl\" });\nif(ar.exist_arg({\"sim-stop-time\" })) params.simulation.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\nif(ar.exist_arg({\"sim-seed\" })) params.simulation.seed = ar.get_arg_int ({\"sim-seed\" });\n@@ -633,7 +627,6 @@ std::vector<std::pair<std::string,std::string>> Launcher<B,R,Q>\nstd::vector<std::pair<std::string,std::string>> p;\np.push_back(std::make_pair(\"Type\", params.channel.type));\n- p.push_back(std::make_pair(\"Domain\", params.channel.domain));\nif (params.channel.type == \"USER\")\np.push_back(std::make_pair(\"Path\", params.channel.path));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -138,7 +138,7 @@ void Simulation_EXIT<B,R>\n// if sig_a = 0, La_K2 = 0\nif (sig_a == 0)\n- std::fill(La_K2.begin(), La_K2.end(), params.channel.domain == \"LLR\" ? init_LLR<R>() : init_LR<R>());\n+ std::fill(La_K2.begin(), La_K2.end(), init_LLR<R>());\nif (!params.terminal.disabled && first_loop)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -121,7 +121,6 @@ struct demodulator_parameters\nstruct channel_parameters\n{\nstd::string type;\n- std::string domain;\nstd::string path;\nstd::string block_fading;\n};\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove the possibility to choose between LR and LLR: all the simus are now in LLR.
|
8,490 |
01.06.2017 11:51:13
| -7,200 |
7c414cc66e3aeb59f054239251e71496b6177618
|
Fix a potential bug in the 64-bit mode.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker.cpp",
"new_path": "src/Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker.cpp",
"diff": "@@ -27,11 +27,6 @@ bool CRC_checker<B,R>\n{\nif (ite >= start_crc_check_ite)\n{\n-// // compute the hard decision (for the CRC)\n-// const auto loop_size = (int)s.size();\n-// for (auto i = 0; i < loop_size; i++)\n-// s[i] = (sys[i] + ext[i]) < 0;\n-\n// compute the hard decision (for the CRC): fast version\nconst auto loop_size1 = (int)s.size() / mipp::nElReg<R>();\nfor (auto i = 0; i < loop_size1; i++)\n@@ -52,6 +47,32 @@ bool CRC_checker<B,R>\nreturn false;\n}\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+template <>\n+bool CRC_checker<long long, double>\n+::siso_n(const int ite,\n+ const mipp::vector<double >& sys,\n+ mipp::vector<double >& ext,\n+ mipp::vector<long long>& s)\n+{\n+ if (ite >= start_crc_check_ite)\n+ {\n+ // compute the hard decision (for the CRC)\n+ const auto loop_size = (int)s.size();\n+ for (auto i = 0; i < loop_size; i++)\n+ s[i] = (sys[i] + ext[i]) < 0;\n+\n+ return crc.check(s, simd_inter_frame_level);\n+ }\n+\n+ return false;\n+}\n+}\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a potential bug in the 64-bit mode.
|
8,490 |
01.06.2017 12:00:18
| -7,200 |
0c14f16a3b793ead7342d7e6305a3e3cf923986e
|
Fix compilation error with StarPU.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"diff": "@@ -182,7 +182,7 @@ void SPU_Simulation_BFER_std<B,R,Q>\nauto task_build_crc = CRC <B >::spu_task_build (this->crc [tid], spu_U_K1[tid], spu_U_K2[tid]);\nauto task_encode = Encoder <B >::spu_task_encode (this->encoder [tid], spu_U_K2[tid], spu_X_N1[tid]);\nauto task_puncture = Puncturer<B, Q>::spu_task_puncture(this->puncturer[tid], spu_X_N1[tid], spu_X_N2[tid]);\n- auto task_modulate = Modulator<B,R,R>::spu_task_modulate(this->modem [tid], spu_X_N2[tid], spu_X_N3[tid]);\n+ auto task_modulate = Modem <B,R,R>::spu_task_modulate(this->modem [tid], spu_X_N2[tid], spu_X_N3[tid]);\ntask_gen_source->priority = STARPU_MIN_PRIO +0;\ntask_build_crc ->priority = STARPU_MIN_PRIO +1;\n@@ -207,8 +207,8 @@ void SPU_Simulation_BFER_std<B,R,Q>\nif (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n{\nauto task_add_noise_wg = Channel< R >::spu_task_add_noise_wg (this->channel[tid], spu_X_N3[tid], spu_Y_N1[tid], spu_H_N [tid]);\n- auto task_filter = Modulator<B,R,R>::spu_task_filter (this->modem [tid], spu_Y_N1[tid], spu_Y_N2[tid] );\n- auto task_demodulate_wg = Modulator<B,R,R>::spu_task_demodulate_wg(this->modem [tid], spu_Y_N2[tid], spu_H_N [tid], spu_Y_N3[tid]);\n+ auto task_filter = Modem <B,R,R>::spu_task_filter (this->modem [tid], spu_Y_N1[tid], spu_Y_N2[tid] );\n+ auto task_demodulate_wg = Modem <B,R,R>::spu_task_demodulate_wg(this->modem [tid], spu_Y_N2[tid], spu_H_N [tid], spu_Y_N3[tid]);\ntask_add_noise_wg ->priority = STARPU_MIN_PRIO +5;\ntask_filter ->priority = STARPU_MIN_PRIO +6;\n@@ -225,8 +225,8 @@ void SPU_Simulation_BFER_std<B,R,Q>\nelse // additive channel (AWGN, USER, NO)\n{\nauto task_add_noise = Channel< R >::spu_task_add_noise (this->channel[tid], spu_X_N3[tid], spu_Y_N1[tid]);\n- auto task_filter = Modulator<B,R,R>::spu_task_filter (this->modem [tid], spu_Y_N1[tid], spu_Y_N2[tid]);\n- auto task_demodulate = Modulator<B,R,R>::spu_task_demodulate(this->modem [tid], spu_Y_N2[tid], spu_Y_N3[tid]);\n+ auto task_filter = Modem <B,R,R>::spu_task_filter (this->modem [tid], spu_Y_N1[tid], spu_Y_N2[tid]);\n+ auto task_demodulate = Modem <B,R,R>::spu_task_demodulate(this->modem [tid], spu_Y_N2[tid], spu_Y_N3[tid]);\ntask_add_noise ->priority = STARPU_MIN_PRIO +5;\ntask_filter ->priority = STARPU_MIN_PRIO +6;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix compilation error with StarPU.
|
8,490 |
01.06.2017 15:05:25
| -7,200 |
361f25f83af62bb87ecbbe15c7add3bc8ccb0bd4
|
Externalize sigma computations.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "#include <stdexcept>\n#include <functional>\n+#include \"Tools/general_utils.h\"\n#include \"Tools/Factory/Factory_monitor.hpp\"\n#include \"Tools/Factory/Factory_terminal.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n@@ -129,14 +130,14 @@ void Simulation_BFER<B,R,Q>\nif (params.simulation.snr_type == \"EB\")\n{\nsnr_b = snr;\n- snr_s = snr + 10.f * std::log10(code_rate * (float)params.modulator.bits_per_symbol);\n+ snr_s = ebn0_to_esn0(snr_b, code_rate, params.modulator.bits_per_symbol);\n}\nelse //if(params.simulation.snr_type == \"ES\")\n{\nsnr_s = snr;\n- snr_b = snr - 10.f * std::log10(code_rate * (float)params.modulator.bits_per_symbol);\n+ snr_b = esn0_to_ebn0(snr_s, code_rate, params.modulator.bits_per_symbol);\n}\n- sigma = std::sqrt((float)params.modulator.upsample_factor) / std::sqrt(2.f * std::pow(10.f, (snr_s / 10.f)));\n+ sigma = esn0_to_sigma(snr_s, params.modulator.upsample_factor);\n// dirty hack to override simulation params\nif (this->params.monitor.err_track_revert)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "#include <cmath>\n#include <algorithm>\n+#include \"Tools/general_utils.h\"\n#include \"Tools/Math/utils.h\"\n#include \"Tools/Factory/Factory_source.hpp\"\n@@ -120,8 +121,8 @@ void Simulation_EXIT<B,R>\n{\n// For EXIT simulation, SNR is considered as Es/N0\ncode_rate = 1.f;\n- sigma = std::sqrt((float)params.modulator.upsample_factor) /\n- std::sqrt(2.f * code_rate * (float)params.modulator.bits_per_symbol * std::pow(10.f, (snr / 10.f)));\n+ sigma = esn0_to_sigma(ebn0_to_esn0(snr, code_rate, params.modulator.bits_per_symbol),\n+ params.modulator.upsample_factor);\ncodec.snr_precompute(sigma);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/general_utils.cpp",
"new_path": "src/Tools/general_utils.cpp",
"diff": "+#include <cmath>\n+#include <limits>\n#include <sstream>\n+#include <stdexcept>\n#include \"general_utils.h\"\n@@ -12,3 +15,70 @@ std::vector<std::string> aff3ct::tools::string_split(const std::string &s, char\nreturn elems;\n}\n+\n+template <typename R>\n+R aff3ct::tools::sigma_to_esn0(const R sigma, const int upsample_factor)\n+{\n+ if (upsample_factor <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::sigma_to_esn0: \\\"upsample_factor\\\" has to be greater than 0.\");\n+ if (sigma < (R)0)\n+ throw std::invalid_argument(\"aff3ct::tools::sigma_to_esn0: \\\"sigma\\\" has to be greater than 0.\");\n+\n+ if (sigma == (R)0)\n+ {\n+ const auto esn0 = std::numeric_limits<R>::infinity();\n+ return esn0;\n+ }\n+ else\n+ {\n+ const auto esn0 = (R)10 * std::log10((R)upsample_factor / (sigma * sigma));\n+ return esn0;\n+ }\n+}\n+\n+template <typename R>\n+R aff3ct::tools::esn0_to_sigma(const R esn0, const int upsample_factor)\n+{\n+ if (upsample_factor <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::esn0_to_sigma: \\\"upsample_factor\\\" has to be greater than 0.\");\n+\n+ const auto sigma = std::sqrt((R)upsample_factor / ((R)2 * std::pow((R)10, (esn0 / (R)10))));\n+ return sigma;\n+}\n+\n+template <typename R>\n+R aff3ct::tools::esn0_to_ebn0(const R esn0, const R code_rate, const int bps)\n+{\n+ if (code_rate <= (R)0 || code_rate > (R)1)\n+ throw std::invalid_argument(\"aff3ct::tools::esn0_to_ebn0: \\\"code_rate\\\" has to be greater than 0 and \"\n+ \"smaller or equal to 1.\");\n+ if (bps <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::esn0_to_ebn0: \\\"bps\\\" has to be greater than 0.\");\n+\n+ const auto ebn0 = esn0 - (R)10 * std::log10(code_rate * (R)bps);\n+ return ebn0;\n+}\n+\n+template <typename R>\n+R aff3ct::tools::ebn0_to_esn0(const R ebn0, const R code_rate, const int bps)\n+{\n+ if (code_rate <= (R)0 || code_rate > (R)1)\n+ throw std::invalid_argument(\"aff3ct::tools::ebn0_to_esn0: \\\"code_rate\\\" has to be greater than 0 and \"\n+ \"smaller or equal to 1.\");\n+ if (bps <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::ebn0_to_esn0: \\\"bps\\\" has to be greater than 0.\");\n+\n+ const auto esn0 = ebn0 + (R)10 * std::log10(code_rate * (R)bps);\n+ return esn0;\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+template float aff3ct::tools::sigma_to_esn0<float >(const float, const int);\n+template double aff3ct::tools::sigma_to_esn0<double>(const double, const int);\n+template float aff3ct::tools::esn0_to_sigma<float >(const float, const int);\n+template double aff3ct::tools::esn0_to_sigma<double>(const double, const int);\n+template float aff3ct::tools::esn0_to_ebn0 <float >(const float, const float, const int);\n+template double aff3ct::tools::esn0_to_ebn0 <double>(const double, const double, const int);\n+template float aff3ct::tools::ebn0_to_esn0 <float >(const float, const float, const int);\n+template double aff3ct::tools::ebn0_to_esn0 <double>(const double, const double, const int);\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/general_utils.h",
"new_path": "src/Tools/general_utils.h",
"diff": "@@ -9,6 +9,18 @@ namespace aff3ct\nnamespace tools\n{\nstd::vector<std::string> string_split(const std::string &s, char delim);\n+\n+template <typename R = float>\n+R sigma_to_esn0(const R sigma, const int upsample_factor = 1);\n+\n+template <typename R = float>\n+R esn0_to_sigma(const R esn0, const int upsample_factor = 1);\n+\n+template <typename R = float>\n+R esn0_to_ebn0(const R esn0, const R code_rate = 1, const int bps = 1);\n+\n+template <typename R = float>\n+R ebn0_to_esn0(const R ebn0, const R code_rate = 1, const int bps = 1);\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Externalize sigma computations.
|
8,490 |
01.06.2017 15:41:07
| -7,200 |
0b558e7c7797171b990a8b4713e159eac9671bd3
|
Improve the terminal for the library use case.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "@@ -130,11 +130,12 @@ void Simulation_BFER_ite_threads<B,R,Q>\n::simulation_loop(const int tid)\n{\nusing namespace std::chrono;\n+ auto t_snr = steady_clock::now();\n// simulation loop\nwhile ((!this->monitor_red->fe_limit_achieved()) && // while max frame error count has not been reached\n(this->params.simulation.stop_time == seconds(0) ||\n- (steady_clock::now() - this->t_snr) < this->params.simulation.stop_time))\n+ (steady_clock::now() - t_snr) < this->params.simulation.stop_time))\n{\nif (this->params.source.type != \"AZCW\")\n{\n@@ -278,13 +279,14 @@ void Simulation_BFER_ite_threads<B,R,Q>\n::simulation_loop_debug()\n{\nusing namespace std::chrono;\n+ auto t_snr = steady_clock::now();\nFrame_trace<B> ft(this->params.simulation.debug_limit, this->params.simulation.debug_precision); // frame trace to display the vectors\n// simulation loop\nwhile (!this->monitor_red->fe_limit_achieved() && // while max frame error count has not been reached\n(this->params.simulation.stop_time == seconds(0) ||\n- (steady_clock::now() - this->t_snr) < this->params.simulation.stop_time))\n+ (steady_clock::now() - t_snr) < this->params.simulation.stop_time))\n{\nstd::cout << \"-------------------------------\" << std::endl;\nstd::cout << \"New encoding/decoding session !\" << std::endl;\n@@ -587,7 +589,6 @@ Terminal* Simulation_BFER_ite_threads<B,R,Q>\nthis->snr_s,\nthis->snr_b,\n*this->monitor_red,\n- this->t_snr,\n&d_dec);\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -119,8 +119,6 @@ void Simulation_BFER<B,R,Q>\n// for each SNR to be simulated\nfor (snr = params.simulation.snr_min; snr <= params.simulation.snr_max; snr += params.simulation.snr_step)\n{\n- t_snr = std::chrono::steady_clock::now();\n-\nauto info_bits = params.code.K;\nif (!this->params.crc.poly.empty() && !this->params.crc.inc_code_rate)\ninfo_bits -= params.crc.size;\n@@ -355,8 +353,7 @@ Terminal* Simulation_BFER<B,R,Q>\nthis->params.code.N_code,\nthis->snr_s,\nthis->snr_b,\n- *this->monitor_red,\n- this->t_snr);\n+ *this->monitor_red);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"diff": "@@ -56,8 +56,6 @@ protected:\ntools::Terminal *terminal;\n// time points and durations\n- std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\n-\nstd::vector<std::map<std::pair<int, std::string>, std::chrono::nanoseconds>> durations;\nstd::map<std::pair<int, std::string>, std::chrono::nanoseconds> durations_red;\nstd::map<std::pair<int, std::string>, std::chrono::nanoseconds> durations_sum;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "@@ -142,11 +142,12 @@ void Simulation_BFER_std_threads<B,R,Q>\n::simulation_loop(const int tid)\n{\nusing namespace std::chrono;\n+ auto t_snr = steady_clock::now();\n// simulation loop\nwhile ((!this->monitor_red->fe_limit_achieved()) && // while max frame error count has not been reached\n(this->params.simulation.stop_time == seconds(0) ||\n- (steady_clock::now() - this->t_snr) < this->params.simulation.stop_time))\n+ (steady_clock::now() - t_snr) < this->params.simulation.stop_time))\n{\nif (this->params.source.type != \"AZCW\")\n{\n@@ -455,7 +456,6 @@ Terminal* Simulation_BFER_std_threads<B,R,Q>\nthis->snr_s,\nthis->snr_b,\n*this->monitor_red,\n- this->t_snr,\n&d_dec);\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -132,8 +132,6 @@ void Simulation_EXIT<B,R>\nI_A = 0.0;\nI_E = 0.0;\n- t_snr = std::chrono::steady_clock::now();\n-\n// allocate and build all the communication chain to generate EXIT chart\nthis->build_communication_chain();\n@@ -520,7 +518,7 @@ template <typename B, typename R>\nTerminal_EXIT<B,R>* Simulation_EXIT<B,R>\n::build_terminal()\n{\n- return new Terminal_EXIT<B,R>(params.code.N, snr, sig_a, t_snr, cur_trial, n_trials, I_A, I_E);\n+ return new Terminal_EXIT<B,R>(params.code.N, snr, sig_a, cur_trial, n_trials, I_A, I_E);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"diff": "@@ -66,9 +66,6 @@ protected:\nmodule::SISO<R> *siso;\ntools::Terminal_EXIT<B,R> *terminal;\n- // time points and durations\n- std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\n-\npublic:\nSimulation_EXIT(const tools::parameters& params, tools::Codec_SISO<B,R> &codec);\nvirtual ~Simulation_EXIT();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"diff": "@@ -14,18 +14,17 @@ template <typename B>\nTerminal_BFER<B>\n::Terminal_BFER(const int K,\nconst int N,\n- const float &snr_s,\n- const float &snr_b,\nconst Monitor<B> &monitor,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\n+ const float *esn0,\n+ const float *ebn0,\nconst std::chrono::nanoseconds *d_decod_total)\n: Terminal ( ),\nK (K ),\nN (N ),\n- snr_s (snr_s ),\n- snr_b (snr_b ),\n+ esn0 (esn0 ),\n+ ebn0 (ebn0 ),\nmonitor (monitor ),\n- t_snr (t_snr ),\n+ t_snr (std::chrono::steady_clock::now()),\nd_decod_total (d_decod_total ),\nreal_time_state(0 )\n{\n@@ -37,6 +36,27 @@ Terminal_BFER<B>\nthrow std::invalid_argument(\"aff3ct::tools::Terminal_BFER: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n}\n+template <typename B>\n+Terminal_BFER<B>\n+::Terminal_BFER(const int K,\n+ const Monitor<B> &monitor,\n+ const float *esn0,\n+ const float *ebn0,\n+ const std::chrono::nanoseconds *d_decod_total)\n+: Terminal ( ),\n+ K (K ),\n+ N (K ),\n+ esn0 (esn0 ),\n+ ebn0 (ebn0 ),\n+ monitor (monitor ),\n+ t_snr (std::chrono::steady_clock::now()),\n+ d_decod_total (d_decod_total ),\n+ real_time_state(0 )\n+{\n+ if (K <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER: \\\"K\\\" has to be greater than 0.\");\n+}\n+\ntemplate <typename B>\nstd::string Terminal_BFER<B>\n::get_time_format(float secondes)\n@@ -152,6 +172,18 @@ void Terminal_BFER<B>\nif (Monitor<B>::is_interrupt()) stream << \"\\r\";\n+ std::stringstream esn0_str;\n+ if (esn0 == nullptr)\n+ esn0_str << \" - \";\n+ else\n+ esn0_str << setprecision(2) << fixed << setw(6) << *esn0;\n+\n+ std::stringstream ebn0_str;\n+ if (ebn0 == nullptr)\n+ ebn0_str << \" - \";\n+ else\n+ ebn0_str << setprecision(2) << fixed << setw(5) << *ebn0;\n+\n#ifdef _WIN32\nstringstream str_ber, str_fer;\nstr_ber << setprecision(2) << scientific << setw(9) << ber;\n@@ -161,8 +193,8 @@ void Terminal_BFER<B>\nunsigned long long l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\n- stream << setprecision( 2) << fixed << setw(6) << snr_s << bold(\" | \");\n- stream << setprecision( 2) << fixed << setw(5) << snr_b << bold(\" | \");\n+ stream << esn0_str.str() << bold(\" | \");\n+ stream << ebn0_str.str() << bold(\" | \");\nstream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(9) << ((fra > l0) ? (float)fra : fra) << bold(\" | \");\nstream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(9) << (( be > l1) ? (float) be : be) << bold(\" | \");\nstream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(9) << (( fe > l1) ? (float) fe : fe) << bold(\" | \");\n@@ -184,8 +216,8 @@ void Terminal_BFER<B>\nunsigned long long l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\n- stream << setprecision( 2) << fixed << setw(6) << snr_s << bold(\" | \");\n- stream << setprecision( 2) << fixed << setw(5) << snr_b << bold(\" | \");\n+ stream << esn0_str.str() << bold(\" | \");\n+ stream << ebn0_str.str() << bold(\" | \");\nstream << setprecision((fra > l0) ? 2 : 0) << ((fra > l0) ? scientific : fixed) << setw(8) << ((fra > l0) ? (float)fra : fra) << bold(\" | \");\nstream << setprecision(( be > l1) ? 2 : 0) << ((be > l1) ? scientific : fixed) << setw(8) << (( be > l1) ? (float) be : be) << bold(\" | \");\nstream << setprecision(( fe > l1) ? 2 : 0) << ((fe > l1) ? scientific : fixed) << setw(8) << (( fe > l1) ? (float) fe : fe) << bold(\" | \");\n@@ -245,6 +277,8 @@ void Terminal_BFER<B>\nif (Monitor<B>::is_interrupt()) stream << \" x\" << std::endl;\nelse stream << \" \" << std::endl;\n+\n+ t_snr = std::chrono::steady_clock::now();\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.hpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.hpp",
"diff": "@@ -17,20 +17,25 @@ class Terminal_BFER : public Terminal\nprotected:\nconst int K;\nconst int N;\n- const float &snr_s;\n- const float &snr_b;\n+ const float *esn0;\n+ const float *ebn0;\nconst module::Monitor<B> &monitor;\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr;\n+ std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\nconst std::chrono::nanoseconds *d_decod_total;\nunsigned short real_time_state;\npublic:\nTerminal_BFER(const int K,\nconst int N,\n- const float &snr_s,\n- const float &snr_b,\nconst module::Monitor<B> &monitor,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\n+ const float *esn0 = nullptr,\n+ const float *ebn0 = nullptr,\n+ const std::chrono::nanoseconds *d_decod_total = nullptr);\n+\n+ Terminal_BFER(const int K,\n+ const module::Monitor<B> &monitor,\n+ const float *esn0 = nullptr,\n+ const float *ebn0 = nullptr,\nconst std::chrono::nanoseconds *d_decod_total = nullptr);\nvirtual ~Terminal_BFER() {}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER_legacy.cpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER_legacy.cpp",
"diff": "@@ -12,10 +12,9 @@ template <typename B>\nTerminal_BFER_legacy<B>\n::Terminal_BFER_legacy(const int K,\nconst int N,\n- const float &snr,\nconst Monitor<B> &monitor,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr)\n-: Terminal(), K(K), N(N), snr(snr), monitor(monitor), t_snr(t_snr), real_time_state(0)\n+ const float &snr)\n+: Terminal(), K(K), N(N), snr(snr), monitor(monitor), t_snr(std::chrono::steady_clock::now()), real_time_state(0)\n{\nif (K <= 0)\nthrow std::invalid_argument(\"aff3ct::tools::Terminal_BFER_legacy: \\\"K\\\" has to be greater than 0.\");\n@@ -114,6 +113,8 @@ void Terminal_BFER_legacy<B>::final_report(std::ostream &stream)\nstream << \" | RUNTIME = \" << std::setprecision(0) << std::fixed << std::setw(8) << rt_format << \" \"\n<< std::endl;\n+\n+ t_snr = std::chrono::steady_clock::now();\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER_legacy.hpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER_legacy.hpp",
"diff": "@@ -19,15 +19,14 @@ protected:\nconst int N;\nconst float &snr;\nconst module::Monitor<B> &monitor;\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr;\n+ std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\nunsigned short real_time_state;\npublic:\nTerminal_BFER_legacy(const int K,\nconst int N,\n- const float &snr,\nconst module::Monitor<B> &monitor,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr);\n+ const float &snr);\nvirtual ~Terminal_BFER_legacy() {}\nvoid temp_report (std::ostream &stream = std::cout);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"new_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"diff": "@@ -13,7 +13,6 @@ Terminal_EXIT<B,R>\n::Terminal_EXIT(const int& N,\nconst R& snr,\nconst R& sig_a,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst int& cur_t,\nconst int& trials,\ndouble& I_A,\n@@ -22,7 +21,7 @@ Terminal_EXIT<B,R>\nN(N),\nsnr(snr),\nsig_a(sig_a),\n- t_snr(t_snr),\n+ t_snr(std::chrono::steady_clock::now()),\ncur_t(cur_t),\ntrials(trials),\nI_A(I_A),\n@@ -123,6 +122,8 @@ void Terminal_EXIT<B,R>\nauto et_format = get_time_format(et);\nstream << \" | \" << std::setprecision(0) << std::fixed << std::setw(8) << et_format << \" \" << std::endl;\n+\n+ t_snr = std::chrono::steady_clock::now();\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp",
"new_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp",
"diff": "@@ -17,7 +17,7 @@ protected:\nconst int N;\nconst R snr;\nconst R sig_a;\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr;\n+ std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\nconst int &cur_t;\nconst int &trials;\ndouble &I_A;\n@@ -28,7 +28,6 @@ public:\nTerminal_EXIT(const int& N,\nconst R& snr,\nconst R& sig_a,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst int& cur_t,\nconst int& trials,\ndouble& I_A,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_terminal.cpp",
"new_path": "src/Tools/Factory/Factory_terminal.cpp",
"diff": "@@ -16,11 +16,10 @@ Terminal* Factory_terminal<B>\nconst float &snr_s,\nconst float &snr_b,\nconst Monitor<B> &monitor,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst std::chrono::nanoseconds *d_decod_total)\n{\n- if (type == \"STD\" ) return new Terminal_BFER <B>(K, N, snr_s, snr_b, monitor, t_snr, d_decod_total);\n- else if (type == \"LEGACY\") return new Terminal_BFER_legacy<B>(K, N, snr_b, monitor, t_snr );\n+ if (type == \"STD\" ) return new Terminal_BFER <B>(K, N, monitor, &snr_s, &snr_b, d_decod_total);\n+ else if (type == \"LEGACY\") return new Terminal_BFER_legacy<B>(K, N, monitor, snr_b );\nthrow std::runtime_error(\"aff3ct::tools::Factory_terminal: the factory could not allocate the object.\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_terminal.hpp",
"new_path": "src/Tools/Factory/Factory_terminal.hpp",
"diff": "@@ -22,7 +22,6 @@ struct Factory_terminal : public Factory\nconst float &snr_s,\nconst float &snr_b,\nconst module::Monitor<B> &monitor,\n- const std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> &t_snr,\nconst std::chrono::nanoseconds *d_decod_total = nullptr);\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the terminal for the library use case.
|
8,490 |
01.06.2017 17:08:46
| -7,200 |
6e9b003da889f7d7e37564fef7064d4b8c2d1329
|
Improve a little bit the repetiton decoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Repetition/Decoder_repetition.cpp",
"new_path": "src/Module/Decoder/Repetition/Decoder_repetition.cpp",
"diff": "@@ -10,8 +10,7 @@ template <typename B, typename R>\nDecoder_repetition<B,R>\n::Decoder_repetition(const int& K, const int& N, const bool buffered_encoding, const int n_frames,\nconst std::string name)\n- : Decoder<B,R>(K, N, n_frames, 1, name),\n- SISO < R>(K, N, n_frames, 1, name + \"_siso\"),\n+ : Decoder_SISO<B,R>(K, N, n_frames, 1, name),\nrep_count((N/K) -1), buffered_encoding(buffered_encoding), sys(K), par(K * rep_count), ext(K)\n{\nif (N % K)\n@@ -66,13 +65,8 @@ void Decoder_repetition<B,R>\nfor (auto i = 0; i < vec_loop_size; i += mipp::nElReg<R>())\n{\nconst auto r_ext = mipp::Reg<R>(&ext[i]);\n+ const auto r_s = mipp::cast<R,B>(r_ext.sign()) >> (sizeof(B) * 8 - 1);\n- // s[i] = ext[i] < 0;\n-#if defined(MIPP_NO_INTRINSICS) && defined(_MSC_VER)\n- const auto r_s = mipp::Reg<B>((B)r_ext.sign().r) >> (sizeof(B) * 8 - 1);\n-#else\n- const auto r_s = mipp::Reg<B>(r_ext.sign().r) >> (sizeof(B) * 8 - 1);\n-#endif\nr_s.store(&V_K[i]);\n}\nfor (auto i = vec_loop_size; i < this->K; i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Repetition/Decoder_repetition.hpp",
"new_path": "src/Module/Decoder/Repetition/Decoder_repetition.hpp",
"diff": "#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"../Decoder.hpp\"\n-#include \"../SISO.hpp\"\n+#include \"../Decoder_SISO.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_repetition : public Decoder<B,R>, public SISO<R>\n+class Decoder_repetition : public Decoder_SISO<B,R>\n{\nprotected:\nconst int rep_count; // number of repetitions\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve a little bit the repetiton decoder.
|
8,490 |
02.06.2017 11:31:22
| -7,200 |
8699fb32df5a3ab3c822e2569e2d87e1f82d616c
|
Refacto the Terminal_BFER.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "#include <algorithm>\n#include <stdexcept>\n-#include \"Tools/Factory/Factory_terminal.hpp\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Simulation_BFER_ite_threads.hpp\"\n@@ -574,20 +573,17 @@ void Simulation_BFER_ite_threads<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-Terminal* Simulation_BFER_ite_threads<B,R,Q>\n+Terminal_BFER<B>* Simulation_BFER_ite_threads<B,R,Q>\n::build_terminal()\n{\n#ifdef ENABLE_MPI\n- Simulation_BFER<B,R,Q>::build_terminal();\n+ return Simulation_BFER<B,R,Q>::build_terminal();\n#else\nthis->durations_red[std::make_pair(11, \"Decoder\")] = std::chrono::nanoseconds(0);\nconst auto &d_dec = this->durations_red[std::make_pair(11, \"Decoder\")];\n- return Factory_terminal<B>::build(this->params.terminal.type,\n- this->params.code.K_info,\n+ return new Terminal_BFER<B>(this->params.code.K_info,\nthis->params.code.N_code,\n- this->snr_s,\n- this->snr_b,\n*this->monitor_red,\n&d_dec);\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp",
"diff": "@@ -46,7 +46,7 @@ public:\nprotected:\nvirtual void build_communication_chain(const int tid = 0);\nvirtual void _launch();\n- virtual tools::Terminal* build_terminal();\n+ virtual tools::Terminal_BFER<B>* build_terminal();\nprivate:\nvoid Monte_Carlo_method (const int tid = 0);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "#include \"Tools/general_utils.h\"\n#include \"Tools/Factory/Factory_monitor.hpp\"\n-#include \"Tools/Factory/Factory_terminal.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n@@ -101,7 +100,12 @@ void Simulation_BFER<B,R,Q>\n::build_communication_chain(const int tid)\n{\n// build the terminal to display the BER/FER\n+ if (tid == 0)\n+ {\nthis->terminal = this->build_terminal();\n+ this->terminal->set_esn0(snr_s);\n+ this->terminal->set_ebn0(snr_b);\n+ }\nfor (auto& duration : this->durations[tid])\nduration.second = std::chrono::nanoseconds(0);\n@@ -345,14 +349,11 @@ Monitor<B>* Simulation_BFER<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-Terminal* Simulation_BFER<B,R,Q>\n+Terminal_BFER<B>* Simulation_BFER<B,R,Q>\n::build_terminal()\n{\n- return Factory_terminal<B>::build(this->params.terminal.type,\n- this->params.code.K_info,\n+ return new Terminal_BFER<B>(this->params.code.K_info,\nthis->params.code.N_code,\n- this->snr_s,\n- this->snr_b,\n*this->monitor_red);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"diff": "#include \"Tools/params.h\"\n#include \"Tools/Threads/Barrier.hpp\"\n-#include \"Tools/Display/Terminal/Terminal.hpp\"\n+#include \"Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n#include \"Tools/Display/Dumper/Dumper.hpp\"\n#include \"Tools/Display/Dumper/Dumper_reduction.hpp\"\n#include \"Module/Monitor/Monitor.hpp\"\n@@ -53,7 +53,7 @@ protected:\ntools::Dumper_reduction* dumper_red;\n// terminal (for the output of the code)\n- tools::Terminal *terminal;\n+ tools::Terminal_BFER<B> *terminal;\n// time points and durations\nstd::vector<std::map<std::pair<int, std::string>, std::chrono::nanoseconds>> durations;\n@@ -74,7 +74,7 @@ protected:\nvirtual void _launch() = 0;\nmodule::Monitor <B>* build_monitor (const int tid = 0);\n- virtual tools::Terminal * build_terminal( );\n+ virtual tools ::Terminal_BFER<B>* build_terminal( );\nprivate:\nvoid time_reduction(const bool is_snr_done = false );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "#include <chrono>\n#include <stdexcept>\n-#include \"Tools/Factory/Factory_terminal.hpp\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Simulation_BFER_std_threads.hpp\"\n@@ -441,20 +440,17 @@ void Simulation_BFER_std_threads<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-Terminal* Simulation_BFER_std_threads<B,R,Q>\n+Terminal_BFER<B>* Simulation_BFER_std_threads<B,R,Q>\n::build_terminal()\n{\n#ifdef ENABLE_MPI\n- Simulation_BFER<B,R,Q>::build_terminal();\n+ return Simulation_BFER<B,R,Q>::build_terminal();\n#else\nthis->durations_red[std::make_pair(11, \"Decoder\")] = std::chrono::nanoseconds(0);\nconst auto &d_dec = this->durations_red[std::make_pair(11, \"Decoder\")];\n- return Factory_terminal<B>::build(this->params.terminal.type,\n- this->params.code.K_info,\n+ return new Terminal_BFER<B>(this->params.code.K_info,\nthis->params.code.N_code,\n- this->snr_s,\n- this->snr_b,\n*this->monitor_red,\n&d_dec);\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.hpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.hpp",
"diff": "@@ -46,7 +46,7 @@ public:\nprotected:\nvirtual void build_communication_chain(const int tid = 0);\nvirtual void _launch();\n- virtual tools::Terminal* build_terminal();\n+ virtual tools::Terminal_BFER<B>* build_terminal();\nprivate:\nvoid Monte_Carlo_method (const int tid = 0);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"diff": "@@ -15,15 +15,15 @@ Terminal_BFER<B>\n::Terminal_BFER(const int K,\nconst int N,\nconst Monitor<B> &monitor,\n- const float *esn0,\n- const float *ebn0,\nconst std::chrono::nanoseconds *d_decod_total)\n: Terminal ( ),\nK (K ),\nN (N ),\n- esn0 (esn0 ),\n- ebn0 (ebn0 ),\nmonitor (monitor ),\n+ esn0 (0.f ),\n+ ebn0 (0.f ),\n+ is_esn0 (false ),\n+ is_ebn0 (false ),\nt_snr (std::chrono::steady_clock::now()),\nd_decod_total (d_decod_total ),\nreal_time_state(0 )\n@@ -40,15 +40,15 @@ template <typename B>\nTerminal_BFER<B>\n::Terminal_BFER(const int K,\nconst Monitor<B> &monitor,\n- const float *esn0,\n- const float *ebn0,\nconst std::chrono::nanoseconds *d_decod_total)\n: Terminal ( ),\nK (K ),\nN (K ),\n- esn0 (esn0 ),\n- ebn0 (ebn0 ),\nmonitor (monitor ),\n+ esn0 (0.f ),\n+ ebn0 (0.f ),\n+ is_esn0 (false ),\n+ is_ebn0 (false ),\nt_snr (std::chrono::steady_clock::now()),\nd_decod_total (d_decod_total ),\nreal_time_state(0 )\n@@ -57,6 +57,22 @@ Terminal_BFER<B>\nthrow std::invalid_argument(\"aff3ct::tools::Terminal_BFER: \\\"K\\\" has to be greater than 0.\");\n}\n+template <typename B>\n+void Terminal_BFER<B>\n+::set_esn0(const float esn0)\n+{\n+ this->is_esn0 = true;\n+ this->esn0 = esn0;\n+}\n+\n+template <typename B>\n+void Terminal_BFER<B>\n+::set_ebn0(const float ebn0)\n+{\n+ this->is_ebn0 = true;\n+ this->ebn0 = ebn0;\n+}\n+\ntemplate <typename B>\nstd::string Terminal_BFER<B>\n::get_time_format(float secondes)\n@@ -173,16 +189,16 @@ void Terminal_BFER<B>\nif (Monitor<B>::is_interrupt()) stream << \"\\r\";\nstd::stringstream esn0_str;\n- if (esn0 == nullptr)\n+ if (!is_esn0)\nesn0_str << \" - \";\nelse\n- esn0_str << setprecision(2) << fixed << setw(6) << *esn0;\n+ esn0_str << setprecision(2) << fixed << setw(6) << esn0;\nstd::stringstream ebn0_str;\n- if (ebn0 == nullptr)\n+ if (!is_ebn0)\nebn0_str << \" - \";\nelse\n- ebn0_str << setprecision(2) << fixed << setw(5) << *ebn0;\n+ ebn0_str << setprecision(2) << fixed << setw(5) << ebn0;\n#ifdef _WIN32\nstringstream str_ber, str_fer;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.hpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.hpp",
"diff": "@@ -17,9 +17,11 @@ class Terminal_BFER : public Terminal\nprotected:\nconst int K;\nconst int N;\n- const float *esn0;\n- const float *ebn0;\nconst module::Monitor<B> &monitor;\n+ float esn0;\n+ float ebn0;\n+ bool is_esn0;\n+ bool is_ebn0;\nstd::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\nconst std::chrono::nanoseconds *d_decod_total;\nunsigned short real_time_state;\n@@ -28,18 +30,17 @@ public:\nTerminal_BFER(const int K,\nconst int N,\nconst module::Monitor<B> &monitor,\n- const float *esn0 = nullptr,\n- const float *ebn0 = nullptr,\nconst std::chrono::nanoseconds *d_decod_total = nullptr);\nTerminal_BFER(const int K,\nconst module::Monitor<B> &monitor,\n- const float *esn0 = nullptr,\n- const float *ebn0 = nullptr,\nconst std::chrono::nanoseconds *d_decod_total = nullptr);\nvirtual ~Terminal_BFER() {}\n+ void set_esn0(const float esn0);\n+ void set_ebn0(const float ebn0);\n+\nvoid legend (std::ostream &stream = std::cout);\nvoid temp_report (std::ostream &stream = std::cout);\nvoid final_report(std::ostream &stream = std::cout);\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER_legacy.cpp",
"new_path": null,
"diff": "-#include <iostream>\n-#include <iomanip>\n-#include <sstream>\n-#include <stdexcept>\n-\n-#include \"Terminal_BFER_legacy.hpp\"\n-\n-using namespace aff3ct::module;\n-using namespace aff3ct::tools;\n-\n-template <typename B>\n-Terminal_BFER_legacy<B>\n-::Terminal_BFER_legacy(const int K,\n- const int N,\n- const Monitor<B> &monitor,\n- const float &snr)\n-: Terminal(), K(K), N(N), snr(snr), monitor(monitor), t_snr(std::chrono::steady_clock::now()), real_time_state(0)\n-{\n- if (K <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER_legacy: \\\"K\\\" has to be greater than 0.\");\n- if (N <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER_legacy: \\\"N\\\" has to be greater than 0.\");\n- if (K > N)\n- throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER_legacy: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n-}\n-\n-template <typename B>\n-std::string Terminal_BFER_legacy<B>::get_time_format(float secondes)\n-{\n- auto ss = (int)secondes % 60;\n- auto mm = ((int)(secondes / 60.f) % 60);\n- auto hh = (int)(secondes / 3600.f);\n-\n- // TODO: this is not a C++ style code\n- char time_format[256];\n-#ifdef _MSC_VER\n- sprintf_s(time_format, 32, \"%2.2dh%2.2d'%2.2d\", hh, mm, ss);\n-#else\n- sprintf(time_format, \"%2.2dh%2.2d'%2.2d\", hh, mm, ss);\n-#endif\n- std::string time_format2(time_format);\n-\n- return time_format2;\n-}\n-\n-template <typename B>\n-void Terminal_BFER_legacy<B>::_report(std::ostream &stream)\n-{\n- using namespace std::chrono;\n-\n- auto ber = 0.f, fer = 0.f, be_fe = 0.f;\n- if (monitor.get_n_be() != 0)\n- {\n- ber = (float)monitor.get_ber();\n- fer = (float)monitor.get_fer();\n- be_fe = (float)monitor.get_n_be() / (float)monitor.get_n_fe();\n- }\n- else\n- {\n- ber = (1.f) / ((float)monitor.get_n_analyzed_fra()) / this->K;\n- fer = (1.f) / ((float)monitor.get_n_analyzed_fra());\n- }\n-\n- auto rt = duration_cast<milliseconds>(steady_clock::now() - t_snr).count() / 1000.f;\n- auto fpmn = (60.f * monitor.get_n_analyzed_fra()) / rt;\n- auto bps = (fpmn * (float)this->N) / 60.f / 1000.f / 1000.f;\n-\n- auto fra = monitor.get_n_analyzed_fra();\n- auto fe = monitor.get_n_fe();\n- auto be = monitor.get_n_be();\n-\n- stream << \"SNR = \" << std::setprecision(2) << std::fixed << std::setw(4) << snr << \" | \";\n- stream << \"BER = \" << std::setprecision(2) << std::scientific << std::setw(4) << ber << \" | \";\n- stream << \"FER = \" << std::setprecision(2) << std::scientific << std::setw(4) << fer << \" | \";\n- stream << \"BPS = \" << std::setprecision(2) << std::scientific << std::setw(4) << bps << \" | \";\n- stream << \"MATRICES = \" << std::setprecision(0) << std::fixed << std::setw(7) << fra << \" | \";\n- stream << \"FE = \" << std::setprecision(0) << std::fixed << std::setw(4) << fe << \" | \";\n- stream << \"BE = \" << std::setprecision(0) << std::fixed << std::setw(7) << be << \" | \";\n- stream << \"BE/FE = \" << std::setprecision(2) << std::fixed << std::setw(7) << be_fe;\n-}\n-\n-template <typename B>\n-void Terminal_BFER_legacy<B>::temp_report(std::ostream &stream)\n-{\n- using namespace std::chrono;\n-\n- _report(stream);\n-\n- auto rt = duration_cast<milliseconds>(steady_clock::now() - t_snr).count() / 1000.f;\n- auto et = rt * ((float)monitor.get_fe_limit() / (float)monitor.get_n_fe()) - rt;\n- auto et_format = get_time_format((monitor.get_n_fe() == 0) ? 0 : et);\n-\n- stream << \" | ESTTIME = \" << std::setprecision(0) << std::fixed << std::setw(8) << et_format;\n-\n- stream << \" \";\n- for (auto i = 0; i < real_time_state; i++) stream << \".\";\n- for (auto i = 0; i < 3 - real_time_state; i++) stream << \" \";\n- real_time_state = (real_time_state +1) % 4;\n- stream << \"\\r\";\n-\n- stream.flush();\n-}\n-\n-template <typename B>\n-void Terminal_BFER_legacy<B>::final_report(std::ostream &stream)\n-{\n- using namespace std::chrono;\n-\n- _report(stream);\n-\n- auto rt = duration_cast<milliseconds>(steady_clock::now() - t_snr).count() / 1000.f;\n- auto rt_format = get_time_format(rt);\n-\n- stream << \" | RUNTIME = \" << std::setprecision(0) << std::fixed << std::setw(8) << rt_format << \" \"\n- << std::endl;\n-\n- t_snr = std::chrono::steady_clock::now();\n-}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template class aff3ct::tools::Terminal_BFER_legacy<B_8>;\n-template class aff3ct::tools::Terminal_BFER_legacy<B_16>;\n-template class aff3ct::tools::Terminal_BFER_legacy<B_32>;\n-template class aff3ct::tools::Terminal_BFER_legacy<B_64>;\n-#else\n-template class aff3ct::tools::Terminal_BFER_legacy<B>;\n-#endif\n-// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER_legacy.hpp",
"new_path": null,
"diff": "-#ifndef TERMINAL_BFER_LEGACY_HPP_\n-#define TERMINAL_BFER_LEGACY_HPP_\n-\n-#include <string>\n-#include <chrono>\n-\n-#include \"Module/Monitor/Monitor.hpp\"\n-#include \"../Terminal.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-template <typename B = int>\n-class Terminal_BFER_legacy : public Terminal\n-{\n-protected:\n- const int K;\n- const int N;\n- const float &snr;\n- const module::Monitor<B> &monitor;\n- std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\n- unsigned short real_time_state;\n-\n-public:\n- Terminal_BFER_legacy(const int K,\n- const int N,\n- const module::Monitor<B> &monitor,\n- const float &snr);\n- virtual ~Terminal_BFER_legacy() {}\n-\n- void temp_report (std::ostream &stream = std::cout);\n- void final_report(std::ostream &stream = std::cout);\n-\n-private:\n- static std::string get_time_format(float secondes);\n- void _report(std::ostream &stream);\n-};\n-}\n-}\n-\n-#endif /* TERMINAL_BFER_LEGACY_HPP_ */\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/Factory/Factory_terminal.cpp",
"new_path": null,
"diff": "-#include <stdexcept>\n-\n-#include \"Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n-#include \"Tools/Display/Terminal/BFER/Terminal_BFER_legacy.hpp\"\n-\n-#include \"Factory_terminal.hpp\"\n-\n-using namespace aff3ct::module;\n-using namespace aff3ct::tools;\n-\n-template <typename B>\n-Terminal* Factory_terminal<B>\n-::build(const std::string type,\n- const int K,\n- const int N,\n- const float &snr_s,\n- const float &snr_b,\n- const Monitor<B> &monitor,\n- const std::chrono::nanoseconds *d_decod_total)\n-{\n- if (type == \"STD\" ) return new Terminal_BFER <B>(K, N, monitor, &snr_s, &snr_b, d_decod_total);\n- else if (type == \"LEGACY\") return new Terminal_BFER_legacy<B>(K, N, monitor, snr_b );\n-\n- throw std::runtime_error(\"aff3ct::tools::Factory_terminal: the factory could not allocate the object.\");\n-}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template struct aff3ct::tools::Factory_terminal<B_8>;\n-template struct aff3ct::tools::Factory_terminal<B_16>;\n-template struct aff3ct::tools::Factory_terminal<B_32>;\n-template struct aff3ct::tools::Factory_terminal<B_64>;\n-#else\n-template struct aff3ct::tools::Factory_terminal<B>;\n-#endif\n-// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/Factory/Factory_terminal.hpp",
"new_path": null,
"diff": "-#ifndef FACTORY_TERMINAL_HPP\n-#define FACTORY_TERMINAL_HPP\n-\n-#include <chrono>\n-#include <string>\n-\n-#include \"Module/Monitor/Monitor.hpp\"\n-#include \"Tools/Display/Terminal/Terminal.hpp\"\n-\n-#include \"Factory.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-template <typename B = int>\n-struct Factory_terminal : public Factory\n-{\n- static Terminal* build(const std::string type,\n- const int K,\n- const int N,\n- const float &snr_s,\n- const float &snr_b,\n- const module::Monitor<B> &monitor,\n- const std::chrono::nanoseconds *d_decod_total = nullptr);\n-};\n-}\n-}\n-\n-#endif /* FACTORY_TERMINAL_HPP */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Factory/Factory_quantizer.hpp>\n#include <Tools/Factory/Factory_channel.hpp>\n#include <Tools/Factory/Factory.hpp>\n-#include <Tools/Factory/Factory_terminal.hpp>\n#include <Tools/Factory/RSC/Factory_decoder_RSC.hpp>\n#include <Tools/Factory/RSC/Factory_encoder_RSC.hpp>\n#include <Tools/Factory/Factory_interleaver.hpp>\n#include <Tools/Display/Dumper/Dumper_reduction.hpp>\n#include <Tools/Display/Terminal/Terminal.hpp>\n#include <Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n-#include <Tools/Display/Terminal/BFER/Terminal_BFER_legacy.hpp>\n#include <Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n#include <Tools/Codec/Polar/Codec_polar.hpp>\n#include <Tools/Codec/Codec_SISO.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Refacto the Terminal_BFER.
|
8,490 |
02.06.2017 14:32:21
| -7,200 |
5ff57777b4feb4176c8a08704b92b21e5e30eadb
|
Improve the sc::module management in the aff3ct:module.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/SC_CRC.hpp",
"new_path": "src/Module/CRC/SC_CRC.hpp",
"diff": "@@ -121,12 +121,14 @@ public:\nvoid create_sc_module_build()\n{\n+ if (sc_module_build != nullptr) { delete sc_module_build; sc_module_build = nullptr; }\nconst std::string new_name = this->name + \"_build\";\nthis->sc_module_build = new SC_CRC_module_build<B>(*this, new_name.c_str());\n}\nvoid create_sc_module_extract()\n{\n+ if (sc_module_extract != nullptr) { delete sc_module_extract; sc_module_extract = nullptr; }\nconst std::string new_name = this->name + \"_extract\";\nthis->sc_module_extract = new SC_CRC_module_extract<B>(*this, new_name.c_str());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/SC_Channel.hpp",
"new_path": "src/Module/Channel/SC_Channel.hpp",
"diff": "@@ -143,11 +143,13 @@ public:\nvoid create_sc_module()\n{\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\nthis->sc_module = new SC_Channel_module<R>(*this, this->name.c_str());\n}\nvoid create_sc_module_wg()\n{\n+ if (sc_module_wg != nullptr) { delete sc_module_wg; sc_module_wg = nullptr; }\nconst std::string new_name = this->name + \"_wg\";\nthis->sc_module_wg = new SC_Channel_module_wg<R>(*this, new_name.c_str());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/SC_Coset.hpp",
"new_path": "src/Module/Coset/SC_Coset.hpp",
"diff": "@@ -95,6 +95,7 @@ public:\nvoid create_sc_module()\n{\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\nthis->sc_module = new SC_Coset_module<B,D>(*this, this->name.c_str());\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_Decoder.hpp",
"new_path": "src/Module/Decoder/SC_Decoder.hpp",
"diff": "@@ -74,10 +74,14 @@ public:\nconst std::string name = \"SC_Decoder\")\n: Decoder_i<B,R>(K, N, n_frames, simd_inter_frame_level, name), sc_module(nullptr) {}\n- virtual ~SC_Decoder() { if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; } }\n+ virtual ~SC_Decoder()\n+ {\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\n+ }\nvoid create_sc_module()\n{\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\nthis->sc_module = new SC_Decoder_module<B,R>(*this, this->name.c_str());\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SC_SISO.hpp",
"new_path": "src/Module/Decoder/SC_SISO.hpp",
"diff": "@@ -74,10 +74,14 @@ public:\nconst std::string name = \"SC_SISO\")\n: SISO_i<R>(K, N, n_frames, simd_inter_frame_level, name), sc_module_siso(nullptr) {}\n- virtual ~SC_SISO() { if (sc_module_siso != nullptr) { delete sc_module_siso; sc_module_siso = nullptr; } }\n+ virtual ~SC_SISO()\n+ {\n+ if (sc_module_siso != nullptr) { delete sc_module_siso; sc_module_siso = nullptr; }\n+ }\nvoid create_sc_module_siso()\n{\n+ if (sc_module_siso != nullptr) { delete sc_module_siso; sc_module_siso = nullptr; }\nthis->sc_module_siso = new SC_SISO_module<R>(*this, this->name.c_str());\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/SC_Encoder.hpp",
"new_path": "src/Module/Encoder/SC_Encoder.hpp",
"diff": "@@ -73,10 +73,14 @@ public:\nSC_Encoder(const int K, const int N, const int n_frames = 1, const std::string name = \"SC_Encoder\")\n: Encoder_i<B>(K, N, n_frames, name), sc_module(nullptr) {}\n- virtual ~SC_Encoder() { if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; } }\n+ virtual ~SC_Encoder()\n+ {\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\n+ }\nvoid create_sc_module()\n{\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\nthis->sc_module = new SC_Encoder_module<B>(*this, this->name.c_str());\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"new_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"diff": "@@ -170,12 +170,14 @@ public:\nvoid create_sc_module_interleaver()\n{\n+ if (sc_module_inter != nullptr) { delete sc_module_inter; sc_module_inter = nullptr; }\nconst std::string new_name = this->name + \"_inter\";\nthis->sc_module_inter = new SC_Interleaver_module_interleaver<T>(*this, new_name.c_str());\n}\nvoid create_sc_module_deinterleaver()\n{\n+ if (sc_module_deinter != nullptr) { delete sc_module_deinter; sc_module_deinter = nullptr; }\nconst std::string new_name = this->name + \"_deinter\";\nthis->sc_module_deinter = new SC_Interleaver_module_deinterleaver<T>(*this, new_name.c_str());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/SC_Modem.hpp",
"new_path": "src/Module/Modem/SC_Modem.hpp",
"diff": "@@ -421,36 +421,42 @@ public:\nvoid create_sc_module_modulator()\n{\n+ if (sc_module_mod != nullptr) { delete sc_module_mod; sc_module_mod = nullptr; }\nconst std::string new_name = this->name + \"_mod\";\nthis->sc_module_mod = new SC_Modem_module_modulator<B,R,Q>(*this, new_name.c_str());\n}\nvoid create_sc_module_filterer()\n{\n+ if (sc_module_filt != nullptr) { delete sc_module_filt; sc_module_filt = nullptr; }\nconst std::string new_name = this->name + \"_filt\";\nthis->sc_module_filt = new SC_Modem_module_filterer<B,R,Q>(*this, new_name.c_str());\n}\nvoid create_sc_module_demodulator()\n{\n+ if (sc_module_demod != nullptr) { delete sc_module_demod; sc_module_demod = nullptr; }\nconst std::string new_name = this->name + \"_demod\";\nthis->sc_module_demod = new SC_Modem_module_demodulator<B,R,Q>(*this, new_name.c_str());\n}\nvoid create_sc_module_demodulator_wg()\n{\n+ if (sc_module_demod_wg != nullptr) { delete sc_module_demod_wg; sc_module_demod_wg = nullptr; }\nconst std::string new_name = this->name + \"_demod_wg\";\nthis->sc_module_demod_wg = new SC_Modem_module_demodulator_wg<B,R,Q>(*this, new_name.c_str());\n}\nvoid create_sc_module_tdemodulator()\n{\n+ if (sc_module_tdemod != nullptr) { delete sc_module_tdemod; sc_module_tdemod = nullptr; }\nconst std::string new_name = this->name + \"_tdemod\";\nthis->sc_module_tdemod = new SC_Modem_module_tdemodulator<B,R,Q>(*this, new_name.c_str());\n}\nvoid create_sc_module_tdemodulator_wg()\n{\n+ if (sc_module_tdemod_wg != nullptr) { delete sc_module_tdemod_wg; sc_module_tdemod_wg = nullptr; }\nconst std::string new_name = this->name + \"_tdemod_wg\";\nthis->sc_module_tdemod_wg = new SC_Modem_module_tdemodulator_wg<B,R,Q>(*this, new_name.c_str());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/SC_Monitor.hpp",
"new_path": "src/Module/Monitor/SC_Monitor.hpp",
"diff": "@@ -76,10 +76,14 @@ public:\nSC_Monitor(const int size, const int n_frames = 1, const std::string name = \"SC_Monitor\")\n: Monitor_i<B>(size, n_frames, name), sc_module(nullptr) {}\n- virtual ~SC_Monitor() {if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }};\n+ virtual ~SC_Monitor()\n+ {\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\n+ };\nvoid create_sc_module()\n{\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\nthis->sc_module = new SC_Monitor_module<B>(*this, this->name.c_str());\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"new_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"diff": "@@ -132,12 +132,14 @@ public:\nvoid create_sc_module_puncturer()\n{\n+ if (sc_module_punct != nullptr) { delete sc_module_punct; sc_module_punct = nullptr; }\nconst std::string new_name = this->name + \"_punct\";\nthis->sc_module_punct = new SC_Puncturer_module_puncturer<B,Q>(*this, new_name.c_str());\n}\nvoid create_sc_module_depuncturer()\n{\n+ if (sc_module_depunct != nullptr) { delete sc_module_depunct; sc_module_depunct = nullptr; }\nconst std::string new_name = this->name + \"_depunct\";\nthis->sc_module_depunct = new SC_Puncturer_module_depuncturer<B,Q>(*this, new_name.c_str());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"new_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"diff": "@@ -73,10 +73,14 @@ public:\nSC_Quantizer(const int N, const int n_frames = 1, const std::string name = \"SC_Quantizer\")\n: Quantizer_i<R,Q>(N, n_frames, name), sc_module(nullptr) {}\n- virtual ~SC_Quantizer() { if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; } };\n+ virtual ~SC_Quantizer()\n+ {\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\n+ };\nvoid create_sc_module()\n{\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\nthis->sc_module = new SC_Quantizer_module<R,Q>(*this, this->name.c_str());\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/SC_Source.hpp",
"new_path": "src/Module/Source/SC_Source.hpp",
"diff": "@@ -73,10 +73,14 @@ public:\nSC_Source(const int K, const int n_frames = 1, const std::string name = \"Source_SC\")\n: Source_i<B>(K, n_frames, name), sc_module(nullptr) {}\n- virtual ~SC_Source() { if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; } };\n+ virtual ~SC_Source()\n+ {\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\n+ };\nvoid create_sc_module()\n{\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\nthis->sc_module = new SC_Source_module<B>(*this, this->name.c_str());\n}\n};\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the sc::module management in the aff3ct:module.
|
8,490 |
02.06.2017 15:38:21
| -7,200 |
cf1846fc13331a7aa907c5900e172b8e632c296d
|
Fix the MKL channel.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.cpp",
"new_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.cpp",
"diff": "@@ -9,29 +9,29 @@ using namespace aff3ct::tools;\ntemplate <typename R>\nNoise_MKL<R>\n::Noise_MKL(const int seed)\n-: Noise<R>(), stream_state(nullptr)\n+: Noise<R>(), stream_state(nullptr), is_stream_alloc(false)\n{\n- this->set_seed(const int seed);\n+ this->set_seed(seed);\n}\ntemplate <typename R>\nNoise_MKL<R>\n::~Noise_MKL()\n{\n- vslDeleteStream(stream_state);\n+ if (is_stream_alloc)\n+ vslDeleteStream(&stream_state);\n}\ntemplate <typename R>\n-void Noise_std<R>\n+void Noise_MKL<R>\n::set_seed(const int seed)\n{\n- if (stream_state != nullptr) vslDeleteStream(stream_state);\n+ if (is_stream_alloc) vslDeleteStream(&stream_state);\n- //vslNewStream(stream_state, VSL_BRNG_MT2203, seed);\n- vslNewStream(stream_state, VSL_BRNG_SFMT19937, seed);\n+ //vslNewStream(&stream_state, VSL_BRNG_MT2203, seed);\n+ vslNewStream(&stream_state, VSL_BRNG_SFMT19937, seed);\n- if (stream_state == nullptr)\n- throw std::runtime_error(\"aff3ct::module::Noise_MKL: \\\"stream_state\\\" can't be null.\");\n+ is_stream_alloc = true;\n}\ntemplate <typename R>\n@@ -44,21 +44,21 @@ void Noise_MKL<R>\nnamespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <>\nvoid Noise_MKL<float>\n::generate(float *noise, const unsigned length, const float sigma)\n{\nvsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\n- *stream_state,\n+ stream_state,\nlength,\nnoise,\n0.0,\nsigma);\n/*\nvsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF,\n- *stream_state,\n+ stream_state,\nlength,\nnoise,\n0.0,\n@@ -70,21 +70,21 @@ void Noise_MKL<float>\nnamespace aff3ct\n{\n-namespace module\n+namespace tools\n{\ntemplate <>\nvoid Noise_MKL<double>\n::generate(double *noise, const unsigned length, const double sigma)\n{\nvdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\n- *stream_state,\n+ stream_state,\nlength,\nnoise,\n0.0,\nsigma);\n/*\nvdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF,\n- *stream_state,\n+ stream_state,\nlength,\nnoise,\n0.0,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.hpp",
"new_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.hpp",
"diff": "@@ -15,11 +15,12 @@ template <typename R = float>\nclass Noise_MKL : public Noise<R>\n{\nprivate:\n- VSLStreamStatePtr* stream_state;\n+ VSLStreamStatePtr stream_state;\n+ bool is_stream_alloc;\npublic:\n- Channel_AWGN_MKL_LLR(const int seed = 0);\n- virtual ~Channel_AWGN_MKL_LLR();\n+ Noise_MKL(const int seed = 0);\n+ virtual ~Noise_MKL();\nvirtual void set_seed(const int seed);\nvirtual void generate(R *noise, const unsigned length, const R sigma);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the MKL channel.
|
8,490 |
03.06.2017 11:28:18
| -7,200 |
fce08af8522d3ac86b562ac954839a988ea3106d
|
Use frame_id instead of cur_frame.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.cpp",
"diff": "@@ -21,7 +21,6 @@ Decoder_LDPC_BP_flooding<B,R>\nconst int n_frames,\nconst std::string name)\n: Decoder_SISO<B,R> (K, N, n_frames, 1, name ),\n- cur_frame (0 ),\nn_ite (n_ite ),\nn_V_nodes (N ), // same as N but more explicit\nn_C_nodes ((int)alist_data.get_n_CN() ),\n@@ -62,22 +61,20 @@ void Decoder_LDPC_BP_flooding<B,R>\n// memory zones initialization\nif (this->init_flag)\n{\n- std::fill(this->C_to_V[cur_frame].begin(), this->C_to_V[cur_frame].end(), (R)0);\n+ std::fill(this->C_to_V[frame_id].begin(), this->C_to_V[frame_id].end(), (R)0);\n- if (cur_frame == Decoder<B,R>::n_frames -1)\n+ if (frame_id == Decoder<B,R>::n_frames -1)\nthis->init_flag = false;\n}\n// actual decoding\n- this->BP_decode(Y_N1);\n+ this->BP_decode(Y_N1,frame_id);\n// prepare for next round by processing extrinsic information\nfor (auto i = 0; i < this->N; i++)\nY_N2[i] = this->Lp_N[i] - Y_N1[i];\n// saturate<R>(Y_N2, (R)-C_to_V_max, (R)C_to_V_max);\n-\n- cur_frame = (cur_frame +1) % SISO<R>::n_frames;\n}\ntemplate <typename B, typename R>\n@@ -88,16 +85,16 @@ void Decoder_LDPC_BP_flooding<B,R>\n// memory zones initialization\nif (this->init_flag)\n{\n- std::fill(this->C_to_V[cur_frame].begin(), this->C_to_V[cur_frame].end(), (R)0);\n+ std::fill(this->C_to_V[frame_id].begin(), this->C_to_V[frame_id].end(), (R)0);\n- if (cur_frame == Decoder<B,R>::n_frames -1)\n+ if (frame_id == Decoder<B,R>::n_frames -1)\nthis->init_flag = false;\n}\nauto d_load = std::chrono::steady_clock::now() - t_load;\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n// actual decoding\n- this->BP_decode(Y_N);\n+ this->BP_decode(Y_N, frame_id);\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -109,10 +106,9 @@ void Decoder_LDPC_BP_flooding<B,R>\n}\n// set the flag so C_to_V structure can be reset to 0 only at the beginning of the loop in iterative decoding\n- if (cur_frame == Decoder<B,R>::n_frames -1)\n+ if (frame_id == Decoder<B,R>::n_frames -1)\nthis->init_flag = true;\n- cur_frame = (cur_frame +1) % SISO<R>::n_frames;\nauto d_store = std::chrono::steady_clock::now() - t_store;\nthis->d_load_total += d_load;\n@@ -123,7 +119,7 @@ void Decoder_LDPC_BP_flooding<B,R>\n// BP algorithm\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding<B,R>\n-::BP_decode(const R *Y_N)\n+::BP_decode(const R *Y_N, const int frame_id)\n{\nauto cur_syndrome_depth = 0;\n@@ -131,7 +127,7 @@ void Decoder_LDPC_BP_flooding<B,R>\nfor (auto ite = 0; ite < this->n_ite; ite++)\n{\n// specific inner code depending on the selected implementation (min-sum or sum-product for example)\n- auto syndrome = this->BP_process(Y_N, this->V_to_C[cur_frame], this->C_to_V[cur_frame]);\n+ auto syndrome = this->BP_process(Y_N, this->V_to_C[frame_id], this->C_to_V[frame_id]);\n// make a saturation\n// saturate<R>(this->C_to_V, (R)-C_to_V_max, (R)C_to_V_max);\n@@ -148,7 +144,7 @@ void Decoder_LDPC_BP_flooding<B,R>\n}\n// begining of the iteration upon all the matrix lines\n- R *C_to_V_ptr = this->C_to_V[cur_frame].data();\n+ R *C_to_V_ptr = this->C_to_V[frame_id].data();\nfor (auto i = 0; i < this->n_V_nodes; i++)\n{\nconst auto length = this->n_parities_per_variable[i];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.hpp",
"diff": "@@ -12,9 +12,6 @@ namespace module\ntemplate <typename B = int, typename R = float>\nclass Decoder_LDPC_BP_flooding : public Decoder_SISO<B,R>\n{\n-private:\n- int cur_frame;\n-\nprotected:\nconst int n_ite; // number of iterations to perform\nconst int n_V_nodes; // number of variable nodes (= N)\n@@ -54,7 +51,7 @@ protected:\nvoid _hard_decode(const R *Y_N, B *V_K, const int frame_id);\n// BP functions for decoding\n- void BP_decode(const R *Y_N);\n+ void BP_decode(const R *Y_N, const int frame_id);\nvirtual bool BP_process(const R *Y_N, mipp::vector<R> &V_to_C, mipp::vector<R> &C_to_V) = 0;\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp",
"diff": "@@ -20,7 +20,6 @@ Decoder_LDPC_BP_layered<B,R>\nconst int n_frames,\nconst std::string name)\n: Decoder_SISO<B,R>(K, N, n_frames, 1, name ),\n- cur_frame (0 ),\nn_ite (n_ite ),\nn_C_nodes ((int)alist_data.get_n_CN() ),\nenable_syndrome (enable_syndrome ),\n@@ -52,37 +51,35 @@ void Decoder_LDPC_BP_layered<B,R>\n::_soft_decode(const R *Y_N1, R *Y_N2, const int frame_id)\n{\n// memory zones initialization\n- this->_load(Y_N1);\n+ this->_load(Y_N1, frame_id);\n// actual decoding\n- this->BP_decode();\n+ this->BP_decode(frame_id);\n// prepare for next round by processing extrinsic information\nfor (auto i = 0; i < this->N; i++)\n- Y_N2[i] = this->var_nodes[cur_frame][i] - Y_N1[i];\n+ Y_N2[i] = this->var_nodes[frame_id][i] - Y_N1[i];\n// copy extrinsic information into var_nodes for next TURBO iteration\n- std::copy(Y_N2, Y_N2 + this->N, this->var_nodes[cur_frame].begin());\n-\n- cur_frame = (cur_frame +1) % SISO<R>::n_frames;\n+ std::copy(Y_N2, Y_N2 + this->N, this->var_nodes[frame_id].begin());\n}\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered<B,R>\n-::_load(const R *Y_N)\n+::_load(const R *Y_N, const int frame_id)\n{\n// memory zones initialization\nif (this->init_flag)\n{\n- std::fill(this->branches [cur_frame].begin(), this->branches [cur_frame].end(), (R)0);\n- std::fill(this->var_nodes[cur_frame].begin(), this->var_nodes[cur_frame].end(), (R)0);\n+ std::fill(this->branches [frame_id].begin(), this->branches [frame_id].end(), (R)0);\n+ std::fill(this->var_nodes[frame_id].begin(), this->var_nodes[frame_id].end(), (R)0);\n- if (cur_frame == Decoder<B,R>::n_frames -1)\n+ if (frame_id == Decoder<B,R>::n_frames -1)\nthis->init_flag = false;\n}\n- for (auto i = 0; i < (int)var_nodes[cur_frame].size(); i++)\n- this->var_nodes[cur_frame][i] += Y_N[i]; // var_nodes contain previous extrinsic information\n+ for (auto i = 0; i < (int)var_nodes[frame_id].size(); i++)\n+ this->var_nodes[frame_id][i] += Y_N[i]; // var_nodes contain previous extrinsic information\n}\ntemplate <typename B, typename R>\n@@ -90,22 +87,20 @@ void Decoder_LDPC_BP_layered<B,R>\n::_hard_decode(const R *Y_N, B *V_K, const int frame_id)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n- this->_load(Y_N);\n+ this->_load(Y_N, frame_id);\nauto d_load = std::chrono::steady_clock::now() - t_load;\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n// actual decoding\n- this->BP_decode();\n+ this->BP_decode(frame_id);\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n// set the flag so the branches can be reset to 0 only at the beginning of the loop in iterative decoding\n- if (cur_frame == Decoder<B,R>::n_frames -1)\n+ if (frame_id == Decoder<B,R>::n_frames -1)\nthis->init_flag = true;\n- cur_frame = (cur_frame +1) % SISO<R>::n_frames;\n-\n- this->_store(V_K);\n+ this->_store(V_K, frame_id);\nauto d_store = std::chrono::steady_clock::now() - t_store;\nthis->d_load_total += d_load;\n@@ -115,31 +110,29 @@ void Decoder_LDPC_BP_layered<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered<B,R>\n-::_store(B *V_K) const\n+::_store(B *V_K, const int frame_id) const\n{\n- const auto past_frame = (cur_frame -1) < 0 ? Decoder<B,R>::n_frames -1 : cur_frame -1;\n-\n// take the hard decision\nfor (auto i = 0; i < this->K; i++)\n{\nconst auto k = this->info_bits_pos[i];\n- V_K[i] = !(this->var_nodes[past_frame][k] >= 0);\n+ V_K[i] = !(this->var_nodes[frame_id][k] >= 0);\n}\n}\n// BP algorithm\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered<B,R>\n-::BP_decode()\n+::BP_decode(const int frame_id)\n{\nauto cur_syndrome_depth = 0;\nfor (auto ite = 0; ite < this->n_ite; ite++)\n{\n- this->BP_process(this->var_nodes[cur_frame], this->branches[cur_frame]);\n+ this->BP_process(this->var_nodes[frame_id], this->branches[frame_id]);\n// stop criterion\n- if (this->enable_syndrome && this->check_syndrome())\n+ if (this->enable_syndrome && this->check_syndrome(frame_id))\n{\ncur_syndrome_depth++;\nif (cur_syndrome_depth == this->syndrome_depth)\n@@ -152,7 +145,7 @@ void Decoder_LDPC_BP_layered<B,R>\ntemplate <typename B, typename R>\nbool Decoder_LDPC_BP_layered<B,R>\n-::check_syndrome()\n+::check_syndrome(const int frame_id)\n{\nauto syndrome = false;\n@@ -164,7 +157,7 @@ bool Decoder_LDPC_BP_layered<B,R>\nconst auto n_VN = (int)this->CN_to_VN[i].size();\nfor (auto j = 0; j < n_VN; j++)\n{\n- const auto value = this->var_nodes[cur_frame][this->CN_to_VN[i][j]] - this->branches[cur_frame][k++];\n+ const auto value = this->var_nodes[frame_id][this->CN_to_VN[i][j]] - this->branches[frame_id][k++];\nconst auto tmp_sign = std::signbit((float)value) ? -1 : 0;\nsign ^= tmp_sign;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp",
"diff": "@@ -12,9 +12,6 @@ namespace module\ntemplate <typename B = int, typename R = float>\nclass Decoder_LDPC_BP_layered : public Decoder_SISO<B,R>\n{\n-private:\n- int cur_frame;\n-\nprotected:\nconst int n_ite; // number of iterations to perform\nconst int n_C_nodes; // number of check nodes (= N - K)\n@@ -48,14 +45,14 @@ protected:\nvoid _soft_decode(const R *Y_N1, R *Y_N2, const int frame_id);\n// hard decoder (load -> decode -> store)\n- void _load (const R *Y_N);\n+ void _load (const R *Y_N, const int frame_id);\nvoid _hard_decode(const R *Y_N, B *V_K, const int frame_id);\n- void _store (B *V_K) const;\n+ void _store ( B *V_K, const int frame_id) const;\n// BP functions for decoding\n- void BP_decode();\n+ void BP_decode(const int frame_id);\n- bool check_syndrome();\n+ bool check_syndrome(const int frame_id);\nvirtual void BP_process(mipp::vector<R> &var_nodes, mipp::vector<R> &branches) = 0;\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.cpp",
"diff": "@@ -22,7 +22,6 @@ Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nconst int n_frames,\nconst std::string name)\n: Decoder_SISO<B,R>(K, N, n_frames, mipp::nElReg<R>(), name ),\n- cur_wave (0 ),\nnormalize_factor (normalize_factor ),\noffset (offset ),\ncontributions (alist_data.get_CN_max_degree() ),\n@@ -64,47 +63,48 @@ Decoder_LDPC_BP_layered_ONMS_inter<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n-::_soft_decode(const R *Y_N1, R *Y_N2)\n+::_soft_decode(const R *Y_N1, R *Y_N2, const int frame_id)\n{\n// memory zones initialization\n- this->_load(Y_N1);\n+ this->_load(Y_N1, frame_id);\n// actual decoding\nif (typeid(R) == typeid(short) || typeid(R) == typeid(signed char))\n{\n- if (normalize_factor == 0.125f) this->BP_decode<1>();\n- else if (normalize_factor == 0.250f) this->BP_decode<2>();\n- else if (normalize_factor == 0.375f) this->BP_decode<3>();\n- else if (normalize_factor == 0.500f) this->BP_decode<4>();\n- else if (normalize_factor == 0.625f) this->BP_decode<5>();\n- else if (normalize_factor == 0.750f) this->BP_decode<6>();\n- else if (normalize_factor == 0.875f) this->BP_decode<7>();\n- else if (normalize_factor == 1.000f) this->BP_decode<8>();\n+ if (normalize_factor == 0.125f) this->BP_decode<1>(frame_id);\n+ else if (normalize_factor == 0.250f) this->BP_decode<2>(frame_id);\n+ else if (normalize_factor == 0.375f) this->BP_decode<3>(frame_id);\n+ else if (normalize_factor == 0.500f) this->BP_decode<4>(frame_id);\n+ else if (normalize_factor == 0.625f) this->BP_decode<5>(frame_id);\n+ else if (normalize_factor == 0.750f) this->BP_decode<6>(frame_id);\n+ else if (normalize_factor == 0.875f) this->BP_decode<7>(frame_id);\n+ else if (normalize_factor == 1.000f) this->BP_decode<8>(frame_id);\nelse\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"normalize_factor\\\" can \"\n\"only be 0.125f, 0.250f, 0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n}\nelse // float or double\n{\n- if (normalize_factor == 1.000f) this->BP_decode<8>();\n- else this->BP_decode<0>();\n+ if (normalize_factor == 1.000f) this->BP_decode<8>(frame_id);\n+ else this->BP_decode<0>(frame_id);\n}\n// prepare for next round by processing extrinsic information\n+ const auto cur_wave = frame_id / this->simd_inter_frame_level;\nfor (auto i = 0; i < this->N; i++)\nthis->var_nodes[cur_wave][i] -= Y_N_reorderered[i];\nstd::vector<R*> frames(mipp::nElReg<R>());\nfor (auto f = 0; f < mipp::nElReg<R>(); f++) frames[f] = Y_N2 + f * this->N;\nReorderer_static<R,mipp::nElReg<R>()>::apply_rev((R*)this->var_nodes[cur_wave].data(), frames, this->N);\n-\n- cur_wave = (cur_wave +1) % this->n_dec_waves;\n}\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n-::_load(const R *Y_N)\n+::_load(const R *Y_N, const int frame_id)\n{\n+ const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+\n// memory zones initialization\nif (this->init_flag)\n{\n@@ -128,35 +128,35 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n::_hard_decode(const R *Y_N, B *V_K, const int frame_id)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n- this->_load(Y_N);\n+ this->_load(Y_N, frame_id);\nauto d_load = std::chrono::steady_clock::now() - t_load;\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n// actual decoding\nif (typeid(R) == typeid(short) || typeid(R) == typeid(signed char))\n{\n- if (normalize_factor == 0.125f) this->BP_decode<1>();\n- else if (normalize_factor == 0.250f) this->BP_decode<2>();\n- else if (normalize_factor == 0.375f) this->BP_decode<3>();\n- else if (normalize_factor == 0.500f) this->BP_decode<4>();\n- else if (normalize_factor == 0.625f) this->BP_decode<5>();\n- else if (normalize_factor == 0.750f) this->BP_decode<6>();\n- else if (normalize_factor == 0.875f) this->BP_decode<7>();\n- else if (normalize_factor == 1.000f) this->BP_decode<8>();\n+ if (normalize_factor == 0.125f) this->BP_decode<1>(frame_id);\n+ else if (normalize_factor == 0.250f) this->BP_decode<2>(frame_id);\n+ else if (normalize_factor == 0.375f) this->BP_decode<3>(frame_id);\n+ else if (normalize_factor == 0.500f) this->BP_decode<4>(frame_id);\n+ else if (normalize_factor == 0.625f) this->BP_decode<5>(frame_id);\n+ else if (normalize_factor == 0.750f) this->BP_decode<6>(frame_id);\n+ else if (normalize_factor == 0.875f) this->BP_decode<7>(frame_id);\n+ else if (normalize_factor == 1.000f) this->BP_decode<8>(frame_id);\nelse\nthrow std::invalid_argument(\"aff3ct::module::Decoder_LDPC_BP_layered_ONMS_inter: \\\"normalize_factor\\\" can \"\n\"only be 0.125f, 0.250f, 0.375f, 0.500f, 0.625f, 0.750f, 0.875f or 1.000f.\");\n}\nelse // float or double\n{\n- if (normalize_factor == 1.000f) this->BP_decode<8>();\n- else this->BP_decode<0>();\n+ if (normalize_factor == 1.000f) this->BP_decode<8>(frame_id);\n+ else this->BP_decode<0>(frame_id);\n}\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- this->_store(V_K);\n+ this->_store(V_K, frame_id);\nauto d_store = std::chrono::steady_clock::now() - t_store;\nthis->d_load_total += d_load;\n@@ -166,8 +166,10 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n-::_store(B *V_K)\n+::_store(B *V_K, const int frame_id)\n{\n+ const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+\n// take the hard decision\nconst auto zero = mipp::Reg<R>((R)0);\nfor (auto i = 0; i < this->K; i++)\n@@ -180,18 +182,18 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nfor (auto f = 0; f < mipp::nElReg<R>(); f++) frames[f] = V_K + f * this->K;\nReorderer_static<B,mipp::nElReg<R>()>::apply_rev((B*)V_K_reorderered.data(), frames, this->K);\n- cur_wave = (cur_wave +1) % this->n_dec_waves;\n-\n// set the flag so the branches can be reset to 0 only at the beginning of the loop in iterative decoding\n- if (cur_wave == 0) this->init_flag = true;\n+ if (cur_wave == this->n_dec_waves -1) this->init_flag = true;\n}\n// BP algorithm\ntemplate <typename B, typename R>\ntemplate <int F>\nvoid Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n-::BP_decode()\n+::BP_decode(const int frame_id)\n{\n+ const auto cur_wave = frame_id / this->simd_inter_frame_level;\n+\nauto cur_syndrome_depth = 0;\nfor (auto ite = 0; ite < this->n_ite; ite++)\n@@ -199,7 +201,7 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\nthis->BP_process<F>(this->var_nodes[cur_wave], this->branches[cur_wave]);\n// stop criterion\n- if (this->enable_syndrome && this->check_syndrome())\n+ if (this->enable_syndrome && this->check_syndrome(frame_id))\n{\ncur_syndrome_depth++;\nif (cur_syndrome_depth == this->syndrome_depth)\n@@ -212,8 +214,9 @@ void Decoder_LDPC_BP_layered_ONMS_inter<B,R>\ntemplate <typename B, typename R>\nbool Decoder_LDPC_BP_layered_ONMS_inter<B,R>\n-::check_syndrome()\n+::check_syndrome(const int frame_id)\n{\n+ const auto cur_wave = frame_id / this->simd_inter_frame_level;\nauto syndrome = mipp::Reg<B>((B)0);\nauto k = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp",
"diff": "@@ -13,7 +13,6 @@ template <typename B = int, typename R = float>\nclass Decoder_LDPC_BP_layered_ONMS_inter : public Decoder_SISO<B,R>\n{\nprivate:\n- int cur_wave;\nconst float normalize_factor;\nconst R offset;\nmipp::vector<mipp::Reg<R>> contributions;\n@@ -54,18 +53,18 @@ public:\nprotected:\n// soft decode\n- void _soft_decode(const R *Y_N1, R *Y_N2);\n+ void _soft_decode(const R *Y_N1, R *Y_N2, const int frame_id);\n// hard decoder (load -> decode -> store)\n- void _load (const R *Y_N);\n+ void _load (const R *Y_N, const int frame_id);\nvoid _hard_decode(const R *Y_N, B *V_K, const int frame_id);\n- void _store (B *V_K);\n+ void _store ( B *V_K, const int frame_id);\n// BP functions for decoding\ntemplate <int F = 1>\n- void BP_decode();\n+ void BP_decode(const int frame_id);\n- bool check_syndrome();\n+ bool check_syndrome(const int frame_id);\ntemplate <int F = 1>\nvoid BP_process(mipp::vector<mipp::Reg<R>> &var_nodes, mipp::vector<mipp::Reg<R>> &branches);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Use frame_id instead of cur_frame.
|
8,490 |
04.06.2017 11:41:37
| -7,200 |
764dae1d7a10675f01efd4043332a015b35cbeb6
|
Fix the --sim-stop-time option.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -24,6 +24,8 @@ Simulation_BFER<B,R,Q>\n::Simulation_BFER(const parameters& params, Codec<B,Q> &codec)\n: Simulation(),\n+ stop_terminal(false),\n+\ncodec(codec),\nparams(params),\n@@ -186,9 +188,11 @@ void Simulation_BFER<B,R,Q>\nif (!this->params.terminal.disabled && this->params.terminal.frequency != std::chrono::nanoseconds(0) &&\n!this->params.simulation.benchs && !this->params.simulation.debug)\n{\n+ stop_terminal = true;\ncond_terminal.notify_all();\n// wait the terminal thread to finish\nterm_thread.join();\n+ stop_terminal = false;\n}\nif (this->params.simulation.mpi_rank == 0 &&\n@@ -365,7 +369,7 @@ void Simulation_BFER<B,R,Q>\n{\nconst auto sleep_time = simu->params.terminal.frequency - std::chrono::milliseconds(0);\n- while (!simu->monitor_red->fe_limit_achieved() && !simu->monitor_red->is_interrupt())\n+ while (!simu->stop_terminal)\n{\nstd::unique_lock<std::mutex> lock(simu->mutex_terminal);\nif (simu->cond_terminal.wait_for(lock, sleep_time) == std::cv_status::timeout)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"diff": "@@ -27,6 +27,7 @@ class Simulation_BFER : public Simulation\nprivate:\nstd::mutex mutex_terminal;\nstd::condition_variable cond_terminal;\n+ bool stop_terminal;\nprotected:\ntools::Codec<B,Q> &codec;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the --sim-stop-time option.
|
8,490 |
04.06.2017 12:10:06
| -7,200 |
75ae554722b4917112a8391c58f79bc2a77d8ae9
|
Fix bad commands in BFER iterative simus.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it10_0.0_3.0.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it10_0.0_3.0.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 10 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 10 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it20_0.0_3.0.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it20_0.0_3.0.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 20 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 20 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it30_0.0_3.0.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it30_0.0_3.0.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 30 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 30 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it40_0.0_3.0.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_NMS_MAX_it40_0.0_3.0.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 40 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 3.01 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 40 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem ONMS --dec-norm 0.825 --dec-ite 1 --mnt-max-fe 100 --dmod-max MAX --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAX NMS, 40 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it10_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it10_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 10 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 10 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAXS SPA, 10 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it20_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it20_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 20 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 20 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAXS SPA, 20 glob. ite.\nTrace:\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it30_0.0_2.5.txt",
"new_path": "tests/data/BFERI/CPM_LDPC/GSM_BPL/gsm_BPL_SPA_MAXS_it30_0.0_2.5.txt",
"diff": "Run command:\n-./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --dmod-ite 30 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\n+./bin/aff3ct --cde-type LDPC --sim-type BFERI --sim-prec 32 -m 0.0 -M 2.51 --sim-snr-step 0.25 -K 2112 -N 4224 --cde-coset --src-type RAND_FAST --itl-type USER --itl-path ../conf/itl/GSM-LDPC_4224.itl --mod-type CPM --chn-type AWGN_FAST --sim-ite 30 --dec-type BP_LAYERED --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist --dec-implem SPA --dec-ite 1 --mnt-max-fe 100 --dmod-max MAXS --mod-cpm-std GSM\nCurve name:\nGSM-BPL MAXS SPA, 30 glob. ite.\nTrace:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad commands in BFER iterative simus.
|
8,490 |
04.06.2017 13:26:32
| -7,200 |
5729a243d9a968eca1cfc49cb63c9342590a414e
|
Add Git SHA1 in the --version.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -20,6 +20,11 @@ set (LIBRARY_OUTPUT_PATH lib/)\n# Generate the source files list\nfile (GLOB_RECURSE source_files src/*)\n+include(GetGitRevisionDescription)\n+get_git_head_revision(GIT_REFSPEC GIT_SHA1)\n+configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp.in\" \"${CMAKE_CURRENT_BINARY_DIR}/git_sha1.cpp\" @ONLY)\n+list(APPEND source_files \"${CMAKE_CURRENT_BINARY_DIR}/git_sha1.cpp\")\n+\n# Filters creation for IDEs (tested on Visual Studio and based on the \"source_group\" function)\nfunction(assign_source_group)\nforeach(_source IN ITEMS ${ARGN})\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "cmake/Modules/GetGitRevisionDescription.cmake",
"diff": "+# - Returns a version string from Git\n+#\n+# These functions force a re-configure on each git commit so that you can\n+# trust the values of the variables in your build system.\n+#\n+# get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])\n+#\n+# Returns the refspec and sha hash of the current head revision\n+#\n+# git_describe(<var> [<additional arguments to git describe> ...])\n+#\n+# Returns the results of git describe on the source tree, and adjusting\n+# the output so that it tests false if an error occurs.\n+#\n+# git_get_exact_tag(<var> [<additional arguments to git describe> ...])\n+#\n+# Returns the results of git describe --exact-match on the source tree,\n+# and adjusting the output so that it tests false if there was no exact\n+# matching tag.\n+#\n+# git_local_changes(<var>)\n+#\n+# Returns either \"CLEAN\" or \"DIRTY\" with respect to uncommitted changes.\n+# Uses the return code of \"git diff-index --quiet HEAD --\".\n+# Does not regard untracked files.\n+#\n+# Requires CMake 2.6 or newer (uses the 'function' command)\n+#\n+# Original Author:\n+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>\n+# http://academic.cleardefinition.com\n+# Iowa State University HCI Graduate Program/VRAC\n+#\n+# Copyright Iowa State University 2009-2010.\n+# Distributed under the Boost Software License, Version 1.0.\n+# (See accompanying file LICENSE_1_0.txt or copy at\n+# http://www.boost.org/LICENSE_1_0.txt)\n+\n+if(__get_git_revision_description)\n+ return()\n+endif()\n+set(__get_git_revision_description YES)\n+\n+# We must run the following at \"include\" time, not at function call time,\n+# to find the path to this module rather than the path to a calling list file\n+get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)\n+\n+function(get_git_head_revision _refspecvar _hashvar)\n+ set(GIT_PARENT_DIR \"${CMAKE_CURRENT_SOURCE_DIR}\")\n+ set(GIT_DIR \"${GIT_PARENT_DIR}/.git\")\n+ while(NOT EXISTS \"${GIT_DIR}\") # .git dir not found, search parent directories\n+ set(GIT_PREVIOUS_PARENT \"${GIT_PARENT_DIR}\")\n+ get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)\n+ if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)\n+ # We have reached the root directory, we are not in git\n+ set(${_refspecvar} \"GITDIR-NOTFOUND\" PARENT_SCOPE)\n+ set(${_hashvar} \"GITDIR-NOTFOUND\" PARENT_SCOPE)\n+ return()\n+ endif()\n+ set(GIT_DIR \"${GIT_PARENT_DIR}/.git\")\n+ endwhile()\n+ # check if this is a submodule\n+ if(NOT IS_DIRECTORY ${GIT_DIR})\n+ file(READ ${GIT_DIR} submodule)\n+ string(REGEX REPLACE \"gitdir: (.*)\\n$\" \"\\\\1\" GIT_DIR_RELATIVE ${submodule})\n+ get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)\n+ get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)\n+ endif()\n+ set(GIT_DATA \"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data\")\n+ if(NOT EXISTS \"${GIT_DATA}\")\n+ file(MAKE_DIRECTORY \"${GIT_DATA}\")\n+ endif()\n+\n+ if(NOT EXISTS \"${GIT_DIR}/HEAD\")\n+ return()\n+ endif()\n+ set(HEAD_FILE \"${GIT_DATA}/HEAD\")\n+ configure_file(\"${GIT_DIR}/HEAD\" \"${HEAD_FILE}\" COPYONLY)\n+\n+ configure_file(\"${_gitdescmoddir}/GetGitRevisionDescription.cmake.in\"\n+ \"${GIT_DATA}/grabRef.cmake\"\n+ @ONLY)\n+ include(\"${GIT_DATA}/grabRef.cmake\")\n+\n+ set(${_refspecvar} \"${HEAD_REF}\" PARENT_SCOPE)\n+ set(${_hashvar} \"${HEAD_HASH}\" PARENT_SCOPE)\n+endfunction()\n+\n+function(git_describe _var)\n+ if(NOT GIT_FOUND)\n+ find_package(Git QUIET)\n+ endif()\n+ get_git_head_revision(refspec hash)\n+ if(NOT GIT_FOUND)\n+ set(${_var} \"GIT-NOTFOUND\" PARENT_SCOPE)\n+ return()\n+ endif()\n+ if(NOT hash)\n+ set(${_var} \"HEAD-HASH-NOTFOUND\" PARENT_SCOPE)\n+ return()\n+ endif()\n+\n+ # TODO sanitize\n+ #if((${ARGN}\" MATCHES \"&&\") OR\n+ # (ARGN MATCHES \"||\") OR\n+ # (ARGN MATCHES \"\\\\;\"))\n+ # message(\"Please report the following error to the project!\")\n+ # message(FATAL_ERROR \"Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}\")\n+ #endif()\n+\n+ #message(STATUS \"Arguments to execute_process: ${ARGN}\")\n+\n+ execute_process(COMMAND\n+ \"${GIT_EXECUTABLE}\"\n+ describe\n+ ${hash}\n+ ${ARGN}\n+ WORKING_DIRECTORY\n+ \"${CMAKE_CURRENT_SOURCE_DIR}\"\n+ RESULT_VARIABLE\n+ res\n+ OUTPUT_VARIABLE\n+ out\n+ ERROR_QUIET\n+ OUTPUT_STRIP_TRAILING_WHITESPACE)\n+ if(NOT res EQUAL 0)\n+ set(out \"${out}-${res}-NOTFOUND\")\n+ endif()\n+\n+ set(${_var} \"${out}\" PARENT_SCOPE)\n+endfunction()\n+\n+function(git_get_exact_tag _var)\n+ git_describe(out --exact-match ${ARGN})\n+ set(${_var} \"${out}\" PARENT_SCOPE)\n+endfunction()\n+\n+function(git_local_changes _var)\n+ if(NOT GIT_FOUND)\n+ find_package(Git QUIET)\n+ endif()\n+ get_git_head_revision(refspec hash)\n+ if(NOT GIT_FOUND)\n+ set(${_var} \"GIT-NOTFOUND\" PARENT_SCOPE)\n+ return()\n+ endif()\n+ if(NOT hash)\n+ set(${_var} \"HEAD-HASH-NOTFOUND\" PARENT_SCOPE)\n+ return()\n+ endif()\n+\n+ execute_process(COMMAND\n+ \"${GIT_EXECUTABLE}\"\n+ diff-index --quiet HEAD --\n+ WORKING_DIRECTORY\n+ \"${CMAKE_CURRENT_SOURCE_DIR}\"\n+ RESULT_VARIABLE\n+ res\n+ OUTPUT_VARIABLE\n+ out\n+ ERROR_QUIET\n+ OUTPUT_STRIP_TRAILING_WHITESPACE)\n+ if(res EQUAL 0)\n+ set(${_var} \"CLEAN\" PARENT_SCOPE)\n+ else()\n+ set(${_var} \"DIRTY\" PARENT_SCOPE)\n+ endif()\n+endfunction()\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "cmake/Modules/GetGitRevisionDescription.cmake.in",
"diff": "+#\n+# Internal file for GetGitRevisionDescription.cmake\n+#\n+# Requires CMake 2.6 or newer (uses the 'function' command)\n+#\n+# Original Author:\n+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>\n+# http://academic.cleardefinition.com\n+# Iowa State University HCI Graduate Program/VRAC\n+#\n+# Copyright Iowa State University 2009-2010.\n+# Distributed under the Boost Software License, Version 1.0.\n+# (See accompanying file LICENSE_1_0.txt or copy at\n+# http://www.boost.org/LICENSE_1_0.txt)\n+\n+set(HEAD_HASH)\n+\n+file(READ \"@HEAD_FILE@\" HEAD_CONTENTS LIMIT 1024)\n+\n+string(STRIP \"${HEAD_CONTENTS}\" HEAD_CONTENTS)\n+if(HEAD_CONTENTS MATCHES \"ref\")\n+ # named branch\n+ string(REPLACE \"ref: \" \"\" HEAD_REF \"${HEAD_CONTENTS}\")\n+ if(EXISTS \"@GIT_DIR@/${HEAD_REF}\")\n+ configure_file(\"@GIT_DIR@/${HEAD_REF}\" \"@GIT_DATA@/head-ref\" COPYONLY)\n+ else()\n+ configure_file(\"@GIT_DIR@/packed-refs\" \"@GIT_DATA@/packed-refs\" COPYONLY)\n+ file(READ \"@GIT_DATA@/packed-refs\" PACKED_REFS)\n+ if(${PACKED_REFS} MATCHES \"([0-9a-z]*) ${HEAD_REF}\")\n+ set(HEAD_HASH \"${CMAKE_MATCH_1}\")\n+ endif()\n+ endif()\n+else()\n+ # detached HEAD\n+ configure_file(\"@GIT_DIR@/HEAD\" \"@GIT_DATA@/head-ref\" COPYONLY)\n+endif()\n+\n+if(NOT HEAD_HASH)\n+ file(READ \"@GIT_DATA@/head-ref\" HEAD_HASH LIMIT 1024)\n+ string(STRIP \"${HEAD_HASH}\" HEAD_HASH)\n+endif()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include <systemc>\n#endif\n+#include \"Tools/git_sha1.h\"\n#include \"Tools/types.h\"\n#include \"Tools/params.h\"\n#include \"Tools/Arguments_reader.hpp\"\n@@ -89,8 +90,12 @@ void print_version()\n#endif\nstd::string affect_version = \"1.1.0\";\n+ std::string git_sha1 = g_GIT_SHA1;\n+\nstd::cout << \"aff3ct (\" << os << prec << \", \" << compiler << \" \" << compiler_version << \", \"\n<< mipp::IntructionsType << \") \" << affect_version << std::endl;\n+ if (git_sha1 != \"GITDIR-NOTFOUND\")\n+ std::cout << \"GIT SHA1: \" << git_sha1 << std::endl;\nstd::cout << \"Copyright (c) 2016 - MIT license.\" << std::endl;\nstd::cout << \"This is free software; see the source for copying conditions. There is NO\" << std::endl;\nstd::cout << \"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\" << std::endl;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add Git SHA1 in the --version.
|
8,490 |
04.06.2017 13:27:43
| -7,200 |
5bada823237e676e863bd43d2bbf22de0f6ec104
|
Oups forgot some files.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/git_sha1.cpp.in",
"diff": "+#include \"Tools/git_sha1.h\"\n+\n+#define GIT_SHA1 \"@GIT_SHA1@\"\n+const char g_GIT_SHA1[] = GIT_SHA1;\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/git_sha1.h",
"diff": "+extern const char g_GIT_SHA1[];\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Oups forgot some files.
|
8,490 |
04.06.2017 13:48:27
| -7,200 |
69e057e525688ac40395fd07ca1311e96316de3a
|
Add a comment in the CMakeList file for the GIT SHA1 gen.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -20,6 +20,7 @@ set (LIBRARY_OUTPUT_PATH lib/)\n# Generate the source files list\nfile (GLOB_RECURSE source_files src/*)\n+# Auto generate a header containing the last GIT SHA1\ninclude(GetGitRevisionDescription)\nget_git_head_revision(GIT_REFSPEC GIT_SHA1)\nconfigure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp.in\" \"${CMAKE_CURRENT_BINARY_DIR}/git_sha1.cpp\" @ONLY)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a comment in the CMakeList file for the GIT SHA1 gen.
|
8,490 |
06.06.2017 09:29:28
| -7,200 |
f787182e83272a92e36205e70c21d17a2a55dd1b
|
Shorten the date.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "#endif\n#include \"Tools/date.h\"\n+#include \"Tools/general_utils.h\"\n#include \"Tools/Factory/Factory_modem.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n@@ -525,7 +526,8 @@ std::vector<std::pair<std::string,std::string>> Launcher<B,R,Q>\nstd::stringstream date;\ndate << system_clock::now();\n- p.push_back(std::make_pair(\"Date (UTC)\", date.str()));\n+ auto split_date = string_split(date.str(), '.');\n+ p.push_back(std::make_pair(\"Date (UTC)\", split_date[0]));\nreturn p;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Shorten the date.
|
8,490 |
06.06.2017 10:03:19
| -7,200 |
94bbfa123f90485a55779230573ef9247fb5723c
|
Use CURRENT_SOURCE_DIR instead of SOURCE_DIR: this way projects using aff3ct as a library can use the Cmake modules defined in aff3ct.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 3.0.2)\nproject (aff3ct)\n-set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} \"${CMAKE_SOURCE_DIR}/cmake/Modules/\")\n+set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} \"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/\")\nset (CMAKE_MACOSX_RPATH 1)\n# Enable C++11\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Use CURRENT_SOURCE_DIR instead of SOURCE_DIR: this way projects using aff3ct as a library can use the Cmake modules defined in aff3ct.
|
8,490 |
06.06.2017 15:33:21
| -7,200 |
4462c4a09ef0d6bda7e02e99221833c066bdc364
|
Add the g_GIT_SHA1 variable in the aff3ct::tools namespace.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/git_sha1.cpp.in",
"new_path": "src/Tools/git_sha1.cpp.in",
"diff": "#include \"Tools/git_sha1.h\"\n#define GIT_SHA1 \"@GIT_SHA1@\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\nconst char g_GIT_SHA1[] = GIT_SHA1;\n+}\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/git_sha1.h",
"new_path": "src/Tools/git_sha1.h",
"diff": "+namespace aff3ct\n+{\n+namespace tools\n+{\nextern const char g_GIT_SHA1[];\n+}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "//find ./src/ -type f -follow -print | grep \"[.]h$\"\n#include <Tools/general_utils.h>\n+#include <Tools/git_sha1.h>\n#include <Tools/types.h>\n#include <Tools/Math/matrix.h>\n#include <Tools/Math/utils.h>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the g_GIT_SHA1 variable in the aff3ct::tools namespace.
|
8,483 |
07.06.2017 18:19:37
| -7,200 |
d922fc429458e3d93fb247a175dfb4b170a29b6a
|
Cosmetics on encoder LDPC from H; correct a factory encoder bug.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "#include <iostream>\n#include <vector>\n#include <numeric>\n-#include <algorithm>\n#include <functional>\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/matrix.h\"\n-#include \"Tools/Code/LDPC/G/LDPC_G.hpp\"\n#include \"Encoder_LDPC_from_H.hpp\"\n@@ -20,19 +18,21 @@ Encoder_LDPC_from_H<B>\nconst std::string name)\n: Encoder_LDPC<B>(K, N, n_frames, name)\n{\n- std::vector<mipp::vector<B>> H;\n- tools::LDPC_G::build_H(alist_H.get_n_CN(), alist_H.get_n_VN(), alist_H.get_CN_to_VN(), H);\n- tools::LDPC_G::triangularization_H(H, swapped);\n+ unsigned k, n;\n+ tools::LDPC_G::transform_H_to_G(alist_H.get_CN_to_VN(), alist_H.get_n_CN(), alist_H.get_n_VN(),\n+ G, k, n, info_bits_pos);\n- if ((int) H[0].size() != N)\n- throw std::length_error(\"aff3ct::module::Encoder_LDPC_from_H: \\\"H[0].size()\\\" has to be equal to \\\"N\\\".\");\n+ if (this->K != (int)k)\n+ throw std::runtime_error(\"aff3ct::module::Encoder_LDPC_from_H: the built G matrix has a dimension \\\"K\\\" \"\n+ \"different than the given one.\");\n- if ((int)(H[0].size() - H.size()) != K)\n- throw std::length_error(\"aff3ct::module::Encoder_LDPC_from_H: \\\"H[0].size()\\\" - \\\"H.size()\\\" has to be \"\n- \"equal to \\\"K\\\".\");\n+ if (this->N != (int)n)\n+ throw std::runtime_error(\"aff3ct::module::Encoder_LDPC_from_H: the built G matrix has a dimension \\\"N\\\" \"\n+ \"different than the given one.\");\n- tools::LDPC_G::identity_H(H);\n- tools::LDPC_G::transformation_H_to_G(H, G, swapped);\n+ if ((int)this->info_bits_pos.size() != this->K)\n+ throw std::length_error(\"aff3ct::module::Encoder_LDPC_from_H: \\\"info_bits_pos.size()\\\" has to be equal \"\n+ \"to \\\"K\\\".\");\n}\ntemplate <typename B>\n@@ -45,21 +45,11 @@ template <typename B>\nvoid Encoder_LDPC_from_H<B>\n::get_info_bits_pos(mipp::vector<B>& info_bits_pos)\n{\n- if (this->K > (int)info_bits_pos.size())\n+ if (this->K != (int)info_bits_pos.size())\nthrow std::length_error(\"aff3ct::module::Encoder_LDPC_from_H: \\\"info_bits_pos.size()\\\" has to be equal \"\n\"or greater than \\\"K\\\".\");\n- mipp::vector<B> tmp(this->N);\n- std::iota(tmp.begin(), tmp.begin() + this->N, 0);\n-\n- for (unsigned l = 1; l <= (swapped.size() / 2); l++)\n- {\n- auto tmp_val = tmp[swapped[l * 2 -1]];\n- tmp[swapped[l * 2 -1]] = tmp[swapped[(l -1) * 2]];\n- tmp[swapped[(l -1) * 2]] = tmp_val;\n- }\n-\n- std::copy(tmp.begin() + this->N - this->K, tmp.end(), info_bits_pos.begin());\n+ std::copy(this->info_bits_pos.begin(), this->info_bits_pos.end(), info_bits_pos.begin());\n}\ntemplate <typename B>\n@@ -70,7 +60,7 @@ void Encoder_LDPC_from_H<B>\n{\nX_N[i] = 0;\nfor (unsigned j = 0; j < G[i].size(); j++)\n- X_N[i] += U_K[ G[i][j] - 1 ];\n+ X_N[i] += U_K[ G[i][j] ];\nX_N[i] %= 2;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"../Encoder_LDPC.hpp\"\n+#include \"Tools/Code/LDPC/G/LDPC_G.hpp\"\nnamespace aff3ct\n{\n@@ -17,8 +18,8 @@ template <typename B = int>\nclass Encoder_LDPC_from_H : public Encoder_LDPC<B>\n{\nprotected:\n- mipp::vector<unsigned> swapped;\n- std::vector<mipp::vector<unsigned>> G; // position of ones by column\n+ mipp::vector<unsigned> info_bits_pos;\n+ tools::LDPC_G::sparse_matrix G; // position of ones by column\npublic:\nEncoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames = 1,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/G/LDPC_G.hpp",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hpp",
"diff": "#ifndef LDPC_G_HPP_\n#define LDPC_G_HPP_\n-#include <fstream>\n#include <vector>\n+#include <algorithm>\n+#include <numeric>\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -12,15 +13,48 @@ namespace tools\nstruct LDPC_G\n{\npublic:\n+\n+ using sparse_matrix = std::vector<std::vector<unsigned>>;\n+ template<typename B>\n+ using full_matrix = std::vector<mipp::vector<B>>;\n+\n+ /*\n+ * convert a binary sparse matrix to a binary full matrix\n+ */\ntemplate <typename B>\n- static void build_H(const unsigned k, const unsigned n, const std::vector<std::vector<unsigned>>& positions,\n- std::vector<mipp::vector<B>>& H);\n+ static inline void sparse_to_full(const sparse_matrix& sparse, const unsigned k, const unsigned n, full_matrix<B>& full_H);\n+\n+ /*\n+ * convert a binary full matrix to a binary sparse matrix\n+ */\n+ template <typename B>\n+ static inline void full_to_sparse(const full_matrix<B>& full, sparse_matrix& sparse, unsigned& k, unsigned& n);\n+\n+ /*\n+ * Reorder rows and columns to create a diagonal of binary ones on the left part of the matrix.\n+ * High of the matrix must be smaller than its width.\n+ * At the end, the left part of the matrix does not necessary form the identity, but includes it.\n+ */\ntemplate <typename B>\n- static void triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<unsigned>& swapped);\n+ static inline void create_diagonal(full_matrix<B>& mat, mipp::vector<unsigned>& swapped_cols);\n+\n+ /*\n+ * Reorder rows and columns to create an identity of binary ones on the left part of the matrix.\n+ * High of the matrix must be smaller than its width.\n+ */\ntemplate <typename B>\n- static void identity_H(std::vector<mipp::vector<B>>& H);\n+ static inline void create_identity(full_matrix<B>& mat);\n+\n+ static inline void transform_H_to_G(const sparse_matrix& H, const unsigned k_H, const unsigned n_H,\n+ sparse_matrix& G, unsigned& k_G, unsigned& n_G,\n+ mipp::vector<unsigned>& info_bits_pos);\n+\n+\n+protected :\n+\ntemplate <typename B>\n- static void transformation_H_to_G(std::vector<mipp::vector<B>>& H, std::vector<mipp::vector<unsigned>>& G, mipp::vector<unsigned>& swapped);\n+ static inline void transform_H_to_G(full_matrix<B>& mat, mipp::vector<unsigned>& info_bits_pos);\n+\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"diff": "-#include <string>\n-#include <sstream>\n-#include <vector>\n-#include <algorithm>\n-\n-#include \"Tools/Display/bash_tools.h\"\n-\n#include \"LDPC_G.hpp\"\n-using namespace aff3ct::tools;\n-\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename B>\nvoid LDPC_G\n-::build_H(const unsigned k, const unsigned n, const std::vector<std::vector<unsigned>>& positions,\n- std::vector<mipp::vector<B>>& H)\n+::sparse_to_full(const sparse_matrix& sparse, const unsigned k, const unsigned n, full_matrix<B>& full)\n{\n- H.resize(k, mipp::vector<B>(n, 0));\n- for (unsigned i = 0; i < positions.size(); i++)\n- for (unsigned j = 0; j < positions[i].size(); j++)\n- H[i][positions[i][j]] = 1;\n+ full.resize(k, mipp::vector<B>(n, 0));\n+\n+ if (k != sparse.size())\n+ throw std::length_error(\"aff3ct::tools::LDPC_G::sparse_to_full: sparse matrix high \\\"sparse.size()\\\" has\"\n+ \" to be equal to its given high \\\"k\\\".\");\n+\n+ for (unsigned i = 0; i < sparse.size(); i++)\n+ for (unsigned j = 0; j < sparse[i].size(); j++)\n+ full[i].at(sparse[i][j]) = 1; // will check if the given position does not overflow\n}\ntemplate <typename B>\nvoid LDPC_G\n-::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<unsigned>& swapped)\n+::full_to_sparse(const full_matrix<B>& full, sparse_matrix& sparse, unsigned& k, unsigned& n)\n{\n- unsigned n = (unsigned)H[0].size();\n- unsigned k = (unsigned)H.size();\n- unsigned i = 0;\n- bool fund = false;\n+ k = (unsigned)full.size();\n+ n = (unsigned)full.front().size();\n+\n+ sparse.resize(k);\n+ for (unsigned i = 0; i < full.size(); i++)\n+ for (unsigned j = 0; j < full[i].size(); j++)\n+ if (full[i][j])\n+ sparse[i].push_back(j);\n+}\n- mipp::vector<B> tmp(n,0);\n- mipp::vector<B> tmp2;\n+template <typename B>\n+void LDPC_G\n+::create_diagonal(full_matrix<B>& mat, mipp::vector<unsigned>& swapped_cols)\n+{\n+ unsigned k = (unsigned)mat.size();\n+ unsigned n = (unsigned)mat.front().size();\n+\n+ if (k > n)\n+ throw std::length_error(\"aff3ct::tools::LDPC_G::create_diagonal: matrix high \\\"mat.size()\\\" has to be smaller \"\n+ \" than its width \\\"mat.front().size()\\\".\");\n+\n+ unsigned i = 0;\n+ bool found = false;\nwhile (i < k)\n{\n- if (H[i][i])\n+ if (mat[i][i])\n{\nfor (unsigned j = i +1; j < k; j++)\n- if( H[j][i] )\n- std::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n+ if( mat[j][i] )\n+ std::transform(mat[j].begin(), mat[j].end(), mat[i].begin(), mat[j].begin(), std::not_equal_to<B>());\n}\nelse\n{\nfor (unsigned j = i +1; j < k; j++) // find an other row which is good\n- if (H[j][i])\n+ if (mat[j][i])\n{\n- tmp = H[i];\n- H[i] = H[j];\n- H[j] = tmp;\n+ std::swap(mat[i], mat[j]);\ni--;\n- fund = true;\n+ found = true;\nbreak;\n}\n- if (!fund) // if does not fund\n+ if (!found) // if does not fund\nfor (unsigned j = i +1; j < n; j++) // find an other column which is good\n- if (H[i][j])\n+ if (mat[i][j])\n{\n- swapped.push_back(i);\n- swapped.push_back(j);\n-\n- tmp2.clear();\n+ swapped_cols.push_back(i);\n+ swapped_cols.push_back(j);\n- for (unsigned l = 0; l < k; l++) tmp2.push_back(H[l][i]);\n- for (unsigned l = 0; l < k; l++) H[l][i] = H[l][j];\n- for (unsigned l = 0; l < k; l++) H[l][j] = tmp2[l];\n+ // swap the columns\n+ mipp::vector<B> column_save(k);\n+ for (unsigned l = 0; l < k; l++) column_save[l] = (mat[l][i]);\n+ for (unsigned l = 0; l < k; l++) mat[l][i] = mat[l][j];\n+ for (unsigned l = 0; l < k; l++) mat[l][j] = column_save[l];\ni--;\n- fund = true;\n+ found = true;\nbreak;\n}\n- if (!fund) // if does not fund again this mean that the row is the null vector\n+ if (!found) // if does not fund again this mean that the row is the null vector\n{\n- H.erase(H.begin() +i);\n+ mat.erase(mat.begin() +i);\ni--;\nk--;\n}\n- fund = false;\n+ found = false;\n}\ni++;\n}\n@@ -89,46 +98,72 @@ void LDPC_G\ntemplate <typename B>\nvoid LDPC_G\n-::identity_H(std::vector<mipp::vector<B>>& H)\n+::create_identity(full_matrix<B>& mat)\n{\n- unsigned k = (unsigned)H.size();\n+ unsigned k = (unsigned)mat.size();\n+ unsigned n = (unsigned)mat.front().size();\n+\n+ if (k > n)\n+ throw std::length_error(\"aff3ct::tools::LDPC_G::create_identity: matrix high \\\"mat.size()\\\" has to be smaller \"\n+ \" than its width \\\"mat.front().size()\\\".\");\n+\nfor (unsigned i = k - 1 ; i > 0; i--)\nfor (unsigned j = i; j > 0; j--)\n- if (H[j-1][i])\n- std::transform (H[j-1].begin(), H[j-1].end(), H[i].begin(), H[j-1].begin(), std::not_equal_to<B>());\n-\n+ if (mat[j-1][i])\n+ std::transform (mat[j-1].begin(), mat[j-1].end(), mat[i].begin(), mat[j-1].begin(), std::not_equal_to<B>());\n}\ntemplate <typename B>\nvoid LDPC_G\n-::transformation_H_to_G(std::vector<mipp::vector<B>>& H, std::vector<mipp::vector<unsigned>>& G, mipp::vector<unsigned>& swapped)\n+::transform_H_to_G(full_matrix<B>& mat, mipp::vector<unsigned>& info_bits_pos)\n{\n- unsigned n = (unsigned)H[0].size();\n- unsigned k = (unsigned)H.size();\n+ unsigned k = (unsigned)mat.size();\n+ unsigned n = (unsigned)mat.front().size();\n+\n+ if (k > n)\n+ throw std::length_error(\"aff3ct::tools::LDPC_G::transform_H_to_G: matrix high \\\"mat.size()\\\" has to be smaller \"\n+ \" than its width \\\"mat.front().size()\\\".\");\n- for (unsigned i = 0; i < k; i++) // Kill of the Identity in H\n- H[i].erase( H[i].begin(), H[i].begin() + k );\n+ mipp::vector<unsigned> swapped_cols;\n+ tools::LDPC_G::create_diagonal(mat, swapped_cols);\n+ tools::LDPC_G::create_identity(mat);\n- H.resize(n, mipp::vector<B>(n-k,0));\n+ for (unsigned i = 0; i < k; i++) // erase the just created identity in the left part of H\n+ mat[i].erase( mat[i].begin(), mat[i].begin() + k );\n+\n+ // mat dimension is now n*k (above it was k*n)\n+ mat.resize(n, mipp::vector<B>(n-k,0));\nfor (unsigned i = k; i < n; i++) // Add identity at the end\n- H[i][i-k] = 1;\n+ mat[i][i-k] = 1;\n- // Re-organization: column of G\n- mipp::vector<B> tmp(n - k, 0);\n- for (unsigned l = (unsigned)(swapped.size() / 2); l > 0; l--)\n- {\n- tmp = H[swapped[l*2-1]];\n- H[swapped[l*2-1]] = H[swapped[(l-1)*2]];\n- H[swapped[(l-1)*2]] = tmp;\n- }\n+ // Re-organization: get G\n+ for (unsigned l = (unsigned)(swapped_cols.size() / 2); l > 0; l--)\n+ std::swap(mat[swapped_cols[l*2-2]], mat[swapped_cols[l*2-1]]);\n- // Write G matrix name H in G with the positions of each one by column\n- G.resize(n, mipp::vector<unsigned>(0,0));\n- for (unsigned i = 0; i < H.size(); i++)\n- for (unsigned j = 0; j < H[0].size(); j++)\n- if (H[i][j])\n- G[i].push_back(j+1);\n+ // return info bits positions\n+ info_bits_pos.resize(k);\n+\n+ mipp::vector<unsigned> bits_pos(n);\n+ std::iota(bits_pos.begin(), bits_pos.begin() + n, 0);\n+\n+ for (unsigned l = 1; l <= (swapped_cols.size() / 2); l++)\n+ std::swap(bits_pos[swapped_cols[l*2-2]], bits_pos[swapped_cols[l*2-1]]);\n+\n+ std::copy(bits_pos.begin() + (n-k), bits_pos.end(), info_bits_pos.begin());\n}\n+inline void LDPC_G\n+::transform_H_to_G(const sparse_matrix& H, const unsigned k_H, const unsigned n_H,\n+ sparse_matrix& G, unsigned& k_G, unsigned& n_G,\n+ mipp::vector<unsigned>& info_bits_pos)\n+{\n+ using bit_type = int8_t;\n+ full_matrix<bit_type> mat;\n+ sparse_to_full(H, k_H, n_H, mat);\n+\n+ transform_H_to_G(mat, info_bits_pos);\n+\n+ full_to_sparse(mat, G, n_G, k_G);\n+}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -44,6 +44,7 @@ Encoder_LDPC<B>* Codec_LDPC<B,Q>\nthis->params.code.K,\nthis->params.code.N_code,\nthis->params.encoder.path,\n+ this->params.code.alist_path,\nthis->params.simulation.inter_frame_level);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"diff": "@@ -13,11 +13,12 @@ Encoder_LDPC<B>* Factory_encoder_LDPC<B>\n::build(const std::string type,\nconst int K,\nconst int N,\n- const std::string path,\n+ const std::string path_G,\n+ const std::string path_H,\nconst int n_frames)\n{\n- if (type == \"LDPC\" ) return new Encoder_LDPC <B>(K, N, AList_reader(path), n_frames);\n- else if (type == \"LDPC_H\" ) return new Encoder_LDPC_from_H<B>(K, N, AList_reader(path), n_frames);\n+ if (type == \"LDPC\" ) return new Encoder_LDPC <B>(K, N, AList_reader(path_G), n_frames);\n+ else if (type == \"LDPC_H\" ) return new Encoder_LDPC_from_H<B>(K, N, AList_reader(path_H), n_frames);\nelse if (type == \"LDPC_DVBS2\") return new Encoder_LDPC_DVBS2 <B>(K, N, n_frames);\nthrow std::runtime_error(\"aff3ct::tools::Factory_encoder_LDPC: the factory could not allocate the object.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.hpp",
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.hpp",
"diff": "@@ -17,7 +17,8 @@ struct Factory_encoder_LDPC : public Factory\nstatic module::Encoder_LDPC<B>* build(const std::string type,\nconst int K,\nconst int N,\n- const std::string path = \"\",\n+ const std::string path_G = \"\",\n+ const std::string path_H = \"\",\nconst int n_frames = 1);\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Cosmetics on encoder LDPC from H; correct a factory encoder bug.
|
8,490 |
08.06.2017 17:46:40
| -7,200 |
42516f0e25ac2397e6c351947e719d98fdd2983e
|
Fix G construction.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -24,7 +24,7 @@ Codec_LDPC<B,Q>\nH = AList::read(file_H);\nfile_H.close();\n- if (!params.encoder.path.empty())\n+ if (!params.encoder.path.empty() && params.encoder.type == \"LDPC\")\n{\nauto file_G = std::ifstream(params.encoder.path, std::ifstream::in);\nG = AList::read(file_G);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix G construction.
|
8,488 |
08.06.2017 13:53:39
| 14,400 |
fb8486443c72702751dda3001a36fe7d2a1e7f48
|
Fix SCMA tests.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/turbo/LTE/scma_PSI2_turbo_3072_1024_0_3.75_LTE.txt",
"new_path": "tests/data/BFER/turbo/LTE/scma_PSI2_turbo_3072_1024_0_3.75_LTE.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type BFER --cde-type TURBO -K 1024 -N 3072 -m 0 -M 3.75 -s 0.25 --chn-type AWGN_FAST --mod-type SCMA --dmod-ite 5 -i 6 --mnt-max-fe 100 --sim-i-lvl 6 --dec-type LTE --dec-implem FAST --dec-simd INTRA -t 8 --sim-pyber \"SCMA_ALI\" --dec-sf LTE_VEC --dmod-psi PSI2\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"TURBO\" -K \"1024\" -N \"3072\" -m \"0\" -M \"4.25\" -s \"0.25\" --chn-type \"AWGN_FAST\" --mod-type \"SCMA\" --dmod-ite \"5\" -i \"6\" --mnt-max-fe \"100\" --sim-inter-lvl \"6\" --dec-type \"LTE\" --dec-implem \"FAST\" --dec-simd \"INTRA\" -t \"8\" --sim-pyber \"SCMA_ALI\" --dec-sf \"LTE_VEC\" --dmod-psi \"PSI2\"\nCurve name:\n-SCMA PSI\n+SCMA_ALI\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n@@ -9,75 +9,77 @@ SCMA PSI\n# * Simulation ------------------------------------\n# ** Type = BFER\n# ** SNR min (m) = 0.000000 dB\n-# ** SNR max (M) = 30.000000 dB\n-# ** SNR step (s) = 0.500000 dB\n+# ** SNR max (M) = 4.250100 dB\n+# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 6\n+# ** Seed = 0\n+# ** Date (UTC) = 2017-06-08 13:26:52\n# ** Multi-threading (t) = 8 thread(s)\n# * Code ------------------------------------------\n-# ** Type = UNCODED\n-# ** Info. bits (K) = 12\n-# ** Codeword size (N) = 12\n+# ** Type = TURBO\n+# ** Info. bits (K) = 1024\n+# ** Codeword size (N) = 3072 + 12 (tail bits)\n+# ** Code rate (R) = 0.332036\n# ** Coset approach (c) = off\n# * Source ----------------------------------------\n# ** Type = RAND\n# * Encoder ---------------------------------------\n+# ** Type = TURBO\n# ** Systematic encoding = on\n+# ** Polynomials = {013,015}\n+# ** Buffered = on\n+# * Interleaver -----------------------------------\n+# ** Type = LTE\n+# ** Uniform = off\n# * Modulator -------------------------------------\n-# ** Type = 8-SCMA\n+# ** Type = SCMA\n+# ** Bits per symbol = 3\n+# ** Sampling factor = 1\n# * Channel ---------------------------------------\n# ** Type = AWGN_FAST\n-# ** Domain = LLR\n# * Demodulator -----------------------------------\n# ** Sigma square = on\n-# ** Max type = MAX\n+# ** Max type = unused\n# ** Number of iterations = 5\n+# ** Psi function = PSI2\n# * Decoder ---------------------------------------\n-# ** Type (D) = NONE\n-# ** Implementation = NONE\n+# ** Type (D) = BCJR\n+# ** Implementation = FAST\n+# ** SIMD strategy = INTRA\n+# ** Num. of iterations (i) = 6\n+# ** Scaling factor = LTE_VEC\n+# ** Max type = MAX\n# * Monitor ---------------------------------------\n-# ** Frame error count (e) = 10000\n+# ** Frame error count (e) = 100\n+# ** Bad frames tracking = off\n+# ** Bad frames replay = off\n#\n# The simulation is running...\n-# -------------------------------------------------------------||--------------------------------||---------------------\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n-# on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time\n-# -------------------------------------------------------------||--------------------------------||---------------------\n-# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n-# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n-# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n-# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 11544 | 21767 | 10036 | 1.57e-01 | 8.69e-01 || 218.19 | 218.19 | 0.33 || 2.47 | 00h00'00\n- 0.50 | 11862 | 20821 | 10037 | 1.46e-01 | 8.46e-01 || 352.47 | 352.47 | 0.20 || 4.01 | 00h00'00\n- 1.00 | 12240 | 19874 | 10036 | 1.35e-01 | 8.20e-01 || 377.90 | 377.90 | 0.19 || 4.50 | 00h00'00\n- 1.50 | 12732 | 18954 | 10033 | 1.24e-01 | 7.88e-01 || 391.19 | 391.19 | 0.18 || 4.49 | 00h00'00\n- 2.00 | 13452 | 18026 | 10030 | 1.12e-01 | 7.46e-01 || 389.66 | 389.66 | 0.18 || 4.33 | 00h00'00\n- 2.50 | 14364 | 17105 | 10037 | 9.92e-02 | 6.99e-01 || 377.71 | 377.71 | 0.19 || 4.54 | 00h00'00\n- 3.00 | 15450 | 16143 | 10035 | 8.71e-02 | 6.50e-01 || 381.85 | 381.85 | 0.19 || 4.46 | 00h00'00\n- 3.50 | 17172 | 15376 | 10028 | 7.46e-02 | 5.84e-01 || 384.35 | 384.35 | 0.19 || 4.52 | 00h00'00\n- 4.00 | 19362 | 14543 | 10025 | 6.26e-02 | 5.18e-01 || 391.29 | 391.29 | 0.18 || 4.52 | 00h00'00\n- 4.50 | 22284 | 13822 | 10020 | 5.17e-02 | 4.50e-01 || 393.71 | 393.71 | 0.18 || 4.55 | 00h00'00\n- 5.00 | 26898 | 13272 | 10010 | 4.11e-02 | 3.72e-01 || 414.36 | 414.36 | 0.17 || 4.80 | 00h00'00\n- 5.50 | 33036 | 12831 | 10013 | 3.24e-02 | 3.03e-01 || 380.72 | 380.72 | 0.19 || 4.53 | 00h00'00\n- 6.00 | 41898 | 12467 | 10018 | 2.48e-02 | 2.39e-01 || 352.12 | 352.12 | 0.20 || 4.45 | 00h00'00\n- 6.50 | 55500 | 12059 | 10014 | 1.81e-02 | 1.80e-01 || 407.67 | 407.67 | 0.18 || 4.76 | 00h00'00\n- 7.00 | 74472 | 11838 | 10006 | 1.32e-02 | 1.34e-01 || 424.55 | 424.55 | 0.17 || 4.90 | 00h00'00\n- 7.50 | 102348 | 11648 | 10010 | 9.48e-03 | 9.78e-02 || 422.75 | 422.75 | 0.17 || 4.97 | 00h00'00\n- 8.00 | 147258 | 11521 | 10002 | 6.52e-03 | 6.79e-02 || 432.62 | 432.62 | 0.17 || 5.10 | 00h00'00\n- 8.50 | 210138 | 11464 | 10009 | 4.55e-03 | 4.76e-02 || 440.05 | 440.05 | 0.16 || 5.14 | 00h00'00\n- 9.00 | 307320 | 11325 | 10007 | 3.07e-03 | 3.26e-02 || 437.77 | 437.77 | 0.16 || 5.20 | 00h00'00\n- 9.50 | 448950 | 11226 | 10003 | 2.08e-03 | 2.23e-02 || 450.44 | 450.44 | 0.16 || 5.23 | 00h00'01\n- 10.00 | 669414 | 11131 | 10001 | 1.39e-03 | 1.49e-02 || 441.30 | 441.30 | 0.16 || 5.25 | 00h00'01\n- 10.50 | 993804 | 10986 | 10001 | 9.21e-04 | 1.01e-02 || 446.96 | 446.96 | 0.16 || 5.28 | 00h00'02\n- 11.00 | 1444746 | 10874 | 10000 | 6.27e-04 | 6.92e-03 || 437.60 | 437.60 | 0.16 || 5.29 | 00h00'03\n- 11.50 | 2170812 | 10811 | 10002 | 4.15e-04 | 4.61e-03 || 453.40 | 453.40 | 0.16 || 5.30 | 00h00'04\n- 12.00 | 3168132 | 10732 | 10005 | 2.82e-04 | 3.16e-03 || 452.13 | 452.13 | 0.16 || 5.32 | 00h00'07\n- 12.50 | 4867434 | 10678 | 10001 | 1.83e-04 | 2.05e-03 || 453.24 | 453.24 | 0.16 || 5.32 | 00h00'10\n- 13.00 | 7721598 | 10623 | 10004 | 1.15e-04 | 1.30e-03 || 415.71 | 415.71 | 0.17 || 5.02 | 00h00'18\n- 13.50 | 13031934 | 10568 | 10005 | 6.76e-05 | 7.68e-04 || 412.55 | 412.55 | 0.17 || 4.96 | 00h00'31\n- 14.00 | 22553508 | 10511 | 10000 | 3.88e-05 | 4.43e-04 || 441.63 | 441.63 | 0.16 || 5.20 | 00h00'52\n-\n- 14.50 | 3184098 | 906 | 870 | 2.37e-05 | 2.73e-04 || 443.20 | 443.20 | 0.16 || 5.18 | 00h00'07 x\n-\n-\n+# on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+ -0.02 | 0.00 | 144 | 43211 | 144 | 2.93e-01 | 1.00e+00 || 2.53 | 0.84 | 7312.60 || 5.69 | 00h00'00\n+ 0.23 | 0.25 | 144 | 42033 | 144 | 2.85e-01 | 1.00e+00 || 2.68 | 0.89 | 6908.83 || 5.49 | 00h00'00\n+ 0.48 | 0.50 | 144 | 41080 | 144 | 2.79e-01 | 1.00e+00 || 2.49 | 0.83 | 7418.07 || 5.21 | 00h00'00\n+ 0.73 | 0.75 | 144 | 39822 | 144 | 2.70e-01 | 1.00e+00 || 1.86 | 0.62 | 9938.21 || 4.77 | 00h00'00\n+ 0.98 | 1.00 | 144 | 37744 | 144 | 2.56e-01 | 1.00e+00 || 2.57 | 0.85 | 7209.13 || 5.76 | 00h00'00\n+ 1.23 | 1.25 | 144 | 35919 | 144 | 2.44e-01 | 1.00e+00 || 2.54 | 0.84 | 7282.40 || 5.51 | 00h00'00\n+ 1.48 | 1.50 | 144 | 33721 | 144 | 2.29e-01 | 1.00e+00 || 2.35 | 0.78 | 7880.08 || 5.18 | 00h00'00\n+ 1.73 | 1.75 | 144 | 31229 | 144 | 2.12e-01 | 1.00e+00 || 2.12 | 0.70 | 8718.64 || 4.55 | 00h00'00\n+ 1.98 | 2.00 | 144 | 27587 | 143 | 1.87e-01 | 9.93e-01 || 2.23 | 0.74 | 8302.22 || 5.47 | 00h00'00\n+ 2.23 | 2.25 | 150 | 23043 | 142 | 1.50e-01 | 9.47e-01 || 2.29 | 0.76 | 8074.57 || 5.68 | 00h00'00\n+ 2.48 | 2.50 | 162 | 17472 | 137 | 1.05e-01 | 8.46e-01 || 2.34 | 0.78 | 7920.21 || 5.89 | 00h00'00\n+ 2.73 | 2.75 | 228 | 11787 | 130 | 5.05e-02 | 5.70e-01 || 2.27 | 0.75 | 8143.29 || 5.48 | 00h00'00\n+ 2.98 | 3.00 | 372 | 7750 | 114 | 2.03e-02 | 3.06e-01 || 2.43 | 0.81 | 7601.84 || 5.71 | 00h00'00\n+ 3.23 | 3.25 | 1044 | 5818 | 105 | 5.44e-03 | 1.01e-01 || 2.66 | 0.88 | 6943.63 || 6.61 | 00h00'00\n+ 3.48 | 3.50 | 4404 | 4111 | 102 | 9.12e-04 | 2.32e-02 || 2.52 | 0.84 | 7337.21 || 6.52 | 00h00'02\n+ 3.73 | 3.75 | 44082 | 2733 | 101 | 6.05e-05 | 2.29e-03 || 2.12 | 0.70 | 8716.36 || 5.52 | 00h00'24\n+ 3.98 | 4.00 | 510270 | 2077 | 100 | 3.97e-06 | 1.96e-04 || 1.79 | 0.59 | 10353.35 || 4.64 | 00h05'38\n# End of the simulation.\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/turbo/LTE/scma_PSI3_turbo_3072_1024_0_3.75_LTE.txt",
"new_path": "tests/data/BFER/turbo/LTE/scma_PSI3_turbo_3072_1024_0_3.75_LTE.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type BFER --cde-type TURBO -K 1024 -N 3072 -m 0 -M 3.75 -s 0.25 --chn-type AWGN_FAST --mod-type SCMA --dmod-ite 5 -i 6 --mnt-max-fe 100 --sim-i-lvl 6 --dec-type LTE --dec-implem FAST --dec-simd INTRA -t 8 --sim-pyber \"SCMA_ALI\" --dec-sf LTE_VEC --dmod-psi PSI3\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"TURBO\" -K \"1024\" -N \"3072\" -m \"0\" -M \"4.0\" -s \"0.25\" --chn-type \"AWGN_FAST\" --mod-type \"SCMA\" --dmod-ite \"5\" -i \"6\" --mnt-max-fe \"100\" --sim-inter-lvl \"6\" --dec-type \"LTE\" --dec-implem \"FAST\" --dec-simd \"INTRA\" -t \"4\" --sim-pyber \"SCMA_ALI\" --dec-sf \"LTE_VEC\" --dmod-psi \"PSI3\"\nCurve name:\n-SCMA estimation 1/(n0+4*norm^2) 5ittr\n+SCMA_ALI\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n@@ -9,72 +9,77 @@ SCMA estimation 1/(n0+4*norm^2) 5ittr\n# * Simulation ------------------------------------\n# ** Type = BFER\n# ** SNR min (m) = 0.000000 dB\n-# ** SNR max (M) = 30.000000 dB\n-# ** SNR step (s) = 0.500000 dB\n+# ** SNR max (M) = 4.000100 dB\n+# ** SNR step (s) = 0.250000 dB\n# ** Type of bits = int (32 bits)\n# ** Type of reals = float (32 bits)\n-# ** Multi-threading (t) = 8 thread(s)\n+# ** Inter frame level = 6\n+# ** Seed = 0\n+# ** Date (UTC) = 2017-06-08 13:56:35\n+# ** Multi-threading (t) = 4 thread(s)\n# * Code ------------------------------------------\n-# ** Type = UNCODED\n-# ** Info. bits (K) = 12\n-# ** Codeword size (N) = 12\n+# ** Type = TURBO\n+# ** Info. bits (K) = 1024\n+# ** Codeword size (N) = 3072 + 12 (tail bits)\n+# ** Code rate (R) = 0.332036\n# ** Coset approach (c) = off\n# * Source ----------------------------------------\n# ** Type = RAND\n# * Encoder ---------------------------------------\n+# ** Type = TURBO\n# ** Systematic encoding = on\n+# ** Polynomials = {013,015}\n+# ** Buffered = on\n+# * Interleaver -----------------------------------\n+# ** Type = LTE\n+# ** Uniform = off\n# * Modulator -------------------------------------\n-# ** Type = 8-SCMA\n+# ** Type = SCMA\n+# ** Bits per symbol = 3\n+# ** Sampling factor = 1\n# * Channel ---------------------------------------\n# ** Type = AWGN_FAST\n-# ** Domain = LLR\n# * Demodulator -----------------------------------\n# ** Sigma square = on\n-# ** Max type = MAX\n+# ** Max type = unused\n# ** Number of iterations = 5\n+# ** Psi function = PSI3\n# * Decoder ---------------------------------------\n-# ** Type (D) = NONE\n-# ** Implementation = NONE\n+# ** Type (D) = BCJR\n+# ** Implementation = FAST\n+# ** SIMD strategy = INTRA\n+# ** Num. of iterations (i) = 6\n+# ** Scaling factor = LTE_VEC\n+# ** Max type = MAX\n# * Monitor ---------------------------------------\n-# ** Frame error count (e) = 10000\n+# ** Frame error count (e) = 100\n+# ** Bad frames tracking = off\n+# ** Bad frames replay = off\n#\n# The simulation is running...\n-# -------------------------------------------------------------||--------------------------------||---------------------\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n-# on the Signal Noise Ratio (SNR) Eb/N0 || latency (per thread) || and elapsed time\n-# -------------------------------------------------------------||--------------------------------||---------------------\n-# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n-# SNR | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n-# (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n-# ------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 0.00 | 11616 | 21646 | 10039 | 1.55e-01 | 8.64e-01 || 372.78 | 372.78 | 0.19 || 3.88 | 00h00'00\n- 0.50 | 11904 | 20818 | 10041 | 1.46e-01 | 8.43e-01 || 411.91 | 411.91 | 0.17 || 5.04 | 00h00'00\n- 1.00 | 12246 | 19931 | 10040 | 1.36e-01 | 8.20e-01 || 454.86 | 454.86 | 0.16 || 5.18 | 00h00'00\n- 1.50 | 12624 | 18988 | 10037 | 1.25e-01 | 7.95e-01 || 449.07 | 449.07 | 0.16 || 5.17 | 00h00'00\n- 2.00 | 13200 | 18054 | 10033 | 1.14e-01 | 7.60e-01 || 448.14 | 448.14 | 0.16 || 5.14 | 00h00'00\n- 2.50 | 14010 | 17168 | 10029 | 1.02e-01 | 7.16e-01 || 459.36 | 459.36 | 0.16 || 5.17 | 00h00'00\n- 3.00 | 15090 | 16381 | 10032 | 9.05e-02 | 6.65e-01 || 460.34 | 460.34 | 0.16 || 5.17 | 00h00'00\n- 3.50 | 16482 | 15528 | 10027 | 7.85e-02 | 6.08e-01 || 450.73 | 450.73 | 0.16 || 5.20 | 00h00'00\n- 4.00 | 18312 | 14784 | 10024 | 6.73e-02 | 5.47e-01 || 464.78 | 464.78 | 0.15 || 5.24 | 00h00'00\n- 4.50 | 20838 | 14025 | 10021 | 5.61e-02 | 4.81e-01 || 461.80 | 461.80 | 0.16 || 5.17 | 00h00'00\n- 5.00 | 24468 | 13298 | 10018 | 4.53e-02 | 4.09e-01 || 458.57 | 458.57 | 0.16 || 5.26 | 00h00'00\n- 5.50 | 30258 | 12837 | 10016 | 3.54e-02 | 3.31e-01 || 459.94 | 459.94 | 0.16 || 5.26 | 00h00'00\n- 6.00 | 38016 | 12402 | 10011 | 2.72e-02 | 2.63e-01 || 456.99 | 456.99 | 0.16 || 5.28 | 00h00'00\n- 6.50 | 49494 | 11978 | 10014 | 2.02e-02 | 2.02e-01 || 453.75 | 453.75 | 0.16 || 5.26 | 00h00'00\n- 7.00 | 66840 | 11626 | 10011 | 1.45e-02 | 1.50e-01 || 455.23 | 455.23 | 0.16 || 5.29 | 00h00'00\n- 7.50 | 90504 | 11469 | 10007 | 1.06e-02 | 1.11e-01 || 463.95 | 463.95 | 0.16 || 5.31 | 00h00'00\n- 8.00 | 129702 | 11292 | 10004 | 7.26e-03 | 7.71e-02 || 455.90 | 455.90 | 0.16 || 5.31 | 00h00'00\n- 8.50 | 187314 | 11203 | 10004 | 4.98e-03 | 5.34e-02 || 468.41 | 468.41 | 0.15 || 5.31 | 00h00'00\n- 9.00 | 274596 | 11091 | 10003 | 3.37e-03 | 3.64e-02 || 448.52 | 448.52 | 0.16 || 5.26 | 00h00'00\n- 9.50 | 404610 | 11025 | 10000 | 2.27e-03 | 2.47e-02 || 439.86 | 439.86 | 0.16 || 5.29 | 00h00'00\n- 10.00 | 602682 | 10932 | 10006 | 1.51e-03 | 1.66e-02 || 461.13 | 461.13 | 0.16 || 5.30 | 00h00'01\n- 10.50 | 887016 | 10814 | 10000 | 1.02e-03 | 1.13e-02 || 447.11 | 447.11 | 0.16 || 5.12 | 00h00'02\n- 11.00 | 1317816 | 10752 | 10003 | 6.80e-04 | 7.59e-03 || 457.66 | 457.66 | 0.16 || 5.25 | 00h00'03\n- 11.50 | 1953714 | 10694 | 10000 | 4.56e-04 | 5.12e-03 || 463.28 | 463.28 | 0.16 || 5.26 | 00h00'04\n- 12.00 | 2877372 | 10634 | 10001 | 3.08e-04 | 3.48e-03 || 458.69 | 458.69 | 0.16 || 5.31 | 00h00'06\n- 12.50 | 4450866 | 10566 | 10001 | 1.98e-04 | 2.25e-03 || 462.09 | 462.09 | 0.16 || 5.31 | 00h00'10\n- 13.00 | 7098582 | 10526 | 10005 | 1.24e-04 | 1.41e-03 || 463.64 | 463.64 | 0.16 || 5.30 | 00h00'16\n- 13.50 | 11489994 | 10496 | 10004 | 7.61e-05 | 8.71e-04 || 452.96 | 452.96 | 0.16 || 5.25 | 00h00'26\n- 14.00 | 19825062 | 10443 | 10001 | 4.39e-05 | 5.04e-04 || 433.62 | 433.62 | 0.17 || 5.17 | 00h00'45\n- 14.50 | 14729190 | 4190 | 4006 | 2.37e-05 | 2.72e-04 || 434.35 | 434.35 | 0.17 || 5.14 | 00h00'34 x\n+# on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+ -0.02 | 0.00 | 120 | 34839 | 120 | 2.84e-01 | 1.00e+00 || 3.26 | 1.08 | 5684.23 || 4.10 | 00h00'00\n+ 0.23 | 0.25 | 120 | 34219 | 120 | 2.78e-01 | 1.00e+00 || 3.15 | 1.05 | 5876.79 || 4.06 | 00h00'00\n+ 0.48 | 0.50 | 120 | 33171 | 120 | 2.70e-01 | 1.00e+00 || 2.59 | 0.86 | 7147.57 || 3.29 | 00h00'00\n+ 0.73 | 0.75 | 120 | 31631 | 120 | 2.57e-01 | 1.00e+00 || 2.81 | 0.93 | 6586.52 || 3.40 | 00h00'00\n+ 0.98 | 1.00 | 120 | 30282 | 120 | 2.46e-01 | 1.00e+00 || 3.07 | 1.02 | 6031.70 || 3.67 | 00h00'00\n+ 1.23 | 1.25 | 120 | 28288 | 120 | 2.30e-01 | 1.00e+00 || 2.57 | 0.85 | 7201.21 || 3.42 | 00h00'00\n+ 1.48 | 1.50 | 120 | 25887 | 120 | 2.11e-01 | 1.00e+00 || 3.06 | 1.02 | 6046.64 || 3.98 | 00h00'00\n+ 1.73 | 1.75 | 120 | 23749 | 120 | 1.93e-01 | 1.00e+00 || 2.92 | 0.97 | 6332.23 || 3.53 | 00h00'00\n+ 1.98 | 2.00 | 120 | 19453 | 117 | 1.58e-01 | 9.75e-01 || 2.96 | 0.98 | 6241.18 || 3.71 | 00h00'00\n+ 2.23 | 2.25 | 138 | 16906 | 122 | 1.20e-01 | 8.84e-01 || 2.80 | 0.93 | 6617.55 || 3.38 | 00h00'00\n+ 2.48 | 2.50 | 174 | 11903 | 114 | 6.68e-02 | 6.55e-01 || 2.84 | 0.94 | 6517.31 || 3.60 | 00h00'00\n+ 2.73 | 2.75 | 270 | 7216 | 107 | 2.61e-02 | 3.96e-01 || 2.90 | 0.96 | 6388.44 || 3.64 | 00h00'00\n+ 2.98 | 3.00 | 738 | 5464 | 102 | 7.23e-03 | 1.38e-01 || 3.33 | 1.11 | 5549.86 || 4.68 | 00h00'00\n+ 3.23 | 3.25 | 2688 | 3959 | 102 | 1.44e-03 | 3.79e-02 || 3.48 | 1.15 | 5321.80 || 5.10 | 00h00'01\n+ 3.48 | 3.50 | 22578 | 3186 | 100 | 1.38e-04 | 4.43e-03 || 2.84 | 0.94 | 6523.68 || 4.11 | 00h00'16\n+ 3.73 | 3.75 | 266322 | 1668 | 100 | 6.12e-06 | 3.75e-04 || 2.51 | 0.83 | 7376.06 || 3.68 | 00h03'42\n+ 3.98 | 4.00 | 4178484 | 1584 | 100 | 3.70e-07 | 2.39e-05 || 2.56 | 0.85 | 7230.58 || 3.75 | 00h57'20\n# End of the simulation.\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix SCMA tests.
|
8,483 |
09.06.2017 15:29:04
| -7,200 |
c22387805dbaf71039178dae9619826b9ff75cdc
|
Update aff3ct.hpp; Integrate the H matrix transpose inside LDPC_matrix_handler in function of the H dimensions.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"diff": "@@ -31,6 +31,10 @@ Sparse_matrix LDPC_matrix_handler\n::transform_H_to_G(const Sparse_matrix& H, mipp::vector<unsigned>& info_bits_pos)\n{\nLDPC_matrix_handler::Full_matrix mat;\n+\n+ if (H.get_n_rows() > H.get_n_cols())\n+ LDPC_matrix_handler::sparse_to_full(H.transpose(), mat);\n+ else\nLDPC_matrix_handler::sparse_to_full(H, mat);\nLDPC_matrix_handler::transform_H_to_G(mat, info_bits_pos);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -85,7 +85,7 @@ Encoder_LDPC<B>* Codec_LDPC<B,Q>\nthis->params.code.K,\nthis->params.code.N_code,\nG,\n- H.transpose(),\n+ H,\nthis->params.simulation.inter_frame_level);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_std.hpp>\n#include <Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp>\n#include <Tools/Code/Polar/Pattern_polar_parser.hpp>\n-#include <Tools/Code/LDPC/G/LDPC_G.hpp>\n-#include <Tools/Code/LDPC/AList_reader/AList_reader.hpp>\n+#include <Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp>\n+#include <Tools/Code/LDPC/AList/AList.hpp>\n#include <Tools/Code/SCMA/modem_SCMA_functions.hpp>\n#include <Tools/Code/Turbo/Post_processing_SISO/Post_processing_SISO.hpp>\n#include <Tools/Code/Turbo/Post_processing_SISO/Self_corrected/Self_corrected.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update aff3ct.hpp; Integrate the H matrix transpose inside LDPC_matrix_handler in function of the H dimensions.
|
8,490 |
09.06.2017 15:38:27
| -7,200 |
24be325cf009c6cc1e7e48aedf04005b7ad04aea
|
Fix a segfault when K > N...
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/Galois.cpp",
"new_path": "src/Tools/Math/Galois.cpp",
"diff": "@@ -8,8 +8,11 @@ using namespace aff3ct::tools;\nGalois\n::Galois(const int& K, const int& N, const int& m, const int& t)\n- : K(K), N(N), m(m), t(t), d(2 * t + 1), alpha_to(N + 1), index_of(N + 1), p(m + 1, 0), g(N - K + 1)\n+ : K(K), N(N), m(m), t(t), d(2 * t + 1)\n{\n+ if (K > N)\n+ throw std::invalid_argument(\"aff3ct::tools::Galois: \\\"K\\\" has to be smaller or equal to \\\"N\\\".\");\n+\nif (N >= 1048576) // 2^20\nthrow std::invalid_argument(\"aff3ct::tools::Galois: \\\"N\\\" has to be smaller than 1048576.\");\n@@ -19,6 +22,11 @@ Galois\nif (N != ((1 << m) -1))\nthrow std::invalid_argument(\"aff3ct::tools::Galois: \\\"N\\\" has to be a power of 2 minus 1.\");\n+ alpha_to.resize(N +1);\n+ index_of.resize(N +1);\n+ p .resize(m +1, 0);\n+ g .resize(N - K + 1);\n+\nSelect_Polynomial();\nGenerate_GF();\nCompute_BCH_Generator_Polynomial();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a segfault when K > N...
|
8,488 |
09.06.2017 09:54:10
| 14,400 |
0d99a372066c4dbcf161177abd390e90ed375df6
|
Fix SCMA for odd values of N
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/SCMA/Modem_SCMA.hxx",
"new_path": "src/Module/Modem/SCMA/Modem_SCMA.hxx",
"diff": "@@ -121,7 +121,7 @@ void Modem_SCMA<B,R,Q,PSI>\nassert(typeid(R) == typeid(Q));\nassert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n- for (auto batch = 0 ; batch < this->N / 2 ; batch++)\n+ for (auto batch = 0 ; batch < (this->N +1) / 2 ; batch++)\n{\n// filling array_phi luts\nfor (auto i = 0; i < 4; i++)\n@@ -141,7 +141,7 @@ void Modem_SCMA<B,R,Q,PSI>\nassert(typeid(R) == typeid(Q));\nassert(typeid(Q) == typeid(float) || typeid(Q) == typeid(double));\n- for (auto batch = 0 ; batch < this->N / 2 ; batch++)\n+ for (auto batch = 0 ; batch < (this->N +1) / 2 ; batch++)\n{\n// filling array_phi luts\nfor (auto i = 0; i < 4; i++)\n@@ -273,7 +273,7 @@ void Modem_SCMA<B,R,Q,PSI>\nY_N2[4 * this->N + batch *2 +0] = std::log(guess[4][0] + guess[4][2]) - std::log(guess[4][1] + guess[4][3]);\nY_N2[5 * this->N + batch *2 +0] = std::log(guess[5][0] + guess[5][2]) - std::log(guess[5][1] + guess[5][3]);\n- if((this->N % 2) != 1 || batch != ((this->N_mod * this->n_frames) / 8 - 1) )\n+ if((this->N % 2) != 1 || batch != ((this->N /2 +1) -1))\n{\nY_N2[0 * this->N + batch *2 +1] = std::log(guess[0][0] + guess[0][1]) - std::log(guess[0][2] + guess[0][3]);\nY_N2[1 * this->N + batch *2 +1] = std::log(guess[1][0] + guess[1][1]) - std::log(guess[1][2] + guess[1][3]);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix SCMA for odd values of N
|
8,490 |
09.06.2017 15:56:47
| -7,200 |
3c47bd65b104b6a6b38191e7f74f2c6652eda774
|
Move the generated git_sha1.cpp file in the src/Tools folder.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -23,8 +23,8 @@ file (GLOB_RECURSE source_files src/*)\n# Auto generate a header containing the last GIT SHA1\ninclude(GetGitRevisionDescription)\nget_git_head_revision(GIT_REFSPEC GIT_SHA1)\n-configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp.in\" \"${CMAKE_CURRENT_BINARY_DIR}/git_sha1.cpp\" @ONLY)\n-list(APPEND source_files \"${CMAKE_CURRENT_BINARY_DIR}/git_sha1.cpp\")\n+configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp.in\" \"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp\" @ONLY)\n+list(APPEND source_files \"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp\")\n# Filters creation for IDEs (tested on Visual Studio and based on the \"source_group\" function)\nfunction(assign_source_group)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move the generated git_sha1.cpp file in the src/Tools folder.
|
8,490 |
09.06.2017 16:24:46
| -7,200 |
aff3332b492a0a0fd75f993c7f5f2b4bf0ff7ba7
|
Replace SCMA_N4096 simu by SCMA_N4003 simu.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/data/BFER/Uncoded/AWGN/8-scma_N4003.txt",
"diff": "+Run command:\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"UNCODED\" -K \"4003\" -N \"4003\" -m \"0\" -M \"18\" -s \"0.5\" --chn-type \"AWGN_FAST\" --mod-type \"SCMA\" --dmod-ite \"6\" --mnt-max-fe \"1000\" --sim-inter-lvl \"6\" --sim-pyber \"8-SCMA\"\n+Curve name:\n+8-SCMA\n+# -------------------------------------------------\n+# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n+# -------------------------------------------------\n+# Parameters:\n+# * Simulation ------------------------------------\n+# ** Type = BFER\n+# ** SNR min (m) = 0.000000 dB\n+# ** SNR max (M) = 18.000099 dB\n+# ** SNR step (s) = 0.500000 dB\n+# ** Type of bits = int (32 bits)\n+# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 6\n+# ** Seed = 0\n+# ** Date (UTC) = 2017-06-09 13:59:44\n+# ** Multi-threading (t) = 4 thread(s)\n+# * Code ------------------------------------------\n+# ** Type = UNCODED\n+# ** Info. bits (K) = 4003\n+# ** Codeword size (N) = 4003\n+# ** Code rate (R) = 1.000000\n+# ** Coset approach (c) = off\n+# * Source ----------------------------------------\n+# ** Type = RAND\n+# * Encoder ---------------------------------------\n+# ** Type = NO\n+# ** Systematic encoding = on\n+# * Modulator -------------------------------------\n+# ** Type = SCMA\n+# ** Bits per symbol = 3\n+# ** Sampling factor = 1\n+# * Channel ---------------------------------------\n+# ** Type = AWGN_FAST\n+# * Demodulator -----------------------------------\n+# ** Sigma square = on\n+# ** Max type = unused\n+# ** Number of iterations = 6\n+# ** Psi function = PSI0\n+# * Decoder ---------------------------------------\n+# ** Type (D) = NO\n+# ** Implementation = HARD_DECISION\n+# * Monitor ---------------------------------------\n+# ** Frame error count (e) = 1000\n+# ** Bad frames tracking = off\n+# ** Bad frames replay = off\n+#\n+# The simulation is running...\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n+# on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+ 4.77 | 0.00 | 1020 | 632048 | 1020 | 1.55e-01 | 1.00e+00 || 1822.85 | 1822.85 | 13.18 || 3.21 | 00h00'01\n+ 5.27 | 0.50 | 1020 | 592255 | 1020 | 1.45e-01 | 1.00e+00 || 1947.89 | 1947.89 | 12.33 || 3.22 | 00h00'01\n+ 5.77 | 1.00 | 1020 | 549245 | 1020 | 1.35e-01 | 1.00e+00 || 1868.01 | 1868.01 | 12.86 || 3.33 | 00h00'01\n+ 6.27 | 1.50 | 1020 | 500585 | 1020 | 1.23e-01 | 1.00e+00 || 1753.54 | 1753.54 | 13.70 || 3.34 | 00h00'01\n+ 6.77 | 2.00 | 1020 | 455404 | 1020 | 1.12e-01 | 1.00e+00 || 1928.46 | 1928.46 | 12.45 || 3.24 | 00h00'01\n+ 7.27 | 2.50 | 1020 | 403070 | 1020 | 9.87e-02 | 1.00e+00 || 1970.96 | 1970.96 | 12.19 || 3.29 | 00h00'01\n+ 7.77 | 3.00 | 1020 | 353221 | 1020 | 8.65e-02 | 1.00e+00 || 1780.28 | 1780.28 | 13.49 || 3.06 | 00h00'01\n+ 8.27 | 3.50 | 1020 | 303105 | 1020 | 7.42e-02 | 1.00e+00 || 1903.07 | 1903.07 | 12.62 || 3.10 | 00h00'01\n+ 8.77 | 4.00 | 1020 | 255197 | 1020 | 6.25e-02 | 1.00e+00 || 2024.86 | 2024.86 | 11.86 || 3.12 | 00h00'01\n+ 9.27 | 4.50 | 1020 | 208328 | 1020 | 5.10e-02 | 1.00e+00 || 1959.64 | 1959.64 | 12.26 || 3.29 | 00h00'01\n+ 9.77 | 5.00 | 1020 | 168235 | 1020 | 4.12e-02 | 1.00e+00 || 2010.05 | 2010.05 | 11.95 || 3.33 | 00h00'01\n+ 10.27 | 5.50 | 1020 | 131008 | 1020 | 3.21e-02 | 1.00e+00 || 1991.99 | 1991.99 | 12.06 || 3.27 | 00h00'01\n+ 10.77 | 6.00 | 1020 | 101766 | 1020 | 2.49e-02 | 1.00e+00 || 1812.87 | 1812.87 | 13.25 || 3.34 | 00h00'01\n+ 11.27 | 6.50 | 1020 | 74506 | 1020 | 1.82e-02 | 1.00e+00 || 1912.21 | 1912.21 | 12.56 || 3.24 | 00h00'01\n+ 11.77 | 7.00 | 1020 | 54432 | 1020 | 1.33e-02 | 1.00e+00 || 1918.84 | 1918.84 | 12.52 || 3.34 | 00h00'01\n+ 12.27 | 7.50 | 1020 | 39085 | 1020 | 9.57e-03 | 1.00e+00 || 1870.44 | 1870.44 | 12.84 || 3.24 | 00h00'01\n+ 12.77 | 8.00 | 1020 | 27148 | 1020 | 6.65e-03 | 1.00e+00 || 2019.96 | 2019.96 | 11.89 || 3.25 | 00h00'01\n+ 13.27 | 8.50 | 1020 | 19167 | 1020 | 4.69e-03 | 1.00e+00 || 1865.18 | 1865.18 | 12.88 || 3.28 | 00h00'01\n+ 13.77 | 9.00 | 1020 | 12777 | 1020 | 3.13e-03 | 1.00e+00 || 1974.82 | 1974.82 | 12.16 || 3.17 | 00h00'01\n+ 14.27 | 9.50 | 1020 | 8703 | 1018 | 2.13e-03 | 9.98e-01 || 1946.40 | 1946.40 | 12.34 || 3.19 | 00h00'01\n+ 14.77 | 10.00 | 1026 | 6441 | 1023 | 1.57e-03 | 9.97e-01 || 1941.30 | 1941.30 | 12.37 || 3.26 | 00h00'01\n+ 15.27 | 10.50 | 1032 | 4512 | 1020 | 1.09e-03 | 9.88e-01 || 1916.59 | 1916.59 | 12.53 || 3.19 | 00h00'01\n+ 15.77 | 11.00 | 1116 | 3139 | 1016 | 7.03e-04 | 9.10e-01 || 2009.14 | 2009.14 | 11.95 || 3.20 | 00h00'01\n+ 16.27 | 11.50 | 1188 | 2437 | 1021 | 5.12e-04 | 8.59e-01 || 1941.74 | 1941.74 | 12.37 || 3.21 | 00h00'01\n+ 16.77 | 12.00 | 1368 | 1946 | 1017 | 3.55e-04 | 7.43e-01 || 1914.00 | 1914.00 | 12.55 || 3.23 | 00h00'01\n+ 17.27 | 12.50 | 1722 | 1613 | 1006 | 2.34e-04 | 5.84e-01 || 1923.55 | 1923.55 | 12.49 || 3.18 | 00h00'02\n+ 17.77 | 13.00 | 2418 | 1383 | 1012 | 1.43e-04 | 4.19e-01 || 1984.85 | 1984.85 | 12.10 || 3.27 | 00h00'02\n+ 18.27 | 13.50 | 3318 | 1226 | 1004 | 9.23e-05 | 3.03e-01 || 1974.52 | 1974.52 | 12.16 || 3.30 | 00h00'04\n+ 18.77 | 14.00 | 5484 | 1196 | 1005 | 5.45e-05 | 1.83e-01 || 2001.97 | 2001.97 | 12.00 || 3.29 | 00h00'06\n+ 19.27 | 14.50 | 8526 | 1125 | 1006 | 3.30e-05 | 1.18e-01 || 1779.85 | 1779.85 | 13.49 || 3.38 | 00h00'10\n+ 19.77 | 15.00 | 16980 | 1054 | 1003 | 1.55e-05 | 5.91e-02 || 1095.96 | 1095.96 | 21.92 || 3.32 | 00h00'20\n+ 20.27 | 15.50 | 30630 | 1043 | 1000 | 8.51e-06 | 3.26e-02 || 1725.27 | 1725.27 | 13.92 || 3.43 | 00h00'35\n+ 20.77 | 16.00 | 63498 | 1035 | 1005 | 4.07e-06 | 1.58e-02 || 1751.38 | 1751.38 | 13.71 || 3.49 | 00h01'12\n+ 21.27 | 16.50 | 152430 | 1020 | 1001 | 1.67e-06 | 6.57e-03 || 1524.39 | 1524.39 | 15.76 || 3.41 | 00h02'59\n+ 21.77 | 17.00 | 166104 | 477 | 472 | 7.17e-07 | 2.84e-03 || 1495.91 | 1495.91 | 16.06 || 3.29 | 00h03'21 x\n+ 22.27 | 17.50 | 90744 | 106 | 104 | 2.92e-07 | 1.15e-03 || 1897.41 | 1897.41 | 12.66 || 3.72 | 00h01'37 x\n+ 22.77 | 18.00 | 486990 | 195 | 194 | 1.00e-07 | 3.98e-04 || 1679.41 | 1679.41 | 14.30 || 3.58 | 00h09'03 x\n+# End of the simulation.\n"
},
{
"change_type": "DELETE",
"old_path": "tests/data/BFER/Uncoded/AWGN/8-scma_N4096.txt",
"new_path": null,
"diff": "-Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"UNCODED\" -K \"4096\" -N \"4096\" -m \"0\" -M \"18\" -s \"0.5\" --chn-type \"AWGN_FAST\" --mod-type \"SCMA\" --dmod-ite \"6\" --mnt-max-fe \"1000\" --sim-inter-lvl \"6\" --sim-pyber \"8-SCMA\"\n-Curve name:\n-8-SCMA\n-# -------------------------------------------------\n-# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n-# -------------------------------------------------\n-# Parameters:\n-# * Simulation ------------------------------------\n-# ** Type = BFER\n-# ** SNR min (m) = 0.000000 dB\n-# ** SNR max (M) = 18.000099 dB\n-# ** SNR step (s) = 0.500000 dB\n-# ** Type of bits = int (32 bits)\n-# ** Type of reals = float (32 bits)\n-# ** Inter frame level = 6\n-# ** Seed = 0\n-# ** Date (UTC) = 2017-06-09 10:16:16\n-# ** Multi-threading (t) = 4 thread(s)\n-# * Code ------------------------------------------\n-# ** Type = UNCODED\n-# ** Info. bits (K) = 4096\n-# ** Codeword size (N) = 4096\n-# ** Code rate (R) = 1.000000\n-# ** Coset approach (c) = off\n-# * Source ----------------------------------------\n-# ** Type = RAND\n-# * Encoder ---------------------------------------\n-# ** Type = NO\n-# ** Systematic encoding = on\n-# * Modulator -------------------------------------\n-# ** Type = SCMA\n-# ** Bits per symbol = 3\n-# ** Sampling factor = 1\n-# * Channel ---------------------------------------\n-# ** Type = AWGN_FAST\n-# * Demodulator -----------------------------------\n-# ** Sigma square = on\n-# ** Max type = unused\n-# ** Number of iterations = 6\n-# ** Psi function = PSI0\n-# * Decoder ---------------------------------------\n-# ** Type (D) = NO\n-# ** Implementation = HARD_DECISION\n-# * Monitor ---------------------------------------\n-# ** Frame error count (e) = 1000\n-# ** Bad frames tracking = off\n-# ** Bad frames replay = off\n-#\n-# The simulation is running...\n-# ----------------------------------------------------------------------||--------------------------------||---------------------\n-# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n-# on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time\n-# ----------------------------------------------------------------------||--------------------------------||---------------------\n-# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n-# Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n-# (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n-# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n- 4.77 | 0.00 | 1020 | 648498 | 1020 | 1.55e-01 | 1.00e+00 || 1967.13 | 1967.13 | 12.49 || 2.76 | 00h00'01\n- 5.27 | 0.50 | 1020 | 604546 | 1020 | 1.45e-01 | 1.00e+00 || 1978.34 | 1978.34 | 12.42 || 3.22 | 00h00'01\n- 5.77 | 1.00 | 1020 | 561412 | 1020 | 1.34e-01 | 1.00e+00 || 2036.97 | 2036.97 | 12.06 || 3.24 | 00h00'01\n- 6.27 | 1.50 | 1020 | 512706 | 1020 | 1.23e-01 | 1.00e+00 || 1905.17 | 1905.17 | 12.90 || 3.34 | 00h00'01\n- 6.77 | 2.00 | 1020 | 465972 | 1020 | 1.12e-01 | 1.00e+00 || 1862.17 | 1862.17 | 13.20 || 3.29 | 00h00'01\n- 7.27 | 2.50 | 1020 | 414889 | 1020 | 9.93e-02 | 1.00e+00 || 1858.14 | 1858.14 | 13.23 || 3.28 | 00h00'01\n- 7.77 | 3.00 | 1020 | 363026 | 1020 | 8.69e-02 | 1.00e+00 || 1894.05 | 1894.05 | 12.98 || 3.24 | 00h00'01\n- 8.27 | 3.50 | 1020 | 307863 | 1020 | 7.37e-02 | 1.00e+00 || 1945.11 | 1945.11 | 12.63 || 3.33 | 00h00'01\n- 8.77 | 4.00 | 1020 | 261110 | 1020 | 6.25e-02 | 1.00e+00 || 1866.66 | 1866.66 | 13.17 || 3.23 | 00h00'01\n- 9.27 | 4.50 | 1020 | 214344 | 1020 | 5.13e-02 | 1.00e+00 || 2001.85 | 2001.85 | 12.28 || 3.31 | 00h00'01\n- 9.77 | 5.00 | 1020 | 171008 | 1020 | 4.09e-02 | 1.00e+00 || 2040.33 | 2040.33 | 12.05 || 3.23 | 00h00'01\n- 10.27 | 5.50 | 1020 | 134284 | 1020 | 3.21e-02 | 1.00e+00 || 1999.38 | 1999.38 | 12.29 || 3.30 | 00h00'01\n- 10.77 | 6.00 | 1020 | 103276 | 1020 | 2.47e-02 | 1.00e+00 || 1966.48 | 1966.48 | 12.50 || 3.28 | 00h00'01\n- 11.27 | 6.50 | 1020 | 77248 | 1020 | 1.85e-02 | 1.00e+00 || 1380.49 | 1380.49 | 17.80 || 3.28 | 00h00'01\n- 11.77 | 7.00 | 1020 | 54865 | 1020 | 1.31e-02 | 1.00e+00 || 1921.67 | 1921.67 | 12.79 || 3.22 | 00h00'01\n- 12.27 | 7.50 | 1020 | 39968 | 1020 | 9.57e-03 | 1.00e+00 || 1988.10 | 1988.10 | 12.36 || 3.28 | 00h00'01\n- 12.77 | 8.00 | 1020 | 27403 | 1020 | 6.56e-03 | 1.00e+00 || 1863.27 | 1863.27 | 13.19 || 3.20 | 00h00'01\n- 13.27 | 8.50 | 1020 | 19543 | 1020 | 4.68e-03 | 1.00e+00 || 1935.97 | 1935.97 | 12.69 || 3.26 | 00h00'01\n- 13.77 | 9.00 | 1020 | 13441 | 1020 | 3.22e-03 | 1.00e+00 || 1822.17 | 1822.17 | 13.49 || 3.18 | 00h00'01\n- 14.27 | 9.50 | 1020 | 9085 | 1020 | 2.17e-03 | 1.00e+00 || 2000.40 | 2000.40 | 12.29 || 3.21 | 00h00'01\n- 14.77 | 10.00 | 1020 | 6377 | 1018 | 1.53e-03 | 9.98e-01 || 2073.73 | 2073.73 | 11.85 || 3.21 | 00h00'01\n- 15.27 | 10.50 | 1038 | 4588 | 1019 | 1.08e-03 | 9.82e-01 || 1964.98 | 1964.98 | 12.51 || 3.11 | 00h00'01\n- 15.77 | 11.00 | 1098 | 3253 | 1016 | 7.23e-04 | 9.25e-01 || 1914.96 | 1914.96 | 12.83 || 3.17 | 00h00'01\n- 16.27 | 11.50 | 1170 | 2519 | 1009 | 5.26e-04 | 8.62e-01 || 1525.70 | 1525.70 | 16.11 || 2.79 | 00h00'01\n- 16.77 | 12.00 | 1380 | 1887 | 1018 | 3.34e-04 | 7.38e-01 || 2034.20 | 2034.20 | 12.08 || 3.14 | 00h00'01\n- 17.27 | 12.50 | 1536 | 1619 | 1010 | 2.57e-04 | 6.58e-01 || 1895.08 | 1895.08 | 12.97 || 3.17 | 00h00'01\n- 17.77 | 13.00 | 2280 | 1354 | 1006 | 1.45e-04 | 4.41e-01 || 1963.21 | 1963.21 | 12.52 || 3.29 | 00h00'02\n- 18.27 | 13.50 | 3456 | 1297 | 1006 | 9.16e-05 | 2.91e-01 || 1913.05 | 1913.05 | 12.85 || 3.34 | 00h00'04\n- 18.77 | 14.00 | 5112 | 1212 | 1007 | 5.79e-05 | 1.97e-01 || 1944.17 | 1944.17 | 12.64 || 3.41 | 00h00'06\n- 19.27 | 14.50 | 7716 | 1104 | 1001 | 3.49e-05 | 1.30e-01 || 1728.44 | 1728.44 | 14.22 || 3.30 | 00h00'09\n- 19.77 | 15.00 | 15642 | 1074 | 1000 | 1.68e-05 | 6.39e-02 || 1484.76 | 1484.76 | 16.55 || 3.13 | 00h00'20\n- 20.27 | 15.50 | 29028 | 1044 | 1001 | 8.78e-06 | 3.45e-02 || 1542.53 | 1542.53 | 15.93 || 3.44 | 00h00'34\n- 20.77 | 16.00 | 71220 | 1025 | 1002 | 3.51e-06 | 1.41e-02 || 1542.03 | 1542.03 | 15.94 || 3.51 | 00h01'23\n- 21.27 | 16.50 | 148704 | 1020 | 1004 | 1.67e-06 | 6.75e-03 || 1507.33 | 1507.33 | 16.30 || 3.56 | 00h02'51\n- 21.77 | 17.00 | 400644 | 1012 | 1000 | 6.17e-07 | 2.50e-03 || 2010.08 | 2010.08 | 12.23 || 3.77 | 00h07'14\n- 22.27 | 17.50 | 987252 | 1020 | 1000 | 2.52e-07 | 1.01e-03 || 2142.49 | 2142.49 | 11.47 || 3.82 | 00h17'39\n- 22.77 | 18.00 | 3351702 | 1013 | 1001 | 7.38e-08 | 2.99e-04 || 1557.80 | 1557.80 | 15.78 || 3.62 | 01h03'14\n-# End of the simulation.\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace SCMA_N4096 simu by SCMA_N4003 simu.
|
8,490 |
09.06.2017 16:42:22
| -7,200 |
2635336b089491c2f3ac06f3ece1e61f96ceb8fc
|
Legend renaming.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/Turbo/LTE/scma_PSI2_turbo_3072_1024_0_4_LTE.txt",
"new_path": "tests/data/BFER/Turbo/LTE/scma_PSI2_turbo_3072_1024_0_4_LTE.txt",
"diff": "Run command:\n./bin/aff3ct --sim-type \"BFER\" --cde-type \"TURBO\" -K \"1024\" -N \"3072\" -m \"0\" -M \"4.00\" -s \"0.25\" --chn-type \"AWGN_FAST\" --mod-type \"SCMA\" --dmod-ite \"5\" -i \"6\" --mnt-max-fe \"100\" --sim-inter-lvl \"6\" --dec-type \"LTE\" --dec-implem \"FAST\" --sim-pyber \"SCMA-PSI2 + Turbo\" --dec-sf \"LTE_VEC\" --dmod-psi \"PSI2\"\nCurve name:\n-SCMA_ALI\n+SCMA-PSI2 + Turbo\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/Turbo/LTE/scma_PSI3_turbo_3072_1024_0_4_LTE.txt",
"new_path": "tests/data/BFER/Turbo/LTE/scma_PSI3_turbo_3072_1024_0_4_LTE.txt",
"diff": "Run command:\n./bin/aff3ct --sim-type \"BFER\" --cde-type \"TURBO\" -K \"1024\" -N \"3072\" -m \"0\" -M \"4.0\" -s \"0.25\" --chn-type \"AWGN_FAST\" --mod-type \"SCMA\" --dmod-ite \"5\" -i \"6\" --mnt-max-fe \"100\" --sim-inter-lvl \"6\" --dec-type \"LTE\" --dec-implem \"FAST\" --sim-pyber \"SCMA-PSI3 + Turbo\" --dec-sf \"LTE_VEC\" --dmod-psi \"PSI3\"\nCurve name:\n-SCMA_ALI\n+SCMA-PSI3 + Turbo\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/data/BFER/Uncoded/AWGN/8-scma_N12.txt",
"new_path": "tests/data/BFER/Uncoded/AWGN/8-scma_N12.txt",
"diff": "Run command:\n./bin/aff3ct --sim-type \"BFER\" --cde-type \"UNCODED\" -K \"12\" -N \"12\" -m \"0\" -M \"14\" -s \"0.5\" --chn-type \"AWGN_FAST\" --mod-type \"SCMA\" --dmod-ite \"6\" --mnt-max-fe \"10000\" --sim-inter-lvl \"6\" --sim-pyber \"8-SCMA\"\nCurve name:\n-8-SCMA\n+8-SCMA N=12\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Legend renaming.
|
8,483 |
09.06.2017 17:44:49
| -7,200 |
a14b46ab19b24edce43c6bc650e052e17e1d306e
|
change info bit pos mipp -> std; add 'at' method in sparse matrix
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -18,7 +18,7 @@ template <typename B = int>\nclass Encoder_LDPC_from_H : public Encoder_LDPC<B>\n{\nprotected:\n- mipp::vector<unsigned> info_bits_pos;\n+ std::vector<unsigned> info_bits_pos;\ntools::Sparse_matrix G; // position of ones by column\npublic:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"new_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"diff": "@@ -74,6 +74,14 @@ const std::vector<unsigned>& Sparse_matrix\nreturn this->get_rows_from_col(col_index);\n}\n+bool Sparse_matrix\n+::at(const size_t row_index, const size_t col_index) const\n+{\n+ auto it = std::find(this->row_to_cols[row_index].begin(), this->row_to_cols[row_index].end(), col_index);\n+\n+ return (it != this->row_to_cols[row_index].end());\n+}\n+\nconst std::vector<std::vector<unsigned int>>& Sparse_matrix\n::get_row_to_cols() const\n{\n@@ -129,3 +137,9 @@ void Sparse_matrix\nstd::swap(this->rows_max_degree, this->cols_max_degree);\nstd::swap(this->row_to_cols, this->col_to_rows );\n}\n+\n+float Sparse_matrix\n+::compute_density() const\n+{\n+ return ((float)n_connections/(float)(n_rows*n_cols));\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.hpp",
"new_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.hpp",
"diff": "@@ -34,6 +34,8 @@ public:\nconst std::vector<unsigned>& operator[](const size_t col_index) const;\n+ bool at(const size_t row_index, const size_t col_index) const;\n+\nconst std::vector<std::vector<unsigned int>>& get_row_to_cols() const;\nconst std::vector<std::vector<unsigned int>>& get_col_to_rows() const;\n@@ -48,6 +50,11 @@ public:\n* Transpose internally this matrix\n*/\nvoid self_transpose();\n+\n+ /*\n+ * Return the density of ones in this matrix\n+ */\n+ float compute_density() const;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"diff": "@@ -28,7 +28,7 @@ Sparse_matrix LDPC_matrix_handler\n}\nSparse_matrix LDPC_matrix_handler\n-::transform_H_to_G(const Sparse_matrix& H, mipp::vector<unsigned>& info_bits_pos)\n+::transform_H_to_G(const Sparse_matrix& H, std::vector<unsigned>& info_bits_pos)\n{\nLDPC_matrix_handler::Full_matrix mat;\n@@ -43,7 +43,7 @@ Sparse_matrix LDPC_matrix_handler\n}\nvoid LDPC_matrix_handler\n-::transform_H_to_G(Full_matrix& mat, mipp::vector<unsigned>& info_bits_pos)\n+::transform_H_to_G(Full_matrix& mat, std::vector<unsigned>& info_bits_pos)\n{\nunsigned n_row = (unsigned)mat.size();\nunsigned n_col = (unsigned)mat.front().size();\n@@ -52,7 +52,7 @@ void LDPC_matrix_handler\nthrow std::length_error(\"aff3ct::tools::LDPC_G::transform_H_to_G: matrix high \\\"mat.size()\\\" has to be smaller \"\n\" than its width \\\"mat.front().size()\\\".\");\n- mipp::vector<unsigned> swapped_cols;\n+ std::vector<unsigned> swapped_cols;\nLDPC_matrix_handler::create_diagonal(mat, swapped_cols);\nLDPC_matrix_handler::create_identity(mat);\n@@ -81,7 +81,7 @@ void LDPC_matrix_handler\n}\nvoid LDPC_matrix_handler\n-::create_diagonal(Full_matrix& mat, mipp::vector<unsigned>& swapped_cols)\n+::create_diagonal(Full_matrix& mat, std::vector<unsigned>& swapped_cols)\n{\nunsigned n_row = (unsigned)mat.size();\nunsigned n_col = (unsigned)mat.front().size();\n@@ -157,3 +157,19 @@ void LDPC_matrix_handler\nif (mat[j-1][i])\nstd::transform (mat[j-1].begin(), mat[j-1].end(), mat[i].begin(), mat[j-1].begin(), std::not_equal_to<int8_t>());\n}\n+\n+float LDPC_matrix_handler\n+::compute_density(Full_matrix& mat)\n+{\n+ unsigned n_rows = mat.size();\n+ unsigned n_cols = mat.front().size();\n+\n+ unsigned nb_ones = 0;\n+\n+ for (unsigned i = 0; i < n_rows; i++)\n+ for (unsigned j = 0; j < n_cols; j++)\n+ if (mat[i][j])\n+ nb_ones++;\n+\n+ return ((float)nb_ones/(float)(n_rows*n_cols));\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"diff": "@@ -35,7 +35,7 @@ public:\n* swapped_cols is completed each time with couple of positions of the two swapped columns.\n* A column might be swapped several times.\n*/\n- static void create_diagonal(Full_matrix& mat, mipp::vector<unsigned>& swapped_cols);\n+ static void create_diagonal(Full_matrix& mat, std::vector<unsigned>& swapped_cols);\n/*\n* Reorder rows and columns to create an identity of binary ones on the left part of the matrix.\n@@ -43,16 +43,21 @@ public:\n*/\nstatic void create_identity(Full_matrix& mat);\n+ /*\n+ * Return the density of ones in the given matrix.\n+ */\n+ static float compute_density(Full_matrix & mat);\n+\n/*\n* Compute a G matrix related to the given H matrix.\n* Warning G is transposed !\n* Return also the information bits positions in the returned G matrix.\n*/\n- static Sparse_matrix transform_H_to_G(const Sparse_matrix& H, mipp::vector<unsigned>& info_bits_pos);\n+ static Sparse_matrix transform_H_to_G(const Sparse_matrix& H, std::vector<unsigned>& info_bits_pos);\nprotected :\n- static void transform_H_to_G(Full_matrix& mat, mipp::vector<unsigned>& info_bits_pos);\n+ static void transform_H_to_G(Full_matrix& mat, std::vector<unsigned>& info_bits_pos);\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
change info bit pos mipp -> std; add 'at' method in sparse matrix
|
8,483 |
12.06.2017 10:33:44
| -7,200 |
740fd1450d6bea3147dcc5ec906cb1a1ab08435b
|
Correct the LDPC_matrix_handler header; separate the Alis::read_info_bits_pos in two methods (one checks the read values).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"new_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"diff": "@@ -94,7 +94,7 @@ void AList\n}\nstd::vector<unsigned> AList\n-::read_info_bits_pos(std::istream &stream, const int K)\n+::read_info_bits_pos(std::istream &stream)\n{\nstd::string line;\n@@ -105,7 +105,38 @@ std::vector<unsigned> AList\nconst unsigned size = std::stoi(values[0]);\n- if (K != -1 && size != (unsigned)K)\n+ getline(stream, line);\n+ values = split(line);\n+ if (values.size() != size)\n+ throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be equal to \\\"size\\\".\");\n+\n+ std::vector<unsigned> info_bits_pos;\n+ for (auto v : values)\n+ {\n+ const unsigned pos = std::stoi(v);\n+\n+ if (std::find(info_bits_pos.begin(), info_bits_pos.end(), pos) != info_bits_pos.end())\n+ throw std::runtime_error(\"aff3ct::tools::AList: \\\"pos\\\" already exists in the \\\"info_bits_pos\\\" vector.\");\n+\n+ info_bits_pos.push_back(pos);\n+ }\n+\n+ return info_bits_pos;\n+}\n+\n+std::vector<unsigned> AList\n+::read_info_bits_pos(std::istream &stream, const int K, const int N)\n+{\n+ std::string line;\n+\n+ getline(stream, line);\n+ auto values = split(line);\n+ if (values.size() != 1)\n+ throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be equal to 1.\");\n+\n+ const unsigned size = std::stoi(values[0]);\n+\n+ if (size != (unsigned)K)\nthrow std::runtime_error(\"aff3ct::tools::AList: \\\"size\\\" has to be equal to \\\"K\\\".\");\ngetline(stream, line);\n@@ -121,8 +152,8 @@ std::vector<unsigned> AList\nif (std::find(info_bits_pos.begin(), info_bits_pos.end(), pos) != info_bits_pos.end())\nthrow std::runtime_error(\"aff3ct::tools::AList: \\\"pos\\\" already exists in the \\\"info_bits_pos\\\" vector.\");\n- if (K != -1 && pos >= (unsigned)K)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"pos\\\" has to be smaller than \\\"K\\\".\");\n+ if (pos >= (unsigned)N)\n+ throw std::runtime_error(\"aff3ct::tools::AList: \\\"pos\\\" has to be smaller than \\\"N\\\".\");\ninfo_bits_pos.push_back(pos);\n}\n@@ -133,7 +164,7 @@ std::vector<unsigned> AList\nvoid AList\n::write_info_bits_pos(const std::vector<unsigned> &info_bits_pos, std::ostream &stream)\n{\n- stream << \"# Position of the information bits in the codeword:\" << std::endl;\n+ stream << \"# Positions of the information bits in the codewords:\" << std::endl;\nstream << info_bits_pos.size() << std::endl;\nfor (auto pos : info_bits_pos)\nstream << pos << \" \";\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/AList/AList.hpp",
"new_path": "src/Tools/Code/LDPC/AList/AList.hpp",
"diff": "@@ -15,7 +15,8 @@ public:\nstatic Sparse_matrix read ( std::istream &stream);\nstatic void write(const Sparse_matrix &matrix, std::ostream &stream);\n- static std::vector<unsigned> read_info_bits_pos (std::istream &stream, const int K = -1);\n+ static std::vector<unsigned> read_info_bits_pos (std::istream &stream);\n+ static std::vector<unsigned> read_info_bits_pos (std::istream &stream, const int K, const int N);\nstatic void write_info_bits_pos(const std::vector<unsigned> &info_bits_pos, std::ostream &stream);\nprivate:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"diff": "-#ifndef LDPC_Matrix_Handler_HPP_\n-#define LDPC_matrix_handler_HPP_\n+#ifndef LDPC_MATRIX_HANDLER_HPP_\n+#define LDPC_MATRIX_HANDLER_HPP_\n#include <vector>\n#include <algorithm>\n@@ -63,4 +63,4 @@ protected :\n}\n}\n-#endif /*LDPC_Matrix_Handler_HPP_ */\n+#endif /* LDPC_MATRIX_HANDLER_HPP_ */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Correct the LDPC_matrix_handler header; separate the Alis::read_info_bits_pos in two methods (one checks the read values).
|
8,483 |
12.06.2017 15:24:08
| -7,200 |
aa1d05d10e5ab5f436b866d85e2ae51a16373999
|
LDPC codec bug correct following the previous commit.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -28,7 +28,7 @@ Codec_LDPC<B,Q>\ntry\n{\n- info_bits_pos = AList::read_info_bits_pos(file_G, params.code.K);\n+ info_bits_pos = AList::read_info_bits_pos(file_G, params.code.K, params.code.N);\nis_info_bits_pos = true;\n}\ncatch (std::exception const&)\n@@ -53,7 +53,7 @@ Codec_LDPC<B,Q>\ndelete encoder_LDPC;\n}\nelse\n- info_bits_pos = AList::read_info_bits_pos(file_H, params.code.K);\n+ info_bits_pos = AList::read_info_bits_pos(file_H, params.code.K, params.code.N);\n}\ncatch (std::exception const&)\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
LDPC codec bug correct following the previous commit.
|
8,483 |
13.06.2017 10:10:08
| -7,200 |
b8563e098b96a7a9feff0a83bf28c25f9f9f881e
|
Add methods names inside exception messages in Alist struct; Add methods that incorporate an interleaver inside a matrix and a vector of bits positions in LDPC_matrix_handler struct.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"new_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"diff": "@@ -101,14 +101,16 @@ std::vector<unsigned> AList\ngetline(stream, line);\nauto values = split(line);\nif (values.size() != 1)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be equal to 1.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"values.size()\\\" has to be equal to 1.\");\nconst unsigned size = std::stoi(values[0]);\ngetline(stream, line);\nvalues = split(line);\nif (values.size() != size)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be equal to \\\"size\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"values.size()\\\" has to be equal to \\\"size\\\".\");\nstd::vector<unsigned> info_bits_pos;\nfor (auto v : values)\n@@ -116,7 +118,8 @@ std::vector<unsigned> AList\nconst unsigned pos = std::stoi(v);\nif (std::find(info_bits_pos.begin(), info_bits_pos.end(), pos) != info_bits_pos.end())\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"pos\\\" already exists in the \\\"info_bits_pos\\\" vector.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"pos\\\" already exists in the \\\"info_bits_pos\\\" vector.\");\ninfo_bits_pos.push_back(pos);\n}\n@@ -132,17 +135,20 @@ std::vector<unsigned> AList\ngetline(stream, line);\nauto values = split(line);\nif (values.size() != 1)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be equal to 1.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"values.size()\\\" has to be equal to 1.\");\nconst unsigned size = std::stoi(values[0]);\nif (size != (unsigned)K)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"size\\\" has to be equal to \\\"K\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"size\\\" has to be equal to \\\"K\\\".\");\ngetline(stream, line);\nvalues = split(line);\nif (values.size() != size)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be equal to \\\"size\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"values.size()\\\" has to be equal to \\\"size\\\".\");\nstd::vector<unsigned> info_bits_pos;\nfor (auto v : values)\n@@ -150,10 +156,12 @@ std::vector<unsigned> AList\nconst unsigned pos = std::stoi(v);\nif (std::find(info_bits_pos.begin(), info_bits_pos.end(), pos) != info_bits_pos.end())\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"pos\\\" already exists in the \\\"info_bits_pos\\\" vector.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"pos\\\" already exists in the \\\"info_bits_pos\\\" vector.\");\nif (pos >= (unsigned)N)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"pos\\\" has to be smaller than \\\"N\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_info_bits_pos:\"\n+ \" \\\"pos\\\" has to be smaller than \\\"N\\\".\");\ninfo_bits_pos.push_back(pos);\n}\n@@ -193,8 +201,8 @@ Sparse_matrix AList\nstream >> n_connections;\nif (n_connections <= 0 || n_connections > rows_max_degree)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"n_connections\\\" has to be greater than 0 and \"\n- \"smaller or equal to \\\"rows_max_degree\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format1: \\\"n_connections\\\" has to be greater than\"\n+ \" 0 and smaller or equal to \\\"rows_max_degree\\\".\");\nrows_degree[i] = n_connections;\n}\n@@ -206,8 +214,8 @@ Sparse_matrix AList\nstream >> n_connections;\nif (n_connections <= 0 || n_connections > cols_max_degree)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"n_connections\\\" has to be greater than 0 and \"\n- \"smaller or equal to \\\"cols_max_degree\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format1: \\\"n_connections\\\" has to be greater than\"\n+ \" 0 and smaller or equal to \\\"cols_max_degree\\\".\");\ncols_degree[i] = n_connections;\n}\n@@ -227,7 +235,7 @@ Sparse_matrix AList\nmatrix.add_connection(i, col_index -1);\n}\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"col_index\\\" is wrong.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format1: \\\"col_index\\\" is wrong.\");\n}\n}\n@@ -246,7 +254,8 @@ Sparse_matrix AList\ntry\n{\nmatrix.add_connection(row_index -1, i);\n- throw std::runtime_error(\"aff3ct::tools::AList: the input AList file is not consistent.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format1: the input AList file is not \"\n+ \"consistent.\");\n}\ncatch (std::exception const&)\n{\n@@ -255,14 +264,14 @@ Sparse_matrix AList\n}\n}\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"row_index\\\" is wrong.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format1: \\\"row_index\\\" is wrong.\");\n}\n}\nreturn matrix;\n}\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"rows\\\", \\\"cols\\\", \\\"rows_max_degree\\\" and \"\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format1: \\\"rows\\\", \\\"cols\\\", \\\"rows_max_degree\\\" and \"\n\"\\\"cols_max_degree\\\" have to be greater than 0.\");\n}\n@@ -275,7 +284,7 @@ Sparse_matrix AList\ngetline(stream, line);\nauto values = split(line);\nif (values.size() < 2)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater than 1.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"values.size()\\\" has to be greater than 1.\");\nunsigned n_rows = 0, n_cols = 0, rows_max_degree = 0, cols_max_degree = 0;\n@@ -283,26 +292,27 @@ Sparse_matrix AList\nn_cols = std::stoi(values[1]);\nif (n_rows <= 0 || n_cols <= 0)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"rows\\\" and \\\"cols\\\" have to be greater than 0.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"rows\\\" and \\\"cols\\\" have to be greater than 0.\");\nSparse_matrix matrix(n_rows, n_cols);\ngetline(stream, line);\nvalues = split(line);\nif (values.size() < 2)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater than 1.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"values.size()\\\" has to be greater than 1.\");\nrows_max_degree = std::stoi(values[0]);\ncols_max_degree = std::stoi(values[1]);\nif (rows_max_degree <= 0 || cols_max_degree <= 0)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"rows_max_degree\\\" and \\\"cols_max_degree\\\" have to be \"\n- \"greater than 0.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"rows_max_degree\\\" and \\\"cols_max_degree\\\" have\"\n+ \" to be greater than 0.\");\ngetline(stream, line);\nvalues = split(line);\nif (values.size() < n_rows)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater or equal to \\\"rows\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"values.size()\\\" has to be greater or equal to\"\n+ \" \\\"rows\\\".\");\nstd::vector<unsigned> rows_degree(n_rows);\nfor (unsigned i = 0; i < n_rows; i++)\n@@ -311,14 +321,15 @@ Sparse_matrix AList\nif (n_connections > 0 && n_connections <= rows_max_degree)\nrows_degree[i] = n_connections;\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"n_connections\\\" has to be greater than 0 and \"\n- \"smaller than \\\"rows_max_degree\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"n_connections\\\" has to be greater than 0 \"\n+ \"and smaller than \\\"rows_max_degree\\\".\");\n}\ngetline(stream, line);\nvalues = split(line);\nif (values.size() < n_cols)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater or equal to \\\"cols\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"values.size()\\\" has to be greater or equal to\"\n+ \" \\\"cols\\\".\");\nstd::vector<unsigned> cols_degree(n_rows);\nfor (unsigned i = 0; i < n_cols; i++)\n@@ -327,8 +338,8 @@ Sparse_matrix AList\nif (n_connections > 0 && n_connections <= cols_max_degree)\ncols_degree[i] = n_connections;\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"n_connections\\\" has to be greater than 0 and \"\n- \"smaller than \\\"cols_max_degree\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"n_connections\\\" has to be greater than 0 \"\n+ \" andsmaller than \\\"cols_max_degree\\\".\");\n}\nfor (unsigned i = 0; i < n_rows; i++)\n@@ -337,7 +348,7 @@ Sparse_matrix AList\nvalues = split(line);\nif (values.size() < rows_degree[i])\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater or equal \"\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"values.size()\\\" has to be greater or equal\"\n\" to \\\"rows_degree[i]\\\".\");\nfor (unsigned j = 0; j < rows_max_degree; j++)\n@@ -350,7 +361,7 @@ Sparse_matrix AList\nmatrix.add_connection(i, col_index -1);\n}\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"col_index\\\" is wrong.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"col_index\\\" is wrong.\");\n}\n}\n@@ -360,7 +371,7 @@ Sparse_matrix AList\nvalues = split(line);\nif (values.size() < cols_degree[i])\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater or equal \"\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"values.size()\\\" has to be greater or equal \"\n\"to \\\"cols_degree[i]\\\".\");\nfor (unsigned j = 0; j < cols_max_degree; j++)\n@@ -374,7 +385,8 @@ Sparse_matrix AList\ntry\n{\nmatrix.add_connection(row_index -1, i);\n- throw std::runtime_error(\"aff3ct::tools::AList: the input AList file is not consistent.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: the input AList file is not\"\n+ \" consistent.\");\n}\ncatch (std::exception const&)\n{\n@@ -383,7 +395,7 @@ Sparse_matrix AList\n}\n}\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"row_index\\\" is wrong.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format2: \\\"row_index\\\" is wrong.\");\n}\n}\n@@ -399,7 +411,7 @@ Sparse_matrix AList\ngetline(stream, line);\nauto values = split(line);\nif (values.size() < 2)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater than 1.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format3: \\\"values.size()\\\" has to be greater than 1.\");\nunsigned n_rows = 0, n_cols = 0;\n@@ -407,14 +419,16 @@ Sparse_matrix AList\nn_rows = std::stoi(values[1]);\nif (n_rows <= 0 || n_cols <= 0)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"n_rows\\\" and \\\"n_cols\\\" have to be greater than 0.\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format3: \\\"n_rows\\\" and \\\"n_cols\\\" have to be greater\"\n+ \" than 0.\");\nSparse_matrix matrix(n_rows, n_cols);\ngetline(stream, line);\nvalues = split(line);\nif (values.size() < n_cols)\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater or equal to \\\"n_cols\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format3: \\\"values.size()\\\" has to be greater or equal\"\n+ \" to \\\"n_cols\\\".\");\nstd::vector<unsigned> cols_degree(n_cols);\nfor (unsigned i = 0; i < n_cols; i++)\n@@ -423,8 +437,8 @@ Sparse_matrix AList\nif (n_connections > 0 && n_connections <= n_rows)\ncols_degree[i] = n_connections;\nelse\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"n_connections\\\" has to be greater than 0 and \"\n- \"smaller than \\\"n_rows\\\".\");\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format3: \\\"n_connections\\\" has to be greater than\"\n+ \" 0 and smaller than \\\"n_rows\\\".\");\n}\nfor (unsigned i = 0; i < n_cols; i++)\n@@ -433,7 +447,7 @@ Sparse_matrix AList\nvalues = split(line);\nif (values.size() < cols_degree[i])\n- throw std::runtime_error(\"aff3ct::tools::AList: \\\"values.size()\\\" has to be greater or equal \"\n+ throw std::runtime_error(\"aff3ct::tools::AList::read_format3: \\\"values.size()\\\" has to be greater or equal\"\n\" to \\\"cols_degree[i]\\\".\");\nfor (unsigned j = 0; j < cols_degree[i]; j++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"diff": "@@ -173,3 +173,39 @@ float LDPC_matrix_handler\nreturn ((float)nb_ones/(float)(n_rows*n_cols));\n}\n+\n+Sparse_matrix LDPC_matrix_handler\n+::interleave_matrix(const Sparse_matrix& mat, std::vector<unsigned>& new_cols_pos)\n+{\n+ if (mat.get_n_cols() != new_cols_pos.size())\n+ throw std::length_error(\"aff3ct::tools::LDPC_G::interleave_matrix: matrix width \\\"mat.get_n_cols()\\\" has to be\"\n+ \" equal to interleaver length \\\"new_cols_pos.size()\\\".\");\n+\n+\n+ Sparse_matrix itl_mat(mat.get_n_rows(), mat.get_n_cols());\n+\n+ for (unsigned i = 0; i < mat.get_n_cols(); i++)\n+ {\n+ for (unsigned j = 0; j < mat.get_rows_from_col(i).size(); j++)\n+ itl_mat.add_connection(mat.get_rows_from_col(i)[j], new_cols_pos[i]);\n+ }\n+\n+ return itl_mat;\n+}\n+\n+std::vector<unsigned> LDPC_matrix_handler\n+::interleave_info_bits_pos(const std::vector<unsigned>& info_bits_pos, std::vector<unsigned>& new_cols_pos)\n+{\n+ if (info_bits_pos.size() > new_cols_pos.size())\n+ throw std::length_error(\"aff3ct::tools::LDPC_G::interleave_info_bits_pos: vector length \\\"vec.size()\\\" has to\"\n+ \" be smaller than or equal to interleaver length \\\"new_cols_pos.size()\\\".\");\n+\n+ std::vector<unsigned> itl_vec(info_bits_pos.size());\n+\n+ for (unsigned i = 0; i < info_bits_pos.size(); i++)\n+ {\n+ itl_vec[i] = new_cols_pos[info_bits_pos[i]];\n+ }\n+\n+ return itl_vec;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"diff": "@@ -55,6 +55,19 @@ public:\n*/\nstatic Sparse_matrix transform_H_to_G(const Sparse_matrix& H, std::vector<unsigned>& info_bits_pos);\n+ /*\n+ * integrate an interleaver inside the matrix to avoid this step.\n+ * new_cols_pos gives the new position of the matching column.\n+ * For ex. the column i will be set at position new_cols_pos[i]\n+ */\n+ static Sparse_matrix interleave_matrix(const Sparse_matrix& mat, std::vector<unsigned>& new_cols_pos);\n+\n+ /*\n+ * return the vector of the position of the info bits after interleaving.\n+ */\n+ static std::vector<unsigned> interleave_info_bits_pos(const std::vector<unsigned>& info_bits_pos,\n+ std::vector<unsigned>& new_cols_pos);\n+\nprotected :\nstatic void transform_H_to_G(Full_matrix& mat, std::vector<unsigned>& info_bits_pos);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add methods names inside exception messages in Alist struct; Add methods that incorporate an interleaver inside a matrix and a vector of bits positions in LDPC_matrix_handler struct.
|
8,490 |
14.06.2017 16:54:40
| -7,200 |
33badcbf87c3fd8f03c74aa95b4efd008ea69ff8
|
Reorganize the SNR loop.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -169,6 +169,15 @@ void Simulation_BFER<B,R,Q>\n// join the slave threads with the master thread\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1].join();\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"communication chain.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\nif (params.simulation.mpi_rank == 0 && !params.terminal.disabled && snr == params.simulation.snr_min &&\n!params.simulation.debug && !this->params.simulation.benchs)\n@@ -184,6 +193,15 @@ void Simulation_BFER<B,R,Q>\ntry\n{\nthis->_launch();\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n// stop the terminal\nif (!this->params.terminal.disabled && this->params.terminal.frequency != std::chrono::nanoseconds(0) &&\n@@ -215,24 +233,6 @@ void Simulation_BFER<B,R,Q>\nthis->monitor_red->reset();\nthis->release_objects();\n- }\n- catch (std::exception const& e)\n- {\n- Monitor<B>::stop();\n-\n- std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n- << std::endl\n- << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n- }\n- }\n- catch (std::exception const& e)\n- {\n- Monitor<B>::stop();\n-\n- std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n- << bold_red(\"communication chain.\") << std::endl\n- << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n- }\n// exit simulation (double [ctrl+c])\nif (Monitor<B>::is_over())\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Reorganize the SNR loop.
|
8,490 |
15.06.2017 08:25:00
| -7,200 |
ada61e6e82f03a7cbd33087fa6d9bf69561ddf65
|
Remove useless threads members.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "@@ -18,8 +18,6 @@ Simulation_BFER_ite_threads<B,R,Q>\n::Simulation_BFER_ite_threads(const parameters& params, Codec_SISO<B,Q> &codec)\n: Simulation_BFER_ite<B,R,Q>(params,codec),\n- threads(this->params.simulation.n_threads -1),\n-\nU_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nU_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\nX_N1(this->params.simulation.n_threads, mipp::vector<B>(params.code.N * params.simulation.inter_frame_level)),\n@@ -95,6 +93,7 @@ template <typename B, typename R, typename Q>\nvoid Simulation_BFER_ite_threads<B,R,Q>\n::_launch()\n{\n+ std::vector<std::thread> threads(this->params.simulation.n_threads -1);\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1] = std::thread(Simulation_BFER_ite_threads<B,R,Q>::start_thread, this, tid);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp",
"diff": "@@ -19,9 +19,6 @@ template <typename B = int, typename R = float, typename Q = R>\nclass Simulation_BFER_ite_threads : public Simulation_BFER_ite<B,R,Q>\n{\nprotected:\n- // array of threads\n- std::vector<std::thread> threads;\n-\n// data vector\nstd::vector<mipp::vector<B>> U_K1; // information bit vector\nstd::vector<mipp::vector<B>> U_K2; // information bit vector + CRC bits\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "@@ -16,8 +16,6 @@ Simulation_BFER_std_threads<B,R,Q>\n::Simulation_BFER_std_threads(const parameters& params, Codec<B,Q> &codec)\n: Simulation_BFER_std<B,R,Q>(params, codec),\n- threads(this->params.simulation.n_threads -1),\n-\nU_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\nU_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\nX_N1(this->params.simulation.n_threads, mipp::vector<B>(params.code.N_code * params.simulation.inter_frame_level)),\n@@ -106,6 +104,7 @@ template <typename B, typename R, typename Q>\nvoid Simulation_BFER_std_threads<B,R,Q>\n::_launch()\n{\n+ std::vector<std::thread> threads(this->params.simulation.n_threads -1);\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1] = std::thread(Simulation_BFER_std_threads<B,R,Q>::start_thread, this, tid);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.hpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.hpp",
"diff": "@@ -17,9 +17,6 @@ template <typename B = int, typename R = float, typename Q = R>\nclass Simulation_BFER_std_threads : public Simulation_BFER_std<B,R,Q>\n{\nprotected:\n- // array of threads\n- std::vector<std::thread> threads;\n-\nstd::map<std::thread::id, int> thread_id;\nstd::mutex mutex_debug;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove useless threads members.
|
8,490 |
15.06.2017 09:00:53
| -7,200 |
aff6fec399cc5f106fc94c59ad4657fab1f48880
|
Compute the code rate (R) in the launcher.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -459,6 +459,12 @@ int Launcher<B,R,Q>\nparams.modulator.cpm_L,\nparams.modulator.cpm_p);\n+ // compute the code rate R\n+ auto real_K = params.code.K;\n+ if (!this->params.crc.poly.empty() && !this->params.crc.inc_code_rate)\n+ real_K -= params.crc.size;\n+ params.code.R = real_K / (float)params.code.N;\n+\ndisplay_help = false;\n// print usage if there is \"-h\" or \"--help\" on the command line\n@@ -548,13 +554,10 @@ std::vector<std::pair<std::string,std::string>> Launcher<B,R,Q>\nelse\nK << params.code.K;\n- auto real_K = (float)params.code.K + (this->params.crc.inc_code_rate ? (float)params.crc.size : 0.f);\n- float code_rate = real_K / (float)params.code.N;\n-\np.push_back(std::make_pair(\"Type\", params.code.type ));\np.push_back(std::make_pair(\"Info. bits (K)\", K.str() ));\np.push_back(std::make_pair(\"Codeword size (N)\", N ));\n- p.push_back(std::make_pair(\"Code rate (R)\", std::to_string(code_rate)));\n+ p.push_back(std::make_pair(\"Code rate (R)\", std::to_string(params.code.R)));\nreturn p;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -36,7 +36,6 @@ Simulation_BFER<B,R,Q>\nsnr (0.f),\nsnr_s(0.f),\nsnr_b(0.f),\n- code_rate(0.f),\nsigma(0.f),\nmonitor (params.simulation.n_threads, nullptr),\n@@ -126,21 +125,15 @@ void Simulation_BFER<B,R,Q>\n// for each SNR to be simulated\nfor (snr = params.simulation.snr_min; snr <= params.simulation.snr_max; snr += params.simulation.snr_step)\n{\n- auto info_bits = params.code.K;\n- if (!this->params.crc.poly.empty() && !this->params.crc.inc_code_rate)\n- info_bits -= params.crc.size;\n-\n- code_rate = (float)(info_bits / (float)params.code.N);\n-\nif (params.simulation.snr_type == \"EB\")\n{\nsnr_b = snr;\n- snr_s = ebn0_to_esn0(snr_b, code_rate, params.modulator.bits_per_symbol);\n+ snr_s = ebn0_to_esn0(snr_b, params.code.R, params.modulator.bits_per_symbol);\n}\nelse //if(params.simulation.snr_type == \"ES\")\n{\nsnr_s = snr;\n- snr_b = esn0_to_ebn0(snr_s, code_rate, params.modulator.bits_per_symbol);\n+ snr_b = esn0_to_ebn0(snr_s, params.code.R, params.modulator.bits_per_symbol);\n}\nsigma = esn0_to_sigma(snr_s, params.modulator.upsample_factor);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"diff": "@@ -42,7 +42,6 @@ protected:\nfloat snr;\nfloat snr_s;\nfloat snr_b;\n- float code_rate;\nfloat sigma;\n// the monitors of the the BFER simulation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -49,7 +49,6 @@ Simulation_EXIT<B,R>\nI_A (0.0),\nI_E (0.0),\nsig_a (0.f),\n- code_rate(0.f),\nsigma (0.f),\nsnr (0.f),\n@@ -120,7 +119,7 @@ void Simulation_EXIT<B,R>\nfor (snr = params.simulation.snr_min; snr <= params.simulation.snr_max; snr += params.simulation.snr_step)\n{\n// For EXIT simulation, SNR is considered as Es/N0\n- code_rate = 1.f;\n+ const auto code_rate = 1.f;\nsigma = esn0_to_sigma(ebn0_to_esn0(snr, code_rate, params.modulator.bits_per_symbol),\nparams.modulator.upsample_factor);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"diff": "@@ -52,7 +52,6 @@ protected:\n// code specifications\nfloat sig_a;\n- float code_rate;\nfloat sigma;\nfloat snr;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -45,6 +45,7 @@ struct code_parameters\nstd::string alist_path;\nstd::string awgn_fb_path;\nfloat sigma; // not noise var, used to set a fixed snr value for frozen bits construction (in polar codes)\n+ float R; // code rate\nbool coset; // true = enable coset approach\nint K_info;\nint K;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Compute the code rate (R) in the launcher.
|
8,490 |
15.06.2017 09:01:21
| -7,200 |
ea6f2d64a0973cfa492856dc6d7a29ea667bfeb4
|
Fix turbo puncturer.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Turbo/Codec_turbo.cpp",
"new_path": "src/Tools/Codec/Turbo/Codec_turbo.cpp",
"diff": "@@ -138,7 +138,7 @@ template <typename B, typename Q, typename QD>\nPuncturer<B,Q>* Codec_turbo<B,Q,QD>\n::build_puncturer(const int tid)\n{\n- const std::string type = (this->params.code.N == this->params.code.N_code) ? \"NO\" : \"WANGLIU\";\n+ const std::string type = (this->params.code.N == this->params.code.N_code) ? \"NO\" : \"TURBO\";\nreturn Factory_puncturer_turbo<B,Q>::build(type,\nthis->params.code.K,\nthis->params.code.N,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix turbo puncturer.
|
8,483 |
15.06.2017 09:43:20
| -7,200 |
2ac2184b1a7dfa2983562d698b467c8231c59d87
|
Change LDPC_matrix_handler::interleavers with a given old cols positions instead of new positions.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.cpp",
"diff": "@@ -177,37 +177,48 @@ float LDPC_matrix_handler\n}\nSparse_matrix LDPC_matrix_handler\n-::interleave_matrix(const Sparse_matrix& mat, std::vector<unsigned>& new_cols_pos)\n+::interleave_matrix(const Sparse_matrix& mat, std::vector<unsigned>& old_cols_pos)\n{\n- if (mat.get_n_cols() != new_cols_pos.size())\n+ if (mat.get_n_cols() != old_cols_pos.size())\nthrow std::length_error(\"aff3ct::tools::LDPC_G::interleave_matrix: matrix width \\\"mat.get_n_cols()\\\" has to be\"\n- \" equal to interleaver length \\\"new_cols_pos.size()\\\".\");\n+ \" equal to interleaver length \\\"old_cols_pos.size()\\\".\");\nSparse_matrix itl_mat(mat.get_n_rows(), mat.get_n_cols());\nfor (unsigned i = 0; i < mat.get_n_cols(); i++)\n{\n- for (unsigned j = 0; j < mat.get_rows_from_col(i).size(); j++)\n- itl_mat.add_connection(mat.get_rows_from_col(i)[j], new_cols_pos[i]);\n+ for (unsigned j = 0; j < mat.get_rows_from_col(old_cols_pos[i]).size(); j++)\n+ itl_mat.add_connection(mat.get_rows_from_col(old_cols_pos[i])[j], i);\n}\nreturn itl_mat;\n}\nstd::vector<unsigned> LDPC_matrix_handler\n-::interleave_info_bits_pos(const std::vector<unsigned>& info_bits_pos, std::vector<unsigned>& new_cols_pos)\n+::interleave_info_bits_pos(const std::vector<unsigned>& info_bits_pos, std::vector<unsigned>& old_cols_pos)\n{\n- if (info_bits_pos.size() > new_cols_pos.size())\n+ if (info_bits_pos.size() > old_cols_pos.size())\nthrow std::length_error(\"aff3ct::tools::LDPC_G::interleave_info_bits_pos: vector length \\\"vec.size()\\\" has to\"\n- \" be smaller than or equal to interleaver length \\\"new_cols_pos.size()\\\".\");\n+ \" be smaller than or equal to interleaver length \\\"old_cols_pos.size()\\\".\");\nstd::vector<unsigned> itl_vec(info_bits_pos.size());\n+ unsigned cnt = 0;\nfor (unsigned i = 0; i < info_bits_pos.size(); i++)\n{\n- itl_vec[i] = new_cols_pos[info_bits_pos[i]];\n+ auto it = std::find(old_cols_pos.begin(), old_cols_pos.end(), info_bits_pos[i]);\n+\n+ if (it != old_cols_pos.end())\n+ {\n+ itl_vec[i] = std::distance(old_cols_pos.begin(), it);\n+ cnt++;\n}\n+ }\n+\n+ if (cnt != itl_vec.size())\n+ throw std::runtime_error(\"aff3ct::tools::LDPC_G::interleave_info_bits_pos: the number of information bits pos\"\n+ \"itions found in the old_cols_pos vector is less than the \\\"info_bits_pos.size()\\\".\");\nreturn itl_vec;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"new_path": "src/Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp",
"diff": "@@ -57,16 +57,19 @@ public:\n/*\n* integrate an interleaver inside the matrix to avoid this step.\n- * new_cols_pos gives the new position of the matching column.\n- * For ex. the column i will be set at position new_cols_pos[i]\n+ * old_cols_pos gives the old position of the matching column.\n+ * For ex. the column old_cols_pos[i] of mat will be set at position i\n*/\n- static Sparse_matrix interleave_matrix(const Sparse_matrix& mat, std::vector<unsigned>& new_cols_pos);\n+ static Sparse_matrix interleave_matrix(const Sparse_matrix& mat, std::vector<unsigned>& old_cols_pos);\n/*\n* return the vector of the position of the info bits after interleaving.\n+ * old_cols_pos gives the old position of the matching column.\n+ * For ex. the bit position info_bits_pos[i] will be set at position j where\n+ * old_cols_pos[j] == info_bits_pos[i]\n*/\nstatic std::vector<unsigned> interleave_info_bits_pos(const std::vector<unsigned>& info_bits_pos,\n- std::vector<unsigned>& new_cols_pos);\n+ std::vector<unsigned>& old_cols_pos);\nprotected :\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change LDPC_matrix_handler::interleavers with a given old cols positions instead of new positions.
|
8,490 |
15.06.2017 14:21:47
| -7,200 |
3e999e186e222dfafa3aadf22497777628e43146
|
Fix compilation error with MPI.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.hpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.hpp",
"diff": "@@ -30,7 +30,7 @@ private:\npublic:\nMonitor_reduction_mpi(const int size, const unsigned max_fe,\n- std::vector<Monitor<B,R>*> monitors,\n+ std::vector<Monitor<B>*> monitors,\nconst std::thread::id master_thread_id,\nconst std::chrono::nanoseconds d_mpi_comm_frequency = std::chrono::milliseconds(1000),\nconst int n_frames = 1,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix compilation error with MPI.
|
8,490 |
15.06.2017 15:02:50
| -7,200 |
c2491ca948b8fb783f7e3a96b2d62a02373bb6d1
|
Improve the simulation management.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -50,7 +50,7 @@ Simulation_BFER_ite<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_ite<B,R,Q>\n-::build_communication_chain(const int tid)\n+::_build_communication_chain(const int tid)\n{\nconst auto seed_src = rd_engine_seed[tid]();\nconst auto seed_itl = this->params.interleaver.uniform ? rd_engine_seed[tid]() : this->params.interleaver.seed;\n@@ -73,8 +73,6 @@ void Simulation_BFER_ite<B,R,Q>\ninterleaver[tid]->init();\nif (interleaver[tid]->is_uniform())\nthis->monitor[tid]->add_handler_check(std::bind(&Interleaver<int>::refresh, this->interleaver[tid]));\n-\n- Simulation_BFER<B,R,Q>::build_communication_chain(tid);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.hpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.hpp",
"diff": "@@ -51,7 +51,7 @@ public:\nvirtual ~Simulation_BFER_ite();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void release_objects();\nvirtual module::Source <B >* build_source (const int tid = 0, const int seed = 0);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"diff": "@@ -53,9 +53,9 @@ SC_Simulation_BFER_ite<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid SC_Simulation_BFER_ite<B,R,Q>\n-::build_communication_chain(const int tid)\n+::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_ite<B,R,Q>::build_communication_chain(tid);\n+ Simulation_BFER_ite<B,R,Q>::_build_communication_chain(tid);\nif (*this->interleaver[tid] != *this->interleaver_e)\nthrow std::runtime_error(\"aff3ct::simulation::SC_Simulation_BFERI_ite: \\\"interleaver[tid]\\\" and \"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.hpp",
"new_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.hpp",
"diff": "@@ -35,7 +35,7 @@ public:\nvirtual ~SC_Simulation_BFER_ite();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void release_objects();\nvirtual void _launch();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "@@ -66,9 +66,9 @@ Simulation_BFER_ite_threads<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_ite_threads<B,R,Q>\n-::build_communication_chain(const int tid)\n+::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_ite<B,R,Q>::build_communication_chain(tid);\n+ Simulation_BFER_ite<B,R,Q>::_build_communication_chain(tid);\nif (this->params.source.type == \"AZCW\")\n{\n@@ -109,9 +109,26 @@ void Simulation_BFER_ite_threads<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_ite_threads<B,R,Q>\n::start_thread(Simulation_BFER_ite_threads<B,R,Q> *simu, const int tid)\n+{\n+ try\n{\nsimu->Monte_Carlo_method(tid);\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B>::stop();\n+\n+ simu->mutex_exception.lock();\n+ if (simu->prev_err_message != e.what())\n+ {\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop (tid = \")\n+ << bold_red(std::to_string(tid) + \").\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ simu->prev_err_message = e.what();\n+ }\n+ simu->mutex_exception.unlock();\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_ite_threads<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp",
"diff": "@@ -41,7 +41,7 @@ public:\nvirtual ~Simulation_BFER_ite_threads();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void _launch();\nvirtual tools::Terminal_BFER<B>* build_terminal();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -95,19 +95,17 @@ Simulation_BFER<B,R,Q>\nif (monitor[tid] != nullptr) { delete monitor[tid]; monitor[tid] = nullptr; }\nif (dumper [tid] != nullptr) { delete dumper [tid]; dumper [tid] = nullptr; }\n}\n+\n+ if (terminal != nullptr) { delete terminal; terminal = nullptr; }\n}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::build_communication_chain(const int tid)\n{\n- // build the terminal to display the BER/FER\n- if (tid == 0)\n+ try\n{\n- this->terminal = this->build_terminal();\n- this->terminal->set_esn0(snr_s);\n- this->terminal->set_ebn0(snr_b);\n- }\n+ this->_build_communication_chain(tid);\nfor (auto& duration : this->durations[tid])\nduration.second = std::chrono::nanoseconds(0);\n@@ -115,11 +113,36 @@ void Simulation_BFER<B,R,Q>\nif (params.monitor.err_track_enable)\nthis->monitor[tid]->add_handler_fe(std::bind(&Dumper::add, this->dumper[tid], std::placeholders::_1));\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B>::stop();\n+\n+ mutex_exception.lock();\n+ if (prev_err_message != e.what())\n+ {\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"communication chain (tid = \" + std::to_string(tid) + \").\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+\n+ prev_err_message = e.what();\n+ }\n+ mutex_exception.unlock();\n+ }\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Simulation_BFER<B,R,Q>\n+::_build_communication_chain(const int tid)\n+{\n+ // by default, do nothing\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::launch()\n{\n+ this->terminal = this->build_terminal();\n+\ncodec.launch_precompute();\n// for each SNR to be simulated\n@@ -137,6 +160,9 @@ void Simulation_BFER<B,R,Q>\n}\nsigma = esn0_to_sigma(snr_s, params.modulator.upsample_factor);\n+ this->terminal->set_esn0(snr_s);\n+ this->terminal->set_ebn0(snr_b);\n+\n// dirty hack to override simulation params\nif (this->params.monitor.err_track_revert)\n{\n@@ -151,27 +177,19 @@ void Simulation_BFER<B,R,Q>\ncodec.snr_precompute(this->sigma);\n- try\n- {\n// build the communication chain in multi-threaded mode\nstd::vector<std::thread> threads(this->params.simulation.n_threads -1);\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1] = std::thread(Simulation_BFER<B,R,Q>::start_thread_build_comm_chain, this, tid);\n+\nSimulation_BFER<B,R,Q>::start_thread_build_comm_chain(this, 0);\n// join the slave threads with the master thread\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1].join();\n- }\n- catch (std::exception const& e)\n- {\n- Monitor<B>::stop();\n-\n- std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n- << bold_red(\"communication chain.\") << std::endl\n- << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n- }\n+ if (!Monitor<B>::is_over())\n+ {\nif (params.simulation.mpi_rank == 0 && !params.terminal.disabled && snr == params.simulation.snr_min &&\n!params.simulation.debug && !this->params.simulation.benchs)\nterminal->legend(std::cout);\n@@ -212,9 +230,12 @@ void Simulation_BFER<B,R,Q>\n!this->params.simulation.benchs &&\nterminal != nullptr)\n{\n- if (this->params.simulation.debug)\n+ if (this->params.simulation.debug && !Monitor<B>::is_over())\nterminal->legend(std::cout);\n+\ntime_reduction(true);\n+\n+ if (!Monitor<B>::is_over())\nterminal->final_report(std::cout);\n}\n@@ -225,9 +246,10 @@ void Simulation_BFER<B,R,Q>\n}\nthis->monitor_red->reset();\n+ }\n+\nthis->release_objects();\n- // exit simulation (double [ctrl+c])\nif (Monitor<B>::is_over())\nbreak;\n}\n@@ -242,7 +264,6 @@ template <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::release_objects()\n{\n- if (terminal != nullptr) { delete terminal; terminal = nullptr; }\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.hpp",
"diff": "@@ -30,6 +30,9 @@ private:\nbool stop_terminal;\nprotected:\n+ std::mutex mutex_exception;\n+ std::string prev_err_message;\n+\ntools::Codec<B,Q> &codec;\n// simulation parameters\n@@ -69,7 +72,7 @@ public:\nvoid launch();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void release_objects();\nvirtual void _launch() = 0;\n@@ -77,6 +80,7 @@ protected:\nvirtual tools ::Terminal_BFER<B>* build_terminal( );\nprivate:\n+ void build_communication_chain(const int tid = 0);\nvoid time_reduction(const bool is_snr_done = false );\nvoid time_report (std::ostream &stream = std::clog);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -49,7 +49,7 @@ Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_std<B,R,Q>\n-::build_communication_chain(const int tid)\n+::_build_communication_chain(const int tid)\n{\nconst auto seed_src = rd_engine_seed[tid]();\nconst auto seed_itl = this->params.interleaver.uniform ? rd_engine_seed[tid]() : this->params.interleaver.seed;\n@@ -75,8 +75,6 @@ void Simulation_BFER_std<B,R,Q>\nif (interleaver[tid]->is_uniform())\nthis->monitor[tid]->add_handler_check(std::bind(&Interleaver<int>::refresh, this->interleaver[tid]));\n}\n-\n- Simulation_BFER<B,R,Q>::build_communication_chain(tid);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.hpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.hpp",
"diff": "@@ -51,7 +51,7 @@ public:\nvirtual ~Simulation_BFER_std();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void release_objects();\nvirtual module::Source <B >* build_source (const int tid = 0, const int seed = 0);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"diff": "@@ -133,9 +133,9 @@ SPU_Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid SPU_Simulation_BFER_std<B,R,Q>\n-::build_communication_chain(const int tid)\n+::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_std<B,R,Q>::build_communication_chain(tid);\n+ Simulation_BFER_std<B,R,Q>::_build_communication_chain(tid);\nif (this->params.source.type == \"AZCW\")\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.hpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.hpp",
"diff": "@@ -59,7 +59,7 @@ public:\nvirtual ~SPU_Simulation_BFER_std();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void _launch();\nprivate:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.cpp",
"diff": "@@ -45,9 +45,9 @@ SC_Simulation_BFER_std<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid SC_Simulation_BFER_std<B,R,Q>\n-::build_communication_chain(const int tid)\n+::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_std<B,R,Q>::build_communication_chain(tid);\n+ Simulation_BFER_std<B,R,Q>::_build_communication_chain(tid);\n// create the sc_module inside the objects of the communication chain\nthis->source [tid]->create_sc_module ();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.hpp",
"new_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.hpp",
"diff": "@@ -30,7 +30,7 @@ public:\nvirtual ~SC_Simulation_BFER_std();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void _launch();\nprivate:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "#include <stdexcept>\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n+#include \"Tools/Display/bash_tools.h\"\n#include \"Simulation_BFER_std_threads.hpp\"\n@@ -69,9 +70,9 @@ Simulation_BFER_std_threads<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_std_threads<B,R,Q>\n-::build_communication_chain(const int tid)\n+::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_std<B,R,Q>::build_communication_chain(tid);\n+ Simulation_BFER_std<B,R,Q>::_build_communication_chain(tid);\nif (this->params.source.type == \"AZCW\")\n{\n@@ -120,10 +121,27 @@ void Simulation_BFER_std_threads<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_std_threads<B,R,Q>\n::start_thread(Simulation_BFER_std_threads<B,R,Q> *simu, const int tid)\n+{\n+ try\n{\nsimu->thread_id[std::this_thread::get_id()] = tid;\nsimu->Monte_Carlo_method(tid);\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B>::stop();\n+\n+ simu->mutex_exception.lock();\n+ if (simu->prev_err_message != e.what())\n+ {\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop (tid = \")\n+ << bold_red(std::to_string(tid) + \").\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ simu->prev_err_message = e.what();\n+ }\n+ simu->mutex_exception.unlock();\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER_std_threads<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.hpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.hpp",
"diff": "@@ -41,7 +41,7 @@ public:\nvirtual ~Simulation_BFER_std_threads();\nprotected:\n- virtual void build_communication_chain(const int tid = 0);\n+ virtual void _build_communication_chain(const int tid = 0);\nvirtual void _launch();\nvirtual tools::Terminal_BFER<B>* build_terminal();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the simulation management.
|
8,490 |
15.06.2017 15:13:36
| -7,200 |
e401d1b6045ee706252d54095050a8211baaceb6
|
Fix an error in the monitor MPI.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp",
"diff": "@@ -28,7 +28,7 @@ public:\nunsigned long long get_n_fe () const;\nunsigned long long get_n_be () const;\n- void reset();\n+ virtual void reset();\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"diff": "@@ -95,6 +95,14 @@ bool Monitor_reduction_mpi<B>\nreturn is_fe_limit_achieved;\n}\n+template <typename B>\n+void Monitor_reduction_mpi<B>\n+::reset()\n+{\n+ Monitor_reduction<B>::reset();\n+ is_fe_limit_achieved = false;\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.hpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.hpp",
"diff": "@@ -38,6 +38,8 @@ public:\nvirtual ~Monitor_reduction_mpi();\nbool fe_limit_achieved();\n+\n+ void reset();\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix an error in the monitor MPI.
|
8,483 |
16.06.2017 16:35:36
| -7,200 |
baaf17dcf4df8bd5f811e3dc26ddcea8934e23c6
|
add colors inside argument reader
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "#include <iostream>\n#include <stdexcept>\n#include <algorithm>\n-using namespace std;\n+#include <type_traits>\n#include \"Arguments_reader.hpp\"\n+#include \"Tools/Display/bash_tools.h\"\nusing namespace aff3ct::tools;\n+using color_function = std::add_pointer<std::string(std::string)>::type;\n+\nArguments_reader\n::Arguments_reader(const int argc, const char** argv)\n: m_argv(argc), max_n_char_arg(0)\n@@ -17,7 +20,7 @@ Arguments_reader\nthis->m_program_name = argv[0];\nfor (unsigned short i = 0; i < argc; ++i)\n- this->m_argv[i] = string(argv[i]);\n+ this->m_argv[i] = std::string(argv[i]);\n}\nArguments_reader\n@@ -26,8 +29,8 @@ Arguments_reader\n}\nbool Arguments_reader\n-::parse_arguments(const map<vector<string>, vector<string>> &required_args,\n- const map<vector<string>, vector<string>> &optional_args,\n+::parse_arguments(const std::map<std::vector<std::string>, std::vector<std::string>> &required_args,\n+ const std::map<std::vector<std::string>, std::vector<std::string>> &optional_args,\nconst bool display_warnings)\n{\nstd::vector<std::string> warns;\n@@ -41,8 +44,8 @@ bool Arguments_reader\n}\nbool Arguments_reader\n-::parse_arguments(const map<vector<string>, vector<string>> &required_args,\n- const map<vector<string>, vector<string>> &optional_args,\n+::parse_arguments(const std::map<std::vector<std::string>, std::vector<std::string>> &required_args,\n+ const std::map<std::vector<std::string>, std::vector<std::string>> &optional_args,\nstd::vector<std::string> &warnings)\n{\nunsigned short int n_req_arg = 0;\n@@ -74,7 +77,7 @@ bool Arguments_reader\n}\nbool Arguments_reader\n-::sub_parse_arguments(map<vector<string>, vector<string>> &args, unsigned short pos_arg)\n+::sub_parse_arguments(std::map<std::vector<std::string>, std::vector<std::string>> &args, unsigned short pos_arg)\n{\nif (pos_arg >= this->m_argv.size())\nthrow std::invalid_argument(\"aff3ct::tools::Arguments_reader: \\\"pos_arg\\\" has to be smaller than \"\n@@ -91,14 +94,14 @@ bool Arguments_reader\n\"than 0.\");\n// remember the biggest argument length to display the doc after\n- const string delimiter = \", \";\n+ const std::string delimiter = \", \";\nunsigned total_length = 0;\nfor (auto i = 0; i < (int)it->first.size() -1; i++)\ntotal_length += unsigned((it->first[i].length() == 1 ? 1 : 2) + it->first[i].length() + delimiter.length());\nconst auto last = it->first.size() -1;\ntotal_length += unsigned((it->first[last].length() == 1 ? 1 : 2) + it->first[last].length());\n- this->max_n_char_arg = max(this->max_n_char_arg, total_length);\n+ this->max_n_char_arg = std::max(this->max_n_char_arg, total_length);\nauto i = 0;\ndo\n@@ -130,13 +133,13 @@ bool Arguments_reader\n}\nbool Arguments_reader\n-::exist_argument(const vector<string> &tags)\n+::exist_argument(const std::vector<std::string> &tags)\n{\nreturn (this->m_args.find(tags) != this->m_args.end());\n}\n-string Arguments_reader\n-::get_argument(const vector<string> &tags)\n+std::string Arguments_reader\n+::get_argument(const std::vector<std::string> &tags)\n{\nreturn this->m_args[tags];\n}\n@@ -144,14 +147,14 @@ string Arguments_reader\nvoid Arguments_reader\n::print_usage()\n{\n- cout << \"Usage: \" << this->m_program_name;\n+ std::cout << \"Usage: \" << this->m_program_name;\nfor (auto it = this->m_required_args.begin(); it != this->m_required_args.end(); ++it)\nif (it->second[0] != \"\")\n- cout << ((it->first[0].size() == 1) ? \" -\" : \" --\") << it->first[0] << \" <\" << it->second[0] << \">\";\n+ std::cout << ((it->first[0].size() == 1) ? \" -\" : \" --\") << it->first[0] << \" <\" << it->second[0] << \">\";\nelse\n- cout << ((it->first[0].size() == 1) ? \" -\" : \" --\") << it->first[0];\n- cout << \" [optional args...]\" << endl << endl;\n+ std::cout << ((it->first[0].size() == 1) ? \" -\" : \" --\") << it->first[0];\n+ std::cout << \" [optional args...]\" << std::endl << std::endl;\nfor (auto it = this->m_required_args.begin(); it != this->m_required_args.end(); ++it)\nthis->print_usage(it->first, it->second, true);\n@@ -159,23 +162,25 @@ void Arguments_reader\nfor (auto it = this->m_optional_args.begin(); it != this->m_optional_args.end(); ++it)\nthis->print_usage(it->first, it->second, false);\n- cout << endl;\n+ std::cout << std::endl;\n}\nvoid Arguments_reader\n::print_usage(std::vector<std::vector<std::string>> arg_groups)\n{\n- cout << \"Usage: \" << this->m_program_name;\n+ color_function head_color = tools::bold_yellow;\n+\n+ std::cout << \"Usage: \" << this->m_program_name;\nfor (auto it = this->m_required_args.begin(); it != this->m_required_args.end(); ++it)\n{\nconst auto last = it->first.size() -1;\nif(it->second[0] != \"\")\n- cout << ((it->first[last].size() == 1) ? \" -\" : \" --\") << it->first[last] << \" <\" << it->second[0] << \">\";\n+ std::cout << ((it->first[last].size() == 1) ? \" -\" : \" --\") << it->first[last] << \" <\" << it->second[0] << \">\";\nelse\n- cout << ((it->first[last].size() == 1) ? \" -\" : \" --\") << it->first[last];\n+ std::cout << ((it->first[last].size() == 1) ? \" -\" : \" --\") << it->first[last];\n}\n- cout << \" [optional args...]\" << endl << endl;\n+ std::cout << \" [optional args...]\" << std::endl << std::endl;\nauto req_args_cpy = this->m_required_args;\nauto opt_args_cpy = this->m_optional_args;\n@@ -212,7 +217,7 @@ void Arguments_reader\nif (display)\n{\n- cout << arg_groups[i][1] << \": \" << endl;\n+ std::cout << head_color(arg_groups[i][1] + \": \") << std::endl;\nif (arg_groups[i].size() > 2)\nstd::cout << arg_groups[i][2] << std::endl;\n@@ -240,13 +245,13 @@ void Arguments_reader\n}\n}\n- cout << endl;\n+ std::cout << std::endl;\n}\n}\nif (!req_args_cpy.empty() || !opt_args_cpy.empty())\n{\n- cout << \"Other parameter(s): \" << endl;\n+ std::cout << head_color(\"Other parameter(s): \") << std::endl;\nfor (auto it = req_args_cpy.begin(); it != req_args_cpy.end(); )\n{\n// gr->first is a prefix of it->first[0].\n@@ -261,48 +266,54 @@ void Arguments_reader\nit = opt_args_cpy.erase(it);\n}\n- cout << endl;\n+ std::cout << std::endl;\n}\n}\nvoid Arguments_reader\n-::print_usage(const vector<string> &tags, const vector<string> &values, const bool required)\n+::print_usage(const std::vector<std::string> &tags, const std::vector<std::string> &values, const bool required)\n{\n+ color_function arg_color;\n+ if (required)\n+ arg_color = tools::red;\n+ else\n+ arg_color = tools::blue;\n+\nif (values.size() >= 2 && !values[1].empty())\n{\nconst auto tab = \" \";\n- const string delimiter = \", \";\n+ const std::string delimiter = \", \";\nauto total_length = 0;\n- cout << tab;\n+ std::cout << tab;\nfor (auto i = 0; i < (int)tags.size() -1; i++)\n{\n- cout << ((tags[i].length() == 1) ? \"-\" : \"--\") << tags[i] << delimiter;\n+ std::cout << arg_color(((tags[i].length() == 1) ? \"-\" : \"--\") + tags[i] + delimiter);\ntotal_length += unsigned((tags[i].length() == 1 ? 1 : 2) + tags[i].length() + delimiter.length());\n}\nconst auto last = tags.size() -1;\n- cout << ((tags[last].length() == 1) ? \"-\" : \"--\") << tags[last];\n+ std::cout << arg_color(((tags[last].length() == 1) ? \"-\" : \"--\") + tags[last]);\ntotal_length += unsigned((tags[last].length() == 1 ? 1 : 2) + tags[last].length());\n- for (unsigned i = 0; i < this->max_n_char_arg - total_length; i++) cout << \" \";\n+ for (unsigned i = 0; i < this->max_n_char_arg - total_length; i++) std::cout << arg_color(\" \");\nif (values.size() < 3)\n{\nif (!values[0].empty())\n- cout << \" <\" << values[0] << \">\";\n+ std::cout << arg_color(\" <\" + values[0] + \">\");\n}\nelse\n{\nauto entries = Arguments_reader::split(values[2]);\n- string set;\n+ std::string set;\nfor (auto i = 0; i < (int)entries.size() -1; i++)\nset += entries[i] + \"|\";\nset += entries[entries.size() -1];\n- cout << \" <\" << values[0] << \"=\" << set << \">\";\n+ std::cout << arg_color(\" <\" + values[0] + \"=\" + set + \">\");\n}\nif (required)\n- cout << \" {REQUIRED}\";\n- cout << endl;\n- cout << tab << values[1] << endl;\n+ std::cout << arg_color(\" {REQUIRED}\");\n+ std::cout << std::endl;\n+ std::cout << arg_color(tab + values[1]) << std::endl;\n}\n}\n@@ -327,7 +338,7 @@ bool Arguments_reader\n}\nbool Arguments_reader\n-::check_argument(const vector<string> &tags, map<vector<string>, vector<string>> &args, string &error)\n+::check_argument(const std::vector<std::string> &tags, std::map<std::vector<std::string>, std::vector<std::string>> &args, std::string &error)\n{\n// check if the input is positive\nif (args[tags][0] == \"positive_int\")\n@@ -335,7 +346,7 @@ bool Arguments_reader\nconst auto int_num = std::stoi(this->m_args[tags]);\nif (int_num < 0)\n{\n- error = \"The \\\"\" + ((tags[0].length() == 1) ? string(\"-\") : string(\"--\")) + tags[0] +\n+ error = \"The \\\"\" + ((tags[0].length() == 1) ? std::string(\"-\") : std::string(\"--\")) + tags[0] +\n\"\\\" argument have to be positive.\";\nreturn false;\n}\n@@ -347,7 +358,7 @@ bool Arguments_reader\nconst auto float_num = std::stof(this->m_args[tags]);\nif (float_num < 0.f)\n{\n- error = \"The \\\"\" + ((tags[0].length() == 1) ? string(\"-\") : string(\"--\")) + tags[0] +\n+ error = \"The \\\"\" + ((tags[0].length() == 1) ? std::string(\"-\") : std::string(\"--\")) + tags[0] +\n\"\\\" argument have to be positive.\";\nreturn false;\n}\n@@ -370,12 +381,12 @@ bool Arguments_reader\nif (!found_entry)\n{\n- string set = \"<\";\n+ std::string set = \"<\";\nfor (auto i = 0; i < (int)entries.size() -1; i++)\nset += entries[i] + \"|\";\nset += entries[entries.size() -1] + \">\";\n- error = \"The \\\"\" + ((tags[0].length() == 1) ? string(\"-\") : string(\"--\")) + tags[0] +\n+ error = \"The \\\"\" + ((tags[0].length() == 1) ? std::string(\"-\") : std::string(\"--\")) + tags[0] +\n\"\\\" argument have to be in the \" + set + \" set.\";\nreturn false;\n@@ -386,10 +397,10 @@ bool Arguments_reader\nreturn true;\n}\n-vector<string> Arguments_reader\n-::split(string str)\n+std::vector<std::string> Arguments_reader\n+::split(std::string str)\n{\n- vector<string> str_splited;\n+ std::vector<std::string> str_splited;\nif (!str.empty())\n{\n@@ -397,11 +408,11 @@ vector<string> Arguments_reader\nstr.erase(remove(str.begin(), str.end(), ' '), str.end());\n// specify a delimiter\n- string delimiter = \",\";\n+ std::string delimiter = \",\";\n// extract each entry from \"str\"\nsize_t pos = 0;\n- while ((pos = str.find(delimiter)) != string::npos)\n+ while ((pos = str.find(delimiter)) != std::string::npos)\n{\nauto token = str.substr(0, pos);\nstr_splited.push_back(token);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
add colors inside argument reader
|
8,483 |
19.06.2017 16:12:04
| -7,200 |
a519a2b5ea1e6a49f866b3f86c427ff39f5f4992
|
Change bash tools colors
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "@@ -166,7 +166,7 @@ void Arguments_reader\nvoid Arguments_reader\n::print_usage(std::vector<std::vector<std::string>> arg_groups)\n{\n- Format head_format = Style::BOLD | Style::ITALIC | FG::Color::YELLOW | FG::Intensity::NORMAL;\n+ Format head_format = Style::BOLD | Style::ITALIC | FG::Color::YELLOW;\nstd::cout << \"Usage: \" << this->m_program_name;\n@@ -276,7 +276,7 @@ void Arguments_reader\nif (required)\narg_format |= FG::Color::RED;\nelse\n- arg_format |= FG::Color::BLUE | FG::Intensity::INTENSE;\n+ arg_format |= FG::Color::BLUE;\nif (values.size() >= 2 && !values[1].empty())\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/bash_tools.cpp",
"new_path": "src/Tools/Display/bash_tools.cpp",
"diff": "bool aff3ct::tools::enable_bash_tools = true;\n+// source : http://misc.flogisoft.com/bash/tip_colors_and_formatting\n+\nstd::vector<std::vector<std::string>> Style_table = {\n// BASIC BLINK BOLD DIM HIDDEN INVERT ITALIC UNDERL\n{ \"0\", \"5\", \"1\", \"2\", \"8\", \"7\", \"3\", \"4\"}, // SET\n{ \"0\", \"25\", \"21\", \"22\", \"28\", \"27\", \"23\", \"24\"} // CLEAR\n};\n+//std::vector<std::vector<std::string>> Color_table_fg = {\n+// //DEFAULT BLACK BLUE CYAN GRAY GREEN MAGENT ORANGE RED WHITE YELLOW\n+// { \"39\", \"30\", \"34\", \"36\", \"37\", \"32\", \"35\", \"38\", \"31\", \"97\", \"33\"}, // NORMAL\n+// { \"39\", \"30\", \"94\", \"96\", \"90\", \"92\", \"95\", \"98\", \"91\", \"97\", \"93\"} // INTENSE\n+// };\n+//\n+//std::vector<std::vector<std::string>> Color_table_bg = {\n+// //DEFAULT BLACK BLUE CYAN GRAY GREEN MAGENT ORANGE RED WHITE YELLOW\n+// { \"49\", \"40\", \"44\", \"46\", \"47\", \"42\", \"45\", \"48\", \"41\", \"107\", \"43\"}, // NORMAL\n+// { \"49\", \"40\", \"104\", \"106\", \"100\", \"102\", \"105\", \"108\", \"101\", \"107\", \"103\"} // INTENSE\n+// };\n+//\n+//std::string reset_command = \"\\e[0m\";\n+//\n+//std::string style_command_head = \"\\e[\";\n+//std::string style_command_queue = \"m\";\n+//\n+//std::string fg_color_command_head = \"\\e[\";\n+//std::string fg_color_command_queue = \"m\";\n+//std::string fg_color_reset_command = \"\\e[39m\";\n+//\n+//std::string bg_color_command_head = \"\\e[\";\n+//std::string bg_color_command_queue = \"m\";\n+//std::string bg_color_reset_command = \"\\e[49m\";\n+\nstd::vector<std::vector<std::string>> Color_table_fg = {\n//DEFAULT BLACK BLUE CYAN GRAY GREEN MAGENT ORANGE RED WHITE YELLOW\n- { \"39\", \"30\", \"34\", \"36\", \"37\", \"32\", \"35\", \"38\", \"31\", \"97\", \"33\"}, // NORMAL\n- { \"39\", \"30\", \"94\", \"96\", \"90\", \"92\", \"95\", \"98\", \"91\", \"97\", \"93\"} // INTENSE\n+ { \"256\", \"0\", \"33\", \"39\", \"244\", \"2\", \"5\", \"208\", \"1\", \"256\", \"220\"}, // NORMAL\n+ { \"256\", \"0\", \"21\", \"51\", \"251\", \"10\", \"13\", \"214\", \"196\", \"256\", \"226\"} // INTENSE\n};\nstd::vector<std::vector<std::string>> Color_table_bg = {\n//DEFAULT BLACK BLUE CYAN GRAY GREEN MAGENT ORANGE RED WHITE YELLOW\n- { \"49\", \"40\", \"44\", \"46\", \"47\", \"42\", \"45\", \"48\", \"41\", \"107\", \"43\"}, // NORMAL\n- { \"49\", \"40\", \"104\", \"106\", \"100\", \"102\", \"105\", \"108\", \"101\", \"107\", \"103\"} // INTENSE\n+ { \"0\", \"0\", \"33\", \"39\", \"244\", \"2\", \"5\", \"208\", \"1\", \"256\", \"220\"}, // NORMAL\n+ { \"0\", \"0\", \"21\", \"51\", \"251\", \"10\", \"13\", \"214\", \"196\", \"256\", \"226\"} // INTENSE\n};\n-std::string reset_code = \"0\";\n+std::string reset_command = \"\\e[0m\";\n+\n+std::string style_command_head = \"\\e[\";\n+std::string style_command_queue = \"m\";\n+\n+std::string fg_color_command_head = \"\\e[38;5;\";\n+std::string fg_color_command_queue = \"m\";\n+std::string fg_color_reset_command = \"\\e[39m\";\n+\n+std::string bg_color_command_head = \"\\e[48;5;\";\n+std::string bg_color_command_queue = \"m\";\n+std::string bg_color_reset_command = \"\\e[49m\";\n-std::string command_head = \"\\e[\";\n-std::string command_queue = \"m\";\nstd::string aff3ct::tools::format(std::string str, Format f)\n@@ -58,8 +94,8 @@ std::string aff3ct::tools::style(std::string str, Style s)\n{\nif(s & ((Format)1 << (i+20)))\n{\n- head += command_head + Style_table.at(0).at(i+1) + command_queue;\n- queue += command_head + Style_table.at(1).at(i+1) + command_queue;\n+ head += style_command_head + Style_table.at(0).at(i+1) + style_command_queue;\n+ queue += style_command_head + Style_table.at(1).at(i+1) + style_command_queue;\n}\n}\nreturn head + str + queue;\n@@ -76,10 +112,10 @@ std::string aff3ct::tools::fg_color(std::string str, FG::Color c, FG::Intensity\nreturn str;\n#else\n- if (enable_bash_tools)\n+ if (enable_bash_tools && c != 0)\n{\n- std::string head = command_head + Color_table_fg.at(i >> 8).at(c >> 0) + command_queue;\n- std::string queue = command_head + Color_table_fg.at(0).at(0) + command_queue;\n+ std::string head = fg_color_command_head + Color_table_fg.at(i >> 8).at(c >> 0) + fg_color_command_queue;\n+ std::string queue = fg_color_reset_command;\nreturn head + str + queue;\n}\nelse\n@@ -94,10 +130,10 @@ std::string aff3ct::tools::bg_color(std::string str, BG::Color c, BG::Intensity\nreturn str;\n#else\n- if (enable_bash_tools)\n+ if (enable_bash_tools && c != 0)\n{\n- std::string head = command_head + Color_table_bg.at(i >> 18).at(c >> 10) + command_queue;\n- std::string queue = command_head + Color_table_bg.at(0).at(0) + command_queue;\n+ std::string head = bg_color_command_head + Color_table_bg.at(i >> 18).at(c >> 10) + bg_color_command_queue;\n+ std::string queue = bg_color_reset_command;\nreturn head + str + queue;\n}\nelse\n@@ -112,7 +148,7 @@ std::string aff3ct::tools::default_style(std::string str)\nreturn str;\n#else\nif (enable_bash_tools)\n- return command_head + reset_code + command_queue + str;\n+ return reset_command + str;\nelse\nreturn str;\n#endif\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change bash tools colors
|
8,490 |
19.06.2017 16:36:44
| -7,200 |
2bf007ad64a2d3d0f825f097f096e83d87cfffa5
|
Improve the exceptions in the module::Coset.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/Coset.hpp",
"new_path": "src/Module/Coset/Coset.hpp",
"diff": "#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -48,7 +49,11 @@ public:\n: Module(n_frames, name), size(size)\n{\nif (size <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Coset: \\\"size\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'size' has to be greater than 0. ('size' = \" << size << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n@@ -75,17 +80,37 @@ public:\nvoid apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data)\n{\nif (ref.size() != in_data.size() || in_data.size() != out_data.size())\n- throw std::length_error(\"aff3ct::module::Coset: \\\"ref.size()\\\" has to be equal to \\\"in_data.size()\\\" and \"\n- \"\\\"out_data.size()\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'ref.size()' has to be equal to 'in_data.size()' and 'out_data.size()' ('ref.size()' = \"\n+ << ref.size() << \", 'in_data.size()' = \" << in_data.size() << \", 'out_data.size()' = \"\n+ << out_data.size() << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (this->size * this->n_frames != (int)ref.size())\n- throw std::length_error(\"aff3ct::module::Coset: \\\"ref.size()\\\" has to be equal to \"\n- \"\\\"size\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'ref.size()' has to be equal to 'size' * 'n_frames' ('ref.size()' = \" << ref.size()\n+ << \", 'size' = \" << this->size << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (this->size * this->n_frames != (int)in_data.size())\n- throw std::length_error(\"aff3ct::module::Coset: \\\"in_data.size()\\\" has to be equal to \"\n- \"\\\"size\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'in_data.size()' has to be equal to 'size' * 'n_frames' ('in_data.size()' = \" << in_data.size()\n+ << \", 'size' = \" << this->size << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (this->size * this->n_frames != (int)out_data.size())\n- throw std::length_error(\"aff3ct::module::Coset: \\\"out_data.size()\\\" has to be equal to \"\n- \"\\\"size\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'out_data.size()' has to be equal to 'size' * 'n_frames' ('out_data.size()' = \" << out_data.size()\n+ << \", 'size' = \" << this->size << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->apply(ref.data(), in_data.data(), out_data.data());\n}\n@@ -102,7 +127,7 @@ public:\nprotected:\nvirtual void _apply(const B *ref, const D *in_data, D *out_data, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::Coset: \\\"_apply\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/SC_Coset.hpp",
"new_path": "src/Module/Coset/SC_Coset.hpp",
"diff": "#ifdef SYSTEMC_MODULE\n#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n#include <tlm_utils/simple_initiator_socket.h>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -52,7 +53,14 @@ private:\nvoid b_transport_ref(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (coset.get_size() * coset.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n- throw std::length_error(\"aff3ct::module::Coset: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'coset.get_size()' * 'coset.get_n_frames()' has to be equal to 'trans.get_data_length()' / \"\n+ \"'sizeof(B)' ('coset.get_size()' = \" << coset.get_size()\n+ << \", 'coset.get_n_frames()' = \" << coset.get_n_frames() << \", 'trans.get_data_length()' = \"\n+ << trans.get_data_length() << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nref = (B*)trans.get_data_ptr();\n}\n@@ -60,10 +68,17 @@ private:\nvoid b_transport_data(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (ref == nullptr)\n- throw std::runtime_error(\"aff3ct::module::Coset: TLM \\\"ref\\\" pointer can't be NULL.\");\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, \"'ref' pointer can't be NULL.\");\nif (coset.get_size() * coset.get_n_frames() != (int)(trans.get_data_length() / sizeof(D)))\n- throw std::length_error(\"aff3ct::module::Coset: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'coset.get_size()' * 'coset.get_n_frames()' has to be equal to 'trans.get_data_length()' / \"\n+ \"'sizeof(D)' ('coset.get_size()' = \" << coset.get_size()\n+ << \", 'coset.get_n_frames()' = \" << coset.get_n_frames() << \", 'trans.get_data_length()' = \"\n+ << trans.get_data_length() << \", 'sizeof(D)' = \" << sizeof(D) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto in_data = (D*)trans.get_data_ptr();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::Coset.
|
8,483 |
19.06.2017 16:46:48
| -7,200 |
376594a17e1745b0a188911bf07db110b02a0b75
|
Change argument reader to list directly all the wrong arguments and to give the whole list of tags of an argument.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "@@ -149,9 +149,9 @@ void Arguments_reader\nfor (auto it = this->m_required_args.begin(); it != this->m_required_args.end(); ++it)\nif (it->second[0] != \"\")\n- std::cout << ((it->first[0].size() == 1) ? \" -\" : \" --\") << it->first[0] << \" <\" << it->second[0] << \">\";\n+ std::cout << \" \" + print_tag(it->first[0]) << \" <\" << it->second[0] << \">\";\nelse\n- std::cout << ((it->first[0].size() == 1) ? \" -\" : \" --\") << it->first[0];\n+ std::cout << \" \" + print_tag(it->first[0]);\nstd::cout << \" [optional args...]\" << std::endl << std::endl;\nfor (auto it = this->m_required_args.begin(); it != this->m_required_args.end(); ++it)\n@@ -174,9 +174,9 @@ void Arguments_reader\n{\nconst auto last = it->first.size() -1;\nif(it->second[0] != \"\")\n- std::cout << ((it->first[last].size() == 1) ? \" -\" : \" --\") << it->first[last] << \" <\" << it->second[0] << \">\";\n+ std::cout << \" \" + print_tag(it->first[last]) << \" <\" << it->second[0] << \">\";\nelse\n- std::cout << ((it->first[last].size() == 1) ? \" -\" : \" --\") << it->first[last];\n+ std::cout << \" \" + print_tag(it->first[last]);\n}\nstd::cout << \" [optional args...]\" << std::endl << std::endl;\n@@ -286,11 +286,11 @@ void Arguments_reader\nstd::cout << tab;\nfor (auto i = 0; i < (int)tags.size() -1; i++)\n{\n- std::cout << format(((tags[i].length() == 1) ? \"-\" : \"--\") + tags[i] + delimiter, arg_format);\n+ std::cout << format(print_tag(tags[i]) + delimiter, arg_format);\ntotal_length += unsigned((tags[i].length() == 1 ? 1 : 2) + tags[i].length() + delimiter.length());\n}\nconst auto last = tags.size() -1;\n- std::cout << format(((tags[last].length() == 1) ? \"-\" : \"--\") + tags[last], arg_format);\n+ std::cout << format(print_tag(tags[last]), arg_format);\ntotal_length += unsigned((tags[last].length() == 1 ? 1 : 2) + tags[last].length());\nfor (unsigned i = 0; i < this->max_n_char_arg - total_length; i++) std::cout << format(\" \", arg_format);\n@@ -319,35 +319,47 @@ void Arguments_reader\nbool Arguments_reader\n::check_arguments(std::string &error)\n{\n- auto success = true;\nfor (auto it = this->m_args.begin(); it != this->m_args.end(); ++it)\n{\n+ std::string arg_error;\n+\nif (this->m_required_args.find(it->first) != this->m_required_args.end())\n- success = this->check_argument(it->first, this->m_required_args, error);\n+ arg_error = this->check_argument(it->first, this->m_required_args);\nelse if (this->m_optional_args.find(it->first) != this->m_optional_args.end())\n- success = this->check_argument(it->first, this->m_optional_args, error);\n+ arg_error = this->check_argument(it->first, this->m_optional_args);\nelse\n- success = false;\n+ for (auto i = 0; i < (int)it->first.size(); i++)\n+ arg_error += print_tag(it->first[i]) + ((i < (int)it->first.size()-1)?\", \":\"\");\n- if (!success)\n- break;\n+ if (arg_error.size())\n+ {\n+ if(error.size())\n+ error += \"\\n\";\n+ error += arg_error;\n+ }\n}\n- return success;\n+ return error.size() == 0;\n}\n-bool Arguments_reader\n-::check_argument(const std::vector<std::string> &tags, std::map<std::vector<std::string>, std::vector<std::string>> &args, std::string &error)\n+\n+std::string Arguments_reader\n+::check_argument(const std::vector<std::string> &tags, std::map<std::vector<std::string>, std::vector<std::string>> &args)\n{\n+ std::string error;\n+\n// check if the input is positive\nif (args[tags][0] == \"positive_int\")\n{\nconst auto int_num = std::stoi(this->m_args[tags]);\nif (int_num < 0)\n{\n- error = \"The \\\"\" + ((tags[0].length() == 1) ? std::string(\"-\") : std::string(\"--\")) + tags[0] +\n- \"\\\" argument have to be positive.\";\n- return false;\n+ error = \"The \\\"\";\n+ for (auto i = 0; i < (int)tags.size(); i++)\n+ error += print_tag(tags[i]) + ((i < (int)tags.size()-1)?\", \":\"\");\n+\n+ error += \"\\\" argument has to be positive.\";\n+ return error;\n}\n}\n@@ -357,9 +369,12 @@ bool Arguments_reader\nconst auto float_num = std::stof(this->m_args[tags]);\nif (float_num < 0.f)\n{\n- error = \"The \\\"\" + ((tags[0].length() == 1) ? std::string(\"-\") : std::string(\"--\")) + tags[0] +\n- \"\\\" argument have to be positive.\";\n- return false;\n+ error = \"The \\\"\";\n+ for (auto i = 0; i < (int)tags.size(); i++)\n+ error += print_tag(tags[i]) + ((i < (int)tags.size()-1)?\", \":\"\");\n+\n+ error += \"\\\" argument has to be positive.\";\n+ return error;\n}\n}\n@@ -385,17 +400,25 @@ bool Arguments_reader\nset += entries[i] + \"|\";\nset += entries[entries.size() -1] + \">\";\n- error = \"The \\\"\" + ((tags[0].length() == 1) ? std::string(\"-\") : std::string(\"--\")) + tags[0] +\n- \"\\\" argument have to be in the \" + set + \" set.\";\n+ error = \"The \\\"\";\n+ for (auto i = 0; i < (int)tags.size(); i++)\n+ error += print_tag(tags[i]) + ((i < (int)tags.size()-1)?\", \":\"\");\n- return false;\n+ error += \"\\\" argument has to be in the \" + set + \" set.\";\n+ return error;\n}\n}\n- error = \"\";\n- return true;\n+ return error;\n+}\n+\n+std::string Arguments_reader\n+::print_tag(const std::string& tag)\n+{\n+ return ((tag.size() == 1) ? \"-\" : \"--\") + tag;\n}\n+\nstd::vector<std::string> Arguments_reader\n::split(std::string str)\n{\n@@ -423,6 +446,7 @@ std::vector<std::string> Arguments_reader\nreturn str_splited;\n}\n+\nvoid Arguments_reader\n::clear_arguments()\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.hpp",
"new_path": "src/Tools/Arguments_reader.hpp",
"diff": "@@ -179,9 +179,8 @@ private:\n*\n* \\return true if the argument criteria are respected, false otherwise.\n*/\n- bool check_argument(const std::vector<std::string> &tags,\n- std::map<std::vector<std::string>, std::vector<std::string>> &args,\n- std::string &error);\n+ std::string check_argument(const std::vector<std::string> &tags,\n+ std::map<std::vector<std::string>, std::vector<std::string>> &args);\n/*!\n* \\brief Clears m_required_args, m_optional_args and m_args.\n@@ -199,6 +198,8 @@ private:\nvoid print_usage(const std::vector<std::string> &tags, const std::vector<std::string> &values,\nconst bool required = false);\n+ std::string print_tag(const std::string& tag);\n+\n/*!\n* \\brief Splits a string in a vector of string, the delimiter is the comma.\n*\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change argument reader to list directly all the wrong arguments and to give the whole list of tags of an argument.
|
8,483 |
19.06.2017 17:30:07
| -7,200 |
48cf0467b942ef59b75e762be1fdc2c26d77148d
|
Create function to add the (EE) symbol on each line of the error message returned by the argument reader.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -497,7 +497,7 @@ int Launcher<B,R,Q>\nstd::string error;\nif (!ar.check_arguments(error))\n{\n- std::cerr << format_error(error) << std::endl;\n+ std::cerr << apply_on_each_line(error, format_error) << std::endl;\nreturn EXIT_FAILURE;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/bash_tools.cpp",
"new_path": "src/Tools/Display/bash_tools.cpp",
"diff": "@@ -189,3 +189,23 @@ std::string aff3ct::tools::format_positive_info(std::string str)\n{\nreturn format(\"(II) \" + str, FG::Color::GREEN | FG::Intensity::NORMAL);\n}\n+\n+\n+std::string aff3ct::tools::apply_on_each_line(const std::string& str, format_function fptr)\n+{\n+ std::string formated;\n+\n+ size_t pos = 0, old_pos = 0;\n+ while((pos = str.find('\\n', old_pos)) != str.npos)\n+ {\n+ formated += fptr(str.substr(old_pos, pos-old_pos)) + \"\\n\";\n+\n+ old_pos = pos+1;\n+ }\n+\n+ if (pos == str.npos && old_pos == 0)\n+ formated = fptr(str);\n+\n+ return formated;\n+}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/bash_tools.h",
"new_path": "src/Tools/Display/bash_tools.h",
"diff": "@@ -95,6 +95,8 @@ std::string format_info (std::string str);\nstd::string format_critical_info (std::string str);\nstd::string format_positive_info (std::string str);\n+using format_function = std::add_pointer<std::string(std::string)>::type;\n+std::string apply_on_each_line(const std::string& str, format_function fptr);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "@@ -171,7 +171,7 @@ void read_arguments(const int argc, const char** argv, std::string &code_type, s\nstd::string error;\nif (!ar.check_arguments(error))\n{\n- std::cerr << format_error(error) << std::endl;\n+ std::cerr << apply_on_each_line(error, format_error) << std::endl;\nstd::exit(EXIT_FAILURE);\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Create function to add the (EE) symbol on each line of the error message returned by the argument reader.
|
8,483 |
19.06.2017 17:38:22
| -7,200 |
342982ea2c963b92766692a3e131b88dfa0a3b4e
|
Change usage printing colors
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "@@ -273,10 +273,10 @@ void Arguments_reader\n{\nFormat arg_format = 0;\n- if (required)\n- arg_format |= FG::Color::RED;\n- else\n- arg_format |= FG::Color::BLUE;\n+// if (required)\n+// arg_format |= FG::Color::GREEN;\n+ //else\n+ //arg_format |= FG::Color::DEFAULT;\nif (values.size() >= 2 && !values[1].empty())\n{\n@@ -286,11 +286,11 @@ void Arguments_reader\nstd::cout << tab;\nfor (auto i = 0; i < (int)tags.size() -1; i++)\n{\n- std::cout << format(print_tag(tags[i]) + delimiter, arg_format);\n+ std::cout << format(print_tag(tags[i]) + delimiter, arg_format | Style::BOLD);\ntotal_length += unsigned((tags[i].length() == 1 ? 1 : 2) + tags[i].length() + delimiter.length());\n}\nconst auto last = tags.size() -1;\n- std::cout << format(print_tag(tags[last]), arg_format);\n+ std::cout << format(print_tag(tags[last]), arg_format | Style::BOLD);\ntotal_length += unsigned((tags[last].length() == 1 ? 1 : 2) + tags[last].length());\nfor (unsigned i = 0; i < this->max_n_char_arg - total_length; i++) std::cout << format(\" \", arg_format);\n@@ -310,7 +310,7 @@ void Arguments_reader\nstd::cout << format(\" <\" + values[0] + \"=\" + set + \">\", arg_format);\n}\nif (required)\n- std::cout << format(\" {REQUIRED}\", arg_format);\n+ std::cout << format(\" {REQUIRED}\", arg_format | Style::BOLD | FG::Color::ORANGE);\nstd::cout << std::endl;\nstd::cout << format(tab + values[1], arg_format) << std::endl;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change usage printing colors
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.