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,483
15.09.2017 12:34:24
-7,200
35883e65e2eaed77bfdc99c6fb5a5e3b25348df9
Change access right to attributes from private to protected
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/OOK/Modem_OOK.hpp", "new_path": "src/Module/Modem/OOK/Modem_OOK.hpp", "diff": "@@ -10,7 +10,7 @@ namespace module\ntemplate <typename B = int, typename R = float, typename Q = R>\nclass Modem_OOK : public Modem<B,R,Q>\n{\n-private:\n+protected:\nconst bool disable_sig2;\nR sigma_factor;\n" } ]
C++
MIT License
aff3ct/aff3ct
Change access right to attributes from private to protected
8,483
15.09.2017 15:22:04
-7,200
f7e54a61accad9ee0489819ef5f58afd74a3fb91
Set gallois function private
[ { "change_type": "MODIFY", "old_path": "src/Tools/Math/Galois.hpp", "new_path": "src/Tools/Math/Galois.hpp", "diff": "@@ -25,10 +25,6 @@ public:\nGalois(const int& K, const int& N, const int& t);\nvirtual ~Galois();\n- void Select_Polynomial(); // move this private section\n- void Generate_GF();\n- void Compute_BCH_Generator_Polynomial();\n-\nint get_K() const;\nint get_N() const;\nint get_m() const;\n@@ -39,6 +35,11 @@ public:\nconst std::vector<int>& get_index_of() const;\nconst std::vector<int>& get_p () const;\nconst std::vector<int>& get_g () const;\n+\n+private:\n+ void Select_Polynomial();\n+ void Generate_GF();\n+ void Compute_BCH_Generator_Polynomial();\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Set gallois function private
8,483
18.09.2017 10:46:58
-7,200
6e8729a846e9ff265381fb054caf28c3922d4b48
Change Channel RAYLEIGH USER to inherit directly from Channel. Add gain directly from file; Correct channel factory
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Channel.cpp", "new_path": "src/Factory/Module/Channel.cpp", "diff": "@@ -112,7 +112,7 @@ void Channel\nif(exist(vals, {p+\"-seed\", \"S\"})) params.seed = std::stoi(vals.at({p+\"-seed\", \"S\"}));\nif(exist(vals, {p+\"-add-users\" })) params.add_users = true;\nif(exist(vals, {p+\"-complex\" })) params.complex = true;\n- if(exist(vals, {p+\"-gain-occur\" })) params.gain_occur = true;\n+ if(exist(vals, {p+\"-gain-occur\" })) params.gain_occur = std::stoi(vals.at({p+\"-gain-occur\" }));\n}\nvoid Channel\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.cpp", "new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.cpp", "diff": "@@ -13,11 +13,21 @@ Channel_Rayleigh_LLR_user<R>\n::Channel_Rayleigh_LLR_user(const int N, const bool complex, const std::string& gains_filename,\nconst int gain_occurrences, tools::Noise<R> *noise_generator, const bool add_users,\nconst R sigma, const int n_frames, const std::string name)\n-: Channel_Rayleigh_LLR<R>(N, complex, noise_generator, add_users, sigma, n_frames, name),\n+: Channel<R>(N, sigma, n_frames, name),\n+ complex(complex),\n+ add_users(add_users),\n+ gains(N * n_frames),\n+ noise_generator(noise_generator),\ngain_occur(gain_occurrences),\ncurrent_gain_occur(0),\ngain_index(0)\n{\n+ if (complex || add_users)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Arguments 'complex' and 'add_users' are not supported yet.\");\n+\n+ if (noise_generator == nullptr)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"'noise_generator' can't be NULL.\");\n+\nif (gain_occurrences <= 0)\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"Argument 'gain_occurrences' must be strictly positive.\");\n@@ -29,11 +39,21 @@ Channel_Rayleigh_LLR_user<R>\n::Channel_Rayleigh_LLR_user(const int N, const bool complex, const int seed, const std::string& gains_filename,\nconst int gain_occurrences, const bool add_users, const R sigma,\nconst int n_frames, const std::string name)\n-: Channel_Rayleigh_LLR<R>(N, complex, seed, add_users, sigma, n_frames, name),\n+: Channel<R>(N, sigma, n_frames, name),\n+ complex(complex),\n+ add_users(add_users),\n+ gains(N * n_frames),\n+ noise_generator(new tools::Noise_std<R>(seed)),\ngain_occur(gain_occurrences),\ncurrent_gain_occur(0),\ngain_index(0)\n{\n+ if (complex || add_users)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Arguments 'complex' and 'add_users' are not supported yet.\");\n+\n+ if (gain_occurrences <= 0)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Argument 'gain_occurrences' must be strictly positive.\");\n+\nread_gains(gains_filename);\n}\n@@ -41,6 +61,7 @@ template <typename R>\nChannel_Rayleigh_LLR_user<R>\n::~Channel_Rayleigh_LLR_user()\n{\n+ delete noise_generator;\n}\ntemplate <typename R>\n@@ -92,6 +113,20 @@ void Channel_Rayleigh_LLR_user<R>\n}\n}\n+template <typename R>\n+void Channel_Rayleigh_LLR_user<R>\n+::add_noise(const R *X_N, R *Y_N, R *H_N)\n+{\n+ this->get_gains(gains, (R)1 / (R)std::sqrt((R)2));\n+ noise_generator->generate(this->noise, this->sigma);\n+\n+ for (auto i = 0; i < this->N * this->n_frames; i++)\n+ {\n+ H_N[i] = this->gains[i];\n+\n+ Y_N[i] = X_N[i] * H_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/Rayleigh/Channel_Rayleigh_LLR_user.hpp", "new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.hpp", "diff": "#ifndef CHANNEL_RAYLEIGH_LLR_USER_HPP_\n#define CHANNEL_RAYLEIGH_LLR_USER_HPP_\n-#include \"Channel_Rayleigh_LLR.hpp\"\n+#include <vector>\n+#include <string>\n+\n+#include \"Tools/Algo/Noise/Noise.hpp\"\n+#include \"Tools/Algo/Noise/Standard/Noise_std.hpp\"\n+\n+#include \"../Channel.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename R = float>\n-class Channel_Rayleigh_LLR_user : public Channel_Rayleigh_LLR<R>\n+class Channel_Rayleigh_LLR_user : public Channel<R>\n{\nprotected:\n+ const bool complex;\n+ const bool add_users;\n+ std::vector<R> gains;\n+ tools::Noise<R> *noise_generator;\n+\nstd::vector<R> gains_stock;\nconst unsigned gain_occur;\nunsigned current_gain_occur;\n@@ -27,10 +38,10 @@ public:\nconst int n_frames = 1, const std::string name = \"Channel_Rayleigh_LLR_user\");\nvirtual ~Channel_Rayleigh_LLR_user();\n- using Channel_Rayleigh_LLR<R>::add_noise;\n-\nvirtual void get_gains(std::vector<R>& gains, const R sigma);\n+ virtual void add_noise(const R *X_N, R *Y_N, R *H_N); using Channel<R>::add_noise;\n+\nprotected:\nvoid read_gains(const std::string& gains_filename);\n};\n" } ]
C++
MIT License
aff3ct/aff3ct
Change Channel RAYLEIGH USER to inherit directly from Channel. Add gain directly from file; Correct channel factory
8,483
18.09.2017 10:54:50
-7,200
e2f78f757e848489540d3f1de4b97f8ccfb0d4be
Change Noise generator to include a noise mean parameter
[ { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp", "new_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp", "diff": "@@ -77,7 +77,7 @@ float Noise_fast<float>\ntemplate <typename R>\nvoid Noise_fast<R>\n-::generate(R *noise, const unsigned length, const R sigma)\n+::generate(R *noise, const unsigned length, const R sigma, const R mu) //TODO: integrate mu in the computation\n{\nif (!mipp::isAligned(noise))\nthrow runtime_error(__FILE__, __LINE__, __func__, \"'noise' is misaligned memory.\");\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": "@@ -24,7 +24,7 @@ public:\nvirtual ~Noise_fast();\nvirtual void set_seed(const int seed);\n- virtual void generate(R *noise, const unsigned length, const R sigma);\n+ virtual void generate(R *noise, const unsigned length, const R sigma, const R mu = 0.0);\nprivate:\ninline mipp::Reg<R> get_random_simd();\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": "@@ -34,7 +34,7 @@ Noise_GSL<R>\ntemplate <typename R>\nvoid Noise_GSL<R>\n-::generate(R *noise, const unsigned length, const R sigma)\n+::generate(R *noise, const unsigned length, const R sigma, const R mu)\n{\nfor (unsigned i = 0; i < length; i++)\nnoise[i] = (R)gsl_ran_gaussian(rng, sigma);\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": "@@ -23,7 +23,7 @@ public:\nvirtual ~Noise_GSL();\nvirtual void set_seed(const int seed);\n- virtual void generate(R *noise, const unsigned length, const R sigma);\n+ virtual void generate(R *noise, const unsigned length, const R sigma, const R mu = 0.0);\n};\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": "@@ -36,7 +36,7 @@ void Noise_MKL<R>\ntemplate <typename R>\nvoid Noise_MKL<R>\n-::generate(R *noise, const unsigned length, const R sigma)\n+::generate(R *noise, const unsigned length, const R sigma, const R mu)\n{\nthrow runtime_error(__FILE__, __LINE__, __func__, \"Adding white Gaussian noise is impossible on this data type.\");\n}\n@@ -47,20 +47,20 @@ namespace tools\n{\ntemplate <>\nvoid Noise_MKL<float>\n-::generate(float *noise, const unsigned length, const float sigma)\n+::generate(float *noise, const unsigned length, const float sigma, const R mu)\n{\nvsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\nstream_state,\nlength,\nnoise,\n- 0.0,\n+ mu,\nsigma);\n/*\nvsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF,\nstream_state,\nlength,\nnoise,\n- 0.0,\n+ mu,\nsigma);\n*/\n}\n@@ -73,20 +73,20 @@ namespace tools\n{\ntemplate <>\nvoid Noise_MKL<double>\n-::generate(double *noise, const unsigned length, const double sigma)\n+::generate(double *noise, const unsigned length, const double sigma, const R mu)\n{\nvdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\nstream_state,\nlength,\nnoise,\n- 0.0,\n+ mu,\nsigma);\n/*\nvdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF,\nstream_state,\nlength,\nnoise,\n- 0.0,\n+ mu,\nsigma);\n*/\n}\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": "@@ -23,7 +23,7 @@ public:\nvirtual ~Noise_MKL();\nvirtual void set_seed(const int seed);\n- virtual void generate(R *noise, const unsigned length, const R sigma);\n+ virtual void generate(R *noise, const unsigned length, const R sigma, const R mu = 0.0);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Noise/Noise.hpp", "new_path": "src/Tools/Algo/Noise/Noise.hpp", "diff": "@@ -26,7 +26,7 @@ public:\n}\nvirtual void set_seed(const int seed) = 0;\n- virtual void generate(R *noise, const unsigned length, const R sigma) = 0;\n+ virtual void generate(R *noise, const unsigned length, const R sigma, const R mu = 0.0) = 0;\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": "@@ -28,9 +28,9 @@ void Noise_std<R>\ntemplate <typename R>\nvoid Noise_std<R>\n-::generate(R *noise, const unsigned length, const R sigma)\n+::generate(R *noise, const unsigned length, const R sigma, const R mu)\n{\n- normal_dist = std::normal_distribution<R>((R)0, sigma);\n+ normal_dist = std::normal_distribution<R>(mu, sigma);\nfor (unsigned i = 0; i < length; i++)\nnoise[i] = this->normal_dist(this->rd_engine);\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": "@@ -22,7 +22,7 @@ public:\nvirtual ~Noise_std();\nvirtual void set_seed(const int seed);\n- virtual void generate(R *noise, const unsigned length, const R sigma);\n+ virtual void generate(R *noise, const unsigned length, const R sigma, const R mu = 0.0);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Change Noise generator to include a noise mean parameter
8,490
19.09.2017 13:24:13
-7,200
40b674d306cb0fa58bf9661046303ee1750bd2bc
Fix bad simu name.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/BFER_ite.cpp", "new_path": "src/Launcher/Simulation/BFER_ite.cpp", "diff": "@@ -167,7 +167,7 @@ void BFER_ite<B,R,Q>\n{\nLauncher::group_args();\n- this->arg_group.push_back({params. get_prefix(), params. get_short_name() + \" parameter(s)\"});\n+ this->arg_group.push_back({params. get_prefix(), \"Simulation parameter(s)\"});\nthis->arg_group.push_back({params.src->get_prefix(), params.src->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params.crc->get_prefix(), params.crc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params.itl->get_prefix(), params.itl->get_short_name() + \" parameter(s)\"});\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/BFER_std.cpp", "new_path": "src/Launcher/Simulation/BFER_std.cpp", "diff": "@@ -155,7 +155,7 @@ void BFER_std<B,R,Q>\n{\nLauncher::group_args();\n- this->arg_group.push_back({params. get_prefix(), params. get_short_name() + \" parameter(s)\"});\n+ this->arg_group.push_back({params. get_prefix(), \"Simulation parameter(s)\"});\nthis->arg_group.push_back({params.src->get_prefix(), params.src->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params.crc->get_prefix(), params.crc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params.mdm->get_prefix(), params.mdm->get_short_name() + \" parameter(s)\"});\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/EXIT.cpp", "new_path": "src/Launcher/Simulation/EXIT.cpp", "diff": "@@ -128,7 +128,7 @@ void EXIT<B,R>\n{\nLauncher::group_args();\n- this->arg_group.push_back({params. get_prefix(), params. get_short_name() + \" parameter(s)\"});\n+ this->arg_group.push_back({params. get_prefix(), \"Simulation parameter(s)\"});\nthis->arg_group.push_back({params.src->get_prefix(), params.src->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params.mdm->get_prefix(), params.mdm->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params.chn->get_prefix(), params.chn->get_short_name() + \" parameter(s)\"});\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bad simu name.
8,490
19.09.2017 13:24:47
-7,200
20bee9c7953681e1606ba07860cae403ed8d6926
Fix argument reader bad arguments detection.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -48,7 +48,7 @@ bool Arguments_reader\nbool Arguments_reader\n::parse_arguments(const arg_map &required_args, const arg_map &optional_args, std::vector<std::string> &warnings)\n{\n- unsigned n_req_arg = 0;\n+ unsigned n_req_arg = 0, n_opt_arg = 0;\nthis->clear_arguments();\n@@ -60,13 +60,10 @@ bool Arguments_reader\n{\n// try to find word m_argv[i] inside the arguments list\nbool valid_arg = false;\n- if (auto n_found = this->sub_parse_arguments(this->m_required_args, i))\n- {\n- n_req_arg += n_found;\n+ if (this->sub_parse_arguments(this->m_required_args, i, n_req_arg))\nvalid_arg = true;\n- }\nelse\n- valid_arg = this->sub_parse_arguments(this->m_optional_args, i);\n+ valid_arg = this->sub_parse_arguments(this->m_optional_args, i, n_opt_arg);\n// do not display warning when negative value\ntry\n@@ -84,8 +81,8 @@ bool Arguments_reader\nreturn n_req_arg >= required_args.size();\n}\n-unsigned Arguments_reader\n-::sub_parse_arguments(arg_map &args, unsigned short pos_arg)\n+bool Arguments_reader\n+::sub_parse_arguments(arg_map &args, unsigned short pos_arg, unsigned &args_count)\n{\nif (pos_arg >= this->m_argv.size())\n{\n@@ -95,7 +92,7 @@ unsigned Arguments_reader\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- auto n_found = 0;\n+ bool found = false;\nfor (auto it = args.begin(); it != args.end(); ++it)\n{\nif (it->first.size() <= 0)\n@@ -135,13 +132,31 @@ unsigned Arguments_reader\nif(pos_arg != (this->m_argv.size() -1))\n{\nthis->m_args[it->first] = this->m_argv[pos_arg +1];\n- n_found++;\n+\n+ found = true;\n+\n+ if(this->m_occ.find(it->first) != this->m_occ.end())\n+ this->m_occ[it->first]++;\n+ else\n+ {\n+ this->m_occ[it->first] = 1;\n+ args_count++;\n+ }\n}\n}\nelse\n{\nthis->m_args[it->first] = \"\";\n- n_found++;\n+\n+ found = true;\n+\n+ if(this->m_occ.find(it->first) != this->m_occ.end())\n+ this->m_occ[it->first]++;\n+ else\n+ {\n+ this->m_occ[it->first] = 1;\n+ args_count++;\n+ }\n}\n}\n@@ -150,7 +165,7 @@ unsigned Arguments_reader\nwhile(i < (int)it->first.size());\n}\n- return n_found;\n+ return found;\n}\nbool Arguments_reader\n@@ -494,4 +509,5 @@ void Arguments_reader\nthis->m_required_args.clear();\nthis->m_optional_args.clear();\nthis->m_args.clear();\n+ this->m_occ.clear();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.hpp", "new_path": "src/Tools/Arguments_reader.hpp", "diff": "@@ -39,6 +39,8 @@ private:\nstd::string m_program_name; /*!< Program binary name. */\nunsigned int max_n_char_arg; /*!< The number of characters of the largest argument name. */\n+ std::map<std::vector<std::string>, unsigned> m_occ;\n+\npublic:\n/*!\n* \\brief Constructor.\n@@ -179,7 +181,7 @@ private:\n*\n* \\return true if the argument \"m_argv[pos_arg]\" is in args.\n*/\n- unsigned sub_parse_arguments(arg_map &args, unsigned short pos_arg);\n+ bool sub_parse_arguments(arg_map &args, unsigned short pos_arg, unsigned &args_count);\n/*!\n* \\brief Checks if the values from the command line respect the criteria given by required_args and optional_args\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix argument reader bad arguments detection.
8,490
19.09.2017 14:08:16
-7,200
643cccdce15383cccc46f343964f257f1b058ad7
Fix turbo DB itl param.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "diff": "@@ -55,7 +55,7 @@ void Decoder_turbo_DB::parameters\nitl->get_description(req_args, opt_args);\n- auto pi = this->get_prefix();\n+ auto pi = this->itl->get_prefix();\nreq_args.erase({pi+\"-size\" });\nopt_args.erase({pi+\"-fra\", \"F\"});\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix turbo DB itl param.
8,490
19.09.2017 14:20:26
-7,200
0b22f8e5f218c607d3f3f78385b37a3897956c51
Fix rep buffered param.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Repetition/Codec_repetition.cpp", "new_path": "src/Factory/Module/Codec/Repetition/Codec_repetition.cpp", "diff": "@@ -53,6 +53,7 @@ void Codec_repetition::parameters\nreq_args.erase({pdec+\"-cw-size\", \"N\"});\nreq_args.erase({pdec+\"-info-bits\", \"K\"});\n+ opt_args.erase({pdec+\"-no-buff\" });\nopt_args.erase({pdec+\"-fra\", \"F\"});\n}\n@@ -65,6 +66,7 @@ void Codec_repetition::parameters\nthis->dec->K = this->enc->K;\nthis->dec->N_cw = this->enc->N_cw;\n+ this->dec->buffered = this->enc->buffered;\nthis->dec->n_frames = this->enc->n_frames;\ndec->store(vals);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix rep buffered param.
8,490
19.09.2017 14:33:06
-7,200
6d09dacfa14e31e3bd3a7fb65823139ae6806c6c
Display the codec info in the header.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/BFER_ite.cpp", "new_path": "src/Launcher/Simulation/BFER_ite.cpp", "diff": "@@ -182,16 +182,29 @@ template <typename B, typename R, typename Q>\nvoid BFER_ite<B,R,Q>\n::print_header()\n{\n+ auto cpy_titles = this->titles;\n+ this->titles.clear();\n+\nauto pcde = \"cde\";\nthis->titles.push_back(std::make_pair(params. get_prefix(), \"Simulation\" ));\nthis->titles.push_back(std::make_pair(pcde, \"Code\" ));\nthis->titles.push_back(std::make_pair(params.src->get_prefix(), params.src->get_short_name()));\nthis->titles.push_back(std::make_pair(params.crc->get_prefix(), params.crc->get_short_name()));\n+\n+ for (auto t : cpy_titles)\n+ if (t.first.find(\"enc\") == 0)\n+ this->titles.push_back(t);\n+\nthis->titles.push_back(std::make_pair(params.itl->get_prefix(), params.itl->get_short_name()));\nthis->titles.push_back(std::make_pair(params.mdm->get_prefix(), params.mdm->get_short_name()));\nthis->titles.push_back(std::make_pair(params.chn->get_prefix(), params.chn->get_short_name()));\nif (std::is_integral<Q>())\nthis->titles.push_back(std::make_pair(params.qnt->get_prefix(), params.qnt->get_short_name()));\n+\n+ for (auto t : cpy_titles)\n+ if (t.first.find(\"dec\") == 0)\n+ this->titles.push_back(t);\n+\nthis->titles.push_back(std::make_pair(params.mnt->get_prefix(), params.mnt->get_short_name()));\nthis->titles.push_back(std::make_pair(params.ter->get_prefix(), params.ter->get_short_name()));\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/EXIT.cpp", "new_path": "src/Launcher/Simulation/EXIT.cpp", "diff": "@@ -140,12 +140,25 @@ template <typename B, typename R>\nvoid EXIT<B,R>\n::print_header()\n{\n+ auto cpy_titles = this->titles;\n+ this->titles.clear();\n+\nauto pcde = \"cde\";\nthis->titles.push_back(std::make_pair(params. get_prefix(), \"Simulation\" ));\nthis->titles.push_back(std::make_pair(pcde, \"Code\" ));\nthis->titles.push_back(std::make_pair(params.src->get_prefix(), params.src->get_short_name()));\nthis->titles.push_back(std::make_pair(params.mdm->get_prefix(), params.mdm->get_short_name()));\n+\n+ for (auto t : cpy_titles)\n+ if (t.first.find(\"enc\") == 0)\n+ this->titles.push_back(t);\n+\nthis->titles.push_back(std::make_pair(params.chn->get_prefix(), params.chn->get_short_name()));\n+\n+ for (auto t : cpy_titles)\n+ if (t.first.find(\"dec\") == 0)\n+ this->titles.push_back(t);\n+\nthis->titles.push_back(std::make_pair(params.mnt->get_prefix(), params.mnt->get_short_name()));\nthis->titles.push_back(std::make_pair(params.ter->get_prefix(), params.ter->get_short_name()));\n" } ]
C++
MIT License
aff3ct/aff3ct
Display the codec info in the header.
8,490
19.09.2017 16:25:33
-7,200
70b6b5edb88cbb3795c9bc5ab5d4f859e7bf9856
Fix a div by 0 in the EXIT launcher.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/EXIT.cpp", "new_path": "src/Launcher/Simulation/EXIT.cpp", "diff": "@@ -46,14 +46,12 @@ void EXIT<B,R>\nauto psrc = params.src ->get_prefix();\nauto penc = params.cdc->enc->get_prefix();\n- auto ppct = std::string(\"pct\");\nauto pmdm = params.mdm ->get_prefix();\nauto pchn = params.chn ->get_prefix();\nauto pmnt = params.mnt ->get_prefix();\nauto pter = params.ter ->get_prefix();\n- if (this->req_args.find({penc+\"-info-bits\", \"K\"}) != this->req_args.end() ||\n- this->req_args.find({ppct+\"-info-bits\", \"K\"}) != this->req_args.end())\n+ if (this->req_args.find({penc+\"-info-bits\", \"K\"}) != this->req_args.end())\nthis->req_args.erase({psrc+\"-info-bits\", \"K\"});\nthis->opt_args.erase({psrc+\"-seed\", \"S\"});\nthis->req_args.erase({pmdm+\"-fra-size\", \"N\"});\n@@ -118,7 +116,7 @@ void EXIT<B,R>\nauto pmnt = params.mnt->get_prefix();\n- if (!this->ar.exist_arg({pmnt+\"-trials\", \"n\"}))\n+ if (!this->ar.exist_arg({pmnt+\"-trials\", \"n\"}) && params.cdc->K != 0)\nparams.mnt->n_trials = 200000 / params.cdc->K;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix a div by 0 in the EXIT launcher.
8,490
21.09.2017 10:15:41
-7,200
2f5ceaaa68676808ec8111144632ad28e4a48ddc
Fix display bug in turbo decoder headers.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "new_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "diff": "@@ -187,10 +187,10 @@ void Decoder_turbo::parameters<D1,D2>\nsf->get_headers(headers, full);\nfnc->get_headers(headers, full);\n- this->sub1->get_headers(headers);\n+ this->sub1->get_headers(headers, full);\nif (!std::is_same<D1,D2>())\n{\n- this->sub2->get_headers(headers);\n+ this->sub2->get_headers(headers, full);\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix display bug in turbo decoder headers.
8,490
21.09.2017 10:16:30
-7,200
e7034ccb67b44d933f32be5022a5e64f9449d8ce
Do not display max in the modem headers when not needed.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.cpp", "new_path": "src/Factory/Module/Modem/Modem.cpp", "diff": "@@ -226,6 +226,7 @@ void Modem::parameters\nif (this->sigma != -1.f && full)\nheaders[p].push_back(std::make_pair(\"Sigma value\", std::to_string(this->sigma)));\nheaders[p].push_back(std::make_pair(\"Sigma square\", demod_sig2));\n+ if (demod_max != \"unused\")\nheaders[p].push_back(std::make_pair(\"Max type\", demod_max));\nif (this->type == \"SCMA\")\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Do not display max in the modem headers when not needed.
8,490
21.09.2017 10:17:02
-7,200
a08203f482dc38e3012a8f2a78f95c2a9d4277f8
Improve the debug mode by displaying frame by frame.
[ { "change_type": "MODIFY", "old_path": "src/Module/Process.cpp", "new_path": "src/Module/Process.cpp", "diff": "@@ -72,11 +72,31 @@ bool Process::is_debug()\n}\ntemplate <typename T>\n-static inline void display_data(const T *data, const size_t n_elmts, const uint8_t p)\n+static inline void display_data(const T *data,\n+ const size_t fra_size, const size_t n_fra, const size_t limit,\n+ const uint8_t p, const uint8_t n_spaces)\n{\n- for (auto i = 0; i < (int)n_elmts; i++)\n+ if (n_fra == 1)\n+ {\n+ for (auto i = 0; i < (int)limit; i++)\nstd::cout << std::fixed << std::setprecision(p) << std::setw(p +3) << +data[i]\n- << (i < (int)n_elmts -1 ? \", \" : \"\");\n+ << (i < (int)fra_size -1 ? \", \" : \"\");\n+ std::cout << (limit < fra_size ? \", ...\" : \"\");\n+ }\n+ else\n+ {\n+ const auto sty_fra = tools::Style::BOLD | tools::FG::Color::GRAY;\n+ std::string spaces = \"#\"; for (auto s = 0; s < (int)n_spaces -1; s++) spaces += \" \";\n+ for (auto f = 0; f < (int)n_fra; f++)\n+ {\n+ std::string fra_id = tools::format(\"f\" + std::to_string(f+1) + \":\", sty_fra);\n+ std::cout << (f >= 1 ? spaces : \"\") << fra_id << \"(\";\n+ for (auto i = 0; i < (int)limit; i++)\n+ std::cout << std::fixed << std::setprecision(p) << std::setw(p +3) << +data[f * fra_size +i]\n+ << (i < (int)fra_size -1 ? \", \" : \"\");\n+ std::cout << (limit < fra_size ? \"...\" : \"\") << \")\" << (f < (int)n_fra -1 ? \", \\n\" : \"\");\n+ }\n+ }\n}\nint Process::exec()\n@@ -119,16 +139,18 @@ int Process::exec()\nstd::string spaces; for (size_t s = 0; s < max_n_chars - i.get_name().size(); s++) spaces += \" \";\nauto n_elmts = i.get_databytes() / (size_t)i.get_datatype_size();\n- auto limit = debug_limit != -1 ? std::min(n_elmts, (size_t)debug_limit) : n_elmts;\n+ auto n_fra = (size_t)this->module.get_n_frames();\n+ auto fra_size = n_elmts / n_fra;\n+ auto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nauto p = debug_precision;\nstd::cout << \"# {IN} \" << i.get_name() << spaces << \" = [\";\n- if (i.get_datatype() == typeid(int8_t )) display_data((int8_t *)i.get_dataptr(), limit, p);\n- else if (i.get_datatype() == typeid(int16_t)) display_data((int16_t*)i.get_dataptr(), limit, p);\n- else if (i.get_datatype() == typeid(int32_t)) display_data((int32_t*)i.get_dataptr(), limit, p);\n- else if (i.get_datatype() == typeid(int64_t)) display_data((int64_t*)i.get_dataptr(), limit, p);\n- else if (i.get_datatype() == typeid(float )) display_data((float *)i.get_dataptr(), limit, p);\n- else if (i.get_datatype() == typeid(double )) display_data((double *)i.get_dataptr(), limit, p);\n- std::cout << (limit < n_elmts ? \", ...\" : \"\") << \"]\" << std::endl;\n+ if (i.get_datatype() == typeid(int8_t )) display_data((int8_t *)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (i.get_datatype() == typeid(int16_t)) display_data((int16_t*)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (i.get_datatype() == typeid(int32_t)) display_data((int32_t*)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (i.get_datatype() == typeid(int64_t)) display_data((int64_t*)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (i.get_datatype() == typeid(float )) display_data((float *)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (i.get_datatype() == typeid(double )) display_data((double *)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ std::cout << \"]\" << std::endl;\n}\n}\n@@ -162,16 +184,18 @@ int Process::exec()\nstd::string spaces; for (size_t s = 0; s < max_n_chars - o.get_name().size(); s++) spaces += \" \";\nauto n_elmts = o.get_databytes() / (size_t)o.get_datatype_size();\n- auto limit = debug_limit != -1 ? std::min(n_elmts, (size_t)debug_limit) : n_elmts;\n+ auto n_fra = (size_t)this->module.get_n_frames();\n+ auto fra_size = n_elmts / n_fra;\n+ auto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nstd::cout << \"# {OUT} \" << o.get_name() << spaces << \" = [\";\nauto p = debug_precision;\n- if (o.get_datatype() == typeid(int8_t )) display_data((int8_t *)o.get_dataptr(), limit, p);\n- else if (o.get_datatype() == typeid(int16_t)) display_data((int16_t*)o.get_dataptr(), limit, p);\n- else if (o.get_datatype() == typeid(int32_t)) display_data((int32_t*)o.get_dataptr(), limit, p);\n- else if (o.get_datatype() == typeid(int64_t)) display_data((int64_t*)o.get_dataptr(), limit, p);\n- else if (o.get_datatype() == typeid(float )) display_data((float *)o.get_dataptr(), limit, p);\n- else if (o.get_datatype() == typeid(double )) display_data((double *)o.get_dataptr(), limit, p);\n- std::cout << (limit < n_elmts ? \", ...\" : \"\") << \"]\" << std::endl;\n+ if (o.get_datatype() == typeid(int8_t )) display_data((int8_t *)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (o.get_datatype() == typeid(int16_t)) display_data((int16_t*)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (o.get_datatype() == typeid(int32_t)) display_data((int32_t*)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (o.get_datatype() == typeid(int64_t)) display_data((int64_t*)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (o.get_datatype() == typeid(float )) display_data((float *)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (o.get_datatype() == typeid(double )) display_data((double *)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ std::cout << \"]\" << std::endl;\n}\nstd::cout << \"# Returned status: \" << exec_status << std::endl;\nstd::cout << \"#\" << std::endl;\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the debug mode by displaying frame by frame.
8,490
21.09.2017 10:17:56
-7,200
e7a856ffa7126bdc47e621cb2c4767cdf7c31697
Fix the n0 computation in the SCMA (when sigma changes).
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/SCMA/Modem_SCMA.hpp", "new_path": "src/Module/Modem/SCMA/Modem_SCMA.hpp", "diff": "@@ -20,8 +20,7 @@ private:\nconst int re_user[4][3] = {{1,2,4},{0,2,5},{1,3,5},{0,3,4}};\nQ arr_phi[4][4][4][4] = {}; // probability functions\nconst bool disable_sig2;\n- const R two_on_square_sigma;\n- const R n0; // 1 / n0 = 179.856115108\n+ R n0; // 1 / n0 = 179.856115108\nconst int n_ite;\npublic:\n@@ -29,6 +28,8 @@ public:\nconst int n_ite = 1, const int n_frames = 6, const std::string name = \"Modem_SCMA\");\nvirtual ~Modem_SCMA();\n+ virtual void set_sigma(const R sigma);\n+\nvirtual void modulate (const B* X_N1, R *X_N2); using Modem<B,R,Q>::modulate;\nvirtual void demodulate (const Q *Y_N1, Q *Y_N2); using Modem<B,R,Q>::demodulate;\nvirtual void demodulate_wg(const Q *Y_N1, const R *H_N, Q *Y_N2); using Modem<B,R,Q>::demodulate_wg;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/SCMA/Modem_SCMA.hxx", "new_path": "src/Module/Modem/SCMA/Modem_SCMA.hxx", "diff": "@@ -62,8 +62,7 @@ Modem_SCMA<B,R,Q,PSI>\nn_frames,\nname),\ndisable_sig2(disable_sig2 ),\n- two_on_square_sigma((R)2.0 / (sigma * sigma)),\n- n0 ((R)2.0 * sigma * sigma ),\n+ n0 (disable_sig2 ? (R)1.0 : (R)2.0 * sigma * sigma ),\nn_ite (n_ite )\n{\nif (n_frames != 6)\n@@ -94,6 +93,16 @@ Modem_SCMA<B,R,Q,PSI>\n{\n}\n+template <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\n+void Modem_SCMA<B,R,Q,PSI>\n+::set_sigma(const R sigma)\n+{\n+ Modem<B,R,Q>::set_sigma(sigma);\n+\n+ if (!disable_sig2)\n+ this->n0 = (R)2.0 * sigma * sigma;\n+}\n+\ntemplate <typename B, typename R, typename Q, tools::proto_psi<Q> PSI>\nvoid Modem_SCMA<B,R,Q,PSI>\n::modulate(const B* X_N1, R* X_N2)\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the n0 computation in the SCMA (when sigma changes).
8,490
21.09.2017 11:19:18
-7,200
4819555d82f16b9cd9c27afabef16598a15ebbe8
Fix RSC launcher and adapt quantif for RSC and RSC_DB simus.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Code/RSC/RSC.cpp", "new_path": "src/Launcher/Code/RSC/RSC.cpp", "diff": "#include <iostream>\n-#include <typeinfo>\n#include <mipp.h>\n#include \"Launcher/Simulation/BFER_std.hpp\"\n@@ -17,9 +16,6 @@ RSC<L,B,R,Q>\n: L(argc, argv, stream), params_cdc(new factory::Codec_RSC::parameters(\"cdc\"))\n{\nthis->params.set_cdc(params_cdc);\n-\n- if (typeid(L) == typeid(BFER_std<B,R,Q>))\n- params_cdc->enable_puncturer();\n}\ntemplate <class L, typename B, typename R, typename Q>\n@@ -53,7 +49,12 @@ void RSC<L,B,R,Q>\nif (params_cdc->dec->simd_strategy == \"INTRA\")\nthis->params.src->n_frames = (int)std::ceil(mipp::N<Q>() / 8.f);\n- if (std::is_same<Q,int8_t>() || std::is_same<Q,int16_t>())\n+ if (std::is_same<Q,int8_t>())\n+ {\n+ this->params.qnt->n_bits = 6;\n+ this->params.qnt->n_decimals = 1;\n+ }\n+ else if (std::is_same<Q,int16_t>())\n{\nthis->params.qnt->n_bits = 6;\nthis->params.qnt->n_decimals = 3;\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/RSC_DB/RSC_DB.cpp", "new_path": "src/Launcher/Code/RSC_DB/RSC_DB.cpp", "diff": "@@ -41,7 +41,12 @@ void RSC_DB<L,B,R,Q>\n{\nparams_cdc->store(this->ar.get_args());\n- if (std::is_same<Q,int8_t>() || std::is_same<Q,int16_t>())\n+ if (std::is_same<Q,int8_t>())\n+ {\n+ this->params.qnt->n_bits = 6;\n+ this->params.qnt->n_decimals = 1;\n+ }\n+ else if (std::is_same<Q,int16_t>())\n{\nthis->params.qnt->n_bits = 6;\nthis->params.qnt->n_decimals = 3;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix RSC launcher and adapt quantif for RSC and RSC_DB simus.
8,490
22.09.2017 21:22:23
-7,200
1cda29a5a91903cb89d4b63f90df44f653cc1841
Update EXIT simulation with the new Module/Process/Socket.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/Codec.hpp", "new_path": "src/Module/Codec/Codec.hpp", "diff": "@@ -118,6 +118,17 @@ public:\nreturn 0;\n});\n+\n+ auto &p4 = this->create_process(\"add_sys_ext\");\n+ this->template create_socket_in<Q>(p4, \"ext\", this->K * this->n_frames);\n+ this->template create_socket_in<Q>(p4, \"Y_N\", this->N_cw * this->n_frames);\n+ this->create_codelet(p4, [&]() -> int\n+ {\n+ this->add_sys_ext(static_cast<Q*>(p4[\"ext\"].get_dataptr()),\n+ static_cast<Q*>(p4[\"Y_N\"].get_dataptr()));\n+\n+ return 0;\n+ });\n}\nvirtual ~Codec()\n@@ -286,6 +297,36 @@ public:\nf);\n}\n+ template <class A = std::allocator<Q>>\n+ void add_sys_ext(const std::vector<Q,A> &ext, std::vector<Q,A> &Y_N)\n+ {\n+ if (this->K * this->n_frames != (int)ext.size())\n+ {\n+ std::stringstream message;\n+ message << \"'ext.size()' has to be equal to 'K' * 'n_frames' ('ext.size()' = \" << ext.size()\n+ << \", 'K' = \" << this->K << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (this->N_cw * this->n_frames != (int)Y_N.size())\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N.size()' has to be equal to 'N_cw' * 'n_frames' ('Y_N.size()' = \" << Y_N.size()\n+ << \", 'N_cw' = \" << this->N_cw << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->add_sys_ext(ext.data(), Y_N.data());\n+ }\n+\n+ virtual void add_sys_ext(const Q *ext, Q *Y_N)\n+ {\n+ for (auto f = 0; f < this->n_frames; f++)\n+ this->_add_sys_ext(ext + f * this->K,\n+ Y_N + f * this->N_cw,\n+ f);\n+ }\n+\nvirtual void reset() {}\nprotected:\n@@ -304,6 +345,11 @@ protected:\nthrow tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n+ virtual void _add_sys_ext(const Q *ext, Q *Y_N, const int frame_id)\n+ {\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ }\n+\nvirtual void set_interleaver(tools::Interleaver_core<>* itl)\n{\nthis->interleaver_core = itl;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Polar/Codec_polar.cpp", "new_path": "src/Module/Codec/Polar/Codec_polar.cpp", "diff": "@@ -184,6 +184,36 @@ void Codec_polar<B,Q>\n}\n}\n+template <typename B, typename Q>\n+void Codec_polar<B,Q>\n+::_extract_sys_llr(const Q* Y_N, Q* sys, const int frame_id)\n+{\n+ auto sys_idx = 0;\n+ auto N_cw = this->N_cw;\n+\n+ for (auto i = 0; i < N_cw; i++)\n+ {\n+ if (!frozen_bits[i])\n+ {\n+ sys[sys_idx] = Y_N[i];\n+ sys_idx++;\n+ }\n+ }\n+}\n+\n+template <typename B, typename Q>\n+void Codec_polar<B,Q>\n+::_add_sys_ext(const Q* ext, Q* Y_N, const int frame_id)\n+{\n+ auto sys_idx = 0;\n+ for (auto i = 0; i < this->N_cw; i++)\n+ if (!frozen_bits[i])\n+ {\n+ Y_N[i] += ext[sys_idx];\n+ sys_idx++;\n+ }\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Polar/Codec_polar.hpp", "new_path": "src/Module/Codec/Polar/Codec_polar.hpp", "diff": "@@ -40,6 +40,8 @@ public:\nprotected:\nvoid _extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id);\n+ void _extract_sys_llr(const Q *Y_N, Q *sys, const int frame_id);\n+ void _add_sys_ext (const Q *ext, Q *Y_N, const int frame_id);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "new_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "diff": "@@ -104,6 +104,29 @@ void Codec_RSC<B,Q>\n}\n}\n+template <typename B, typename Q>\n+void Codec_RSC<B,Q>\n+::_extract_sys_llr(const Q* Y_N, Q* sys, const int frame_id)\n+{\n+ if (buffered_encoding)\n+ std::copy(Y_N, Y_N + this->K, sys);\n+ else\n+ for (auto i = 0; i < this->K; i++)\n+ sys[i] = Y_N[i*2];\n+}\n+\n+template <typename B, typename Q>\n+void Codec_RSC<B,Q>\n+::_add_sys_ext(const Q* ext, Q* Y_N, const int frame_id)\n+{\n+ if (buffered_encoding)\n+ for (auto i = 0; i < this->K; i++)\n+ Y_N[i] += ext[i];\n+ else\n+ for (auto i = 0; i < this->K; i++)\n+ Y_N[i*2] += ext[i];\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC/Codec_RSC.hpp", "new_path": "src/Module/Codec/RSC/Codec_RSC.hpp", "diff": "@@ -25,6 +25,8 @@ public:\nprotected:\nvoid _extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id);\n+ void _extract_sys_llr(const Q *Y_N, Q *sys, const int frame_id);\n+ void _add_sys_ext (const Q *ext, Q *Y_N, const int frame_id);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/EXIT/Monitor_EXIT.hpp", "new_path": "src/Module/Monitor/EXIT/Monitor_EXIT.hpp", "diff": "@@ -68,7 +68,6 @@ public:\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n-\nreturn this->measure_mutual_info(bits.data(), llrs_a.data(), llrs_e.data());\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.cpp", "new_path": "src/Simulation/EXIT/EXIT.cpp", "diff": "@@ -17,22 +17,6 @@ EXIT<B,R>\n: Simulation(),\nparams(params),\n- H_N ( params.cdc->N_cw),\n- B_K ( params.cdc->K ),\n- B_N ( params.cdc->N_cw),\n- X_N1 ( params.cdc->N_cw),\n- X_K ( params.cdc->K ),\n- X_N2 ( params.cdc->N_cw),\n- Y_N ( params.cdc->N_cw),\n- Y_K ( params.cdc->K ),\n- La_K1 ( params.cdc->K ),\n- Lch_N1( params.cdc->N_cw),\n- La_K2 ( params.cdc->K ),\n- Lch_N2( params.cdc->N_cw),\n- Le_K ( params.cdc->K ),\n- sys ( params.cdc->K + params.cdc->tail_length / 2),\n- par ((params.cdc->N_cw - params.cdc->K) - (params.cdc->tail_length / 2)),\n-\nsig_a(0.f),\nsigma(0.f),\nebn0 (0.f),\n@@ -86,14 +70,10 @@ void EXIT<B,R>\nchannel_a = build_channel_a(K_mod);\nterminal = build_terminal ( );\n+ this->monitor->add_handler_measure(std::bind(&module::Codec_SISO<B,R>::reset, codec));\n+\nif (codec->get_decoder_siso()->get_n_frames() > 1)\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"The inter frame is not supported.\");\n-\n- if (X_K .size() != (unsigned)K_mod) X_K .resize(K_mod);\n- if (X_N2 .size() != (unsigned)N_mod) X_N2 .resize(N_mod);\n- if (La_K1 .size() != (unsigned)K_mod) La_K1 .resize(K_mod);\n- if (Lch_N1.size() != (unsigned)N_mod) Lch_N1.resize(N_mod);\n- if (H_N .size() != (unsigned)N_mod) H_N .resize(N_mod);\n}\ntemplate <typename B, typename R>\n@@ -129,7 +109,21 @@ void EXIT<B,R>\nmodem_a ->set_sigma(2.f / sig_a);\nif (sig_a == 0.f) // if sig_a = 0, La_K2 = 0\n- std::fill(La_K2.begin(), La_K2.end(), (R)0);\n+ {\n+ auto &mdm = *this->modem_a;\n+ if (params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n+ {\n+ auto mdm_data = (uint8_t*)(mdm[\"demodulate_wg\"][\"Y_N2\"].get_dataptr ());\n+ auto mdm_bytes = mdm[\"demodulate_wg\"][\"Y_N2\"].get_databytes();\n+ std::fill(mdm_data, mdm_data + mdm_bytes, 0);\n+ }\n+ else\n+ {\n+ auto mdm_data = (uint8_t*)(mdm[\"demodulate\"][\"Y_N2\"].get_dataptr ());\n+ auto mdm_bytes = mdm[\"demodulate\"][\"Y_N2\"].get_databytes();\n+ std::fill(mdm_data, mdm_data + mdm_bytes, 0);\n+ }\n+ }\nthis->simulation_loop();\n@@ -154,20 +148,23 @@ void EXIT<B,R>\nusing namespace std::chrono;\nauto t_simu = steady_clock::now();\n- auto *encoder = codec->get_encoder();\n- auto *decoder_siso = codec->get_decoder_siso();\n-\n- while (!monitor->n_trials_achieved())\n+ auto &source = *this->source;\n+ auto &codec = *this->codec;\n+ auto &encoder = *this->codec->get_encoder();\n+ auto &decoder = *this->codec->get_decoder_siso();\n+ auto &modem = *this->modem;\n+ auto &modem_a = *this->modem_a;\n+ auto &channel = *this->channel;\n+ auto &channel_a = *this->channel_a;\n+ auto &monitor = *this->monitor;\n+\n+ while (!monitor.n_trials_achieved())\n{\n- // generate a random binary value\n- source->generate(B_K);\n-\n- // encode\n- encoder->encode(B_K, X_N1);\n-\n- // modulate\n- modem_a->modulate(B_K, X_K );\n- modem ->modulate(X_N1, X_N2);\n+ source [\"generate\"].exec();\n+ source [\"generate\"][\"U_K\" ].bind(monitor[\"measure_mutual_info\"][\"bits\"]);\n+ source [\"generate\"][\"U_K\" ].bind(modem_a[\"modulate\" ][\"X_N1\"]);\n+ source [\"generate\"][\"U_K\" ].bind(encoder[\"encode\" ][\"U_K\" ]);\n+ encoder[\"encode\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N1\"]);\n//if sig_a = 0, La_K = 0, no noise to add\nif (sig_a != 0)\n@@ -175,41 +172,42 @@ void EXIT<B,R>\n// Rayleigh channel\nif (params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- channel_a->add_noise_wg (X_K, La_K1, H_N );\n- modem_a ->demodulate_wg( La_K1, H_N, La_K2);\n+ modem_a [\"modulate\" ][\"X_N2\"].bind(channel_a[\"add_noise_wg\" ][\"X_N\" ]);\n+ channel_a[\"add_noise_wg\"][\"Y_N\" ].bind(modem_a [\"demodulate_wg\"][\"Y_N1\"]);\n+ channel_a[\"add_noise_wg\"][\"H_N\" ].bind(modem_a [\"demodulate_wg\"][\"H_N \"]);\n}\nelse // additive channel (AWGN, USER, NO)\n{\n- channel_a->add_noise (X_K, La_K1 );\n- modem_a ->demodulate( La_K1, La_K2);\n+ modem_a [\"modulate\" ][\"X_N2\"].bind(channel_a[\"add_noise\" ][\"X_N\" ]);\n+ channel_a[\"add_noise\"][\"Y_N\" ].bind(modem_a [\"demodulate\"][\"Y_N1\"]);\n}\n}\n// Rayleigh channel\nif (params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- channel->add_noise_wg (X_N2, Lch_N1, H_N );\n- modem ->demodulate_wg( Lch_N1, H_N, Lch_N2);\n+ modem_a[\"demodulate_wg\"][\"Y_N2\"].bind(monitor[\"measure_mutual_info\"][\"llrs_a\"]);\n+ modem [\"modulate\" ][\"X_N2\"].bind(channel[\"add_noise_wg\" ][\"X_N\" ]);\n+ channel[\"add_noise_wg\" ][\"Y_N\" ].bind(modem [\"demodulate_wg\" ][\"Y_N1\" ]);\n+ channel[\"add_noise_wg\" ][\"H_N\" ].bind(modem [\"demodulate_wg\" ][\"H_N \" ]);\n+ modem [\"demodulate_wg\"][\"Y_N2\"].bind(codec [\"extract_sys_par\" ][\"Y_N\" ]);\n+ modem_a[\"demodulate_wg\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"ext\" ]);\n+ modem [\"demodulate_wg\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"Y_N\" ]);\n+ modem [\"demodulate_wg\"][\"Y_N2\"].bind(decoder[\"decode_siso\" ][\"Y_N1\" ]);\n}\nelse // additive channel (AWGN, USER, NO)\n{\n- channel->add_noise (X_N2, Lch_N1 );\n- modem ->demodulate( Lch_N1, Lch_N2);\n+ modem_a[\"demodulate\"][\"Y_N2\"].bind(monitor[\"measure_mutual_info\"][\"llrs_a\"]);\n+ modem [\"modulate\" ][\"X_N2\"].bind(channel[\"add_noise\" ][\"X_N\" ]);\n+ channel[\"add_noise\" ][\"Y_N\" ].bind(modem [\"demodulate\" ][\"Y_N1\" ]);\n+ modem [\"demodulate\"][\"Y_N2\"].bind(codec [\"extract_sys_par\" ][\"Y_N\" ]);\n+ modem_a[\"demodulate\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"ext\" ]);\n+ modem [\"demodulate\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"Y_N\" ]);\n+ modem [\"demodulate\"][\"Y_N2\"].bind(decoder[\"decode_siso\" ][\"Y_N1\" ]);\n}\n- // extract systematic and parity information\n- codec->extract_sys_par(Lch_N2, sys, par);\n-\n- // add other siso's extrinsic\n- for (auto k = 0; k < params.cdc->K; k++)\n- sys[k] += La_K2[k];\n-\n- // decode\n- decoder_siso->decode_siso(sys, par, Le_K);\n- decoder_siso->reset();\n-\n- // compute the mutual info\n- monitor->measure_mutual_info(B_K, La_K2, Le_K);\n+ decoder[\"decode_siso\" ][\"Y_N2\"].bind(codec [\"extract_sys_llr\" ][\"Y_N\" ]);\n+ codec [\"extract_sys_llr\"][\"Y_K\" ].bind(monitor[\"measure_mutual_info\"][\"llrs_e\"]);\n// display statistics in terminal\nif (!params.ter->disabled && (steady_clock::now() - t_simu) >= params.ter->frequency)\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.hpp", "new_path": "src/Simulation/EXIT/EXIT.hpp", "diff": "@@ -27,20 +27,6 @@ class EXIT : public Simulation\nprotected:\nconst factory::EXIT::parameters &params; // simulation parameters\n- // channel gains\n- mipp::vector<R> H_N;\n-\n- // data vectors\n- mipp::vector<B> B_K, B_N, X_N1;\n- mipp::vector<R> X_K, X_N2;\n- mipp::vector<R> Y_N, Y_K;\n- mipp::vector<R> La_K1;\n- mipp::vector<R> Lch_N1;\n- mipp::vector<R> La_K2;\n- mipp::vector<R> Lch_N2;\n- mipp::vector<R> Le_K;\n- mipp::vector<R> sys, par;\n-\n// code specifications\nfloat sig_a;\nfloat sigma;\n" } ]
C++
MIT License
aff3ct/aff3ct
Update EXIT simulation with the new Module/Process/Socket.
8,490
26.09.2017 12:45:07
-7,200
a854afc1d6046c7cfb0ea016c0a9c1829e832aa7
Add a sub encoding function more generic in the RSC encoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.cpp", "new_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.cpp", "diff": "@@ -51,20 +51,31 @@ void Encoder_RSC_sys<B>\n::_encode(const B *U_K, B *X_N, const int frame_id)\n{\nif (buffered_encoding)\n- {\n- std::copy(U_K, U_K + this->K, X_N); // sys\n- __encode(U_K, X_N + this->K, 1, true); // par + tail bits\n- }\n+ __encode(U_K,\n+ X_N, // sys\n+ X_N + 2 * this->K + this->n_ff, // tail sys\n+ X_N + 1 * this->K, // par\n+ X_N + 2 * this->K ); // tail par\nelse\n- __encode(U_K, X_N);\n+ __encode(U_K,\n+ X_N, // sys\n+ X_N + 2 * this->K, // tail sys\n+ X_N + 1, // par\n+ X_N + 2 * this->K + 1, // tail par\n+ 2, // stride\n+ 2); // stride tail bits\n}\ntemplate <typename B>\nvoid Encoder_RSC_sys<B>\n::_encode_sys(const B *U_K, B *par, const int frame_id)\n{\n- // par bits: [par | tail bit sys | tail bits par]\n- __encode(U_K, par, 1, true);\n+ // par bits: [par | tail bit par | tail bits sys]\n+ __encode(U_K,\n+ nullptr, // sys\n+ par + this->K + this->n_ff, // tail sys\n+ par, // par\n+ par + this->K); // tail par\n}\ntemplate <typename B>\n@@ -109,36 +120,34 @@ std::vector<std::vector<int>> Encoder_RSC_sys<B>\ntemplate <typename B>\nvoid Encoder_RSC_sys<B>\n-::__encode(const B* U_K, B* X_N, const int stride, const bool only_parity)\n+::__encode(const B* U_K, B* sys, B* tail_sys, B* par, B* tail_par, const int stride, const int stride_tail)\n{\n- auto j = 0; // cur offset in X_N buffer\nauto state = 0; // initial (and final) state 0 0 0\n+ if (sys != nullptr)\n+ for (auto i = 0; i < this->K; i++)\n+ sys[i * stride] = U_K[i];\n+\n// standard frame encoding process\n+ if (par != nullptr)\nfor (auto i = 0; i < this->K; i++)\n- {\n- if (!only_parity)\n- {\n- X_N[j] = U_K[i];\n- j += stride; // systematic transmission of the bit\n- }\n- X_N[j] = inner_encode((int)U_K[i], state); j += stride; // encoding block\n- }\n+ par[i * stride] = inner_encode((int)U_K[i], state); // encoding block\n+ else\n+ for (auto i = 0; i < this->K; i++)\n+ inner_encode((int)U_K[i], state); // encoding block\n// tail bits for initialization conditions (state of data \"state\" have to be 0 0 0)\nfor (auto i = 0; i < this->n_ff; i++)\n{\nB bit_sys = tail_bit_sys(state);\n- if (!only_parity)\n- {\n- X_N[j] = bit_sys; // systematic transmission of the bit\n- j += stride;\n- }\n- else\n- X_N[j+this->n_ff] = bit_sys; // systematic transmission of the bit\n+ if (tail_sys != nullptr)\n+ tail_sys[i * stride_tail] = bit_sys; // systematic transmission of the bit\n+\n+ auto p = inner_encode((int)bit_sys, state); // encoding block\n- X_N[j] = inner_encode((int)bit_sys, state); j += stride; // encoding block\n+ if (tail_par != nullptr)\n+ tail_par[i * stride_tail] = p;\n}\nif (state != 0)\n@@ -147,28 +156,6 @@ void Encoder_RSC_sys<B>\nmessage << \"'state' should be equal to 0 ('state' = \" << state << \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n-\n- if (!only_parity)\n- {\n- if (j != this->N * stride)\n- {\n- std::stringstream message;\n- message << \"'j' should be equal to 'N' * 'stride' ('j' = \" << j << \", 'N' = \" << this->N\n- << \", 'stride' = \" << stride << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- }\n- else\n- {\n- j += this->n_ff * stride;\n- if (j != (this->K + 2*this->n_ff) * stride)\n- {\n- std::stringstream message;\n- message << \"'j' should be equal to ('K' + 2 * 'n_ff') * 'stride' ('j' = \" << j << \", 'K' = \" << this->K\n- << \", 'n_ff' = \" << this->n_ff << \", 'stride' = \" << stride << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- }\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.hpp", "new_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.hpp", "diff": "@@ -30,7 +30,7 @@ protected:\nvoid _encode (const B *U_K, B *X_N, const int frame_id);\nvoid _encode_sys(const B *U_K, B *par, const int frame_id);\n- void __encode(const B* U_K, B* X_N, const int stride = 1, const bool only_parity = false);\n+ void __encode(const B* U_K, B* sys, B* tail_sys, B* par, B* tail_par, const int stride = 1, const int stride_tail = 1);\nvirtual int inner_encode(const int bit_sys, int &state) = 0;\nvirtual int tail_bit_sys(const int &state ) = 0;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a sub encoding function more generic in the RSC encoder.
8,490
26.09.2017 21:40:43
-7,200
ebdc26c2b13ae0315bf36ec6a0b0ab648d3a5cba
Simplify the encoding buffered mode for the RSC and the Turbo codes.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RSC/BCJR/Decoder_RSC_BCJR.hxx", "new_path": "src/Module/Decoder/RSC/BCJR/Decoder_RSC_BCJR.hxx", "diff": "@@ -56,12 +56,8 @@ void Decoder_RSC_BCJR<B,R>\nif (n_frames == 1)\n{\n- std::copy(Y_N + 0*this->K, Y_N + 1*this->K, sys.begin());\n- std::copy(Y_N + 1*this->K, Y_N + 2*this->K, par.begin());\n-\n- // tails bit\n- std::copy(Y_N + 2*this->K , Y_N + 2*this->K + tail/2, par.begin() +this->K);\n- std::copy(Y_N + 2*this->K + tail/2, Y_N + 2*this->K + tail , sys.begin() +this->K);\n+ std::copy(Y_N + 0*this->K, Y_N + 1*this->K + tail/2, sys.begin());\n+ std::copy(Y_N + 1*this->K + tail/2, Y_N + 2*this->K + tail/2, par.begin());\n}\nelse\n{\n@@ -70,20 +66,11 @@ void Decoder_RSC_BCJR<B,R>\nstd::vector<const R*> frames(n_frames);\nfor (auto f = 0; f < n_frames; f++)\nframes[f] = Y_N + f*frame_size;\n- tools::Reorderer<R>::apply(frames, sys.data(), this->K);\n-\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K;\n- tools::Reorderer<R>::apply(frames, par.data(), this->K);\n-\n- // tails bit\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size + 2*this->K + tail/2;\n- tools::Reorderer<R>::apply(frames, &sys[this->K*n_frames], tail/2);\n+ tools::Reorderer<R>::apply(frames, sys.data(), this->K + tail/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size + 2*this->K;\n- tools::Reorderer<R>::apply(frames, &par[this->K*n_frames], tail/2);\n+ frames[f] = Y_N + f*frame_size + this->K + tail/2;\n+ tools::Reorderer<R>::apply(frames, par.data(), this->K + tail/2);\n}\n}\nelse\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter.hxx", "new_path": "src/Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter.hxx", "diff": "@@ -150,20 +150,11 @@ void Decoder_RSC_BCJR_inter<B,R>\nstd::vector<const R*> frames(n_frames);\nfor (auto f = 0; f < n_frames; f++)\nframes[f] = Y_N + f*frame_size;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->sys.data(), this->K);\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->sys.data(), this->K + tail/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->par.data(), this->K);\n-\n- // tails bit\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size + 2*this->K + tail/2;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->sys[this->K*n_frames], tail/2);\n-\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size + 2*this->K;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->par[this->K*n_frames], tail/2);\n+ frames[f] = Y_N + f*frame_size + this->K + tail/2;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->par.data(), this->K + tail/2);\n}\nelse\nDecoder_RSC_BCJR<B,R>::_load(Y_N);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hxx", "new_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hxx", "diff": "@@ -59,20 +59,11 @@ void Decoder_RSC_BCJR_inter_intra<B,R>\nstd::vector<const R*> frames(n_frames);\nfor (auto f = 0; f < n_frames; f++)\nframes[f] = Y_N + f*frame_size;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->sys.data(), this->K);\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->sys.data(), this->K + tail/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->par.data(), this->K);\n-\n- // tails bit\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size + 2*this->K + tail/2;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->sys[this->K*n_frames], tail/2);\n-\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size + 2*this->K;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->par[this->K*n_frames], tail/2);\n+ frames[f] = Y_N + f*frame_size + this->K + tail/2;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->par.data(), this->K + tail/2);\n}\nelse\nDecoder_RSC_BCJR<B,R>::_load(Y_N);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo/Decoder_turbo.cpp", "new_path": "src/Module/Decoder/Turbo/Decoder_turbo.cpp", "diff": "@@ -144,64 +144,36 @@ template <typename B, typename R>\nvoid Decoder_turbo<B,R>\n::buffered_load(const R *Y_N, const int frame_id)\n{\n- const auto tail_n = siso_n.tail_length();\n- const auto tail_i = siso_i.tail_length();\n-\n- const auto N_without_tb = this->N - (siso_n.tail_length() + siso_i.tail_length());\n-\n- const auto p_size = (N_without_tb - this->K) / 2; // size of the parity\nif (this->get_simd_inter_frame_level() == 1)\n{\n- std::copy(Y_N , Y_N + this->K , l_sn.begin());\n- std::copy(Y_N + this->K , Y_N + this->K + 1*p_size, l_pn.begin());\n- std::copy(Y_N + this->K + 1*p_size, Y_N + this->K + 2*p_size, l_pi.begin());\n- pi.interleave(l_sn.data(), l_si.data(), frame_id, this->get_simd_inter_frame_level());\n-\n- // tails bit in the natural domain\n- std::copy(Y_N + N_without_tb , Y_N + N_without_tb + tail_n/2, l_pn.begin() +p_size);\n- std::copy(Y_N + N_without_tb + tail_n/2, Y_N + N_without_tb + tail_n , l_sn.begin() +p_size);\n-\n- // tails bit in the interleaved domain\n- std::copy(Y_N + N_without_tb + tail_n , Y_N + N_without_tb + tail_n + tail_i/2, l_pi.begin() +p_size);\n- std::copy(Y_N + N_without_tb + tail_n + tail_i/2, Y_N + N_without_tb + tail_n + tail_i , l_si.begin() +p_size);\n+ std::copy(Y_N , Y_N + siso_n.get_K() + siso_n.tail_length()/2, l_sn.begin() );\n+ std::copy(Y_N + siso_n.get_K() + siso_n.tail_length()/2, Y_N + siso_n.get_N(), l_pn.begin() );\n+ std::copy(Y_N + siso_n.get_N(), Y_N + siso_n.get_N() + siso_i.tail_length()/2, l_si.begin() + this->K);\n+ std::copy(Y_N + siso_n.get_N() + siso_i.tail_length()/2, Y_N + this->N , l_pi.begin() );\n+ pi.interleave(l_sn.data(), l_si.data(), frame_id, 1);\n}\nelse\n{\nconst auto n_frames = this->get_simd_inter_frame_level();\n- const auto frame_size = this->N;\nstd::vector<const R*> frames(n_frames);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size;\n- tools::Reorderer<R>::apply(frames, l_sn.data(), this->K);\n+ frames[f] = Y_N + f*this->N;\n+ tools::Reorderer<R>::apply(frames, l_sn.data(), siso_n.get_K() + siso_n.tail_length()/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K;\n- tools::Reorderer<R>::apply(frames, l_pn.data(), p_size);\n+ frames[f] = Y_N + f*this->N + siso_n.get_K() + siso_n.tail_length()/2;\n+ tools::Reorderer<R>::apply(frames, l_pn.data(), siso_n.get_K() + siso_n.tail_length()/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K + p_size;\n- tools::Reorderer<R>::apply(frames, l_pi.data(), p_size);\n+ frames[f] = Y_N + f*this->N + siso_n.get_N();\n+ tools::Reorderer<R>::apply(frames, &l_si[this->K*n_frames], siso_i.tail_length()/2);\n- pi.interleave(l_sn.data(), l_si.data(), frame_id, this->get_simd_inter_frame_level(), true);\n-\n- // tails bit in the natural domain\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n/2;\n- tools::Reorderer<R>::apply(frames, &l_sn[this->K*n_frames], tail_n/2);\n+ frames[f] = Y_N + f*this->N + siso_n.get_N() + siso_i.tail_length()/2;\n+ tools::Reorderer<R>::apply(frames, l_pi.data(), siso_i.get_K() + siso_i.tail_length()/2);\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb;\n- tools::Reorderer<R>::apply(frames, &l_pn[p_size*n_frames], tail_n/2);\n-\n- // tails bit in the interleaved domain\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n + tail_i/2;\n- tools::Reorderer<R>::apply(frames, &l_si[this->K*n_frames], tail_i/2);\n-\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n;\n- tools::Reorderer<R>::apply(frames, &l_pi[p_size*n_frames], tail_i/2);\n+ pi.interleave(l_sn.data(), l_si.data(), frame_id, this->get_simd_inter_frame_level(), true);\n}\nstd::fill(l_e1n.begin(), l_e1n.end(), (R)0);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo/Decoder_turbo_fast.cpp", "new_path": "src/Module/Decoder/Turbo/Decoder_turbo_fast.cpp", "diff": "@@ -41,9 +41,6 @@ void Decoder_turbo_fast<B,R>\n{\nconst auto tail_n = this->siso_n.tail_length();\nconst auto tail_i = this->siso_i.tail_length();\n- const auto frame_size = this->N;\n- const auto N_without_tb = this->N - (this->siso_n.tail_length() + this->siso_i.tail_length());\n- const auto p_size = (N_without_tb - this->K) / 2; // size of the parity\nif (this->get_simd_inter_frame_level() == mipp::nElReg<B>())\n{\n@@ -51,36 +48,22 @@ void Decoder_turbo_fast<B,R>\nstd::vector<const R*> frames(n_frames);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->l_sn.data(), this->K);\n+ frames[f] = Y_N + f*this->N;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->l_sn.data(), this->siso_n.get_K() + tail_n/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pn.data(), p_size);\n+ frames[f] = Y_N + f*this->N + this->siso_n.get_K() + tail_n/2;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pn.data(), this->siso_n.get_K() + tail_n/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K + p_size;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pi.data(), p_size);\n-\n- this->pi.interleave(this->l_sn.data(), this->l_si.data(), frame_id, this->get_simd_inter_frame_level(), true);\n-\n- // tails bit in the natural domain\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n/2;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->l_sn[this->K*n_frames], tail_n/2);\n-\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->l_pn[p_size*n_frames], tail_n/2);\n-\n- // tails bit in the interleaved domain\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n + tail_i/2;\n+ frames[f] = Y_N + f*this->N + this->siso_n.get_N();\ntools::Reorderer_static<R,n_frames>::apply(frames, &this->l_si[this->K*n_frames], tail_i/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->l_pi[p_size*n_frames], tail_i/2);\n+ frames[f] = Y_N + f*this->N + this->siso_n.get_N() + tail_i/2;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pi.data(), this->siso_i.get_K() + tail_i/2);\n+\n+ this->pi.interleave(this->l_sn.data(), this->l_si.data(), frame_id, this->get_simd_inter_frame_level(), true);\n}\nelse\n{\n@@ -88,36 +71,22 @@ void Decoder_turbo_fast<B,R>\nstd::vector<const R*> frames(n_frames);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->l_sn.data(), this->K);\n+ frames[f] = Y_N + f*this->N;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->l_sn.data(), this->siso_n.get_K() + tail_n/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pn.data(), p_size);\n+ frames[f] = Y_N + f*this->N + this->siso_n.get_K() + tail_n/2;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pn.data(), this->siso_n.get_K() + tail_n/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +this->K + p_size;\n- tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pi.data(), p_size);\n-\n- this->pi.interleave(this->l_sn.data(), this->l_si.data(), frame_id, this->get_simd_inter_frame_level(), true);\n-\n- // tails bit in the natural domain\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n/2;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->l_sn[this->K*n_frames], tail_n/2);\n-\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->l_pn[p_size*n_frames], tail_n/2);\n-\n- // tails bit in the interleaved domain\n- for (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n + tail_i/2;\n+ frames[f] = Y_N + f*this->N + this->siso_n.get_N();\ntools::Reorderer_static<R,n_frames>::apply(frames, &this->l_si[this->K*n_frames], tail_i/2);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = Y_N + f*frame_size +N_without_tb + tail_n;\n- tools::Reorderer_static<R,n_frames>::apply(frames, &this->l_pi[p_size*n_frames], tail_i/2);\n+ frames[f] = Y_N + f*this->N + this->siso_n.get_N() + tail_i/2;\n+ tools::Reorderer_static<R,n_frames>::apply(frames, this->l_pi.data(), this->siso_i.get_K() + tail_i/2);\n+\n+ this->pi.interleave(this->l_sn.data(), this->l_si.data(), frame_id, this->get_simd_inter_frame_level(), true);\n}\nstd::fill(this->l_e1n.begin(), this->l_e1n.end(), (R)0);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.cpp", "new_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.cpp", "diff": "@@ -53,9 +53,9 @@ void Encoder_RSC_sys<B>\nif (buffered_encoding)\n__encode(U_K,\nX_N, // sys\n- X_N + 2 * this->K + this->n_ff, // tail sys\n- X_N + 1 * this->K, // par\n- X_N + 2 * this->K ); // tail par\n+ X_N + 1 * this->K, // tail sys\n+ X_N + 1 * this->K + this->n_ff, // par\n+ X_N + 2 * this->K + this->n_ff); // tail par\nelse\n__encode(U_K,\nX_N, // sys\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.hpp", "new_path": "src/Module/Encoder/RSC/Encoder_RSC_sys.hpp", "diff": "@@ -30,10 +30,11 @@ protected:\nvoid _encode (const B *U_K, B *X_N, const int frame_id);\nvoid _encode_sys(const B *U_K, B *par, const int frame_id);\n- void __encode(const B* U_K, B* sys, B* tail_sys, B* par, B* tail_par, const int stride = 1, const int stride_tail = 1);\n-\nvirtual int inner_encode(const int bit_sys, int &state) = 0;\nvirtual int tail_bit_sys(const int &state ) = 0;\n+\n+private:\n+ void __encode(const B* U_K, B* sys, B* tail_sys, B* par, B* tail_par, const int stride = 1, const int stride_tail = 1);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-// [sys | pn | pi | tailn | taili]\n+// [sysn | tail sysn | pn | tail pn | tail sysi | pi | tail pi]\ntemplate <typename B>\nEncoder_turbo<B>\n@@ -20,8 +20,7 @@ Encoder_turbo<B>\nenco_n (enco_n),\nenco_i (enco_i),\nU_K_i (K * n_frames),\n- par_n(((N - (enco_n.tail_length() + enco_i.tail_length()) - K) / 2 + enco_n.tail_length()) * n_frames),\n- par_i(((N - (enco_n.tail_length() + enco_i.tail_length()) - K) / 2 + enco_i.tail_length()) * n_frames)\n+ X_N_tmp ((enco_n.get_N() >= enco_i.get_N() ? enco_n.get_N() : enco_i.get_N()) * n_frames)\n{\nif (N - (enco_n.tail_length() + enco_i.tail_length()) != 3 * K)\n{\n@@ -48,26 +47,19 @@ void Encoder_turbo<B>\n{\npi.interleave(U_K, U_K_i.data(), 0, this->n_frames);\n- enco_n.encode_sys(U_K, par_n.data());\n- enco_i.encode_sys(U_K_i.data(), par_i.data());\n+ enco_n.encode(U_K, X_N_tmp.data());\n- const auto N_without_tb = this->N - (enco_n.tail_length() + enco_i.tail_length());\n- const auto p_si = (N_without_tb - this->K) / 2; // size of the parity\n- const auto t_n = enco_n.tail_length(); // tail_n\n- const auto t_i = enco_i.tail_length(); // tail_i\nfor (auto f = 0; f < this->n_frames; f++)\n- {\n- const auto off_U = f * this->K; // off_U_K\n- const auto off_X = f * (N_without_tb + t_n + t_i); // off_U_N\n- const auto off_pn = f * (p_si + t_n); // off_par_n\n- const auto off_pi = f * (p_si + t_i); // off_par_i\n+ std::copy(X_N_tmp.data() + f * enco_n.get_N(),\n+ X_N_tmp.data() + f * enco_n.get_N() + enco_n.get_N(),\n+ X_N + f * this->N);\n- std::copy( U_K +off_U , U_K +off_U +this->K , X_N +off_X );\n- std::copy(par_n.begin() +off_pn , par_n.begin() +off_pn +p_si , X_N +off_X +this->K );\n- std::copy(par_i.begin() +off_pi , par_i.begin() +off_pi +p_si , X_N +off_X +this->K + 1*p_si );\n- std::copy(par_n.begin() +off_pn +p_si, par_n.begin() +off_pn +p_si +t_n, X_N +off_X +this->K + 2*p_si );\n- std::copy(par_i.begin() +off_pi +p_si, par_i.begin() +off_pi +p_si +t_i, X_N +off_X +this->K + 2*p_si +t_n);\n- }\n+ enco_i.encode(U_K_i.data(), X_N_tmp.data());\n+\n+ for (auto f = 0; f < this->n_frames; f++)\n+ std::copy(X_N_tmp.data() + f * enco_i.get_N() + enco_i.get_K(),\n+ X_N_tmp.data() + f * enco_i.get_N() + enco_i.get_N(),\n+ X_N + f * this->N + enco_n.get_N());\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "diff": "@@ -23,8 +23,7 @@ protected:\nEncoder_sys<B> &enco_i; // sub encoder\nstd::vector<B> U_K_i; // internal buffer for the systematic bits in the interleaved domain\n- std::vector<B> par_n; // internal buffer for the encoded bits in the natural domain\n- std::vector<B> par_i; // internal buffer for the encoded bits in the interleaved domain\n+ std::vector<B> X_N_tmp;\npublic:\nEncoder_turbo(const int& K, const int& N, const Interleaver<B> &pi,\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Process.cpp", "new_path": "src/Module/Process.cpp", "diff": "@@ -110,6 +110,8 @@ int Process::exec()\nconst auto sty_class = tools::Style::BOLD;\nconst auto sty_method = tools::Style::BOLD | tools::FG::Color::GREEN;\n+ auto n_fra = (size_t)this->module.get_n_frames();\n+\nstd::cout << \"# \";\nstd::cout << tools::format(module.get_name(), sty_class) << \"::\" << tools::format(get_name(), sty_method)\n<< \"(\";\n@@ -118,7 +120,8 @@ int Process::exec()\nauto n_elmts = in[i].get_databytes() / (size_t)in[i].get_datatype_size();\nstd::cout << tools::format(\"const \", sty_type)\n<< tools::format(in[i].get_datatype_string(), sty_type)\n- << \" \" << in[i].get_name() << \"[\" << n_elmts << \"]\"\n+ << \" \" << in[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n+ << (n_elmts / n_fra) << \"]\"\n<< (i < (int)in.size() -1 || out.size() > 0 ? \", \" : \"\");\nmax_n_chars = std::max(in[i].get_name().size(), max_n_chars);\n@@ -127,7 +130,8 @@ int Process::exec()\n{\nauto n_elmts = out[i].get_databytes() / (size_t)out[i].get_datatype_size();\nstd::cout << tools::format(out[i].get_datatype_string(), sty_type)\n- << \" \" << out[i].get_name() << \"[\" << n_elmts << \"]\"\n+ << \" \" << out[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n+ << (n_elmts / n_fra) << \"]\"\n<< (i < (int)out.size() -1 ? \", \" : \"\");\nmax_n_chars = std::max(out[i].get_name().size(), max_n_chars);\n@@ -139,7 +143,6 @@ int Process::exec()\nstd::string spaces; for (size_t s = 0; s < max_n_chars - i.get_name().size(); s++) spaces += \" \";\nauto n_elmts = i.get_databytes() / (size_t)i.get_datatype_size();\n- auto n_fra = (size_t)this->module.get_n_frames();\nauto fra_size = n_elmts / n_fra;\nauto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nauto p = debug_precision;\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the encoding buffered mode for the RSC and the Turbo codes.
8,490
26.09.2017 22:01:13
-7,200
f533614e87faff9c450698eab1ff00b178d35a8c
Fix the SISO decoding in the generic BCJR.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hpp", "new_path": "src/Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hpp", "diff": "@@ -37,8 +37,6 @@ protected:\nvirtual void compute_beta ( );\nvirtual void compute_ext (const R *sys, R *ext );\nvirtual void compute_beta_ext(const R *sys, R *ext );\n-\n- virtual void compute_gamma (const R *sys, const R *par, const R *tail_sys, const R *tail_par);\nvirtual void compute_ext_sys (const R *sys, R *ext_sys);\nvirtual void compute_ext_par (const R *par, R *ext_par);\n};\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hxx", "new_path": "src/Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hxx", "diff": "@@ -41,27 +41,6 @@ void Decoder_RSC_BCJR_seq_generic_std<B,R,RD,MAX1,MAX2>\n}\n}\n-template <typename B, typename R, typename RD, tools::proto_max<R> MAX1, tools::proto_max<RD> MAX2>\n-void Decoder_RSC_BCJR_seq_generic_std<B,R,RD,MAX1,MAX2>\n-::compute_gamma(const R *sys, const R *par, const R *tail_sys, const R *tail_par)\n-{\n- for (auto i = 0; i < this->K; i++)\n- {\n- // there is a big loss of precision here in fixed point\n- this->gamma[0][i] = RSC_BCJR_seq_generic_div_or_not<R>::apply(sys[i] + par[i]);\n- // there is a big loss of precision here in fixed point\n- this->gamma[1][i] = RSC_BCJR_seq_generic_div_or_not<R>::apply(sys[i] - par[i]);\n- }\n-\n- for (auto i = 0; i < this->n_ff; i++)\n- {\n- // there is a big loss of precision here in fixed point\n- this->gamma[0][this->K +i] = RSC_BCJR_seq_generic_div_or_not<R>::apply(tail_sys[i] + tail_par[i]);\n- // there is a big loss of precision here in fixed point\n- this->gamma[1][this->K +i] = RSC_BCJR_seq_generic_div_or_not<R>::apply(tail_sys[i] - tail_par[i]);\n- }\n-}\n-\ntemplate <typename B, typename R, typename RD, tools::proto_max<R> MAX1, tools::proto_max<RD> MAX2>\nvoid Decoder_RSC_BCJR_seq_generic_std<B,R,RD,MAX1,MAX2>\n::compute_alpha()\n@@ -199,7 +178,7 @@ void Decoder_RSC_BCJR_seq_generic_std<B,R,RD,MAX1,MAX2>\n::compute_ext_sys(const R *sys, R *ext_sys)\n{\n// compute extrinsic values\n- for (auto i = 0; i < this->K; i++)\n+ for (auto i = 0; i < this->K + this->n_ff; i++)\n{\nRD max0 = -std::numeric_limits<RD>::max();\nRD max1 = -std::numeric_limits<RD>::max();\n@@ -233,7 +212,7 @@ void Decoder_RSC_BCJR_seq_generic_std<B,R,RD,MAX1,MAX2>\n::compute_ext_par(const R *par, R *ext_par)\n{\n// compute extrinsic values\n- for (auto i = 0; i < this->K; i++)\n+ for (auto i = 0; i < this->K + this->n_ff; i++)\n{\nRD max0 = -std::numeric_limits<RD>::max();\nRD max1 = -std::numeric_limits<RD>::max();\n@@ -303,13 +282,11 @@ void Decoder_RSC_BCJR_seq_generic_std<B,R,RD,MAX1,MAX2>\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"'buffered_encoding' has to be enabled.\");\nconst R* sys = Y_N1;\n- const R* par = Y_N1 + 1 * this->K;\n- const R* tail_sys = Y_N1 + 2 * this->K + this->n_ff;\n- const R* tail_par = Y_N1 + 2 * this->K;\n+ const R* par = Y_N1 + this->K + this->n_ff;\nR* ext_sys = Y_N2;\n- R* ext_par = Y_N2 + 1 * this->K;\n+ R* ext_par = Y_N2 + this->K + this->n_ff;\n- this->compute_gamma (sys, par, tail_sys, tail_par);\n+ this->compute_gamma (sys, par );\nthis->compute_alpha ( );\nthis->compute_beta ( );\nthis->compute_ext_sys(sys, ext_sys);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the SISO decoding in the generic BCJR.
8,490
27.09.2017 09:10:44
-7,200
1542fe6fe66dad40ef7134300d49561ac1e88179
Add a new type of socket : in_out.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/Codec.hpp", "new_path": "src/Module/Codec/Codec.hpp", "diff": "@@ -121,7 +121,7 @@ public:\nauto &p4 = this->create_process(\"add_sys_ext\");\nthis->template create_socket_in <Q>(p4, \"ext\", this->K * this->n_frames);\n- this->template create_socket_in<Q>(p4, \"Y_N\", this->N_cw * this->n_frames);\n+ this->template create_socket_in_out<Q>(p4, \"Y_N\", this->N_cw * this->n_frames);\nthis->create_codelet(p4, [&]() -> int\n{\nthis->add_sys_ext(static_cast<Q*>(p4[\"ext\"].get_dataptr()),\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Module.hpp", "new_path": "src/Module/Module.hpp", "diff": "@@ -123,6 +123,12 @@ protected:\nprocess.template create_socket_in<T>(name, n_elmts);\n}\n+ template <typename T>\n+ void create_socket_in_out(Process& process, const std::string name, const size_t n_elmts)\n+ {\n+ process.template create_socket_in_out<T>(name, n_elmts);\n+ }\n+\ntemplate <typename T>\nvoid create_socket_out(Process& process, const std::string name, const size_t n_elmts)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Process.cpp", "new_path": "src/Module/Process.cpp", "diff": "@@ -115,30 +115,40 @@ int Process::exec()\nstd::cout << \"# \";\nstd::cout << tools::format(module.get_name(), sty_class) << \"::\" << tools::format(get_name(), sty_method)\n<< \"(\";\n- for (auto i = 0; i < (int)in.size(); i++)\n+ for (auto i = 0; i < (int)s_in.size(); i++)\n{\n- auto n_elmts = in[i].get_databytes() / (size_t)in[i].get_datatype_size();\n+ auto n_elmts = s_in[i].get_databytes() / (size_t)s_in[i].get_datatype_size();\nstd::cout << tools::format(\"const \", sty_type)\n- << tools::format(in[i].get_datatype_string(), sty_type)\n- << \" \" << in[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n+ << tools::format(s_in[i].get_datatype_string(), sty_type)\n+ << \" \" << s_in[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n<< (n_elmts / n_fra) << \"]\"\n- << (i < (int)in.size() -1 || out.size() > 0 ? \", \" : \"\");\n+ << (i < (int)s_in.size() -1 || s_in_out.size() || s_out.size() > 0 ? \", \" : \"\");\n- max_n_chars = std::max(in[i].get_name().size(), max_n_chars);\n+ max_n_chars = std::max(s_in[i].get_name().size(), max_n_chars);\n}\n- for (auto i = 0; i < (int)out.size(); i++)\n+ for (auto i = 0; i < (int)s_in_out.size(); i++)\n{\n- auto n_elmts = out[i].get_databytes() / (size_t)out[i].get_datatype_size();\n- std::cout << tools::format(out[i].get_datatype_string(), sty_type)\n- << \" \" << out[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n+ auto n_elmts = s_in_out[i].get_databytes() / (size_t)s_in_out[i].get_datatype_size();\n+ std::cout << tools::format(s_in_out[i].get_datatype_string(), sty_type)\n+ << \" \" << s_in_out[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n<< (n_elmts / n_fra) << \"]\"\n- << (i < (int)out.size() -1 ? \", \" : \"\");\n+ << (i < (int)s_in_out.size() -1 || s_out.size() > 0 ? \", \" : \"\");\n- max_n_chars = std::max(out[i].get_name().size(), max_n_chars);\n+ max_n_chars = std::max(s_in_out[i].get_name().size(), max_n_chars);\n+ }\n+ for (auto i = 0; i < (int)s_out.size(); i++)\n+ {\n+ auto n_elmts = s_out[i].get_databytes() / (size_t)s_out[i].get_datatype_size();\n+ std::cout << tools::format(s_out[i].get_datatype_string(), sty_type)\n+ << \" \" << s_out[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n+ << (n_elmts / n_fra) << \"]\"\n+ << (i < (int)s_out.size() -1 ? \", \" : \"\");\n+\n+ max_n_chars = std::max(s_out[i].get_name().size(), max_n_chars);\n}\nstd::cout << \")\" << std::endl;\n- for (auto &i : in)\n+ for (auto &i : s_in)\n{\nstd::string spaces; for (size_t s = 0; s < max_n_chars - i.get_name().size(); s++) spaces += \" \";\n@@ -155,6 +165,23 @@ int Process::exec()\nelse if (i.get_datatype() == typeid(double )) display_data((double *)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\nstd::cout << \"]\" << std::endl;\n}\n+ for (auto &io : s_in_out)\n+ {\n+ std::string spaces; for (size_t s = 0; s < max_n_chars - io.get_name().size(); s++) spaces += \" \";\n+\n+ auto n_elmts = io.get_databytes() / (size_t)io.get_datatype_size();\n+ auto fra_size = n_elmts / n_fra;\n+ auto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\n+ auto p = debug_precision;\n+ std::cout << \"# {IN} \" << io.get_name() << spaces << \" = [\";\n+ if (io.get_datatype() == typeid(int8_t )) display_data((int8_t *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(int16_t)) display_data((int16_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(int32_t)) display_data((int32_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(int64_t)) display_data((int64_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(float )) display_data((float *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(double )) display_data((double *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ std::cout << \"]\" << std::endl;\n+ }\n}\nint exec_status;\n@@ -182,7 +209,25 @@ int Process::exec()\nif (debug)\n{\n- for (auto &o : out)\n+ for (auto &io : s_in_out)\n+ {\n+ std::string spaces; for (size_t s = 0; s < max_n_chars - io.get_name().size(); s++) spaces += \" \";\n+\n+ auto n_elmts = io.get_databytes() / (size_t)io.get_datatype_size();\n+ auto n_fra = (size_t)this->module.get_n_frames();\n+ auto fra_size = n_elmts / n_fra;\n+ auto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\n+ std::cout << \"# {OUT} \" << io.get_name() << spaces << \" = [\";\n+ auto p = debug_precision;\n+ if (io.get_datatype() == typeid(int8_t )) display_data((int8_t *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(int16_t)) display_data((int16_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(int32_t)) display_data((int32_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(int64_t)) display_data((int64_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(float )) display_data((float *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (io.get_datatype() == typeid(double )) display_data((double *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ std::cout << \"]\" << std::endl;\n+ }\n+ for (auto &o : s_out)\n{\nstd::string spaces; for (size_t s = 0; s < max_n_chars - o.get_name().size(); s++) spaces += \" \";\n@@ -218,17 +263,23 @@ int Process::exec()\ntemplate <typename T>\nvoid Process::create_socket_in(const std::string name, const size_t n_elmts)\n{\n- in.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n+ s_in.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n+}\n+\n+template <typename T>\n+void Process::create_socket_in_out(const std::string name, const size_t n_elmts)\n+{\n+ s_in_out.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n}\ntemplate <typename T>\nvoid Process::create_socket_out(const std::string name, const size_t n_elmts)\n{\n- out.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n+ s_out.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n// memory allocation\n- out_buffers.push_back(std::vector<uint8_t>(out.back().databytes));\n- out.back().dataptr = out_buffers.back().data();\n+ out_buffers.push_back(std::vector<uint8_t>(s_out.back().databytes));\n+ s_out.back().dataptr = out_buffers.back().data();\n}\nvoid Process::create_codelet(std::function<int(void)> codelet)\n@@ -238,8 +289,9 @@ void Process::create_codelet(std::function<int(void)> codelet)\nSocket& Process::operator[](const std::string name)\n{\n- for (auto &s : in ) if (s.get_name() == name) return s;\n- for (auto &s : out) if (s.get_name() == name) return s;\n+ for (auto &s : s_in ) if (s.get_name() == name) return s;\n+ for (auto &s : s_in_out) if (s.get_name() == name) return s;\n+ for (auto &s : s_out ) if (s.get_name() == name) return s;\nstd::stringstream message;\nmessage << \"The socket does not exist ('socket.name' = \" << name << \", 'process.name' = \" << this->get_name()\n@@ -249,12 +301,15 @@ Socket& Process::operator[](const std::string name)\nbool Process::last_input_socket(Socket &s_in)\n{\n- return &s_in == &in.back();\n+ return this->s_in_out.size() == 0 ? &s_in == &this->s_in.back() : &s_in == &this->s_in_out.back();\n}\nbool Process::can_exec()\n{\n- for (auto &s : this->in)\n+ for (auto &s : this->s_in)\n+ if (s.dataptr == nullptr)\n+ return false;\n+ for (auto &s : this->s_in_out)\nif (s.dataptr == nullptr)\nreturn false;\nreturn true;\n@@ -360,6 +415,13 @@ template void Process::create_socket_in<int64_t>(const std::string, const size_t\ntemplate void Process::create_socket_in<float >(const std::string, const size_t);\ntemplate void Process::create_socket_in<double >(const std::string, const size_t);\n+template void Process::create_socket_in_out<int8_t >(const std::string, const size_t);\n+template void Process::create_socket_in_out<int16_t>(const std::string, const size_t);\n+template void Process::create_socket_in_out<int32_t>(const std::string, const size_t);\n+template void Process::create_socket_in_out<int64_t>(const std::string, const size_t);\n+template void Process::create_socket_in_out<float >(const std::string, const size_t);\n+template void Process::create_socket_in_out<double >(const std::string, const size_t);\n+\ntemplate void Process::create_socket_out<int8_t >(const std::string, const size_t);\ntemplate void Process::create_socket_out<int16_t>(const std::string, const size_t);\ntemplate void Process::create_socket_out<int32_t>(const std::string, const size_t);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Process.hpp", "new_path": "src/Module/Process.hpp", "diff": "@@ -52,9 +52,9 @@ protected:\nstd::map<std::string, std::chrono::nanoseconds> registered_duration_max;\npublic:\n- std::vector<Socket> in;\n- std::vector<Socket> out;\n- std::vector<Socket> in_out;\n+ std::vector<Socket> s_in;\n+ std::vector<Socket> s_in_out;\n+ std::vector<Socket> s_out;\nProcess(const Module &module,\nconst std::string name,\n@@ -103,10 +103,10 @@ protected:\nvoid create_socket_in(const std::string name, const size_t n_elmts);\ntemplate <typename T>\n- void create_socket_out(const std::string name, const size_t n_elmts);\n+ void create_socket_in_out(const std::string name, const size_t n_elmts);\ntemplate <typename T>\n- void create_socket_in_out(const std::string name, const size_t n_elmts);\n+ void create_socket_out(const std::string name, const size_t n_elmts);\nvoid create_codelet(std::function<int(void)> codelet);\n};\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -79,8 +79,9 @@ void Simulation\n{\nfor (auto &p : m.second[0]->processes)\n{\n- size_t n_elmts = p.second->out.size() ? p.second->out[0].get_n_elmts() :\n- p.second->in [0].get_n_elmts();\n+ size_t n_elmts = p.second->s_out .size() ? p.second->s_out [0].get_n_elmts():\n+ p.second->s_in_out.size() ? p.second->s_in_out[0].get_n_elmts():\n+ p.second->s_in [0].get_n_elmts();\nauto module = m.second[0]->get_short_name();\nauto process = p.second->get_name();\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a new type of socket : in_out.
8,490
27.09.2017 14:51:52
-7,200
cac44b8733478cc622431c44fdae2f222bd623ac
Improve the sockets contral and management in the process.
[ { "change_type": "MODIFY", "old_path": "src/Module/Process.cpp", "new_path": "src/Module/Process.cpp", "diff": "@@ -26,7 +26,7 @@ Process::Process(const Module &module, const std::string name, const bool autost\n{\n}\n-std::string Process::get_name()\n+std::string Process::get_name() const\n{\nreturn this->name;\n}\n@@ -36,7 +36,7 @@ void Process::set_autostart(const bool autostart)\nthis->autostart = autostart;\n}\n-bool Process::is_autostart()\n+bool Process::is_autostart() const\n{\nreturn this->autostart;\n}\n@@ -46,7 +46,7 @@ void Process::set_stats(const bool stats)\nthis->stats = stats;\n}\n-bool Process::is_stats()\n+bool Process::is_stats() const\n{\nreturn this->stats;\n}\n@@ -66,7 +66,7 @@ void Process::set_debug_precision(const uint8_t prec)\nthis->debug_precision = prec;\n}\n-bool Process::is_debug()\n+bool Process::is_debug() const\n{\nreturn this->debug;\n}\n@@ -115,74 +115,43 @@ int Process::exec()\nstd::cout << \"# \";\nstd::cout << tools::format(module.get_name(), sty_class) << \"::\" << tools::format(get_name(), sty_method)\n<< \"(\";\n- for (auto i = 0; i < (int)s_in.size(); i++)\n- {\n- auto n_elmts = s_in[i].get_databytes() / (size_t)s_in[i].get_datatype_size();\n- std::cout << tools::format(\"const \", sty_type)\n- << tools::format(s_in[i].get_datatype_string(), sty_type)\n- << \" \" << s_in[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n- << (n_elmts / n_fra) << \"]\"\n- << (i < (int)s_in.size() -1 || s_in_out.size() || s_out.size() > 0 ? \", \" : \"\");\n-\n- max_n_chars = std::max(s_in[i].get_name().size(), max_n_chars);\n- }\n- for (auto i = 0; i < (int)s_in_out.size(); i++)\n- {\n- auto n_elmts = s_in_out[i].get_databytes() / (size_t)s_in_out[i].get_datatype_size();\n- std::cout << tools::format(s_in_out[i].get_datatype_string(), sty_type)\n- << \" \" << s_in_out[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n- << (n_elmts / n_fra) << \"]\"\n- << (i < (int)s_in_out.size() -1 || s_out.size() > 0 ? \", \" : \"\");\n-\n- max_n_chars = std::max(s_in_out[i].get_name().size(), max_n_chars);\n- }\n- for (auto i = 0; i < (int)s_out.size(); i++)\n- {\n- auto n_elmts = s_out[i].get_databytes() / (size_t)s_out[i].get_datatype_size();\n- std::cout << tools::format(s_out[i].get_datatype_string(), sty_type)\n- << \" \" << s_out[i].get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n+ for (auto i = 0; i < (int)socket.size(); i++)\n+ {\n+ auto &s = socket[i];\n+ auto s_type = get_socket_type(s);\n+ auto n_elmts = s.get_databytes() / (size_t)s.get_datatype_size();\n+ std::cout << (s_type == IN ? tools::format(\"const \", sty_type) : \"\")\n+ << tools::format(s.get_datatype_string(), sty_type)\n+ << \" \" << s.get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n<< (n_elmts / n_fra) << \"]\"\n- << (i < (int)s_out.size() -1 ? \", \" : \"\");\n+ << (i < (int)socket.size() -1 ? \", \" : \"\");\n- max_n_chars = std::max(s_out[i].get_name().size(), max_n_chars);\n+ max_n_chars = std::max(s.get_name().size(), max_n_chars);\n}\nstd::cout << \")\" << std::endl;\n- for (auto &i : s_in)\n+ for (auto &s : socket)\n{\n- std::string spaces; for (size_t s = 0; s < max_n_chars - i.get_name().size(); s++) spaces += \" \";\n-\n- auto n_elmts = i.get_databytes() / (size_t)i.get_datatype_size();\n- auto fra_size = n_elmts / n_fra;\n- auto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\n- auto p = debug_precision;\n- std::cout << \"# {IN} \" << i.get_name() << spaces << \" = [\";\n- if (i.get_datatype() == typeid(int8_t )) display_data((int8_t *)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (i.get_datatype() == typeid(int16_t)) display_data((int16_t*)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (i.get_datatype() == typeid(int32_t)) display_data((int32_t*)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (i.get_datatype() == typeid(int64_t)) display_data((int64_t*)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (i.get_datatype() == typeid(float )) display_data((float *)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (i.get_datatype() == typeid(double )) display_data((double *)i.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- std::cout << \"]\" << std::endl;\n- }\n- for (auto &io : s_in_out)\n+ auto s_type = get_socket_type(s);\n+ if (s_type == IN || s_type == IN_OUT)\n{\n- std::string spaces; for (size_t s = 0; s < max_n_chars - io.get_name().size(); s++) spaces += \" \";\n+ std::string spaces; for (size_t ss = 0; ss < max_n_chars - s.get_name().size(); ss++) spaces += \" \";\n- auto n_elmts = io.get_databytes() / (size_t)io.get_datatype_size();\n+ auto n_elmts = s.get_databytes() / (size_t)s.get_datatype_size();\nauto fra_size = n_elmts / n_fra;\nauto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nauto p = debug_precision;\n- std::cout << \"# {IN} \" << io.get_name() << spaces << \" = [\";\n- if (io.get_datatype() == typeid(int8_t )) display_data((int8_t *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(int16_t)) display_data((int16_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(int32_t)) display_data((int32_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(int64_t)) display_data((int64_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(float )) display_data((float *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(double )) display_data((double *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ std::cout << \"# {IN} \" << s.get_name() << spaces << \" = [\";\n+ if (s.get_datatype() == typeid(int8_t )) display_data((int8_t *)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(int16_t)) display_data((int16_t*)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(int32_t)) display_data((int32_t*)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(int64_t)) display_data((int64_t*)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(float )) display_data((float *)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(double )) display_data((double *)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\nstd::cout << \"]\" << std::endl;\n}\n}\n+ }\nint exec_status;\nif (stats)\n@@ -209,42 +178,28 @@ int Process::exec()\nif (debug)\n{\n- for (auto &io : s_in_out)\n- {\n- std::string spaces; for (size_t s = 0; s < max_n_chars - io.get_name().size(); s++) spaces += \" \";\n-\n- auto n_elmts = io.get_databytes() / (size_t)io.get_datatype_size();\nauto n_fra = (size_t)this->module.get_n_frames();\n- auto fra_size = n_elmts / n_fra;\n- auto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\n- std::cout << \"# {OUT} \" << io.get_name() << spaces << \" = [\";\n- auto p = debug_precision;\n- if (io.get_datatype() == typeid(int8_t )) display_data((int8_t *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(int16_t)) display_data((int16_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(int32_t)) display_data((int32_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(int64_t)) display_data((int64_t*)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(float )) display_data((float *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (io.get_datatype() == typeid(double )) display_data((double *)io.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- std::cout << \"]\" << std::endl;\n- }\n- for (auto &o : s_out)\n+ for (auto &s : socket)\n{\n- std::string spaces; for (size_t s = 0; s < max_n_chars - o.get_name().size(); s++) spaces += \" \";\n+ auto s_type = get_socket_type(s);\n+ if (s_type == OUT || s_type == IN_OUT)\n+ {\n+ std::string spaces; for (size_t ss = 0; ss < max_n_chars - s.get_name().size(); ss++) spaces += \" \";\n- auto n_elmts = o.get_databytes() / (size_t)o.get_datatype_size();\n- auto n_fra = (size_t)this->module.get_n_frames();\n+ auto n_elmts = s.get_databytes() / (size_t)s.get_datatype_size();\nauto fra_size = n_elmts / n_fra;\nauto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\n- std::cout << \"# {OUT} \" << o.get_name() << spaces << \" = [\";\nauto p = debug_precision;\n- if (o.get_datatype() == typeid(int8_t )) display_data((int8_t *)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (o.get_datatype() == typeid(int16_t)) display_data((int16_t*)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (o.get_datatype() == typeid(int32_t)) display_data((int32_t*)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (o.get_datatype() == typeid(int64_t)) display_data((int64_t*)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (o.get_datatype() == typeid(float )) display_data((float *)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n- else if (o.get_datatype() == typeid(double )) display_data((double *)o.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ std::cout << \"# {OUT} \" << s.get_name() << spaces << \" = [\";\n+ if (s.get_datatype() == typeid(int8_t )) display_data((int8_t *)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(int16_t)) display_data((int16_t*)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(int32_t)) display_data((int32_t*)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(int64_t)) display_data((int64_t*)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(float )) display_data((float *)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\n+ else if (s.get_datatype() == typeid(double )) display_data((double *)s.get_dataptr(), fra_size, n_fra, limit, p, max_n_chars +12);\nstd::cout << \"]\" << std::endl;\n}\n+ }\nstd::cout << \"# Returned status: \" << exec_status << std::endl;\nstd::cout << \"#\" << std::endl;\n}\n@@ -254,32 +209,64 @@ int Process::exec()\nelse\n{\nstd::stringstream message;\n- message << \"The process cannot be executed because some of the inputs are not fed ('process.name' = \"\n+ message << \"The process cannot be executed because some of the inputs/outputs are not fed ('process.name' = \"\n<< this->get_name() << \", 'module.name' = \" << module.get_name() << \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\n+template <typename T>\n+Socket& Process::create_socket(const std::string name, const size_t n_elmts)\n+{\n+ if (name.empty())\n+ {\n+ std::stringstream message;\n+ message << \"Impossible to create this socket because the name is empty ('process.name' = \" << this->get_name()\n+ << \", 'module.name' = \" << module.get_name() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (auto &s : socket)\n+ if (s.get_name() == name)\n+ {\n+ std::stringstream message;\n+ message << \"Impossible to create this socket because an other socket has the same name ('socket.name' = \"\n+ << name << \", 'process.name' = \" << this->get_name()\n+ << \", 'module.name' = \" << module.get_name() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ socket.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n+\n+ return socket.back();\n+}\n+\ntemplate <typename T>\nvoid Process::create_socket_in(const std::string name, const size_t n_elmts)\n{\n- s_in.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n+ auto &s = create_socket<T>(name, n_elmts);\n+\n+ socket_type[s.get_name()] = Socket_type::IN;\n}\ntemplate <typename T>\nvoid Process::create_socket_in_out(const std::string name, const size_t n_elmts)\n{\n- s_in_out.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n+ auto &s = create_socket<T>(name, n_elmts);\n+\n+ socket_type[s.get_name()] = Socket_type::IN_OUT;\n}\ntemplate <typename T>\nvoid Process::create_socket_out(const std::string name, const size_t n_elmts)\n{\n- s_out.push_back(Socket(*this, name, typeid(T), n_elmts * sizeof(T)));\n+ auto &s = create_socket<T>(name, n_elmts);\n+\n+ socket_type[s.get_name()] = Socket_type::OUT;\n// memory allocation\n- out_buffers.push_back(std::vector<uint8_t>(s_out.back().databytes));\n- s_out.back().dataptr = out_buffers.back().data();\n+ out_buffers.push_back(std::vector<uint8_t>(s.databytes));\n+ s.dataptr = out_buffers.back().data();\n}\nvoid Process::create_codelet(std::function<int(void)> codelet)\n@@ -289,9 +276,9 @@ void Process::create_codelet(std::function<int(void)> codelet)\nSocket& Process::operator[](const std::string name)\n{\n- for (auto &s : s_in ) if (s.get_name() == name) return s;\n- for (auto &s : s_in_out) if (s.get_name() == name) return s;\n- for (auto &s : s_out ) if (s.get_name() == name) return s;\n+ for (auto &s : socket)\n+ if (s.get_name() == name)\n+ return s;\nstd::stringstream message;\nmessage << \"The socket does not exist ('socket.name' = \" << name << \", 'process.name' = \" << this->get_name()\n@@ -299,75 +286,108 @@ Socket& Process::operator[](const std::string name)\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n-bool Process::last_input_socket(Socket &s_in)\n+const Socket& Process::operator[](const std::string name) const\n{\n- return this->s_in_out.size() == 0 ? &s_in == &this->s_in.back() : &s_in == &this->s_in_out.back();\n+ for (auto &s : socket)\n+ if (s.get_name() == name)\n+ return s;\n+\n+ std::stringstream message;\n+ message << \"The socket does not exist ('socket.name' = \" << name << \", 'process.name' = \" << this->get_name()\n+ << \", 'module.name' = \" << module.get_name() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n-bool Process::can_exec()\n+bool Process::last_input_socket(const Socket &s_in) const\n{\n- for (auto &s : this->s_in)\n- if (s.dataptr == nullptr)\n- return false;\n- for (auto &s : this->s_in_out)\n+ const Socket* last_s_in = nullptr;\n+ for (auto &s : socket)\n+ {\n+ auto s_type = get_socket_type(s);\n+ if (s_type == IN || s_type == IN_OUT)\n+ last_s_in = &s;\n+ }\n+\n+ auto val = last_s_in == nullptr ? false : &s_in == last_s_in;\n+\n+ return val;\n+}\n+\n+bool Process::can_exec() const\n+{\n+ for (auto &s : socket)\nif (s.dataptr == nullptr)\nreturn false;\nreturn true;\n}\n-uint32_t Process::get_n_calls()\n+uint32_t Process::get_n_calls() const\n{\nreturn this->n_calls;\n}\n-std::chrono::nanoseconds Process::get_duration_total()\n+std::chrono::nanoseconds Process::get_duration_total() const\n{\nreturn this->duration_total;\n}\n-std::chrono::nanoseconds Process::get_duration_avg()\n+std::chrono::nanoseconds Process::get_duration_avg() const\n{\nreturn this->duration_total / this->n_calls;\n}\n-std::chrono::nanoseconds Process::get_duration_min()\n+std::chrono::nanoseconds Process::get_duration_min() const\n{\nreturn this->duration_min;\n}\n-std::chrono::nanoseconds Process::get_duration_max()\n+std::chrono::nanoseconds Process::get_duration_max() const\n{\nreturn this->duration_max;\n}\n-const std::vector<std::string>& Process::get_registered_duration()\n+const std::vector<std::string>& Process::get_registered_duration() const\n{\nreturn this->registered_duration;\n}\n-uint32_t Process::get_registered_n_calls(const std::string key)\n+uint32_t Process::get_registered_n_calls(const std::string key) const\n{\n- return this->registered_n_calls[key];\n+ return this->registered_n_calls.find(key)->second;\n}\n-std::chrono::nanoseconds Process::get_registered_duration_total(const std::string key)\n+std::chrono::nanoseconds Process::get_registered_duration_total(const std::string key) const\n{\n- return this->registered_duration_total[key];\n+ return this->registered_duration_total.find(key)->second;\n}\n-std::chrono::nanoseconds Process::get_registered_duration_avg(const std::string key)\n+std::chrono::nanoseconds Process::get_registered_duration_avg(const std::string key) const\n{\n- return this->registered_duration_total[key] / this->n_calls;\n+ return this->registered_duration_total.find(key)->second / this->n_calls;\n}\n-std::chrono::nanoseconds Process::get_registered_duration_min(const std::string key)\n+std::chrono::nanoseconds Process::get_registered_duration_min(const std::string key) const\n{\n- return this->registered_duration_min[key];\n+ return this->registered_duration_min.find(key)->second;\n}\n-std::chrono::nanoseconds Process::get_registered_duration_max(const std::string key)\n+std::chrono::nanoseconds Process::get_registered_duration_max(const std::string key) const\n{\n- return this->registered_duration_max[key];\n+ return this->registered_duration_max.find(key)->second;\n+}\n+\n+Socket_type Process::get_socket_type(const Socket &s) const\n+{\n+ const auto &it = this->socket_type.find(s.get_name());\n+ if (it != socket_type.end())\n+ return it->second;\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"The socket does not exist ('s.name' = \" << s.name << \", 'process.name' = \" << this->get_name()\n+ << \", 'module.name' = \" << module.get_name() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nvoid Process::register_duration(const std::string key)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Process.hpp", "new_path": "src/Module/Process.hpp", "diff": "@@ -51,10 +51,10 @@ protected:\nstd::map<std::string, std::chrono::nanoseconds> registered_duration_min;\nstd::map<std::string, std::chrono::nanoseconds> registered_duration_max;\n+ std::map<std::string,Socket_type> socket_type;\n+\npublic:\n- std::vector<Socket> s_in;\n- std::vector<Socket> s_in_out;\n- std::vector<Socket> s_out;\n+ std::vector<Socket> socket;\nProcess(const Module &module,\nconst std::string name,\n@@ -70,29 +70,31 @@ public:\nvoid set_debug_limit (const uint32_t limit );\nvoid set_debug_precision(const uint8_t prec );\n- bool is_autostart();\n- bool is_stats ();\n- bool is_debug ();\n- bool can_exec ();\n-\n- std::string get_name ( );\n- uint32_t get_n_calls ( );\n- std::chrono::nanoseconds get_duration_total ( );\n- std::chrono::nanoseconds get_duration_avg ( );\n- std::chrono::nanoseconds get_duration_min ( );\n- std::chrono::nanoseconds get_duration_max ( );\n- const std::vector<std::string>& get_registered_duration ( );\n- uint32_t get_registered_n_calls (const std::string key);\n- std::chrono::nanoseconds get_registered_duration_total(const std::string key);\n- std::chrono::nanoseconds get_registered_duration_avg (const std::string key);\n- std::chrono::nanoseconds get_registered_duration_min (const std::string key);\n- std::chrono::nanoseconds get_registered_duration_max (const std::string key);\n-\n- bool last_input_socket(Socket &s_in);\n+ bool is_autostart() const;\n+ bool is_stats () const;\n+ bool is_debug () const;\n+ bool can_exec () const;\n+\n+ std::string get_name ( ) const;\n+ uint32_t get_n_calls ( ) const;\n+ std::chrono::nanoseconds get_duration_total ( ) const;\n+ std::chrono::nanoseconds get_duration_avg ( ) const;\n+ std::chrono::nanoseconds get_duration_min ( ) const;\n+ std::chrono::nanoseconds get_duration_max ( ) const;\n+ const std::vector<std::string>& get_registered_duration ( ) const;\n+ uint32_t get_registered_n_calls (const std::string key) const;\n+ std::chrono::nanoseconds get_registered_duration_total(const std::string key) const;\n+ std::chrono::nanoseconds get_registered_duration_avg (const std::string key) const;\n+ std::chrono::nanoseconds get_registered_duration_min (const std::string key) const;\n+ std::chrono::nanoseconds get_registered_duration_max (const std::string key) const;\n+ Socket_type get_socket_type (const Socket &s ) const;\n+\n+ bool last_input_socket(const Socket &s_in) const;\nint exec();\nSocket& operator[](const std::string name);\n+ const Socket& operator[](const std::string name) const;\nprotected:\nvoid register_duration(const std::string key);\n@@ -109,6 +111,10 @@ protected:\nvoid create_socket_out(const std::string name, const size_t n_elmts);\nvoid create_codelet(std::function<int(void)> codelet);\n+\n+private:\n+ template <typename T>\n+ inline Socket& create_socket(const std::string name, const size_t n_elmts);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Socket.cpp", "new_path": "src/Module/Socket.cpp", "diff": "@@ -28,37 +28,37 @@ Socket::Socket(Process &process, const std::string name, const std::type_index d\n{\n}\n-std::string Socket::get_name()\n+std::string Socket::get_name() const\n{\nreturn this->name;\n}\n-std::type_index Socket::get_datatype()\n+std::type_index Socket::get_datatype() const\n{\nreturn this->datatype;\n}\n-std::string Socket::get_datatype_string()\n+std::string Socket::get_datatype_string() const\n{\nreturn type_to_string[this->datatype];\n}\n-uint8_t Socket::get_datatype_size()\n+uint8_t Socket::get_datatype_size() const\n{\nreturn type_to_size[this->datatype];\n}\n-size_t Socket::get_databytes()\n+size_t Socket::get_databytes() const\n{\nreturn this->databytes;\n}\n-size_t Socket::get_n_elmts()\n+size_t Socket::get_n_elmts() const\n{\nreturn this->get_databytes() / (size_t)this->get_datatype_size();\n}\n-void* Socket::get_dataptr()\n+void* Socket::get_dataptr() const\n{\nreturn this->dataptr;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Socket.hpp", "new_path": "src/Module/Socket.hpp", "diff": "@@ -13,6 +13,13 @@ namespace module\n{\nclass Process;\n+enum Socket_type\n+{\n+ IN = 0,\n+ IN_OUT = 1,\n+ OUT = 2\n+};\n+\nclass Socket\n{\nfriend Process;\n@@ -29,13 +36,13 @@ protected:\nvoid *dataptr = nullptr);\npublic:\n- std::string get_name ();\n- std::type_index get_datatype ();\n- std::string get_datatype_string();\n- uint8_t get_datatype_size ();\n- size_t get_databytes ();\n- size_t get_n_elmts ();\n- void* get_dataptr ();\n+ std::string get_name () const;\n+ std::type_index get_datatype () const;\n+ std::string get_datatype_string() const;\n+ uint8_t get_datatype_size () const;\n+ size_t get_databytes () const;\n+ size_t get_n_elmts () const;\n+ void* get_dataptr () const;\nint bind(Socket &s_in);\n};\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -79,9 +79,11 @@ void Simulation\n{\nfor (auto &p : m.second[0]->processes)\n{\n- size_t n_elmts = p.second->s_out .size() ? p.second->s_out [0].get_n_elmts():\n- p.second->s_in_out.size() ? p.second->s_in_out[0].get_n_elmts():\n- p.second->s_in [0].get_n_elmts();\n+// size_t n_elmts = p.second->s_out .size() ? p.second->s_out [0].get_n_elmts():\n+// p.second->s_in_out.size() ? p.second->s_in_out[0].get_n_elmts():\n+// p.second->s_in [0].get_n_elmts();\n+\n+ size_t n_elmts = p.second->socket.back().get_n_elmts();\nauto module = m.second[0]->get_short_name();\nauto process = p.second->get_name();\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the sockets contral and management in the process.
8,490
27.09.2017 19:41:26
-7,200
46ae519280633b6e1d998680300fc2a52492cc0c
Improve the socket binding.
[ { "change_type": "MODIFY", "old_path": "src/Module/Socket.cpp", "new_path": "src/Module/Socket.cpp", "diff": "@@ -63,47 +63,119 @@ void* Socket::get_dataptr() const\nreturn this->dataptr;\n}\n-int Socket::bind(Socket &s_in)\n+int Socket::bind(Socket &s)\n{\n- if (s_in.datatype != this->datatype)\n+ if (s.datatype != this->datatype)\n{\nstd::stringstream message;\n- message << \"'s_in.datatype' has to be equal to 'datatype' ('s_in.datatype' = \" << type_to_string[s_in.datatype]\n+ message << \"'s.datatype' has to be equal to 'datatype' ('s.datatype' = \" << type_to_string[s.datatype]\n<< \", 'datatype' = \" << type_to_string[this->datatype]\n- << \", 'socket_out.name' = \" << get_name()\n- << \", 'socket_in.name' = \" << s_in.get_name()\n- << \", 'process_out.name' = \" << process.get_name()\n- << \", 'process_in.name' = \" << s_in.process.get_name()\n- << \", 'module_out.name' = \" << process.module.get_name()\n- << \", 'module_in.name' = \" << s_in.process.module.get_name() << \").\";\n+ << \", 'name' = \" << get_name()\n+ << \", 's.name' = \" << s.get_name()\n+ << \", 'process.name' = \" << process.get_name()\n+ << \", 's.process.name' = \" << s.process.get_name()\n+ << \", 'process.module.name' = \" << process.module.get_name()\n+ << \", 's.process.module.name' = \" << s.process.module.get_name() << \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n- if (s_in.databytes != this->databytes)\n+ if (s.databytes != this->databytes)\n{\nstd::stringstream message;\n- message << \"'s_in.databytes' has to be equal to 'databytes' ('s_in.databytes' = \" << s_in.databytes\n+ message << \"'s.databytes' has to be equal to 'databytes' ('s.databytes' = \" << s.databytes\n<< \", 'databytes' = \" << this->databytes\n- << \", 'socket_out.name' = \" << get_name()\n- << \", 'socket_in.name' = \" << s_in.get_name()\n- << \", 'process_out.name' = \" << process.get_name()\n- << \", 'process_in.name' = \" << s_in.process.get_name()\n- << \", 'module_out.name' = \" << process.module.get_name()\n- << \", 'module_in.name' = \" << s_in.process.module.get_name() << \").\";\n+ << \", 'name' = \" << get_name()\n+ << \", 's.name' = \" << s.get_name()\n+ << \", 'process.name' = \" << process.get_name()\n+ << \", 's.process.name' = \" << s.process.get_name()\n+ << \", 'process.module.name' = \" << process.module.get_name()\n+ << \", 's.process.module.name' = \" << s.process.module.get_name() << \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n- if (this->dataptr == nullptr)\n+ if (s.dataptr == nullptr)\n{\nstd::stringstream message;\n- message << \"'dataptr' can't be NULL ('dataptr' = \" << dataptr << \").\";\n+ message << \"'s.dataptr' can't be NULL.\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n- s_in.dataptr = this->dataptr;\n+ this->dataptr = s.dataptr;\n- if (s_in.process.is_autostart() && s_in.process.last_input_socket(s_in))\n- return s_in.process.exec();\n+ if (this->process.is_autostart() && this->process.last_input_socket(*this))\n+ return this->process.exec();\nelse\nreturn 0;\n}\n+\n+template <typename T, class A>\n+int Socket::bind(std::vector<T,A> &vector)\n+{\n+ if (vector.size() != this->get_n_elmts())\n+ {\n+ std::stringstream message;\n+ message << \"'vector.size()' has to be equal to 'get_n_elmts()' ('vector.size()' = \" << vector.size()\n+ << \", 'get_n_elmts()' = \" << get_n_elmts()\n+ << \", 'name' = \" << get_name()\n+ << \", 'process.name' = \" << process.get_name()\n+ << \", 'process.module.name' = \" << process.module.get_name() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return bind(vector.data());\n+}\n+\n+template <typename T>\n+int Socket::bind(T *array)\n+{\n+ if (type_to_string[typeid(T)] != type_to_string[this->datatype])\n+ {\n+ std::stringstream message;\n+ message << \"'T' has to be equal to 'datatype' ('T' = \" << type_to_string[typeid(T)]\n+ << \", 'datatype' = \" << type_to_string[this->datatype]\n+ << \", 'socket.name' = \" << get_name()\n+ << \", 'process.name' = \" << process.get_name()\n+ << \", 'module.name' = \" << process.module.get_name() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return bind(static_cast<void*>(array));\n+}\n+\n+int Socket::bind(void* dataptr)\n+{\n+ if (dataptr == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'s.dataptr' can't be NULL.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->dataptr = dataptr;\n+\n+ return 0;\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+template int aff3ct::module::Socket::bind<int8_t >(int8_t *);\n+template int aff3ct::module::Socket::bind<int16_t>(int16_t*);\n+template int aff3ct::module::Socket::bind<int32_t>(int32_t*);\n+template int aff3ct::module::Socket::bind<int64_t>(int64_t*);\n+template int aff3ct::module::Socket::bind<float >(float *);\n+template int aff3ct::module::Socket::bind<double >(double *);\n+\n+template int aff3ct::module::Socket::bind<int8_t >(std::vector<int8_t >&);\n+template int aff3ct::module::Socket::bind<int16_t>(std::vector<int16_t>&);\n+template int aff3ct::module::Socket::bind<int32_t>(std::vector<int32_t>&);\n+template int aff3ct::module::Socket::bind<int64_t>(std::vector<int64_t>&);\n+template int aff3ct::module::Socket::bind<float >(std::vector<float >&);\n+template int aff3ct::module::Socket::bind<double >(std::vector<double >&);\n+\n+#include <mipp.h>\n+template int aff3ct::module::Socket::bind<int8_t ,mipp::allocator<int8_t >>(std::vector<int8_t ,mipp::allocator<int8_t >>&);\n+template int aff3ct::module::Socket::bind<int16_t,mipp::allocator<int16_t>>(std::vector<int16_t,mipp::allocator<int16_t>>&);\n+template int aff3ct::module::Socket::bind<int32_t,mipp::allocator<int32_t>>(std::vector<int32_t,mipp::allocator<int32_t>>&);\n+template int aff3ct::module::Socket::bind<int64_t,mipp::allocator<int64_t>>(std::vector<int64_t,mipp::allocator<int64_t>>&);\n+template int aff3ct::module::Socket::bind<float ,mipp::allocator<float >>(std::vector<float ,mipp::allocator<float >>&);\n+template int aff3ct::module::Socket::bind<double ,mipp::allocator<double >>(std::vector<double ,mipp::allocator<double >>&);\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Socket.hpp", "new_path": "src/Module/Socket.hpp", "diff": "@@ -44,7 +44,15 @@ public:\nsize_t get_n_elmts () const;\nvoid* get_dataptr () const;\n- int bind(Socket &s_in);\n+ int bind(Socket &s);\n+\n+ template <typename T, class A = std::allocator<T>>\n+ int bind(std::vector<T,A> &vector);\n+\n+ template <typename T>\n+ inline int bind(T *array);\n+\n+ inline int bind(void* dataptr);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "diff": "@@ -64,7 +64,7 @@ void BFER_ite_threads<B,R,Q>\nstd::fill(enc_data, enc_data + enc_bytes, 0);\nstd::fill(itl_data, itl_data + itl_bytes, 0);\n- interleaver_bit[\"interleave\"][\"itl\"].bind(modem[\"modulate\"][\"X_N1\"]);\n+ modem[\"modulate\"][\"X_N1\"].bind(interleaver_bit[\"interleave\"][\"itl\"]);\n}\nif (this->params.err_track_enable)\n@@ -168,40 +168,40 @@ void BFER_ite_threads<B,R,Q>\nif (this->params.src->type != \"AZCW\")\n{\nsource [\"generate\" ].exec();\n- source [\"generate\" ][\"U_K\" ].bind(crc [\"build\" ][\"U_K1\"]);\n- crc [\"build\" ][\"U_K2\"].bind(encoder [\"encode\" ][\"U_K\" ]);\n- encoder [\"encode\" ][\"X_N\" ].bind(interleaver_bit[\"interleave\"][\"nat\" ]);\n- interleaver_bit[\"interleave\"][\"itl\" ].bind(modem [\"modulate\" ][\"X_N1\"]);\n+ crc [\"build\" ][\"U_K1\"].bind(source [\"generate\" ][\"U_K\" ]);\n+ encoder [\"encode\" ][\"U_K\" ].bind(crc [\"build\" ][\"U_K2\"]);\n+ interleaver_bit[\"interleave\"][\"nat\" ].bind(encoder [\"encode\" ][\"X_N\" ]);\n+ modem [\"modulate\" ][\"X_N1\"].bind(interleaver_bit[\"interleave\"][\"itl\" ]);\n}\nif (this->params.coset)\n{\n- if (this->params.coded_monitoring) encoder[\"encode\"][\"X_N\" ].bind(coset_bit[\"apply\"][\"ref\"]);\n- else crc [\"build\" ][\"U_K2\"].bind(coset_bit[\"apply\"][\"ref\"]);\n+ if (this->params.coded_monitoring) coset_bit[\"apply\"][\"ref\"].bind(encoder[\"encode\"][\"X_N\" ]);\n+ else coset_bit[\"apply\"][\"ref\"].bind(crc [\"build\" ][\"U_K2\"]);\n- encoder[\"encode\"][\"X_N\"].bind(coset_real[\"apply\"][\"ref\"]);\n+ coset_real[\"apply\"][\"ref\"].bind(encoder[\"encode\"][\"X_N\"]);\n}\n- if (this->params.coded_monitoring) encoder[\"encode\" ][\"X_N\"].bind(monitor[\"check_errors\"][\"U\"]);\n- else source [\"generate\"][\"U_K\"].bind(monitor[\"check_errors\"][\"U\"]);\n+ if (this->params.coded_monitoring) monitor[\"check_errors\"][\"U\"].bind(encoder[\"encode\" ][\"X_N\"]);\n+ else monitor[\"check_errors\"][\"U\"].bind(source [\"generate\"][\"U_K\"]);\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- modem [\"modulate\" ][\"X_N2\"].bind(channel [\"add_noise_wg\" ][\"X_N\" ]);\n- channel [\"add_noise_wg\" ][\"Y_N\" ].bind(modem [\"filter\" ][\"Y_N1\"]);\n- modem [\"filter\" ][\"Y_N2\"].bind(quantizer[\"process\" ][\"Y_N1\"]);\n- quantizer[\"process\" ][\"Y_N2\"].bind(modem [\"demodulate_wg\"][\"Y_N1\"]);\n- channel [\"add_noise_wg\" ][\"H_N\" ].bind(modem [\"demodulate_wg\"][\"H_N\" ]);\n+ channel [\"add_noise_wg\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N2\"]);\n+ modem [\"filter\" ][\"Y_N1\"].bind(channel [\"add_noise_wg\" ][\"Y_N\" ]);\n+ quantizer[\"process\" ][\"Y_N1\"].bind(modem [\"filter\" ][\"Y_N2\"]);\n+ modem [\"demodulate_wg\"][\"Y_N1\"].bind(quantizer[\"process\" ][\"Y_N2\"]);\n+ modem [\"demodulate_wg\"][\"H_N\" ].bind(channel [\"add_noise_wg\" ][\"H_N\" ]);\n}\nelse\n{\n- modem [\"modulate\" ][\"X_N2\"].bind(channel [\"add_noise\" ][\"X_N\" ]);\n- channel [\"add_noise\"][\"Y_N\" ].bind(modem [\"filter\" ][\"Y_N1\"]);\n- modem [\"filter\" ][\"Y_N2\"].bind(quantizer[\"process\" ][\"Y_N1\"]);\n- quantizer[\"process\" ][\"Y_N2\"].bind(modem [\"demodulate\"][\"Y_N1\"]);\n+ channel [\"add_noise\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N2\"]);\n+ modem [\"filter\" ][\"Y_N1\"].bind(channel [\"add_noise\"][\"Y_N\" ]);\n+ quantizer[\"process\" ][\"Y_N1\"].bind(modem [\"filter\" ][\"Y_N2\"]);\n+ modem [\"demodulate\"][\"Y_N1\"].bind(quantizer[\"process\" ][\"Y_N2\"]);\n}\n- modem[\"demodulate\"][\"Y_N2\"].bind(interleaver_llr[\"deinterleave\"][\"itl\"]);\n+ interleaver_llr[\"deinterleave\"][\"itl\"].bind(modem[\"demodulate\"][\"Y_N2\"]);\n// ------------------------------------------------------------------------------------------------------------\n// ------------------------------------------------------------------------------------ turbo demodulation loop\n@@ -211,84 +211,84 @@ void BFER_ite_threads<B,R,Q>\n// ------------------------------------------------------------------------------------------- CRC checking\nif (this->params.crc->type != \"NO\" && ite >= this->params.crc_start)\n{\n- interleaver_llr[\"deinterleave\" ][\"nat\"].bind(codec[\"extract_sys_bit\"][\"Y_N\"]);\n- if (codec [\"extract_sys_bit\"][\"V_K\"].bind(crc [\"check\" ][\"V_K\"]))\n+ codec [\"extract_sys_bit\"][\"Y_N\"].bind(interleaver_llr[\"deinterleave\" ][\"nat\"]);\n+ if (crc[\"check\" ][\"V_K\"].bind(codec [\"extract_sys_bit\"][\"V_K\"]))\nbreak;\n}\n// ----------------------------------------------------------------------------------------------- decoding\nif (this->params.coset)\n{\n- interleaver_llr[\"deinterleave\"][\"nat\" ].bind(coset_real [\"apply\" ][\"in_data\"]);\n- coset_real [\"apply\" ][\"out_data\"].bind(decoder_siso[\"decode_siso\"][\"Y_N1\" ]);\n- decoder_siso [\"decode_siso\" ][\"Y_N2\" ].bind(coset_real [\"apply\" ][\"in_data\"]);\n+ coset_real [\"apply\" ][\"in_data\"].bind(interleaver_llr[\"deinterleave\"][\"nat\" ]);\n+ decoder_siso[\"decode_siso\"][\"Y_N1\" ].bind(coset_real [\"apply\" ][\"out_data\"]);\n+ coset_real [\"apply\" ][\"in_data\"].bind(decoder_siso [\"decode_siso\" ][\"Y_N2\" ]);\n}\nelse\n{\n- interleaver_llr[\"deinterleave\"][\"nat\"].bind(decoder_siso[\"decode_siso\"][\"Y_N1\"]);\n+ decoder_siso[\"decode_siso\"][\"Y_N1\"].bind(interleaver_llr[\"deinterleave\"][\"nat\"]);\n}\n// ------------------------------------------------------------------------------------------- interleaving\n- if (this->params.coset) coset_real [\"apply\" ][\"out_data\"].bind(interleaver_llr[\"interleave\"][\"nat\"]);\n- else decoder_siso[\"decode_siso\"][\"Y_N2\" ].bind(interleaver_llr[\"interleave\"][\"nat\"]);\n+ if (this->params.coset) interleaver_llr[\"interleave\"][\"nat\"].bind(coset_real [\"apply\" ][\"out_data\"]);\n+ else interleaver_llr[\"interleave\"][\"nat\"].bind(decoder_siso[\"decode_siso\"][\"Y_N2\" ]);\n// ------------------------------------------------------------------------------------------- demodulation\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- quantizer [\"process\" ][\"Y_N2\"].bind(modem[\"tdemodulate_wg\"][\"Y_N1\"]);\n- channel [\"add_noise_wg\"][\"H_N\" ].bind(modem[\"tdemodulate_wg\"][\"H_N\" ]);\n- interleaver_llr[\"interleave\" ][\"itl\" ].bind(modem[\"tdemodulate_wg\"][\"Y_N2\"]);\n+ modem[\"tdemodulate_wg\"][\"Y_N1\"].bind(quantizer [\"process\" ][\"Y_N2\"]);\n+ modem[\"tdemodulate_wg\"][\"H_N\" ].bind(channel [\"add_noise_wg\"][\"H_N\" ]);\n+ modem[\"tdemodulate_wg\"][\"Y_N2\"].bind(interleaver_llr[\"interleave\" ][\"itl\" ]);\n}\nelse\n{\n- quantizer [\"process\" ][\"Y_N2\"].bind(modem[\"tdemodulate\"][\"Y_N1\"]);\n- interleaver_llr[\"interleave\"][\"itl\" ].bind(modem[\"tdemodulate\"][\"Y_N2\"]);\n+ modem[\"tdemodulate\"][\"Y_N1\"].bind(quantizer [\"process\" ][\"Y_N2\"]);\n+ modem[\"tdemodulate\"][\"Y_N2\"].bind(interleaver_llr[\"interleave\"][\"itl\" ]);\n}\n// ----------------------------------------------------------------------------------------- deinterleaving\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n- modem[\"tdemodulate_wg\"][\"Y_N3\"].bind(interleaver_llr[\"deinterleave\"][\"itl\"]);\n+ interleaver_llr[\"deinterleave\"][\"itl\"].bind(modem[\"tdemodulate_wg\"][\"Y_N3\"]);\nelse\n- modem[\"tdemodulate\" ][\"Y_N3\"].bind(interleaver_llr[\"deinterleave\"][\"itl\"]);\n+ interleaver_llr[\"deinterleave\"][\"itl\"].bind(modem[\"tdemodulate\" ][\"Y_N3\"]);\n}\nif (this->params.coset)\n{\n- interleaver_llr[\"deinterleave\"][\"nat\"].bind(coset_real[\"apply\"][\"in_data\"]);\n+ coset_real[\"apply\"][\"in_data\"].bind(interleaver_llr[\"deinterleave\"][\"nat\"]);\nif (this->params.coded_monitoring)\n{\n- coset_real [\"apply\" ][\"out_data\"].bind(decoder_siho[\"decode_siho_coded\"][\"Y_N\" ]);\n- decoder_siho[\"decode_siho_coded\"][\"V_N\" ].bind(coset_bit [\"apply\" ][\"in_data\"]);\n+ decoder_siho[\"decode_siho_coded\"][\"Y_N\" ].bind(coset_real [\"apply\" ][\"out_data\"]);\n+ coset_bit [\"apply\" ][\"in_data\"].bind(decoder_siho[\"decode_siho_coded\"][\"V_N\" ]);\n}\nelse\n{\n- coset_real [\"apply\" ][\"out_data\"].bind(decoder_siho[\"decode_siho\"][\"Y_N\" ]);\n- decoder_siho[\"decode_siho\"][\"V_K\" ].bind(coset_bit [\"apply\" ][\"in_data\"]);\n- coset_bit [\"apply\" ][\"out_data\"].bind(crc [\"extract\" ][\"V_K1\" ]);\n+ decoder_siho[\"decode_siho\"][\"Y_N\" ].bind(coset_real [\"apply\" ][\"out_data\"]);\n+ coset_bit [\"apply\" ][\"in_data\"].bind(decoder_siho[\"decode_siho\"][\"V_K\" ]);\n+ crc [\"extract\" ][\"V_K1\" ].bind(coset_bit [\"apply\" ][\"out_data\"]);\n}\n}\nelse\n{\nif (this->params.coded_monitoring)\n{\n- interleaver_llr[\"deinterleave\"][\"nat\"].bind(decoder_siho[\"decode_siho_coded\"][\"Y_N\"]);\n+ decoder_siho[\"decode_siho_coded\"][\"Y_N\"].bind(interleaver_llr[\"deinterleave\"][\"nat\"]);\n}\nelse\n{\n- interleaver_llr[\"deinterleave\"][\"nat\"].bind(decoder_siho[\"decode_siho\"][\"Y_N\" ]);\n- decoder_siho [\"decode_siho\" ][\"V_K\"].bind(crc [\"extract\" ][\"V_K1\"]);\n+ decoder_siho[\"decode_siho\"][\"Y_N\" ].bind(interleaver_llr[\"deinterleave\"][\"nat\"]);\n+ crc [\"extract\" ][\"V_K1\"].bind(decoder_siho [\"decode_siho\" ][\"V_K\"]);\n}\n}\nif (this->params.coded_monitoring)\n{\n- if (this->params.coset) coset_bit [\"apply\" ][\"out_data\"].bind(monitor[\"check_errors\"][\"V\"]);\n- else decoder_siho[\"decode_siho_coded\"][\"V_N\" ].bind(monitor[\"check_errors\"][\"V\"]);\n+ if (this->params.coset) monitor[\"check_errors\"][\"V\"].bind(coset_bit [\"apply\" ][\"out_data\"]);\n+ else monitor[\"check_errors\"][\"V\"].bind(decoder_siho[\"decode_siho_coded\"][\"V_N\" ]);\n}\nelse\n{\n- crc[\"extract\"][\"V_K2\"].bind(monitor[\"check_errors\"][\"V\"]);\n+ monitor[\"check_errors\"][\"V\"].bind(crc[\"extract\"][\"V_K2\"]);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "diff": "@@ -64,7 +64,7 @@ void BFER_std_threads<B,R,Q>\nstd::fill(enc_data, enc_data + enc_bytes, 0);\nstd::fill(pct_data, pct_data + pct_bytes, 0);\n- puncturer[\"puncture\"][\"X_N2\"].bind(modem[\"modulate\"][\"X_N1\"]);\n+ modem[\"modulate\"][\"X_N1\"].bind(puncturer[\"puncture\"][\"X_N2\"]);\n}\nif (this->params.err_track_enable)\n@@ -164,79 +164,79 @@ void BFER_std_threads<B,R,Q>\nif (this->params.src->type != \"AZCW\")\n{\nsource [\"generate\"].exec();\n- source [\"generate\"][\"U_K\" ].bind(crc [\"build\" ][\"U_K1\"]);\n- crc [\"build\" ][\"U_K2\"].bind(encoder [\"encode\" ][\"U_K\" ]);\n- encoder [\"encode\" ][\"X_N\" ].bind(puncturer[\"puncture\"][\"X_N1\"]);\n- puncturer[\"puncture\"][\"X_N2\"].bind(modem [\"modulate\"][\"X_N1\"]);\n+ crc [\"build\" ][\"U_K1\"].bind(source [\"generate\"][\"U_K\" ]);\n+ encoder [\"encode\" ][\"U_K\" ].bind(crc [\"build\" ][\"U_K2\"]);\n+ puncturer[\"puncture\"][\"X_N1\"].bind(encoder [\"encode\" ][\"X_N\" ]);\n+ modem [\"modulate\"][\"X_N1\"].bind(puncturer[\"puncture\"][\"X_N2\"]);\n}\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- modem [\"modulate\" ][\"X_N2\"].bind(channel [\"add_noise_wg\" ][\"X_N\" ]);\n- channel[\"add_noise_wg\" ][\"Y_N\" ].bind(modem [\"filter\" ][\"Y_N1\"]);\n- modem [\"filter\" ][\"Y_N2\"].bind(modem [\"demodulate_wg\"][\"Y_N1\"]);\n- channel[\"add_noise_wg\" ][\"H_N\" ].bind(modem [\"demodulate_wg\"][\"H_N\" ]);\n- modem [\"demodulate_wg\"][\"Y_N2\"].bind(quantizer[\"process\" ][\"Y_N1\"]);\n+ channel [\"add_noise_wg\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N2\"]);\n+ modem [\"filter\" ][\"Y_N1\"].bind(channel[\"add_noise_wg\" ][\"Y_N\" ]);\n+ modem [\"demodulate_wg\"][\"Y_N1\"].bind(modem [\"filter\" ][\"Y_N2\"]);\n+ modem [\"demodulate_wg\"][\"H_N\" ].bind(channel[\"add_noise_wg\" ][\"H_N\" ]);\n+ quantizer[\"process\" ][\"Y_N1\"].bind(modem [\"demodulate_wg\"][\"Y_N2\"]);\n}\nelse\n{\n- modem [\"modulate\" ][\"X_N2\"].bind(channel [\"add_noise\" ][\"X_N\" ]);\n- channel[\"add_noise\" ][\"Y_N\" ].bind(modem [\"filter\" ][\"Y_N1\"]);\n- modem [\"filter\" ][\"Y_N2\"].bind(modem [\"demodulate\"][\"Y_N1\"]);\n- modem [\"demodulate\"][\"Y_N2\"].bind(quantizer[\"process\" ][\"Y_N1\"]);\n+ channel [\"add_noise\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N2\"]);\n+ modem [\"filter\" ][\"Y_N1\"].bind(channel[\"add_noise\" ][\"Y_N\" ]);\n+ modem [\"demodulate\"][\"Y_N1\"].bind(modem [\"filter\" ][\"Y_N2\"]);\n+ quantizer[\"process\" ][\"Y_N1\"].bind(modem [\"demodulate\"][\"Y_N2\"]);\n}\n- quantizer[\"process\"][\"Y_N2\"].bind(puncturer[\"depuncture\"][\"Y_N1\"]);\n+ puncturer[\"depuncture\"][\"Y_N1\"].bind(quantizer[\"process\"][\"Y_N2\"]);\nif (this->params.coset)\n{\n- encoder [\"encode\" ][\"X_N\" ].bind(coset_real[\"apply\"][\"ref\" ]);\n- puncturer[\"depuncture\"][\"Y_N2\"].bind(coset_real[\"apply\"][\"in_data\"]);\n+ coset_real[\"apply\"][\"ref\" ].bind(encoder [\"encode\" ][\"X_N\" ]);\n+ coset_real[\"apply\"][\"in_data\"].bind(puncturer[\"depuncture\"][\"Y_N2\"]);\nif (this->params.coded_monitoring)\n{\n- coset_real[\"apply\" ][\"out_data\"].bind(decoder [\"decode_siho_coded\"][\"Y_N\" ]);\n- encoder [\"encode\" ][\"X_N\" ].bind(coset_bit[\"apply\" ][\"ref\" ]);\n- decoder [\"decode_siho_coded\"][\"V_N\" ].bind(coset_bit[\"apply\" ][\"in_data\"]);\n+ decoder [\"decode_siho_coded\"][\"Y_N\" ].bind(coset_real[\"apply\" ][\"out_data\"]);\n+ coset_bit[\"apply\" ][\"ref\" ].bind(encoder [\"encode\" ][\"X_N\" ]);\n+ coset_bit[\"apply\" ][\"in_data\"].bind(decoder [\"decode_siho_coded\"][\"V_N\" ]);\n}\nelse\n{\n- coset_real[\"apply\" ][\"out_data\"].bind(decoder [\"decode_siho\"][\"Y_N\" ]);\n- crc [\"build\" ][\"U_K2\" ].bind(coset_bit[\"apply\" ][\"ref\" ]);\n- decoder [\"decode_siho\"][\"V_K\" ].bind(coset_bit[\"apply\" ][\"in_data\"]);\n- coset_bit [\"apply\" ][\"out_data\"].bind(crc [\"extract\" ][\"V_K1\" ]);\n+ decoder [\"decode_siho\"][\"Y_N\" ].bind(coset_real[\"apply\" ][\"out_data\"]);\n+ coset_bit[\"apply\" ][\"ref\" ].bind(crc [\"build\" ][\"U_K2\" ]);\n+ coset_bit[\"apply\" ][\"in_data\"].bind(decoder [\"decode_siho\"][\"V_K\" ]);\n+ crc [\"extract\" ][\"V_K1\" ].bind(coset_bit [\"apply\" ][\"out_data\"]);\n}\n}\nelse\n{\nif (this->params.coded_monitoring)\n{\n- puncturer[\"depuncture\"][\"Y_N2\"].bind(decoder[\"decode_siho_coded\"][\"Y_N\"]);\n+ decoder[\"decode_siho_coded\"][\"Y_N\"].bind(puncturer[\"depuncture\"][\"Y_N2\"]);\n}\nelse\n{\n- puncturer[\"depuncture\" ][\"Y_N2\"].bind(decoder[\"decode_siho\"][\"Y_N\" ]);\n- decoder [\"decode_siho\"][\"V_K\" ].bind(crc [\"extract\" ][\"V_K1\"]);\n+ decoder[\"decode_siho\"][\"Y_N\" ].bind(puncturer[\"depuncture\" ][\"Y_N2\"]);\n+ crc [\"extract\" ][\"V_K1\"].bind(decoder [\"decode_siho\"][\"V_K\" ]);\n}\n}\nif (this->params.coded_monitoring)\n{\n- encoder[\"encode\"][\"X_N\"].bind(monitor[\"check_errors\"][\"U\"]);\n+ monitor[\"check_errors\"][\"U\"].bind(encoder[\"encode\"][\"X_N\"]);\nif (this->params.coset)\n{\n- coset_bit[\"apply\"][\"out_data\"].bind(monitor[\"check_errors\"][\"V\"]);\n+ monitor[\"check_errors\"][\"V\"].bind(coset_bit[\"apply\"][\"out_data\"]);\n}\nelse\n{\n- decoder[\"decode_siho_coded\"][\"V_N\"].bind(monitor[\"check_errors\"][\"V\"]);\n+ monitor[\"check_errors\"][\"V\"].bind(decoder[\"decode_siho_coded\"][\"V_N\"]);\n}\n}\nelse\n{\n- source[\"generate\"][\"U_K\" ].bind(monitor[\"check_errors\"][\"U\"]);\n- crc [\"extract\" ][\"V_K2\"].bind(monitor[\"check_errors\"][\"V\"]);\n+ monitor[\"check_errors\"][\"U\"].bind(source[\"generate\"][\"U_K\" ]);\n+ monitor[\"check_errors\"][\"V\"].bind(crc [\"extract\" ][\"V_K2\"]);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.cpp", "new_path": "src/Simulation/EXIT/EXIT.cpp", "diff": "@@ -217,10 +217,10 @@ void EXIT<B,R>\n}\nsource [\"generate\"].exec();\n- source [\"generate\"][\"U_K\" ].bind(monitor[\"check_mutual_info\"][\"bits\"]);\n- source [\"generate\"][\"U_K\" ].bind(modem_a[\"modulate\" ][\"X_N1\"]);\n- source [\"generate\"][\"U_K\" ].bind(encoder[\"encode\" ][\"U_K\" ]);\n- encoder[\"encode\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N1\"]);\n+ monitor[\"check_mutual_info\"][\"bits\"].bind(source [\"generate\"][\"U_K\"]);\n+ modem_a[\"modulate\" ][\"X_N1\"].bind(source [\"generate\"][\"U_K\"]);\n+ encoder[\"encode\" ][\"U_K\" ].bind(source [\"generate\"][\"U_K\"]);\n+ modem [\"modulate\" ][\"X_N1\"].bind(encoder[\"encode\" ][\"X_N\"]);\n//if sig_a = 0, La_K = 0, no noise to add\nif (sig_a != 0)\n@@ -228,40 +228,40 @@ void EXIT<B,R>\n// Rayleigh channel\nif (params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- modem_a [\"modulate\" ][\"X_N2\"].bind(channel_a[\"add_noise_wg\" ][\"X_N\" ]);\n- channel_a[\"add_noise_wg\"][\"Y_N\" ].bind(modem_a [\"demodulate_wg\"][\"Y_N1\"]);\n- channel_a[\"add_noise_wg\"][\"H_N\" ].bind(modem_a [\"demodulate_wg\"][\"H_N \"]);\n+ channel_a[\"add_noise_wg\" ][\"X_N\" ].bind(modem_a [\"modulate\" ][\"X_N2\"]);\n+ modem_a [\"demodulate_wg\"][\"Y_N1\"].bind(channel_a[\"add_noise_wg\"][\"Y_N\" ]);\n+ modem_a [\"demodulate_wg\"][\"H_N \"].bind(channel_a[\"add_noise_wg\"][\"H_N\" ]);\n}\nelse // additive channel (AWGN, USER, NO)\n{\n- modem_a [\"modulate\" ][\"X_N2\"].bind(channel_a[\"add_noise\" ][\"X_N\" ]);\n- channel_a[\"add_noise\"][\"Y_N\" ].bind(modem_a [\"demodulate\"][\"Y_N1\"]);\n+ channel_a[\"add_noise\" ][\"X_N\" ].bind(modem_a [\"modulate\" ][\"X_N2\"]);\n+ modem_a [\"demodulate\"][\"Y_N1\"].bind(channel_a[\"add_noise\"][\"Y_N\" ]);\n}\n}\n// Rayleigh channel\nif (params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- modem_a[\"demodulate_wg\"][\"Y_N2\"].bind(monitor[\"check_mutual_info\"][\"llrs_a\"]);\n- modem [\"modulate\" ][\"X_N2\"].bind(channel[\"add_noise_wg\" ][\"X_N\" ]);\n- channel[\"add_noise_wg\" ][\"Y_N\" ].bind(modem [\"demodulate_wg\" ][\"Y_N1\" ]);\n- channel[\"add_noise_wg\" ][\"H_N\" ].bind(modem [\"demodulate_wg\" ][\"H_N \" ]);\n- modem_a[\"demodulate_wg\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"ext\" ]);\n- modem [\"demodulate_wg\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"Y_N\" ]);\n- modem [\"demodulate_wg\"][\"Y_N2\"].bind(decoder[\"decode_siso\" ][\"Y_N1\" ]);\n+ monitor[\"check_mutual_info\"][\"llrs_a\"].bind(modem_a[\"demodulate_wg\"][\"Y_N2\"]);\n+ channel[\"add_noise_wg\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N2\"]);\n+ modem [\"demodulate_wg\" ][\"Y_N1\" ].bind(channel[\"add_noise_wg\" ][\"Y_N\" ]);\n+ modem [\"demodulate_wg\" ][\"H_N \" ].bind(channel[\"add_noise_wg\" ][\"H_N\" ]);\n+ codec [\"add_sys_ext\" ][\"ext\" ].bind(modem_a[\"demodulate_wg\"][\"Y_N2\"]);\n+ codec [\"add_sys_ext\" ][\"Y_N\" ].bind(modem [\"demodulate_wg\"][\"Y_N2\"]);\n+ decoder[\"decode_siso\" ][\"Y_N1\" ].bind(modem [\"demodulate_wg\"][\"Y_N2\"]);\n}\nelse // additive channel (AWGN, USER, NO)\n{\n- modem_a[\"demodulate\"][\"Y_N2\"].bind(monitor[\"check_mutual_info\"][\"llrs_a\"]);\n- modem [\"modulate\" ][\"X_N2\"].bind(channel[\"add_noise\" ][\"X_N\" ]);\n- channel[\"add_noise\" ][\"Y_N\" ].bind(modem [\"demodulate\" ][\"Y_N1\" ]);\n- modem_a[\"demodulate\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"ext\" ]);\n- modem [\"demodulate\"][\"Y_N2\"].bind(codec [\"add_sys_ext\" ][\"Y_N\" ]);\n- modem [\"demodulate\"][\"Y_N2\"].bind(decoder[\"decode_siso\" ][\"Y_N1\" ]);\n+ monitor[\"check_mutual_info\"][\"llrs_a\"].bind(modem_a[\"demodulate\"][\"Y_N2\"]);\n+ channel[\"add_noise\" ][\"X_N\" ].bind(modem [\"modulate\" ][\"X_N2\"]);\n+ modem [\"demodulate\" ][\"Y_N1\" ].bind(channel[\"add_noise\" ][\"Y_N\" ]);\n+ codec [\"add_sys_ext\" ][\"ext\" ].bind(modem_a[\"demodulate\"][\"Y_N2\"]);\n+ codec [\"add_sys_ext\" ][\"Y_N\" ].bind(modem [\"demodulate\"][\"Y_N2\"]);\n+ decoder[\"decode_siso\" ][\"Y_N1\" ].bind(modem [\"demodulate\"][\"Y_N2\"]);\n}\n- decoder[\"decode_siso\" ][\"Y_N2\"].bind(codec [\"extract_sys_llr\" ][\"Y_N\" ]);\n- codec [\"extract_sys_llr\"][\"Y_K\" ].bind(monitor[\"check_mutual_info\"][\"llrs_e\"]);\n+ codec [\"extract_sys_llr\" ][\"Y_N\" ].bind(decoder[\"decode_siso\" ][\"Y_N2\"]);\n+ monitor[\"check_mutual_info\"][\"llrs_e\"].bind(codec [\"extract_sys_llr\"][\"Y_K\" ]);\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the socket binding.
8,490
28.09.2017 15:45:34
-7,200
aee2de8345b5d4970b69e26393bd77eff047cfc6
Fix potential bugs.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -79,10 +79,6 @@ void Simulation\n{\nfor (auto &p : m.second[0]->processes)\n{\n-// size_t n_elmts = p.second->s_out .size() ? p.second->s_out [0].get_n_elmts():\n-// p.second->s_in_out.size() ? p.second->s_in_out[0].get_n_elmts():\n-// p.second->s_in [0].get_n_elmts();\n-\nsize_t n_elmts = p.second->socket.back().get_n_elmts();\nauto module = m.second[0]->get_short_name();\n@@ -177,10 +173,11 @@ void Simulation\nauto rmin_lat = (float)(rmin_duration.count() * 0.001f);\nauto rmax_lat = (float)(rmax_duration.count() * 0.001f);\n- std::stringstream sssp, ssrn_calls, ssrtot_dur, ssrpercent;\n+ std::stringstream spaces, sssp, ssrn_calls, ssrtot_dur, ssrpercent;\nstd::stringstream ssravg_thr, ssrmin_thr, ssrmax_thr;\nstd::stringstream ssravg_lat, ssrmin_lat, ssrmax_lat;\n+ spaces << std::fixed << std::setw(12) << \"-\";\nsssp << std::setprecision( 2) << std::fixed << std::setw( 7) << sp;\nssrn_calls << std::setprecision(rn_calls > l1 ? P : 2) << (rn_calls > l1 ? std::scientific : std::fixed) << std::setw( 8) << rn_calls;\nssrtot_dur << std::setprecision(rtot_dur > l1 ? P : 2) << (rtot_dur > l1 ? std::scientific : std::fixed) << std::setw( 8) << rtot_dur;\n@@ -193,7 +190,7 @@ void Simulation\nssrmax_lat << std::setprecision(rmax_lat > l1 ? P : 2) << (rmax_lat > l2 ? std::scientific : std::fixed) << std::setw( 8) << rmax_lat;\nstream << \"# \";\n- stream << tools::format(ssmodule .str(), tools::Style::ITALIC) << tools::format(\" | \", tools::Style::BOLD)\n+ stream << spaces.str() << tools::format(\" | \", tools::Style::BOLD)\n<< tools::format(ssprocess .str(), tools::Style::ITALIC) << tools::format(\" | \", tools::Style::BOLD)\n<< tools::format(sssp .str(), tools::Style::ITALIC) << tools::format(\" || \", tools::Style::BOLD)\n<< tools::format(ssrn_calls.str(), tools::Style::ITALIC) << tools::format(\" | \", tools::Style::BOLD)\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix potential bugs.
8,490
28.09.2017 15:46:12
-7,200
35ecf8815be97dbca765b940ad22d6d91dd09fa6
Fix bad display in the statistics.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "diff": "@@ -77,11 +77,14 @@ void BFER_ite<B,R,Q>\nthis->modules[\"quantizer\" ][tid] = quantizer [tid];\nthis->modules[\"coset_real\" ][tid] = coset_real [tid];\nthis->modules[\"decoder_siso\" ][tid] = codec [tid]->get_decoder_siso();\n- this->modules[\"decoder_siho\" ][tid] = codec [tid]->get_decoder_siho();\nthis->modules[\"coset_bit\" ][tid] = coset_bit [tid];\nthis->modules[\"interleaver_bit\"][tid] = interleaver_bit[tid];\nthis->modules[\"interleaver_llr\"][tid] = interleaver_llr[tid];\n+ if (dynamic_cast<module::Decoder*>(codec[tid]->get_decoder_siso()) !=\n+ dynamic_cast<module::Decoder*>(codec[tid]->get_decoder_siho()))\n+ this->modules[\"decoder_siho\"][tid] = codec[tid]->get_decoder_siho();\n+\nthis->monitor[tid]->add_handler_check(std::bind(&module::Codec_SISO_SIHO<B,Q>::reset, codec[tid]));\ninterleaver_core[tid]->init();\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bad display in the statistics.
8,490
28.09.2017 15:46:35
-7,200
d628eee44d04c0b532d8d1ab5a126cb96e30e682
Fix MPI compilation.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -137,7 +137,7 @@ void Launcher::launch()\n{\n// print the warnings\n#ifdef ENABLE_MPI\n- if (this->params->mpi_rank == 0)\n+ if (this->params.mpi_rank == 0)\n#endif\nfor (unsigned w = 0; w < cmd_warn.size(); w++)\nstd::clog << tools::format_warning(cmd_warn[w]) << std::endl;\n@@ -146,7 +146,7 @@ void Launcher::launch()\n// write the command and he curve name in the PyBER format\n#ifdef ENABLE_MPI\n- if (!this->params->pyber.empty() && this->params->mpi_rank == 0)\n+ if (!this->params.pyber.empty() && this->params.mpi_rank == 0)\n#else\nif (!this->params.pyber.empty())\n#endif\n@@ -158,13 +158,13 @@ void Launcher::launch()\n}\n#ifdef ENABLE_MPI\n- if (this->params->mpi_rank == 0)\n+ if (this->params.mpi_rank == 0)\n#endif\nthis->print_header();\n// print the warnings\n#ifdef ENABLE_MPI\n- if (this->params->mpi_rank == 0)\n+ if (this->params.mpi_rank == 0)\n#endif\nfor (unsigned w = 0; w < cmd_warn.size(); w++)\nstd::clog << tools::format_warning(cmd_warn[w]) << std::endl;\n@@ -182,7 +182,7 @@ void Launcher::launch()\n{\n// launch the simulation\n#ifdef ENABLE_MPI\n- if (this->params->mpi_rank == 0)\n+ if (this->params.mpi_rank == 0)\n#endif\nstream << \"# \" << \"The simulation is running...\" << std::endl;\n@@ -197,7 +197,7 @@ void Launcher::launch()\n}\n#ifdef ENABLE_MPI\n- if (this->params->mpi_rank == 0)\n+ if (this->params.mpi_rank == 0)\n#endif\nstream << \"# End of the simulation.\" << std::endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction_mpi.hpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction_mpi.hpp", "diff": "#include <mpi.h>\n-#include \"Monitor_reduction.hpp\"\n+#include \"Monitor_BFER_reduction.hpp\"\nnamespace aff3ct\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix MPI compilation.
8,490
28.09.2017 15:47:09
-7,200
1a36683bd9245e85c929a9754deb5202ebeb78fa
Add autoalloc option in the process + rename autostart in autoexec.
[ { "change_type": "MODIFY", "old_path": "src/Module/Module.hpp", "new_path": "src/Module/Module.hpp", "diff": "@@ -112,8 +112,8 @@ public:\nprotected:\nProcess& create_process(const std::string name)\n{\n- bool autostart = true, stats = true, debug = false;\n- processes[name] = new Process(*this, name, autostart, stats, debug);\n+ bool autoalloc = true, autoexec = true, stats = true, debug = false;\n+ processes[name] = new Process(*this, name, autoalloc, autoexec, stats, debug);\nreturn *processes[name];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Process.cpp", "new_path": "src/Module/Process.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-Process::Process(const Module &module, const std::string name, const bool autostart, const bool stats, const bool debug)\n+Process::Process(const Module &module, const std::string name, const bool autoalloc, const bool autoexec,\n+ const bool stats, const bool debug)\n: module(module),\nname(name),\n- autostart(autostart),\n+ autoalloc(autoalloc),\n+ autoexec(autoexec),\nstats(stats),\ndebug(debug),\ndebug_limit(-1),\n@@ -31,14 +33,26 @@ std::string Process::get_name() const\nreturn this->name;\n}\n-void Process::set_autostart(const bool autostart)\n+void Process::set_autoalloc(const bool autoalloc)\n{\n- this->autostart = autostart;\n+ this->autoalloc = autoalloc;\n+\n+ //TODO: free mem and set ptr to null in the socket (if autoalloc = false)\n}\n-bool Process::is_autostart() const\n+bool Process::is_autoalloc() const\n{\n- return this->autostart;\n+ return this->autoalloc;\n+}\n+\n+void Process::set_autoexec(const bool autoexec)\n+{\n+ this->autoexec = autoexec;\n+}\n+\n+bool Process::is_autoexec() const\n+{\n+ return this->autoexec;\n}\nvoid Process::set_stats(const bool stats)\n@@ -265,9 +279,12 @@ void Process::create_socket_out(const std::string name, const size_t n_elmts)\nsocket_type[s.get_name()] = Socket_type::OUT;\n// memory allocation\n+ if (is_autoalloc())\n+ {\nout_buffers.push_back(std::vector<uint8_t>(s.databytes));\ns.dataptr = out_buffers.back().data();\n}\n+}\nvoid Process::create_codelet(std::function<int(void)> codelet)\n{\n@@ -393,6 +410,7 @@ Socket_type Process::get_socket_type(const Socket &s) const\nvoid Process::register_duration(const std::string key)\n{\nthis->registered_duration.push_back(key);\n+ this->registered_n_calls [key] = 0;\nthis->registered_duration_total[key] = std::chrono::nanoseconds(0);\nthis->registered_duration_max [key] = std::chrono::nanoseconds(0);\nthis->registered_duration_min [key] = std::chrono::nanoseconds(0);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Process.hpp", "new_path": "src/Module/Process.hpp", "diff": "@@ -31,7 +31,8 @@ protected:\nconst Module &module;\nconst std::string name;\n- bool autostart;\n+ bool autoalloc;\n+ bool autoexec;\nbool stats;\nbool debug;\nint32_t debug_limit;\n@@ -58,19 +59,22 @@ public:\nProcess(const Module &module,\nconst std::string name,\n- const bool autostart = true,\n+ const bool autoalloc = false,\n+ const bool autoexec = false,\nconst bool stats = false,\nconst bool debug = false);\nvoid reset_stats();\n- void set_autostart (const bool autostart);\n+ void set_autoalloc (const bool autoalloc);\n+ void set_autoexec (const bool autoexec );\nvoid set_stats (const bool stats );\nvoid set_debug (const bool debug );\nvoid set_debug_limit (const uint32_t limit );\nvoid set_debug_precision(const uint8_t prec );\n- bool is_autostart() const;\n+ bool is_autoalloc() const;\n+ bool is_autoexec () const;\nbool is_stats () const;\nbool is_debug () const;\nbool can_exec () const;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Socket.cpp", "new_path": "src/Module/Socket.cpp", "diff": "@@ -102,7 +102,7 @@ int Socket::bind(Socket &s)\nthis->dataptr = s.dataptr;\n- if (this->process.is_autostart() && this->process.last_input_socket(*this))\n+ if (this->process.is_autoexec() && this->process.last_input_socket(*this))\nreturn this->process.exec();\nelse\nreturn 0;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add autoalloc option in the process + rename autostart in autoexec.
8,490
28.09.2017 15:57:19
-7,200
d380a6cec3f4b918b807cd60dbc1b3940c7eb3f4
Fix debug mode cosmetics.
[ { "change_type": "MODIFY", "old_path": "src/Module/Process.cpp", "new_path": "src/Module/Process.cpp", "diff": "@@ -94,7 +94,7 @@ static inline void display_data(const T *data,\n{\nfor (auto i = 0; i < (int)limit; i++)\nstd::cout << std::fixed << std::setprecision(p) << std::setw(p +3) << +data[i]\n- << (i < (int)fra_size -1 ? \", \" : \"\");\n+ << (i < (int)limit -1 ? \", \" : \"\");\nstd::cout << (limit < fra_size ? \", ...\" : \"\");\n}\nelse\n@@ -107,8 +107,8 @@ static inline void display_data(const T *data,\nstd::cout << (f >= 1 ? spaces : \"\") << fra_id << \"(\";\nfor (auto i = 0; i < (int)limit; i++)\nstd::cout << std::fixed << std::setprecision(p) << std::setw(p +3) << +data[f * fra_size +i]\n- << (i < (int)fra_size -1 ? \", \" : \"\");\n- std::cout << (limit < fra_size ? \"...\" : \"\") << \")\" << (f < (int)n_fra -1 ? \", \\n\" : \"\");\n+ << (i < (int)limit -1 ? \", \" : \"\");\n+ std::cout << (limit < fra_size ? \", ...\" : \"\") << \")\" << (f < (int)n_fra -1 ? \", \\n\" : \"\");\n}\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix debug mode cosmetics.
8,490
28.09.2017 16:04:55
-7,200
54da158dc8af81e08c42c80ef69f746e6cefafa6
Improve the autoalloc setter in the process.
[ { "change_type": "MODIFY", "old_path": "src/Module/Process.cpp", "new_path": "src/Module/Process.cpp", "diff": "@@ -34,10 +34,28 @@ std::string Process::get_name() const\n}\nvoid Process::set_autoalloc(const bool autoalloc)\n+{\n+ if (autoalloc != this->autoalloc)\n{\nthis->autoalloc = autoalloc;\n- //TODO: free mem and set ptr to null in the socket (if autoalloc = false)\n+ if (!autoalloc)\n+ {\n+ this->out_buffers.clear();\n+ for (auto &s : socket)\n+ if (get_socket_type(s) == OUT)\n+ s.dataptr = nullptr;\n+ }\n+ else\n+ {\n+ for (auto &s : socket)\n+ if (get_socket_type(s) == OUT)\n+ {\n+ out_buffers.push_back(std::vector<uint8_t>(s.databytes));\n+ s.dataptr = out_buffers.back().data();\n+ }\n+ }\n+ }\n}\nbool Process::is_autoalloc() const\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the autoalloc setter in the process.
8,490
29.09.2017 09:25:48
-7,200
ec9af9ade6e1c262d45478de30f856fafcfa1c39
By default all the features of a Task are set to false.
[ { "change_type": "MODIFY", "old_path": "src/Module/Module.hpp", "new_path": "src/Module/Module.hpp", "diff": "#include \"Task.hpp\"\n#include \"Tools/Exception/exception.hpp\"\n-\nnamespace aff3ct\n{\nnamespace module\n@@ -112,7 +111,7 @@ public:\nprotected:\nTask& create_task(const std::string name)\n{\n- bool autoalloc = true, autoexec = true, stats = true, debug = false;\n+ bool autoalloc = false, autoexec = false, stats = false, debug = false;\ntasks[name] = new Task(*this, name, autoalloc, autoexec, stats, debug);\nreturn *tasks[name];\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -25,12 +25,17 @@ void Simulation\n{\n_build_communication_chain();\n- // enable the debug mode in the modules\n- if (params.debug)\nfor (auto &m : modules)\nfor (auto mm : m.second)\nif (mm != nullptr)\nfor (auto &t : mm->tasks)\n+ {\n+ t.second->set_autoexec (true);\n+ t.second->set_autoalloc(true);\n+ t.second->set_stats (true);\n+\n+ // enable the debug mode in the modules\n+ if (params.debug)\n{\nt.second->set_debug(true);\nif (params.debug_limit)\n@@ -39,6 +44,7 @@ void Simulation\nt.second->set_debug_precision((uint8_t)params.debug_precision);\n}\n}\n+}\nvoid Simulation\n::display_stats(std::ostream &stream)\n" } ]
C++
MIT License
aff3ct/aff3ct
By default all the features of a Task are set to false.
8,490
02.10.2017 12:04:23
-7,200
043af4d8fe07179d0c703f36c57ee5b0b4d572d2
Fix compilation errors and warnings on clang.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp", "new_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp", "diff": "@@ -65,24 +65,24 @@ void Decoder_repetition::parameters\nif (full) headers[p].push_back(std::make_pair(\"Buffered\", (this->buffered ? \"on\" : \"off\")));\n}\n-template <typename B, typename R>\n-module::Decoder_SIHO<B,R>* Decoder_repetition::parameters\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_repetition::parameters\n::build() const\n{\nif (this->type == \"REPETITION\")\n{\n- if (this->implem == \"STD\" ) return new module::Decoder_repetition_std <B,R>(this->K, this->N_cw, this->buffered, this->n_frames);\n- else if (this->implem == \"FAST\") return new module::Decoder_repetition_fast<B,R>(this->K, this->N_cw, this->buffered, this->n_frames);\n+ if (this->implem == \"STD\" ) return new module::Decoder_repetition_std <B,Q>(this->K, this->N_cw, this->buffered, this->n_frames);\n+ else if (this->implem == \"FAST\") return new module::Decoder_repetition_fast<B,Q>(this->K, this->N_cw, this->buffered, this->n_frames);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n-template <typename B, typename R>\n-module::Decoder_SIHO<B,R>* Decoder_repetition\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_repetition\n::build(const parameters &params)\n{\n- return params.template build<B,R>();\n+ return params.template build<B,Q>();\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -113,7 +113,7 @@ void Simulation\nauto max_lat = (float)(max_duration.count() * 0.001f);\nunsigned l1 = 99999999;\n- unsigned l2 = 99999.99;\n+ float l2 = 99999.99;\nstd::stringstream ssmodule, ssprocess, sssp, ssn_calls, sstot_dur, sspercent;\nstd::stringstream ssavg_thr, ssmin_thr, ssmax_thr;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_GA.hpp", "new_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_GA.hpp", "diff": "@@ -29,8 +29,6 @@ private:\nconst double bisection_max = std::numeric_limits<double>::max();\n- const double epsilon = 0.00000000001;\n-\npublic:\nFrozenbits_generator_GA(const int K, const int N, const float sigma = 0.f);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix compilation errors and warnings on clang.
8,490
02.10.2017 13:37:51
-7,200
5a8371b0abd18be42bbe1590aba69c904ab91161
Update aff3ct.hpp.
[ { "change_type": "MODIFY", "old_path": "src/aff3ct.hpp", "new_path": "src/aff3ct.hpp", "diff": "+#ifndef AFF3CT_HPP\n+#define AFF3CT_HPP\n+\n//find ./src/ -type f -follow -print | grep \"[.]h$\"\n#include <Tools/general_utils.h>\n#include <Tools/types.h>\n-#include \"Tools/version.h\"\n#include <Tools/Math/matrix.h>\n#include <Tools/Math/utils.h>\n#include <Tools/Math/max.h>\n+#include <Tools/version.h>\n// #include <Tools/date.h>\n#include <Tools/Code/Polar/nodes_parser.h>\n#include <Tools/Code/Polar/API/functions_polar_inter_intra.h>\n#include <Tools/Perf/Transpose/transpose_SSE.h>\n#include <Tools/Perf/Transpose/transpose_selector.h>\n#include <Tools/Perf/Transpose/transpose_NEON.h>\n+#include <Tools/Perf/hard_decision.h>\n#include <Tools/Display/bash_tools.h>\n// #include <Tools/MSVC/dirent.h>\n//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n+#include <Tools/Interleaver/Random/Interleaver_core_random.hpp>\n+#include <Tools/Interleaver/Interleaver_core.hpp>\n+#include <Tools/Interleaver/Golden/Interleaver_core_golden.hpp>\n+#include <Tools/Interleaver/Row_column/Interleaver_core_row_column.hpp>\n+#include <Tools/Interleaver/User/Interleaver_core_user.hpp>\n+#include <Tools/Interleaver/Random_column/Interleaver_core_random_column.hpp>\n+#include <Tools/Interleaver/NO/Interleaver_core_NO.hpp>\n+#include <Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS1.hpp>\n+#include <Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS2.hpp>\n+#include <Tools/Interleaver/CCSDS/Interleaver_core_CCSDS.hpp>\n+#include <Tools/Interleaver/Column_row/Interleaver_core_column_row.hpp>\n+#include <Tools/Interleaver/LTE/Interleaver_core_LTE.hpp>\n#include <Tools/Threads/Barrier.hpp>\n#include <Tools/Math/Galois.hpp>\n#include <Tools/Algo/Sort/LC_sorter.hpp>\n#include <Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp>\n#include <Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp>\n#include <Tools/Code/Polar/Pattern_polar_parser.hpp>\n+#include <Tools/Code/Polar/Frozenbits_notifier.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/CRC/CRC_checker.hpp>\n#include <Tools/Arguments_reader.hpp>\n#include <Tools/Perf/Reorderer/Reorderer.hpp>\n-#include <Tools/Perf/hard_decision.h>\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.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/Turbo_DB/Codec_turbo_DB.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/RSC_DB/Codec_RSC_DB.hpp>\n-#include <Tools/Codec/Turbo/Codec_turbo.hpp>\n#include <Tools/Exception/out_of_range/out_of_range.hpp>\n#include <Tools/Exception/range_error/range_error.hpp>\n#include <Tools/Exception/cannot_allocate/cannot_allocate.hpp>\n#include <Tools/Exception/logic_error/logic_error.hpp>\n#include <Tools/Exception/exception.hpp>\n#include <Tools/Exception/domain_error/domain_error.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/Row_column/Interleaver_row_column.hpp>\n-#include <Module/Interleaver/Column_row/Interleaver_column_row.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/ARP/Interleaver_ARP_DVB_RCS1.hpp>\n-#include <Module/Interleaver/ARP/Interleaver_ARP_DVB_RCS2.hpp>\n-#include <Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp>\n-#include <Module/Interleaver/LTE/Interleaver_LTE.hpp>\n#include <Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp>\n-// #include <Module/Puncturer/SPU_Puncturer.hpp>\n#include <Module/Puncturer/Puncturer.hpp>\n#include <Module/Puncturer/Turbo_DB/Puncturer_turbo_DB.hpp>\n#include <Module/Puncturer/NO/Puncturer_NO.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/Polar/Encoder_polar_sys.hpp>\n#include <Module/Encoder/AZCW/Encoder_AZCW.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/Turbo_DB/Encoder_turbo_DB.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/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp>\n+#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2_constants_64800.hpp>\n#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2_constants.hpp>\n+#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2_constants_16200.hpp>\n#include <Module/Encoder/Coset/Encoder_coset.hpp>\n#include <Module/Encoder/User/Encoder_user.hpp>\n#include <Module/Encoder/BCH/Encoder_BCH.hpp>\n#include <Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp>\n#include <Module/Encoder/Turbo/Encoder_turbo.hpp>\n#include <Module/Encoder/Turbo/Encoder_turbo_legacy.hpp>\n+#include <Module/Task.hpp>\n#include <Module/Channel/Channel.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/Channel/SC_Channel.hpp>\n#include <Module/Channel/NO/Channel_NO.hpp>\n-#include <Module/Decoder/Decoder_SIHO.hpp>\n-#include <Module/Decoder/Decoder_HIHO.hpp>\n+#include <Module/Decoder/Decoder_SISO_SIHO.hpp>\n+#include <Module/Decoder/Decoder.hpp>\n#include <Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp>\n#include <Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp>\n#include <Module/Decoder/Polar/SC/Decoder_polar_SC_naive.hpp>\n#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp>\n#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.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/Decoder_SIHO_HIHO.hpp>\n+#include <Module/Decoder/Decoder_HIHO.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_SSE.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hpp>\n#include <Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp>\n-// #include <Module/Decoder/SPU_SISO.hpp>\n-#include <Module/Decoder/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/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/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.hpp>\n+#include <Module/Decoder/Decoder_SIHO.hpp>\n#include <Module/Decoder/BCH/Decoder_BCH.hpp>\n-#include <Module/Decoder/Decoder_SISO_SIHO.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/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_generic.hpp>\n+#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS2.hpp>\n#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR.hpp>\n#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS1.hpp>\n-#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS2.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo_fast.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo_std.hpp>\n-// #include <Module/Coset/SPU_Coset.hpp>\n+#include <Module/Socket.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/Bit/Coset_bit.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/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/EXIT/Monitor_EXIT.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/BFER/Monitor_BFER.hpp>\n+#include <Module/Monitor/BFER/Monitor_BFER_reduction.hpp>\n+#include <Module/Monitor/BFER/Monitor_BFER_reduction_mpi.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/Tricky/Quantizer_tricky.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/Polynomial/CRC_polynomial.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#include <Module/CRC/CRC.hpp>\n-// #include <Module/Modem/SC_Modem.hpp>\n-// #include <Module/Modem/SPU_Modem.hpp>\n#include <Module/Modem/BPSK/Modem_BPSK_fast.hpp>\n#include <Module/Modem/BPSK/Modem_BPSK.hpp>\n#include <Module/Modem/Modem.hpp>\n#include <Module/Modem/QAM/Modem_QAM.hpp>\n#include <Module/Modem/PAM/Modem_PAM.hpp>\n#include <Module/Modem/SCMA/Modem_SCMA.hpp>\n+#include <Module/SC_Module.hpp>\n#include <Module/Module.hpp>\n+#include <Module/Codec/Codec_SIHO.hpp>\n+#include <Module/Codec/Polar/Codec_polar.hpp>\n+#include <Module/Codec/Codec_SISO.hpp>\n+#include <Module/Codec/Codec_SISO_SIHO.hpp>\n+#include <Module/Codec/RSC/Codec_RSC.hpp>\n+#include <Module/Codec/Turbo_DB/Codec_turbo_DB.hpp>\n+#include <Module/Codec/Codec.hpp>\n+#include <Module/Codec/Repetition/Codec_repetition.hpp>\n+#include <Module/Codec/LDPC/Codec_LDPC.hpp>\n+#include <Module/Codec/Uncoded/Codec_uncoded.hpp>\n+#include <Module/Codec/BCH/Codec_BCH.hpp>\n+#include <Module/Codec/RA/Codec_RA.hpp>\n+#include <Module/Codec/RSC_DB/Codec_RSC_DB.hpp>\n+#include <Module/Codec/Turbo/Codec_turbo.hpp>\n+#include <Factory/Tools/Interleaver/Interleaver_core.hpp>\n#include <Factory/Tools/Code/Polar/Frozenbits_generator.hpp>\n#include <Factory/Tools/Code/Turbo/Flip_and_check.hpp>\n#include <Factory/Tools/Code/Turbo/Scaling_factor.hpp>\n#include <Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n#include <Factory/Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n#include <Factory/Factory.hpp>\n-#include <Factory/Module/Channel.hpp>\n-#include <Factory/Module/Monitor.hpp>\n-#include <Factory/Module/Modem.hpp>\n-#include <Factory/Module/Quantizer.hpp>\n-#include <Factory/Module/Coset.hpp>\n-#include <Factory/Module/Source.hpp>\n-#include <Factory/Module/Code/Decoder.hpp>\n-#include <Factory/Module/Code/Polar/Decoder_polar.hpp>\n-#include <Factory/Module/Code/Polar/Puncturer_polar.hpp>\n-#include <Factory/Module/Code/Polar/Encoder_polar.hpp>\n-#include <Factory/Module/Code/Polar/Decoder_polar_gen.hpp>\n-#include <Factory/Module/Code/RSC/Decoder_RSC.hpp>\n-#include <Factory/Module/Code/RSC/Encoder_RSC.hpp>\n-#include <Factory/Module/Code/Puncturer.hpp>\n-#include <Factory/Module/Code/Turbo_DB/Decoder_turbo_DB.hpp>\n-#include <Factory/Module/Code/Turbo_DB/Encoder_turbo_DB.hpp>\n-#include <Factory/Module/Code/Turbo_DB/Puncturer_turbo_DB.hpp>\n-#include <Factory/Module/Code/Repetition/Encoder_repetition.hpp>\n-#include <Factory/Module/Code/Repetition/Decoder_repetition.hpp>\n-#include <Factory/Module/Code/LDPC/Decoder_LDPC.hpp>\n-#include <Factory/Module/Code/LDPC/Encoder_LDPC.hpp>\n-#include <Factory/Module/Code/BCH/Encoder_BCH.hpp>\n-#include <Factory/Module/Code/BCH/Decoder_BCH.hpp>\n-#include <Factory/Module/Code/Encoder.hpp>\n-#include <Factory/Module/Code/NO/Decoder_NO.hpp>\n-#include <Factory/Module/Code/RA/Encoder_RA.hpp>\n-#include <Factory/Module/Code/RA/Decoder_RA.hpp>\n-#include <Factory/Module/Code/RSC_DB/Encoder_RSC_DB.hpp>\n-#include <Factory/Module/Code/RSC_DB/Decoder_RSC_DB.hpp>\n-#include <Factory/Module/Code/Turbo/Decoder_turbo.hpp>\n-#include <Factory/Module/Code/Turbo/Encoder_turbo.hpp>\n-#include <Factory/Module/Code/Turbo/Puncturer_turbo.hpp>\n-#include <Factory/Module/Interleaver.hpp>\n-#include <Factory/Module/CRC.hpp>\n+#include <Factory/Module/Interleaver/Interleaver.hpp>\n+#include <Factory/Module/Puncturer/Polar/Puncturer_polar.hpp>\n+#include <Factory/Module/Puncturer/Puncturer.hpp>\n+#include <Factory/Module/Puncturer/Turbo_DB/Puncturer_turbo_DB.hpp>\n+#include <Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n+#include <Factory/Module/Encoder/Polar/Encoder_polar.hpp>\n+#include <Factory/Module/Encoder/RSC/Encoder_RSC.hpp>\n+#include <Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp>\n+#include <Factory/Module/Encoder/Repetition/Encoder_repetition.hpp>\n+#include <Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp>\n+#include <Factory/Module/Encoder/BCH/Encoder_BCH.hpp>\n+#include <Factory/Module/Encoder/Encoder.hpp>\n+#include <Factory/Module/Encoder/RA/Encoder_RA.hpp>\n+#include <Factory/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp>\n+#include <Factory/Module/Encoder/Turbo/Encoder_turbo.hpp>\n+#include <Factory/Module/Channel/Channel.hpp>\n+#include <Factory/Module/Decoder/Decoder.hpp>\n+#include <Factory/Module/Decoder/Polar/Decoder_polar.hpp>\n+#include <Factory/Module/Decoder/RSC/Decoder_RSC.hpp>\n+#include <Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp>\n+#include <Factory/Module/Decoder/Repetition/Decoder_repetition.hpp>\n+#include <Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp>\n+#include <Factory/Module/Decoder/BCH/Decoder_BCH.hpp>\n+#include <Factory/Module/Decoder/NO/Decoder_NO.hpp>\n+#include <Factory/Module/Decoder/RA/Decoder_RA.hpp>\n+#include <Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.hpp>\n+#include <Factory/Module/Decoder/Turbo/Decoder_turbo.hpp>\n+#include <Factory/Module/Coset/Coset.hpp>\n+#include <Factory/Module/Source/Source.hpp>\n+#include <Factory/Module/Monitor/EXIT/Monitor_EXIT.hpp>\n+#include <Factory/Module/Monitor/Monitor.hpp>\n+#include <Factory/Module/Monitor/BFER/Monitor_BFER.hpp>\n+#include <Factory/Module/Quantizer/Quantizer.hpp>\n+#include <Factory/Module/CRC/CRC.hpp>\n+#include <Factory/Module/Modem/Modem.hpp>\n+#include <Factory/Module/Codec/Codec_SIHO.hpp>\n+#include <Factory/Module/Codec/Polar/Codec_polar.hpp>\n+#include <Factory/Module/Codec/Codec_SISO.hpp>\n+#include <Factory/Module/Codec/Codec_SISO_SIHO.hpp>\n+#include <Factory/Module/Codec/RSC/Codec_RSC.hpp>\n+#include <Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp>\n+#include <Factory/Module/Codec/Codec.hpp>\n+#include <Factory/Module/Codec/Repetition/Codec_repetition.hpp>\n+#include <Factory/Module/Codec/LDPC/Codec_LDPC.hpp>\n+#include <Factory/Module/Codec/Uncoded/Codec_uncoded.hpp>\n+#include <Factory/Module/Codec/BCH/Codec_BCH.hpp>\n+#include <Factory/Module/Codec/RA/Codec_RA.hpp>\n+#include <Factory/Module/Codec/RSC_DB/Codec_RSC_DB.hpp>\n+#include <Factory/Module/Codec/Turbo/Codec_turbo.hpp>\n#include <Factory/Launcher/Launcher.hpp>\n#include <Factory/Simulation/Simulation.hpp>\n#include <Factory/Simulation/EXIT/EXIT.hpp>\n#include <Simulation/BFER/Iterative/BFER_ite.hpp>\n#include <Simulation/BFER/BFER.hpp>\n// #include <aff3ct.hpp>\n+\n+#endif /* AFF3CT_HPP */\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Update aff3ct.hpp.
8,490
04.10.2017 14:31:13
-7,200
87aa2ac147e29fc899f9c1f7153f087ef20adce2
Re-implement the BFERI SystemC simulation.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.cpp", "diff": "@@ -65,6 +65,12 @@ void SC_BFER_ite<B,R,Q>\nthis->dumper[tid]->register_data(enc_data, enc_size, \"enc\", false, {(unsigned)this->params.cdc->enc->K});\n}\n}\n+\n+ this->monitor[tid]->add_handler_check([&]() -> void\n+ {\n+ if (this->monitor_red->fe_limit_achieved()) // will make the MPI communication\n+ sc_core::sc_stop();\n+ });\n}\ntemplate <typename B, typename R, typename Q>\n@@ -168,20 +174,28 @@ void SC_BFER_ite<B,R,Q>\nthis->duplicator[0] = new tools::SC_Duplicator(\"Duplicator0\");\nthis->duplicator[1] = new tools::SC_Duplicator(\"Duplicator1\");\n+ this->duplicator[5] = new tools::SC_Duplicator(\"Duplicator5\");\nif (this->params.coset)\n{\nthis->duplicator[2] = new tools::SC_Duplicator(\"Duplicator2\");\nthis->duplicator[3] = new tools::SC_Duplicator(\"Duplicator3\");\nthis->duplicator[4] = new tools::SC_Duplicator(\"Duplicator4\");\n}\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n+ {\n+ this->duplicator[6] = new tools::SC_Duplicator(\"Duplicator6\");\n+ }\n+\n+\nthis->router = new tools::SC_Router (p, \"Router\" );\n+ this->funnel = new tools::SC_Funnel (p, \"Funnel\" );\nthis->predicate = new tools::SC_Predicate(p, \"Predicate\");\nthis->bind_sockets();\nsc_core::sc_report_handler::set_actions(sc_core::SC_INFO, sc_core::SC_DO_NOTHING);\nsc_core::sc_start(); // start simulation\n- for (auto i = 0; i < 5; i++)\n+ for (auto i = 0; i < 7; i++)\nif (this->duplicator[i] != nullptr)\n{\ndelete this->duplicator[i];\n@@ -189,6 +203,7 @@ void SC_BFER_ite<B,R,Q>\n}\ndelete this->router; this->router = nullptr;\n+ delete this->funnel; this->funnel = nullptr;\ndelete this->predicate; this->predicate = nullptr;\nthis->erase_sc_modules();\n@@ -209,8 +224,11 @@ void SC_BFER_ite<B,R,Q>\nauto &duplicator2 = *this->duplicator[2];\nauto &duplicator3 = *this->duplicator[3];\nauto &duplicator4 = *this->duplicator[4];\n+ auto &duplicator5 = *this->duplicator[5];\n+ auto &duplicator6 = *this->duplicator[6];\nauto &router = *this->router;\n+ auto &funnel = *this->funnel;\nauto &predicate = *this->predicate;\nauto &source = *this->source [0];\n@@ -244,18 +262,25 @@ void SC_BFER_ite<B,R,Q>\ninterleaver_bit .sc[\"interleave\" ].s_out [\"itl\" ](modem .sc[\"modulate\" ].s_in [\"X_N1\" ]);\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nmodem .sc[\"modulate\" ].s_out [\"X_N2\" ](channel .sc[\"add_noise_wg\" ].s_in [\"X_N\" ]);\n- channel .sc[\"add_noise_wg\" ].s_out [\"H_N\" ](modem .sc[\"tdemodulate_wg\"].s_in[\"H_N\" ]);\n+ channel .sc[\"add_noise_wg\" ].s_out [\"H_N\" ](duplicator6 .s_in );\n+ duplicator6 .s_out1 (modem .sc[\"demodulate_wg\" ].s_in [\"H_N\" ]);\n+ duplicator6 .s_out2 (modem .sc[\"tdemodulate_wg\"].s_in [\"H_N\" ]);\nchannel .sc[\"add_noise_wg\" ].s_out [\"Y_N\" ](modem .sc[\"filter\" ].s_in [\"Y_N1\" ]);\nmodem .sc[\"filter\" ].s_out [\"Y_N2\" ](quantizer .sc[\"process\" ].s_in [\"Y_N1\" ]);\n- quantizer .sc[\"process\" ].s_out [\"Y_N2\" ](modem .sc[\"tdemodulate_wg\"].s_in[\"Y_N1\" ]);\n- modem .sc[\"tdemodulate_wg\"].s_out [\"Y_N3\" ](interleaver_llr.sc[\"deinterleave\" ].s_in[\"itl\" ]);\n+ quantizer .sc[\"process\" ].s_out [\"Y_N2\" ](duplicator5 .s_in );\n+ duplicator5 .s_out1 (modem .sc[\"tdemodulate_wg\"].s_in [\"Y_N1\" ]);\n+ duplicator5 .s_out2 (modem .sc[\"demodulate_wg\" ].s_in [\"Y_N1\" ]);\n+ modem .sc[\"demodulate_wg\" ].s_out [\"Y_N2\" ](funnel .s_in1 );\n} else {\nmodem .sc[\"modulate\" ].s_out [\"X_N2\" ](channel .sc[\"add_noise\" ].s_in [\"X_N\" ]);\nchannel .sc[\"add_noise\" ].s_out [\"Y_N\" ](modem .sc[\"filter\" ].s_in [\"Y_N1\" ]);\nmodem .sc[\"filter\" ].s_out [\"Y_N2\" ](quantizer .sc[\"process\" ].s_in [\"Y_N1\" ]);\n- quantizer .sc[\"process\" ].s_out [\"Y_N2\" ](modem .sc[\"tdemodulate\" ].s_in[\"Y_N1\" ]);\n- modem .sc[\"tdemodulate\" ].s_out [\"Y_N3\" ](interleaver_llr.sc[\"deinterleave\" ].s_in[\"itl\" ]);\n+ quantizer .sc[\"process\" ].s_out [\"Y_N2\" ](duplicator5 .s_in );\n+ duplicator5 .s_out1 (modem .sc[\"tdemodulate\" ].s_in [\"Y_N1\" ]);\n+ duplicator5 .s_out2 (modem .sc[\"demodulate\" ].s_in [\"Y_N1\" ]);\n+ modem .sc[\"demodulate\" ].s_out [\"Y_N2\" ](funnel .s_in1 );\n}\n+ funnel .s_out (interleaver_llr.sc[\"deinterleave\" ].s_in [\"itl\" ]);\ninterleaver_llr .sc[\"deinterleave\" ].s_out [\"nat\" ](coset_real .sc[\"apply\" ].s_in [\"in_data\"]);\ncoset_real .sc[\"apply\" ].s_out [\"out_data\"](router .s_in );\nrouter .s_out1 (decoder_siso .sc[\"decode_siso\" ].s_in [\"Y_N1\" ]);\n@@ -264,8 +289,10 @@ void SC_BFER_ite<B,R,Q>\ncoset_real_i .sc[\"apply\" ].s_out [\"out_data\"](interleaver_llr.sc[\"interleave\" ].s_in [\"nat\" ]);\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\ninterleaver_llr.sc[\"interleave\" ].s_out [\"itl\" ](modem .sc[\"tdemodulate_wg\"].s_in [\"Y_N2\" ]);\n+ modem .sc[\"tdemodulate_wg\"].s_out [\"Y_N3\" ](funnel .s_in2 );\n} else {\ninterleaver_llr.sc[\"interleave\" ].s_out [\"itl\" ](modem .sc[\"tdemodulate\" ].s_in [\"Y_N2\" ]);\n+ modem .sc[\"tdemodulate\" ].s_out [\"Y_N3\" ](funnel .s_in2 );\n}\ndecoder_siho .sc[\"decode_siho\" ].s_out [\"V_K\" ](coset_bit .sc[\"apply\" ].s_in [\"in_data\"]);\ncoset_bit .sc[\"apply\" ].s_out [\"out_data\"](crc .sc[\"extract\" ].s_in [\"V_K1\" ]);\n@@ -283,26 +310,35 @@ void SC_BFER_ite<B,R,Q>\ninterleaver_bit .sc[\"interleave\" ].s_out [\"itl\" ](modem .sc[\"modulate\" ].s_in [\"X_N1\"]);\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nmodem .sc[\"modulate\" ].s_out [\"X_N2\"](channel .sc[\"add_noise_wg\" ].s_in [\"X_N\" ]);\n- channel .sc[\"add_noise_wg\" ].s_out [\"H_N\" ](modem .sc[\"tdemodulate_wg\"].s_in[\"H_N\" ]);\n+ channel .sc[\"add_noise_wg\" ].s_out [\"H_N\" ](duplicator6 .s_in );\n+ duplicator6 .s_out1 (modem .sc[\"demodulate_wg\" ].s_in [\"H_N\" ]);\n+ duplicator6 .s_out2 (modem .sc[\"tdemodulate_wg\"].s_in [\"H_N\" ]);\nchannel .sc[\"add_noise_wg\" ].s_out [\"Y_N\" ](modem .sc[\"filter\" ].s_in [\"Y_N1\"]);\nmodem .sc[\"filter\" ].s_out [\"Y_N2\"](quantizer .sc[\"process\" ].s_in [\"Y_N1\"]);\n- quantizer .sc[\"process\" ].s_out [\"Y_N2\"](modem .sc[\"tdemodulate_wg\"].s_in[\"Y_N1\"]);\n- modem .sc[\"tdemodulate_wg\"].s_out [\"Y_N3\"](interleaver_llr.sc[\"deinterleave\" ].s_in[\"itl\" ]);\n+ quantizer .sc[\"process\" ].s_out [\"Y_N2\"](duplicator5 .s_in );\n+ duplicator5 .s_out1 (modem .sc[\"tdemodulate_wg\"].s_in [\"Y_N1\"]);\n+ duplicator5 .s_out2 (modem .sc[\"demodulate_wg\" ].s_in [\"Y_N1\"]);\n+ modem .sc[\"demodulate_wg\" ].s_out [\"Y_N2\"](funnel .s_in1 );\n} else {\nmodem .sc[\"modulate\" ].s_out [\"X_N2\"](channel .sc[\"add_noise\" ].s_in [\"X_N\" ]);\n- channel .sc[\"add_noise\" ].s_out [\"Y_N\" ](modem .sc[\"filter\" ].s_in[\"Y_N\" ]);\n+ channel .sc[\"add_noise\" ].s_out [\"Y_N\" ](modem .sc[\"filter\" ].s_in [\"Y_N1\"]);\nmodem .sc[\"filter\" ].s_out [\"Y_N2\"](quantizer .sc[\"process\" ].s_in [\"Y_N1\"]);\n- quantizer .sc[\"process\" ].s_out [\"Y_N2\"](modem .sc[\"tdemodulate\" ].s_in[\"Y_N1\"]);\n- modem .sc[\"tdemodulate\" ].s_out [\"Y_N3\"](interleaver_llr.sc[\"deinterleave\" ].s_in[\"itl\" ]);\n+ quantizer .sc[\"process\" ].s_out [\"Y_N2\"](duplicator5 .s_in );\n+ duplicator5 .s_out1 (modem .sc[\"tdemodulate\" ].s_in [\"Y_N1\"]);\n+ duplicator5 .s_out2 (modem .sc[\"demodulate\" ].s_in [\"Y_N1\"]);\n+ modem .sc[\"demodulate\" ].s_out [\"Y_N2\"](funnel .s_in1 );\n}\n+ funnel .s_out (interleaver_llr.sc[\"deinterleave\" ].s_in [\"itl\" ]);\ninterleaver_llr .sc[\"deinterleave\" ].s_out [\"nat\" ](router .s_in );\nrouter .s_out1 (decoder_siso .sc[\"decode_siso\" ].s_in [\"Y_N1\"]);\nrouter .s_out2 (decoder_siho .sc[\"decode_siho\" ].s_in [\"Y_N\" ]);\ndecoder_siso .sc[\"decode_siso\" ].s_out [\"Y_N2\"](interleaver_llr.sc[\"interleave\" ].s_in [\"nat\" ]);\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\ninterleaver_llr.sc[\"interleave\" ].s_out [\"itl\" ](modem .sc[\"tdemodulate_wg\"].s_in [\"Y_N2\"]);\n+ modem .sc[\"tdemodulate_wg\"].s_out [\"Y_N3\"](funnel .s_in2 );\n} else {\ninterleaver_llr.sc[\"interleave\" ].s_out [\"itl\" ](modem .sc[\"tdemodulate\" ].s_in [\"Y_N2\"]);\n+ modem .sc[\"tdemodulate\" ].s_out [\"Y_N3\"](funnel .s_in2 );\n}\ndecoder_siho .sc[\"decode_siho\" ].s_out [\"V_K\" ](crc .sc[\"extract\" ].s_in [\"V_K1\"]);\ncrc .sc[\"extract\" ].s_out [\"V_K2\"](duplicator1 .s_in );\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp", "new_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp", "diff": "#include \"Tools/SystemC/SC_Debug.hpp\"\n#include \"Tools/SystemC/SC_Router.hpp\"\n+#include \"Tools/SystemC/SC_Funnel.hpp\"\n#include \"Tools/SystemC/SC_Predicate.hpp\"\n#include \"Tools/SystemC/SC_Duplicator.hpp\"\n#include \"Tools/Display/Terminal/Terminal.hpp\"\n@@ -21,8 +22,9 @@ class SC_BFER_ite : public BFER_ite<B,R,Q>\nprotected:\nmodule::Coset<B,Q> *coset_real_i;\n- tools::SC_Duplicator *duplicator[5];\n+ tools::SC_Duplicator *duplicator[7];\ntools::SC_Router *router;\n+ tools::SC_Funnel *funnel;\ntools::SC_Predicate *predicate;\npublic:\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/SystemC/SC_Funnel.hpp", "diff": "+#if defined(SYSTEMC) || defined(SYSTEMC_MODULE)\n+\n+#ifndef SC_FUNNEL_HPP_\n+#define SC_FUNNEL_HPP_\n+\n+#include <string>\n+#include <typeinfo>\n+#include <systemc>\n+#include <tlm>\n+#include <tlm_utils/simple_target_socket.h>\n+#include <tlm_utils/simple_initiator_socket.h>\n+\n+#include \"Tools/Algo/Predicate.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+class SC_Funnel : sc_core::sc_module\n+{\n+ SC_HAS_PROCESS(SC_Funnel);\n+\n+public:\n+ tlm_utils::simple_target_socket <SC_Funnel> s_in1;\n+ tlm_utils::simple_target_socket <SC_Funnel> s_in2;\n+ tlm_utils::simple_initiator_socket<SC_Funnel> s_out;\n+\n+private:\n+ Predicate &p;\n+\n+public:\n+ SC_Funnel(Predicate &p, sc_core::sc_module_name name = \"SC_Double_input\")\n+ : sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"), s_out(\"s_out\"), p(p)\n+ {\n+ s_in1.register_b_transport(this, &SC_Funnel::b_transport);\n+ s_in2.register_b_transport(this, &SC_Funnel::b_transport);\n+ }\n+\n+private:\n+ void b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+ {\n+ sc_core::sc_time zero_time(sc_core::SC_ZERO_TIME);\n+ s_out->b_transport(trans, zero_time);\n+ }\n+};\n+}\n+}\n+\n+#endif /* SC_FUNNEL_HPP_ */\n+\n+#endif /* SYSTEMC */\n" } ]
C++
MIT License
aff3ct/aff3ct
Re-implement the BFERI SystemC simulation.
8,490
04.10.2017 15:25:48
-7,200
c3e584d2f036c583cc23263a012567178777faad
Remove useless throw for MPI and debug mode + and the coset_real_i object in the module list.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -45,11 +45,6 @@ BFER<B,R,Q>\ndumper_red ( nullptr),\nterminal ( nullptr)\n{\n-#ifdef ENABLE_MPI\n- if (params.debug)\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"The debug modes is unavailable in MPI.\");\n-#endif\n-\nif (params.n_threads < 1)\n{\nstd::stringstream message;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.cpp", "diff": "@@ -29,6 +29,8 @@ SC_BFER_ite<B,R,Q>\nif (params.coded_monitoring)\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support the coded \"\n\"monitoring.\");\n+\n+ this->modules[\"coset_real_i\"] = std::vector<module::Module*>(params.n_threads, nullptr);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -43,6 +45,8 @@ void SC_BFER_ite<B,R,Q>\n{\nBFER_ite<B,R,Q>::__build_communication_chain(tid);\n+ this->modules[\"coset_real_i\"][tid] = coset_real_i;\n+\nthis->interleaver_bit[tid]->rename(this->interleaver_llr[tid]->get_name() + \"_bit\");\nthis->interleaver_llr[tid]->rename(this->interleaver_llr[tid]->get_name() + \"_llr\");\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove useless throw for MPI and debug mode + and the coset_real_i object in the module list.
8,490
04.10.2017 16:46:22
-7,200
9ecd950d09740248232e568c0383624c980f62b8
Remove StarPU from AFF3CT.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/BFER/BFER.cpp", "new_path": "src/Factory/Simulation/BFER/BFER.cpp", "diff": "@@ -80,7 +80,7 @@ void BFER::parameters\nvoid BFER::parameters\n::store(const arg_val_map &vals)\n{\n-#if !defined(STARPU) && !defined(SYSTEMC)\n+#if !defined(SYSTEMC)\nthis->n_threads = std::thread::hardware_concurrency() ? std::thread::hardware_concurrency() : 1;\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/BFER/BFER_ite.cpp", "new_path": "src/Factory/Simulation/BFER/BFER_ite.cpp", "diff": "@@ -95,8 +95,6 @@ simulation::BFER_ite<B,R,Q>* BFER_ite::parameters\n{\n#if defined(SYSTEMC)\nreturn new simulation::SC_BFER_ite<B,R,Q>(*this);\n-#elif defined(STARPU)\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation is not available.\");\n#else\nreturn new simulation::BFER_ite_threads<B,R,Q>(*this);\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/BFER/BFER_std.cpp", "new_path": "src/Factory/Simulation/BFER/BFER_std.cpp", "diff": "-#include \"Simulation/BFER/Standard/StarPU/SPU_BFER_std.hpp\"\n#include \"Simulation/BFER/Standard/SystemC/SC_BFER_std.hpp\"\n#include \"Simulation/BFER/Standard/Threads/BFER_std_threads.hpp\"\n@@ -64,8 +63,6 @@ simulation::BFER_std<B,R,Q>* BFER_std::parameters\n{\n#if defined(SYSTEMC)\nreturn new simulation::SC_BFER_std<B,R,Q>(*this);\n-#elif defined(STARPU)\n- return new simulation::SPU_BFER_std<B,R,Q>(*this);\n#else\nreturn new simulation::BFER_std_threads<B,R,Q>(*this);\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/EXIT/EXIT.cpp", "new_path": "src/Factory/Simulation/EXIT/EXIT.cpp", "diff": "@@ -104,8 +104,6 @@ simulation::EXIT<B,R>* EXIT::parameters\n{\n#if defined(SYSTEMC)\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"SystemC/TLM simulation is not available.\");\n-#elif defined(STARPU)\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation is not available.\");\n#else\nreturn new simulation::EXIT<B,R>(*this);\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.cpp", "new_path": "src/Factory/Simulation/Simulation.cpp", "diff": "@@ -68,15 +68,9 @@ void Simulation::parameters\n{\"\",\n\"display statistics module by module.\"};\n-#ifndef STARPU\nopt_args[{p+\"-threads\", \"t\"}] =\n{\"positive_int\",\n\"enable multi-threaded mode and specify the number of threads.\"};\n-#else\n- opt_args[{p+\"-conc-tasks\", \"t\"}] =\n- {\"positive_int\",\n- \"set the task concurrency level (default is 1, no concurrency).\"};\n-#endif\nopt_args[{p+\"-seed\", \"S\"}] =\n{\"positive_int\",\n@@ -125,12 +119,8 @@ void Simulation::parameters\nthis->snr_max += 0.0001f; // hack to avoid the miss of the last snr\n-#ifndef STARPU\nif(exist(vals, {p+\"-threads\", \"t\"}) && std::stoi(vals.at({p+\"-threads\", \"t\"})) > 0)\nif(exist(vals, {p+\"-threads\", \"t\"})) this->n_threads = std::stoi(vals.at({p+\"-threads\", \"t\"}));\n-#else\n- if(exist(vals, {p+\"-conc-tasks\", \"t\"})) this->n_threads = std::stoi(vals.at({p+\"-conc-tasks\", \"t\"}));\n-#endif\n#ifdef ENABLE_MPI\nMPI_Comm_size(MPI_COMM_WORLD, &this->mpi_size);\n@@ -197,13 +187,9 @@ void Simulation::parameters\nheaders[p].push_back(std::make_pair(\"MPI size\", std::to_string(this->mpi_size )));\n#endif\n-#ifdef STARPU\n- headers[p].push_back(std::make_pair(\"Task concurrency level (t)\", std::to_string(this->n_threads)));\n-#else\nstd::string threads = \"unused\";\nif (this->n_threads)\nthreads = std::to_string(this->n_threads) + \" thread(s)\";\nheaders[p].push_back(std::make_pair(\"Multi-threading (t)\", threads));\n-#endif\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Simulation/EXIT.cpp", "new_path": "src/Launcher/Simulation/EXIT.cpp", "diff": "@@ -179,10 +179,10 @@ template <typename B, typename R>\nsimulation::Simulation* EXIT<B,R>\n::build_simu()\n{\n-#if !defined(SYSTEMC) && !defined(STARPU)\n+#if !defined(SYSTEMC)\nreturn factory::EXIT::build<B,R>(params);\n#else\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"SystemC/TLM and StarPU simulation are not available.\");\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"SystemC/TLM simulation is not available.\");\n#endif\n}\n" }, { "change_type": "DELETE", "old_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.cpp", "new_path": null, "diff": "-#ifdef STARPU\n-\n-#include <iostream>\n-\n-#include \"Tools/Exception/exception.hpp\"\n-#include \"Tools/Display/bash_tools.h\"\n-\n-#include \"SPU_BFER_std.hpp\"\n-\n-using namespace aff3ct;\n-using namespace aff3ct::simulation;\n-\n-template <typename B, typename R, typename Q>\n-SPU_BFER_std<B,R,Q>\n-::SPU_BFER_std(const factory::BFER_std::parameters &params, tools::Codec<B,Q> &codec)\n-: BFER_std<B,R,Q>(params, codec),\n-\n- task_names(this->params.n_threads, std::vector<std::string>(15)),\n- frame_id(0),\n-\n- U_K1(this->params.n_threads, mipp::vector<B>(this->params.src->K * this->params.src->n_frames)),\n- U_K2(this->params.n_threads, mipp::vector<B>(this->params.enc->K * this->params.enc->n_frames)),\n- X_N1(this->params.n_threads, mipp::vector<B>(this->params.enc->N_cw * this->params.enc->n_frames)),\n- X_N2(this->params.n_threads, mipp::vector<B>(this->params.pct->N * this->params.pct->n_frames)),\n- X_N3(this->params.n_threads, mipp::vector<R>(this->params.mdm->N_mod * this->params.mdm->n_frames)),\n- H_N (this->params.n_threads, mipp::vector<R>(this->params.chn->N * this->params.chn->n_frames)),\n- Y_N1(this->params.n_threads, mipp::vector<R>(this->params.chn->N * this->params.chn->n_frames)),\n- Y_N2(this->params.n_threads, mipp::vector<R>(this->params.mdm->N_fil * this->params.mdm->n_frames)),\n- Y_N3(this->params.n_threads, mipp::vector<R>(this->params.mdm->N * this->params.mdm->n_frames)),\n- Y_N4(this->params.n_threads, mipp::vector<Q>(this->params.qnt->size * this->params.qnt->n_frames)),\n- Y_N5(this->params.n_threads, mipp::vector<Q>(this->params.pct->N_cw * this->params.pct->n_frames)),\n- V_K1(this->params.n_threads, mipp::vector<B>(this->params.dec->K * this->params.dec->n_frames)),\n- V_K2(this->params.n_threads, mipp::vector<B>(this->params.crc->K * this->params.crc->n_frames)),\n-\n- spu_U_K1(this->params.n_threads),\n- spu_U_K2(this->params.n_threads),\n- spu_X_N1(this->params.n_threads),\n- spu_X_N2(this->params.n_threads),\n- spu_X_N3(this->params.n_threads),\n- spu_H_N (this->params.n_threads),\n- spu_Y_N1(this->params.n_threads),\n- spu_Y_N2(this->params.n_threads),\n- spu_Y_N3(this->params.n_threads),\n- spu_Y_N4(this->params.n_threads),\n- spu_Y_N5(this->params.n_threads),\n- spu_V_K1(this->params.n_threads),\n- spu_V_K2(this->params.n_threads)\n-{\n- if (params.debug)\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation does not support the debug \"\n- \"mode.\");\n-\n- if (params.benchs)\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation does not support the bench \"\n- \"mode.\");\n-\n- if (params.coded_monitoring)\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation does not support the coded \"\n- \"monitoring.\");\n-\n- if (params.time_report)\n- std::clog << tools::format_warning(\"The time report is not available in the StarPU simulation.\") << std::endl;\n-\n- // initialize StarPU with default configuration\n- auto ret = starpu_init(NULL);\n- STARPU_CHECK_RETURN_VALUE(ret, \"starpu_init\");\n-\n- // Tell StaPU to associate the \"vector\" vector with the \"vector_handle\"\n- // identifier. When a task needs to access a piece of data, it should\n- // refer to the handle that is associated to it.\n- // In the case of the \"vector\" data interface:\n- // - the first argument of the registration method is a pointer to the\n- // handle that should describe the data\n- // - the second argument is the memory node where the data (ie. \"vector\")\n- // resides initially: STARPU_MAIN_RAM stands for an address in main memory, as\n- // opposed to an adress on a GPU for instance.\n- // - the third argument is the adress of the vector in RAM\n- // - the fourth argument is the number of elements in the vector\n- // - the fifth argument is the size of each element.\n- for (auto tid = 0; tid < this->params.n_threads; tid++)\n- {\n- starpu_vector_data_register(&spu_U_K1[tid], STARPU_MAIN_RAM, (uintptr_t)U_K1[tid].data(), U_K1[tid].size(), sizeof(B));\n- starpu_vector_data_register(&spu_U_K2[tid], STARPU_MAIN_RAM, (uintptr_t)U_K2[tid].data(), U_K2[tid].size(), sizeof(B));\n- starpu_vector_data_register(&spu_X_N1[tid], STARPU_MAIN_RAM, (uintptr_t)X_N1[tid].data(), X_N1[tid].size(), sizeof(B));\n- starpu_vector_data_register(&spu_X_N2[tid], STARPU_MAIN_RAM, (uintptr_t)X_N2[tid].data(), X_N2[tid].size(), sizeof(B));\n- starpu_vector_data_register(&spu_X_N3[tid], STARPU_MAIN_RAM, (uintptr_t)X_N3[tid].data(), X_N3[tid].size(), sizeof(R));\n- starpu_vector_data_register(&spu_Y_N1[tid], STARPU_MAIN_RAM, (uintptr_t)Y_N1[tid].data(), Y_N1[tid].size(), sizeof(R));\n- starpu_vector_data_register(&spu_H_N [tid], STARPU_MAIN_RAM, (uintptr_t)H_N [tid].data(), H_N [tid].size(), sizeof(R));\n- starpu_vector_data_register(&spu_Y_N2[tid], STARPU_MAIN_RAM, (uintptr_t)Y_N2[tid].data(), Y_N2[tid].size(), sizeof(R));\n- starpu_vector_data_register(&spu_Y_N3[tid], STARPU_MAIN_RAM, (uintptr_t)Y_N3[tid].data(), Y_N3[tid].size(), sizeof(R));\n- starpu_vector_data_register(&spu_Y_N4[tid], STARPU_MAIN_RAM, (uintptr_t)Y_N4[tid].data(), Y_N4[tid].size(), sizeof(Q));\n- starpu_vector_data_register(&spu_Y_N5[tid], STARPU_MAIN_RAM, (uintptr_t)Y_N5[tid].data(), Y_N5[tid].size(), sizeof(Q));\n- starpu_vector_data_register(&spu_V_K1[tid], STARPU_MAIN_RAM, (uintptr_t)V_K1[tid].data(), V_K1[tid].size(), sizeof(B));\n- starpu_vector_data_register(&spu_V_K2[tid], STARPU_MAIN_RAM, (uintptr_t)V_K2[tid].data(), V_K2[tid].size(), sizeof(B));\n-\n- starpu_data_set_user_data(spu_U_K1[tid], (void*)&U_K1[tid]);\n- starpu_data_set_user_data(spu_U_K2[tid], (void*)&U_K2[tid]);\n- starpu_data_set_user_data(spu_X_N1[tid], (void*)&X_N1[tid]);\n- starpu_data_set_user_data(spu_X_N2[tid], (void*)&X_N2[tid]);\n- starpu_data_set_user_data(spu_X_N3[tid], (void*)&X_N3[tid]);\n- starpu_data_set_user_data(spu_Y_N1[tid], (void*)&Y_N1[tid]);\n- starpu_data_set_user_data(spu_H_N [tid], (void*)&H_N [tid]);\n- starpu_data_set_user_data(spu_Y_N2[tid], (void*)&Y_N2[tid]);\n- starpu_data_set_user_data(spu_Y_N3[tid], (void*)&Y_N3[tid]);\n- starpu_data_set_user_data(spu_Y_N4[tid], (void*)&Y_N4[tid]);\n- starpu_data_set_user_data(spu_Y_N5[tid], (void*)&Y_N5[tid]);\n- starpu_data_set_user_data(spu_V_K1[tid], (void*)&V_K1[tid]);\n- starpu_data_set_user_data(spu_V_K2[tid], (void*)&V_K2[tid]);\n- }\n-}\n-\n-template <typename B, typename R, typename Q>\n-SPU_BFER_std<B,R,Q>\n-::~SPU_BFER_std()\n-{\n- // StarPU does not need to manipulate the arrays anymore so we can stop monitoring them\n- for (auto tid = 0; tid < this->params.n_threads; tid++)\n- {\n- starpu_data_unregister(spu_U_K1[tid]);\n- starpu_data_unregister(spu_U_K2[tid]);\n- starpu_data_unregister(spu_X_N1[tid]);\n- starpu_data_unregister(spu_X_N2[tid]);\n- starpu_data_unregister(spu_X_N3[tid]);\n- starpu_data_unregister(spu_Y_N1[tid]);\n- starpu_data_unregister(spu_H_N [tid]);\n- starpu_data_unregister(spu_Y_N2[tid]);\n- starpu_data_unregister(spu_Y_N3[tid]);\n- starpu_data_unregister(spu_Y_N4[tid]);\n- starpu_data_unregister(spu_Y_N5[tid]);\n- starpu_data_unregister(spu_V_K1[tid]);\n- starpu_data_unregister(spu_V_K2[tid]);\n- }\n-\n- /* terminate StarPU, no task can be submitted after */\n- starpu_shutdown();\n-}\n-\n-template <typename B, typename R, typename Q>\n-void SPU_BFER_std<B,R,Q>\n-::__build_communication_chain(const int tid)\n-{\n- BFER_std<B,R,Q>::__build_communication_chain(tid);\n-\n- if (this->params.src->type == \"AZCW\")\n- {\n- std::fill(this->U_K1[tid].begin(), this->U_K1[tid].end(), (B)0);\n- std::fill(this->U_K2[tid].begin(), this->U_K2[tid].end(), (B)0);\n- std::fill(this->X_N1[tid].begin(), this->X_N1[tid].end(), (B)0);\n- std::fill(this->X_N2[tid].begin(), this->X_N2[tid].end(), (B)0);\n- this->modem[tid]->modulate(this->X_N2[tid], this->X_N3[tid]);\n- }\n-\n- if (this->params.err_track_enable)\n- {\n- if (this->params.src->type != \"AZCW\")\n- this->dumper[tid]->register_data(U_K1[tid], \"src\", false, {});\n-\n- if (this->params.coset)\n- this->dumper[tid]->register_data(X_N1[tid], \"enc\", false, {(unsigned)this->params.enc->K});\n-\n- this->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\n-\n- if (this->interleaver[tid] != nullptr && this->interleaver[tid]->is_uniform())\n- this->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\n- }\n-}\n-\n-template <typename B, typename R, typename Q>\n-void SPU_BFER_std<B,R,Q>\n-::_launch()\n-{\n- // Monte Carlo simulation\n- while (!this->monitor_red->fe_limit_achieved() &&\n- (this->monitor_red->get_n_analyzed_fra() < this->max_fra || this->max_fra == 0))\n- {\n- for (auto tid = 0; tid < this->params.n_threads; tid++)\n- this->seq_tasks_submission(tid);\n-\n- starpu_task_wait_for_all();\n- }\n-}\n-\n-template <typename B, typename R, typename Q>\n-void SPU_BFER_std<B,R,Q>\n-::seq_tasks_submission(const int tid)\n-{\n- const std::string str_id = std::to_string(frame_id);\n-\n- if (this->params.src->type != \"AZCW\")\n- {\n- auto task_gen_source = module::Source <B >::spu_task_generate(this->source [tid], spu_U_K1[tid] );\n- auto task_build_crc = module::CRC <B >::spu_task_build (this->crc [tid], spu_U_K1[tid], spu_U_K2[tid]);\n- auto task_encode = module::Encoder <B >::spu_task_encode (this->encoder [tid], spu_U_K2[tid], spu_X_N1[tid]);\n- auto task_puncture = module::Puncturer<B, Q>::spu_task_puncture(this->puncturer[tid], spu_X_N1[tid], spu_X_N2[tid]);\n- auto task_modulate = module::Modem <B,R,R>::spu_task_modulate(this->modem [tid], spu_X_N2[tid], spu_X_N3[tid]);\n-\n- task_gen_source->priority = STARPU_MIN_PRIO +0;\n- task_build_crc ->priority = STARPU_MIN_PRIO +1;\n- task_encode ->priority = STARPU_MIN_PRIO +2;\n- task_puncture ->priority = STARPU_MIN_PRIO +3;\n- task_modulate ->priority = STARPU_MIN_PRIO +4;\n-\n- task_names[tid][0] = \"src::generate_\" + str_id; task_gen_source->name = task_names[tid][0].c_str();\n- task_names[tid][1] = \"crc::build_\" + str_id; task_build_crc ->name = task_names[tid][1].c_str();\n- task_names[tid][2] = \"enc::encode_\" + str_id; task_encode ->name = task_names[tid][2].c_str();\n- task_names[tid][3] = \"pct::puncture_\" + str_id; task_puncture ->name = task_names[tid][3].c_str();\n- task_names[tid][4] = \"mod::modulate_\" + str_id; task_modulate ->name = task_names[tid][4].c_str();\n-\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_gen_source), \"task_submit::src::generate\");\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_build_crc ), \"task_submit::crc::build\" );\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_encode ), \"task_submit::enc::encode\" );\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_puncture ), \"task_submit::pct::puncture\");\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_modulate ), \"task_submit::mod::modulate\");\n- }\n-\n- // Rayleigh channel\n- if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n- {\n- auto task_add_noise_wg = module::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 = module::Modem <B,R,R>::spu_task_filter (this->modem [tid], spu_Y_N1[tid], spu_Y_N2[tid] );\n- auto task_demodulate_wg = module::Modem <B,R,R>::spu_task_demodulate_wg(this->modem [tid], spu_Y_N2[tid], spu_H_N [tid], spu_Y_N3[tid]);\n-\n- task_add_noise_wg ->priority = STARPU_MIN_PRIO +5;\n- task_filter ->priority = STARPU_MIN_PRIO +6;\n- task_demodulate_wg->priority = STARPU_MIN_PRIO +7;\n-\n- task_names[tid][5] = \"chn::add_noise_wg_\" + str_id; task_add_noise_wg ->name = task_names[tid][5].c_str();\n- task_names[tid][6] = \"mod::filter_\" + str_id; task_filter ->name = task_names[tid][6].c_str();\n- task_names[tid][7] = \"mod::demodulate_wg_\" + str_id; task_demodulate_wg->name = task_names[tid][7].c_str();\n-\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_add_noise_wg ), \"task_submit::chn::add_noise_wg\" );\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_filter ), \"task_submit::mod::filter\" );\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_demodulate_wg), \"task_submit::mod::demodulate_wg\");\n- }\n- else // additive channel (AWGN, USER, NO)\n- {\n- auto task_add_noise = module::Channel< R >::spu_task_add_noise (this->channel[tid], spu_X_N3[tid], spu_Y_N1[tid]);\n- auto task_filter = module::Modem <B,R,R>::spu_task_filter (this->modem [tid], spu_Y_N1[tid], spu_Y_N2[tid]);\n- auto task_demodulate = module::Modem <B,R,R>::spu_task_demodulate(this->modem [tid], spu_Y_N2[tid], spu_Y_N3[tid]);\n-\n- task_add_noise ->priority = STARPU_MIN_PRIO +5;\n- task_filter ->priority = STARPU_MIN_PRIO +6;\n- task_demodulate->priority = STARPU_MIN_PRIO +7;\n-\n- task_names[tid][5] = \"chn::add_noise_\" + str_id; task_add_noise ->name = task_names[tid][5].c_str();\n- task_names[tid][6] = \"mod::filter_\" + str_id; task_filter ->name = task_names[tid][6].c_str();\n- task_names[tid][7] = \"mod::demodulate_\" + str_id; task_demodulate->name = task_names[tid][7].c_str();\n-\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_add_noise ), \"task_submit::chn::add_noise\" );\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_filter ), \"task_submit::mod::filter\" );\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_demodulate), \"task_submit::mod::demodulate\");\n- }\n-\n- auto task_quantize = module::Quantizer< R,Q>::spu_task_process (this->quantizer[tid], spu_Y_N3[tid], spu_Y_N4[tid]);\n- auto task_depuncture = module::Puncturer<B, Q>::spu_task_depuncture(this->puncturer[tid], spu_Y_N4[tid], spu_Y_N5[tid]);\n-\n- task_quantize ->priority = STARPU_MIN_PRIO +8;\n- task_depuncture->priority = STARPU_MIN_PRIO +9;\n-\n- task_names[tid][8] = \"qnt::process_\" + str_id; task_quantize ->name = task_names[tid][8].c_str();\n- task_names[tid][9] = \"pct::depuncture_\" + str_id; task_depuncture->name = task_names[tid][9].c_str();\n-\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_quantize ), \"task_submit::qnt::process\" );\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_depuncture), \"task_submit::pct::depuncture\");\n-\n- if (this->params.coset)\n- {\n- auto task_coset_real = module::Coset<B,Q>::spu_task_apply(this->coset_real[tid], spu_X_N1[tid], spu_Y_N5[tid], spu_Y_N5[tid]);\n- task_coset_real->priority = STARPU_MIN_PRIO +10;\n- task_names[tid][10] = \"cst::apply_\" + str_id; task_coset_real->name = task_names[tid][10].c_str();\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_coset_real), \"task_submit::cst::apply\");\n- }\n-\n- auto task_decode = module::Decoder_SIHO<B,Q>::spu_task_decode_siho(this->decoder[tid], spu_Y_N5[tid], spu_V_K1[tid]);\n- task_decode->priority = STARPU_MIN_PRIO +11;\n- task_names[tid][11] = \"dec::decode_siho_\" + str_id; task_decode->name = task_names[tid][11].c_str();\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_decode), \"task_submit::dec::decode_siho\");\n-\n- if (this->params.coset)\n- {\n- auto task_coset_bit = module::Coset<B,B>::spu_task_apply(this->coset_bit[tid], spu_U_K2[tid], spu_V_K1[tid], spu_V_K1[tid]);\n- task_coset_bit->priority = STARPU_MIN_PRIO +12;\n- task_names[tid][12] = \"cst::apply_\" + str_id; task_coset_bit->name = task_names[tid][12].c_str();\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_coset_bit), \"task_submit::cst::apply\");\n- }\n-\n- auto task_extract_crc = module::CRC<B>::spu_task_extract(this->crc[tid], spu_V_K1[tid], spu_V_K2[tid]);\n- task_extract_crc->priority = STARPU_MIN_PRIO +13;\n- task_names[tid][13] = \"crc::extract_\" + str_id; task_extract_crc->name = task_names[tid][13].c_str();\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_extract_crc), \"task_submit::crc::extract\");\n-\n- auto task_check_err = module::Monitor<B>::spu_task_check_errors(this->monitor[tid], spu_U_K1[tid], spu_V_K2[tid]);\n- task_check_err->priority = STARPU_MIN_PRIO +14;\n- task_names[tid][14] = \"mnt::check_errors_\" + str_id; task_check_err->name = task_names[tid][14].c_str();\n- STARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_check_err), \"task_submit::mnt::check_errors\");\n-\n- frame_id++;\n-}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template class aff3ct::simulation::SPU_BFER_std<B_8,R_8,Q_8>;\n-template class aff3ct::simulation::SPU_BFER_std<B_16,R_16,Q_16>;\n-template class aff3ct::simulation::SPU_BFER_std<B_32,R_32,Q_32>;\n-template class aff3ct::simulation::SPU_BFER_std<B_64,R_64,Q_64>;\n-#else\n-template class aff3ct::simulation::SPU_BFER_std<B,R,Q>;\n-#endif\n-// ==================================================================================== explicit template instantiation\n-\n-#endif /* STARPU */\n" }, { "change_type": "DELETE", "old_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.hpp", "new_path": null, "diff": "-#ifdef STARPU\n-\n-#ifndef SPU_SIMULATION_BFER_STD_HPP_\n-#define SPU_SIMULATION_BFER_STD_HPP_\n-\n-#include <vector>\n-#include <starpu.h>\n-#include <mipp.h>\n-\n-#include \"../BFER_std.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace simulation\n-{\n-template <typename B = int, typename R = float, typename Q = R>\n-class SPU_BFER_std : public BFER_std<B,R,Q>\n-{\n-private:\n- std::condition_variable cond_terminal;\n- std::vector<std::vector<std::string>> task_names;\n- unsigned long long frame_id;\n-\n-protected:\n- // data vector\n- std::vector<mipp::vector<B>> U_K1; // information bit vector\n- std::vector<mipp::vector<B>> U_K2; // information bit vector + CRC bits\n- std::vector<mipp::vector<B>> X_N1; // encoded codeword\n- std::vector<mipp::vector<B>> X_N2; // encoded and punctured codeword\n- std::vector<mipp::vector<R>> X_N3; // modulate codeword\n- std::vector<mipp::vector<R>> H_N; // code gain for Rayleigh channels\n- std::vector<mipp::vector<R>> Y_N1; // noisy codeword (after the channel noise)\n- std::vector<mipp::vector<R>> Y_N2; // noisy codeword (after the filtering)\n- std::vector<mipp::vector<R>> Y_N3; // noisy codeword (after the demodulation)\n- std::vector<mipp::vector<Q>> Y_N4; // noisy codeword (after quantization)\n- std::vector<mipp::vector<Q>> Y_N5; // noisy and depunctured codeword\n- std::vector<mipp::vector<B>> V_K1; // decoded bits + CRC bits\n- std::vector<mipp::vector<B>> V_K2; // decoded bits\n-\n- // starpu vector handlers\n- std::vector<starpu_data_handle_t> spu_U_K1;\n- std::vector<starpu_data_handle_t> spu_U_K2;\n- std::vector<starpu_data_handle_t> spu_X_N1;\n- std::vector<starpu_data_handle_t> spu_X_N2;\n- std::vector<starpu_data_handle_t> spu_X_N3;\n- std::vector<starpu_data_handle_t> spu_H_N;\n- std::vector<starpu_data_handle_t> spu_Y_N1;\n- std::vector<starpu_data_handle_t> spu_Y_N2;\n- std::vector<starpu_data_handle_t> spu_Y_N3;\n- std::vector<starpu_data_handle_t> spu_Y_N4;\n- std::vector<starpu_data_handle_t> spu_Y_N5;\n- std::vector<starpu_data_handle_t> spu_V_K1;\n- std::vector<starpu_data_handle_t> spu_V_K2;\n-\n-public:\n- SPU_BFER_std(const factory::BFER_std::parameters &params, tools::Codec<B,Q> &codec);\n- virtual ~SPU_BFER_std();\n-\n-protected:\n- virtual void __build_communication_chain(const int tid = 0);\n- virtual void _launch();\n-\n-private:\n- inline void seq_tasks_submission(const int tid = 0);\n-};\n-}\n-}\n-\n-#endif /* SPU_SIMULATION_BFER_STD_HPP_ */\n-\n-#endif /* STARPU */\n" }, { "change_type": "MODIFY", "old_path": "src/aff3ct.hpp", "new_path": "src/aff3ct.hpp", "diff": "#include <Simulation/EXIT/EXIT.hpp>\n#include <Simulation/BFER/Standard/BFER_std.hpp>\n#include <Simulation/BFER/Standard/Threads/BFER_std_threads.hpp>\n-#include <Simulation/BFER/Standard/StarPU/SPU_BFER_std.hpp>\n#include <Simulation/BFER/Standard/SystemC/SC_BFER_std.hpp>\n#include <Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp>\n#include <Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp>\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove StarPU from AFF3CT.
8,490
04.10.2017 16:47:20
-7,200
0b5ccd165a8913ce7ab4c39f8a42e6e04e9550b9
Remove the StarPU entry in the CMakeList file.
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -52,18 +52,8 @@ option (ENABLE_GSL \"Enable GSL support\" OF\noption (ENABLE_MKL \"Enable MKL support\" OFF)\noption (ENABLE_SYSTEMC \"Enable SystemC support\" OFF)\noption (ENABLE_SYSTEMC_MODULE \"Enable SystemC support (only for the modules)\" OFF)\n-option (ENABLE_STARPU \"Enable StarPU support\" OFF)\noption (ENABLE_MPI \"Enable MPI support\" OFF)\n-# StarPU: set the link dir\n-if (ENABLE_STARPU)\n- find_package (PkgConfig REQUIRED)\n- if (PKG_CONFIG_FOUND)\n- pkg_search_module(SPU REQUIRED starpu-1.2)\n- link_directories(${SPU_LIBRARY_DIRS})\n- endif (PKG_CONFIG_FOUND)\n-endif (ENABLE_STARPU)\n-\n# Add includes\ninclude_directories (src)\nif (\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"MSVC\")\n@@ -155,20 +145,6 @@ if (ENABLE_SYSTEMC)\nendif (TLM_FOUND)\nendif (ENABLE_SYSTEMC)\n-# StarPU\n-if (ENABLE_STARPU)\n- add_definitions (\"-DSTARPU\")\n-\n- find_package (PkgConfig REQUIRED)\n- if (PKG_CONFIG_FOUND)\n- pkg_search_module(SPU REQUIRED starpu-1.2)\n-\n- include_directories (${SPU_INCLUDE_DIRS})\n- aff3ct_link_libraries (\"${SPU_LIBRARIES}\")\n-\n- endif (PKG_CONFIG_FOUND)\n-endif (ENABLE_STARPU)\n-\n# MPI\nif (ENABLE_MPI)\nadd_definitions (\"-DENABLE_MPI\")\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove the StarPU entry in the CMakeList file.
8,490
05.10.2017 09:32:15
-7,200
67d912e9c300cc1c1cba569304379714cacd6a43
Fix the seed...
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.cpp", "new_path": "src/Factory/Simulation/Simulation.cpp", "diff": "@@ -143,6 +143,8 @@ void Simulation::parameters\n// ensure that all the MPI processes have a different seed (crucial for the Monte-Carlo method)\nthis->local_seed = this->global_seed + max_n_threads_global * this->mpi_rank;\n+#else\n+ this->local_seed = this->global_seed;\n#endif\n#ifdef ENABLE_COOL_BASH\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the seed...
8,490
05.10.2017 11:05:12
-7,200
9e7dd1b4cabeee1c17c1c5a6f9624fd4bccca40c
Fix wrong proto in Modem_BPSK.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/BPSK/Modem_BPSK.hpp", "new_path": "src/Module/Modem/BPSK/Modem_BPSK.hpp", "diff": "@@ -23,8 +23,8 @@ public:\nvoid modulate ( const B *X_N1, R *X_N2); using Modem<B,R,Q>::modulate;\nvoid filter ( const R *Y_N1, R *Y_N2); using Modem<B,R,Q>::filter;\n- void demodulate ( const Q *Y_N1, Q *Y_N2);\n- void demodulate_wg (const R *H_N, const Q *Y_N1, Q *Y_N2);\n+ void demodulate ( const Q *Y_N1, Q *Y_N2); using Modem<B,R,Q>::demodulate;\n+ void demodulate_wg (const R *H_N, const Q *Y_N1, Q *Y_N2); using Modem<B,R,Q>::demodulate_wg;\nvoid tdemodulate ( const Q *Y_N1, const Q *Y_N2, Q *Y_N3); using Modem<B,R,Q>::tdemodulate;\nvoid tdemodulate_wg(const R *H_N, const Q *Y_N1, const Q *Y_N2, Q *Y_N3); using Modem<B,R,Q>::tdemodulate_wg;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.hpp", "new_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.hpp", "diff": "@@ -23,7 +23,7 @@ public:\nvoid modulate (const B *X_N1, R *X_N2); using Modem<B,R,Q>::modulate;\nvoid filter (const R *Y_N1, R *Y_N2); using Modem<B,R,Q>::filter;\n- void demodulate (const Q *Y_N1, Q *Y_N2);\n+ void demodulate (const Q *Y_N1, Q *Y_N2); using Modem<B,R,Q>::demodulate;\nvoid tdemodulate(const Q *Y_N1, const Q *Y_N2, Q *Y_N3); using Modem<B,R,Q>::tdemodulate;\nstatic int size_mod(const int N)\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix wrong proto in Modem_BPSK.
8,490
06.10.2017 16:14:34
-7,200
9beb224a3a8ad4455248ec6829b23762226888f4
Improve the statistics by adding the ordered feature.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -243,7 +243,7 @@ void BFER<B,R,Q>\nmod_vec.push_back(vm.second);\nstd::cout << \"#\" << std::endl;\n- tools::Stats::show(mod_vec, std::cout);\n+ tools::Stats::show(mod_vec, true, std::cout);\nstd::cout << \"#\" << std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.cpp", "new_path": "src/Simulation/EXIT/EXIT.cpp", "diff": "@@ -175,7 +175,7 @@ void EXIT<B,R>\nmod_vec.push_back(vm.second);\nstd::cout << \"#\" << std::endl;\n- tools::Stats::show(mod_vec, std::cout);\n+ tools::Stats::show(mod_vec, true, std::cout);\nstd::cout << \"#\" << std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.cpp", "new_path": "src/Tools/Display/Statistics/Statistics.cpp", "diff": "+#include <algorithm>\n#include <iomanip>\n#include \"Tools/Display/bash_tools.h\"\n@@ -168,15 +169,28 @@ void Statistics\n}\nvoid Statistics\n-::show(std::vector<module::Module*> &modules, std::ostream &stream)\n+::show(const std::vector<module::Module*> &modules, const bool ordered, std::ostream &stream)\n{\n- size_t max_chars = 0;\n- auto d_total = std::chrono::nanoseconds(0);\n+ std::vector<module::Task*> tasks;\nfor (auto *m : modules)\nfor (auto &t : m->tasks)\n+ if (t.second->get_n_calls())\n+ tasks.push_back(t.second);\n+\n+ if (ordered)\n+ {\n+ std::sort(tasks.begin(), tasks.end(), [](module::Task* t1, module::Task* t2)\n+ {\n+ return t1->get_duration_total() > t2->get_duration_total();\n+ });\n+ }\n+\n+ size_t max_chars = 0;\n+ auto d_total = std::chrono::nanoseconds(0);\n+ for (auto *t : tasks)\n{\n- d_total += t.second->get_duration_total();\n- std::max(max_chars, m->get_short_name().size() + t.second->get_name().size());\n+ d_total += t->get_duration_total();\n+ std::max(max_chars, t->get_module().get_short_name().size() + t->get_module().get_name().size());\n}\nauto total_sec = ((float)d_total.count()) * 0.000000001f;\n@@ -184,30 +198,28 @@ void Statistics\n{\nStatistics::show_header(stream);\n- for (auto *m : modules)\n- {\n- for (auto &t : m->tasks)\n+ for (auto *t : tasks)\n{\n- auto module_sname = m->get_short_name();\n- auto task_n_elmts = t.second->socket.back().get_n_elmts();\n- auto task_name = t.second->get_name ();\n- auto task_n_calls = t.second->get_n_calls ();\n- auto task_tot_duration = t.second->get_duration_total();\n- auto task_min_duration = t.second->get_duration_min ();\n- auto task_max_duration = t.second->get_duration_max ();\n+ auto module_sname = t->get_module().get_short_name();\n+ auto task_n_elmts = t->socket.back().get_n_elmts();\n+ auto task_name = t->get_name ();\n+ auto task_n_calls = t->get_n_calls ();\n+ auto task_tot_duration = t->get_duration_total();\n+ auto task_min_duration = t->get_duration_min ();\n+ auto task_max_duration = t->get_duration_max ();\nStatistics::show_task(total_sec, module_sname, task_name, task_n_elmts, task_n_calls,\ntask_tot_duration, task_min_duration, task_max_duration, stream);\nauto task_total_sec = ((float)task_tot_duration.count()) * 0.000000001f;\n- for (auto &sp : t.second->get_registered_duration())\n+ for (auto &sp : t->get_registered_duration())\n{\nauto subtask_name = sp;\nauto subtask_n_elmts = task_n_elmts;\n- auto subtask_n_calls = t.second->get_registered_n_calls (sp);\n- auto subtask_tot_duration = t.second->get_registered_duration_total(sp);\n- auto subtask_min_duration = t.second->get_registered_duration_min (sp);\n- auto subtask_max_duration = t.second->get_registered_duration_max (sp);\n+ auto subtask_n_calls = t->get_registered_n_calls (sp);\n+ auto subtask_tot_duration = t->get_registered_duration_total(sp);\n+ auto subtask_min_duration = t->get_registered_duration_min (sp);\n+ auto subtask_max_duration = t->get_registered_duration_max (sp);\nStatistics::show_sub_task(task_total_sec, task_name, task_n_calls, subtask_n_elmts,\nsubtask_name, subtask_n_calls, subtask_tot_duration,\n@@ -215,24 +227,47 @@ void Statistics\n}\n}\n}\n- }\nelse\n{\n- stream << \"# Statistics are unavailable (did you enable the statistics in the tasks?).\" << std::endl;\n+ stream << \"# \" << format(\"(II)\", tools::Style::BOLD | tools::FG::BLUE)\n+ << \" Statistics are unavailable. Did you enable the statistics in the tasks?\" << std::endl;\n}\n}\nvoid Statistics\n-::show(std::vector<std::vector<module::Module*>> &modules, std::ostream &stream)\n+::show(const std::vector<std::vector<module::Module*>> &modules, const bool ordered, std::ostream &stream)\n{\n- size_t max_chars = 0;\n- auto d_total = std::chrono::nanoseconds(0);\n+ std::vector<std::vector<module::Task*>> tasks;\n+\nfor (auto &vm : modules)\n+ if (vm.size() > 0)\n+ for (auto &t : vm[0]->tasks)\n+ {\n+ std::vector<module::Task*> tsk;\nfor (auto *m : vm)\n- for (auto &t : m->tasks)\n+ tsk.push_back(m->tasks[t.first]);\n+ tasks.push_back(tsk);\n+ }\n+\n+ if (ordered)\n+ {\n+ std::sort(tasks.begin(), tasks.end(), [](std::vector<module::Task*> &t1, std::vector<module::Task*> &t2)\n+ {\n+ auto total1 = std::chrono::nanoseconds(0);\n+ auto total2 = std::chrono::nanoseconds(0);\n+ for (auto *t : t1) total1 += t->get_duration_total();\n+ for (auto *t : t2) total2 += t->get_duration_total();\n+ return total1 > total2;\n+ });\n+ }\n+\n+ size_t max_chars = 0;\n+ auto d_total = std::chrono::nanoseconds(0);\n+ for (auto &vt : tasks)\n+ for (auto *t : vt)\n{\n- d_total += t.second->get_duration_total();\n- std::max(max_chars, m->get_short_name().size() + t.second->get_name().size());\n+ d_total += t->get_duration_total();\n+ std::max(max_chars, t->get_module().get_short_name().size() + t->get_module().get_name().size());\n}\nauto total_sec = ((float)d_total.count()) * 0.000000001f;\n@@ -240,31 +275,29 @@ void Statistics\n{\nStatistics::show_header(stream);\n- for (auto &vm : modules)\n- {\n- for (auto &t : vm[0]->tasks)\n+ for (auto &vt : tasks)\n{\n- auto module_sname = vm[0]->get_short_name();\n- auto task_n_elmts = t.second->socket.back().get_n_elmts();\n- auto task_name = t.second->get_name();\n+ auto module_sname = vt[0]->get_module().get_short_name();\n+ auto task_n_elmts = vt[0]->socket.back().get_n_elmts();\n+ auto task_name = vt[0]->get_name();\nauto task_n_calls = 0;\nauto task_tot_duration = std::chrono::nanoseconds(0);\nauto task_min_duration = d_total;\nauto task_max_duration = std::chrono::nanoseconds(0);\n- for (auto *m : vm)\n+ for (auto *t : vt)\n{\n- task_n_calls += (*m)[task_name].get_n_calls();\n- task_tot_duration += (*m)[task_name].get_duration_total();\n- task_min_duration = std::min(task_min_duration, (*m)[task_name].get_duration_min());\n- task_max_duration = std::max(task_max_duration, (*m)[task_name].get_duration_max());\n+ task_n_calls += t->get_n_calls();\n+ task_tot_duration += t->get_duration_total();\n+ task_min_duration = std::min(task_min_duration, t->get_duration_min());\n+ task_max_duration = std::max(task_max_duration, t->get_duration_max());\n}\nStatistics::show_task(total_sec, module_sname, task_name, task_n_elmts, task_n_calls,\ntask_tot_duration, task_min_duration, task_max_duration, stream);\nauto task_total_sec = ((float)task_tot_duration.count()) * 0.000000001f;\n- for (auto &sp : t.second->get_registered_duration())\n+ for (auto &sp : vt[0]->get_registered_duration())\n{\nauto subtask_name = sp;\nauto subtask_n_elmts = task_n_elmts;\n@@ -273,12 +306,12 @@ void Statistics\nauto subtask_min_duration = d_total;\nauto subtask_max_duration = std::chrono::nanoseconds(0);\n- for (auto *m : vm)\n+ for (auto *t : vt)\n{\n- subtask_n_calls += (*m)[task_name].get_registered_n_calls(sp);\n- subtask_tot_duration += (*m)[task_name].get_registered_duration_total(sp);\n- subtask_min_duration = std::min(task_min_duration, (*m)[task_name].get_registered_duration_min(sp));\n- subtask_max_duration = std::max(task_max_duration, (*m)[task_name].get_registered_duration_max(sp));\n+ subtask_n_calls += t->get_registered_n_calls(sp);\n+ subtask_tot_duration += t->get_registered_duration_total(sp);\n+ subtask_min_duration = std::min(task_min_duration, t->get_registered_duration_min(sp));\n+ subtask_max_duration = std::max(task_max_duration, t->get_registered_duration_max(sp));\n}\nStatistics::show_sub_task(task_total_sec, task_name, task_n_calls, subtask_n_elmts,\n@@ -287,9 +320,9 @@ void Statistics\n}\n}\n}\n- }\nelse\n{\n- stream << \"# Statistics are unavailable (did you enable the statistics in the tasks?).\" << std::endl;\n+ stream << \"# \" << format(\"(II)\", tools::Style::BOLD | tools::FG::BLUE)\n+ << \" Statistics are unavailable. Did you enable the statistics in the tasks?\" << std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.hpp", "new_path": "src/Tools/Display/Statistics/Statistics.hpp", "diff": "@@ -18,8 +18,10 @@ protected:\npublic:\nvirtual ~Statistics();\n- static void show(std::vector< module::Module* > &modules, std::ostream &stream = std::cout);\n- static void show(std::vector<std::vector<module::Module*>> &modules, std::ostream &stream = std::cout);\n+ static void show(const std::vector<module::Module*> &modules, const bool ordered = false,\n+ std::ostream &stream = std::cout);\n+ static void show(const std::vector<std::vector<module::Module*>> &modules, const bool ordered = false,\n+ std::ostream &stream = std::cout);\nprivate:\nstatic void show_header(std::ostream &stream = std::cout);\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the statistics by adding the ordered feature.
8,490
06.10.2017 20:05:22
-7,200
dc74c741f587b6d0928f1fa20d7818a299a53568
Improve the stats: now supports a vector of tasks.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.cpp", "new_path": "src/Tools/Display/Statistics/Statistics.cpp", "diff": "@@ -169,7 +169,7 @@ void Statistics\n}\nvoid Statistics\n-::show(const std::vector<module::Module*> &modules, const bool ordered, std::ostream &stream)\n+::show(std::vector<module::Module*> modules, const bool ordered, std::ostream &stream)\n{\nstd::vector<module::Task*> tasks;\nfor (auto *m : modules)\n@@ -177,6 +177,12 @@ void Statistics\nif (t.second->get_n_calls())\ntasks.push_back(t.second);\n+ Statistics::show(tasks, ordered, stream);\n+}\n+\n+void Statistics\n+::show(std::vector<module::Task*> tasks, const bool ordered, std::ostream &stream)\n+{\nif (ordered)\n{\nstd::sort(tasks.begin(), tasks.end(), [](module::Task* t1, module::Task* t2)\n@@ -235,10 +241,9 @@ void Statistics\n}\nvoid Statistics\n-::show(const std::vector<std::vector<module::Module*>> &modules, const bool ordered, std::ostream &stream)\n+::show(std::vector<std::vector<module::Module*>> modules, const bool ordered, std::ostream &stream)\n{\nstd::vector<std::vector<module::Task*>> tasks;\n-\nfor (auto &vm : modules)\nif (vm.size() > 0)\nfor (auto &t : vm[0]->tasks)\n@@ -249,6 +254,12 @@ void Statistics\ntasks.push_back(tsk);\n}\n+ Statistics::show(tasks, ordered, stream);\n+}\n+\n+void Statistics\n+::show(std::vector<std::vector<module::Task*>> tasks, const bool ordered, std::ostream &stream)\n+{\nif (ordered)\n{\nstd::sort(tasks.begin(), tasks.end(), [](std::vector<module::Task*> &t1, std::vector<module::Task*> &t2)\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.hpp", "new_path": "src/Tools/Display/Statistics/Statistics.hpp", "diff": "#define STATISTICS_HPP_\n#include \"Module/Module.hpp\"\n+#include \"Module/Task.hpp\"\n#include <vector>\n#include <iostream>\n@@ -18,9 +19,13 @@ protected:\npublic:\nvirtual ~Statistics();\n- static void show(const std::vector<module::Module*> &modules, const bool ordered = false,\n+ static void show(std::vector<module::Module*> modules, const bool ordered = false,\nstd::ostream &stream = std::cout);\n- static void show(const std::vector<std::vector<module::Module*>> &modules, const bool ordered = false,\n+ static void show(std::vector<module::Task*> tasks, const bool ordered = false,\n+ std::ostream &stream = std::cout);\n+ static void show(std::vector<std::vector<module::Module*>> modules, const bool ordered = false,\n+ std::ostream &stream = std::cout);\n+ static void show(std::vector<std::vector<module::Task*>> tasks, const bool ordered = false,\nstd::ostream &stream = std::cout);\nprivate:\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the stats: now supports a vector of tasks.
8,490
08.10.2017 09:57:15
-7,200
029d0380083eac5dbd65786a795677a47f0bc49f
Enable the statistics in the task only if the user want to display the stats.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -26,6 +26,8 @@ void Simulation\n{\nt.second->set_autoexec (true);\nt.second->set_autoalloc(true);\n+\n+ if (params.statistics)\nt.second->set_stats(true);\n// enable the debug mode in the modules\n" } ]
C++
MIT License
aff3ct/aff3ct
Enable the statistics in the task only if the user want to display the stats.
8,490
09.10.2017 13:29:59
-7,200
06c9e9d5ea7d4894eb9c90efef762c0ce4ffbd3c
Add the total in the stats.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.cpp", "new_path": "src/Tools/Display/Statistics/Statistics.cpp", "diff": "@@ -18,16 +18,32 @@ Statistics\n}\nvoid Statistics\n-::show_header(std::ostream &stream)\n+::separation1(std::ostream &stream)\n{\nstream << tools::format(\"# -------------------------------------------||------------------------------||--------------------------------||--------------------------------\", tools::Style::BOLD) << std::endl;\n+}\n+\n+void Statistics\n+::separation2(std::ostream &stream)\n+{\n+ stream << tools::format(\"# -------------|-------------------|---------||----------|----------|--------||----------|----------|----------||----------|----------|----------\", tools::Style::BOLD) << std::endl;\n+}\n+\n+void Statistics\n+::show_header(std::ostream &stream)\n+{\n+ Statistics::separation1(stream);\n+// stream << tools::format(\"# -------------------------------------------||------------------------------||--------------------------------||--------------------------------\", tools::Style::BOLD) << std::endl;\nstream << tools::format(\"# Statistics for the given task || Basic statistics || Measured throughput || Measured latency \", tools::Style::BOLD) << std::endl;\nstream << tools::format(\"# ('*' = all the sub-tasks) || on the task || considering the last socket || considering the last socket \", tools::Style::BOLD) << std::endl;\n- stream << tools::format(\"# -------------------------------------------||------------------------------||--------------------------------||--------------------------------\", tools::Style::BOLD) << std::endl;\n- stream << tools::format(\"# -------------|-------------------|---------||----------|----------|--------||----------|----------|----------||----------|----------|----------\", tools::Style::BOLD) << std::endl;\n+// stream << tools::format(\"# -------------------------------------------||------------------------------||--------------------------------||--------------------------------\", tools::Style::BOLD) << std::endl;\n+ Statistics::separation1(stream);\n+ Statistics::separation2(stream);\n+// stream << tools::format(\"# -------------|-------------------|---------||----------|----------|--------||----------|----------|----------||----------|----------|----------\", tools::Style::BOLD) << std::endl;\nstream << tools::format(\"# MODULE | TASK | SUB || CALLS | TIME | PERC || AVERAGE | MINIMUM | MAXIMUM || AVERAGE | MINIMUM | MAXIMUM \", tools::Style::BOLD) << std::endl;\nstream << tools::format(\"# | | TASK || | (s) | (%) || (Mb/s) | (Mb/s) | (Mb/s) || (us) | (us) | (us) \", tools::Style::BOLD) << std::endl;\n- stream << tools::format(\"# -------------|-------------------|---------||----------|----------|--------||----------|----------|----------||----------|----------|----------\", tools::Style::BOLD) << std::endl;\n+// stream << tools::format(\"# -------------|-------------------|---------||----------|----------|--------||----------|----------|----------||----------|----------|----------\", tools::Style::BOLD) << std::endl;\n+ Statistics::separation2(stream);\n}\nvoid Statistics\n@@ -191,19 +207,25 @@ void Statistics\n});\n}\n+ size_t ttask_n_elmts = 0;\n+ uint32_t ttask_n_calls = 0;\n+ auto ttask_tot_duration = std::chrono::nanoseconds(0);\n+ auto ttask_min_duration = std::chrono::nanoseconds(0);\n+ auto ttask_max_duration = std::chrono::nanoseconds(0);\n+\nsize_t max_chars = 0;\n- auto d_total = std::chrono::nanoseconds(0);\nfor (auto *t : tasks)\n{\n- d_total += t->get_duration_total();\n+ ttask_tot_duration += t->get_duration_total();\nstd::max(max_chars, t->get_module().get_short_name().size() + t->get_module().get_name().size());\n}\n- auto total_sec = ((float)d_total.count()) * 0.000000001f;\n+ auto total_sec = ((float)ttask_tot_duration.count()) * 0.000000001f;\n- if (d_total.count())\n+ if (ttask_tot_duration.count())\n{\nStatistics::show_header(stream);\n+ auto is_first = true;\nfor (auto *t : tasks)\n{\nauto module_sname = t->get_module().get_short_name();\n@@ -214,6 +236,23 @@ void Statistics\nauto task_min_duration = t->get_duration_min ();\nauto task_max_duration = t->get_duration_max ();\n+ if (is_first)\n+ {\n+ if (task_n_calls)\n+ {\n+ ttask_n_elmts = task_n_elmts;\n+ ttask_n_calls = task_n_calls;\n+ is_first = false;\n+ }\n+ }\n+ else\n+ {\n+ ttask_n_elmts = task_n_elmts ? std::min(ttask_n_elmts, task_n_elmts) : ttask_n_elmts;\n+ ttask_n_calls = task_n_calls ? std::min(ttask_n_calls, task_n_calls) : ttask_n_calls;\n+ }\n+ ttask_min_duration += task_min_duration;\n+ ttask_max_duration += task_max_duration;\n+\nStatistics::show_task(total_sec, module_sname, task_name, task_n_elmts, task_n_calls,\ntask_tot_duration, task_min_duration, task_max_duration, stream);\n@@ -232,6 +271,10 @@ void Statistics\nsubtask_min_duration, subtask_max_duration, stream);\n}\n}\n+ Statistics::separation2(stream);\n+\n+ Statistics::show_task(total_sec, \"TOTAL\", \"*\", ttask_n_elmts, ttask_n_calls,\n+ ttask_tot_duration, ttask_min_duration, ttask_max_duration, stream);\n}\nelse\n{\n@@ -272,20 +315,26 @@ void Statistics\n});\n}\n+ size_t ttask_n_elmts = 0;\n+ auto ttask_n_calls = 0;\n+ auto ttask_tot_duration = std::chrono::nanoseconds(0);\n+ auto ttask_min_duration = std::chrono::nanoseconds(0);\n+ auto ttask_max_duration = std::chrono::nanoseconds(0);\n+\nsize_t max_chars = 0;\n- auto d_total = std::chrono::nanoseconds(0);\nfor (auto &vt : tasks)\nfor (auto *t : vt)\n{\n- d_total += t->get_duration_total();\n+ ttask_tot_duration += t->get_duration_total();\nstd::max(max_chars, t->get_module().get_short_name().size() + t->get_module().get_name().size());\n}\n- auto total_sec = ((float)d_total.count()) * 0.000000001f;\n+ auto total_sec = ((float)ttask_tot_duration.count()) * 0.000000001f;\n- if (d_total.count())\n+ if (ttask_tot_duration.count())\n{\nStatistics::show_header(stream);\n+ auto is_first = true;\nfor (auto &vt : tasks)\n{\nauto module_sname = vt[0]->get_module().get_short_name();\n@@ -293,7 +342,7 @@ void Statistics\nauto task_name = vt[0]->get_name();\nauto task_n_calls = 0;\nauto task_tot_duration = std::chrono::nanoseconds(0);\n- auto task_min_duration = d_total;\n+ auto task_min_duration = ttask_tot_duration;\nauto task_max_duration = std::chrono::nanoseconds(0);\nfor (auto *t : vt)\n@@ -304,6 +353,23 @@ void Statistics\ntask_max_duration = std::max(task_max_duration, t->get_duration_max());\n}\n+ if (is_first)\n+ {\n+ if (task_n_calls)\n+ {\n+ ttask_n_elmts = task_n_elmts;\n+ ttask_n_calls = task_n_calls;\n+ is_first = false;\n+ }\n+ }\n+ else\n+ {\n+ ttask_n_elmts = task_n_elmts ? std::min(ttask_n_elmts, task_n_elmts) : ttask_n_elmts;\n+ ttask_n_calls = task_n_calls ? std::min(ttask_n_calls, task_n_calls) : ttask_n_calls;\n+ }\n+ ttask_min_duration += task_min_duration;\n+ ttask_max_duration += task_max_duration;\n+\nStatistics::show_task(total_sec, module_sname, task_name, task_n_elmts, task_n_calls,\ntask_tot_duration, task_min_duration, task_max_duration, stream);\n@@ -314,7 +380,7 @@ void Statistics\nauto subtask_n_elmts = task_n_elmts;\nauto subtask_n_calls = 0;\nauto subtask_tot_duration = std::chrono::nanoseconds(0);\n- auto subtask_min_duration = d_total;\n+ auto subtask_min_duration = ttask_tot_duration;\nauto subtask_max_duration = std::chrono::nanoseconds(0);\nfor (auto *t : vt)\n@@ -330,6 +396,10 @@ void Statistics\nsubtask_min_duration, subtask_max_duration, stream);\n}\n}\n+ Statistics::separation2(stream);\n+\n+ Statistics::show_task(total_sec, \"TOTAL\", \"*\", ttask_n_elmts, ttask_n_calls,\n+ ttask_tot_duration, ttask_min_duration, ttask_max_duration, stream);\n}\nelse\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.hpp", "new_path": "src/Tools/Display/Statistics/Statistics.hpp", "diff": "@@ -29,6 +29,10 @@ public:\nstd::ostream &stream = std::cout);\nprivate:\n+ static void separation1(std::ostream &stream = std::cout);\n+\n+ static void separation2(std::ostream &stream = std::cout);\n+\nstatic void show_header(std::ostream &stream = std::cout);\nstatic void show_task(const float total_sec,\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the total in the stats.
8,490
09.10.2017 13:54:09
-7,200
1eae7e16906e8d145a99725731b32ca26e7743af
Do not display the task name for sub-tasks.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.cpp", "new_path": "src/Tools/Display/Statistics/Statistics.cpp", "diff": "@@ -119,7 +119,6 @@ void Statistics\nvoid Statistics\n::show_sub_task(const float total_sec,\n- const std::string task_name,\nconst uint32_t task_n_calls,\nconst size_t subtask_n_elmts,\nconst std::string subtask_name,\n@@ -156,7 +155,7 @@ void Statistics\nstd::stringstream ssravg_lat, ssrmin_lat, ssrmax_lat;\nspaces << std::fixed << std::setw(12) << \"-\";\n- ssprocess << std::setprecision( 2) << std::fixed << std::setw(17) << task_name;\n+ ssprocess << std::setprecision( 2) << std::fixed << std::setw(17) << \"-\";\nsssp << std::setprecision( 2) << std::fixed << std::setw( 7) << subtask_name;\nssrn_calls << std::setprecision(subtask_n_calls > l1 ? P : 2) << (subtask_n_calls > l1 ? std::scientific : std::fixed) << std::setw( 8) << subtask_n_calls;\nssrtot_dur << std::setprecision(rtot_dur > l1 ? P : 2) << (rtot_dur > l1 ? std::scientific : std::fixed) << std::setw( 8) << rtot_dur;\n@@ -266,7 +265,7 @@ void Statistics\nauto subtask_min_duration = t->get_registered_duration_min (sp);\nauto subtask_max_duration = t->get_registered_duration_max (sp);\n- Statistics::show_sub_task(task_total_sec, task_name, task_n_calls, subtask_n_elmts,\n+ Statistics::show_sub_task(task_total_sec, task_n_calls, subtask_n_elmts,\nsubtask_name, subtask_n_calls, subtask_tot_duration,\nsubtask_min_duration, subtask_max_duration, stream);\n}\n@@ -391,7 +390,7 @@ void Statistics\nsubtask_max_duration = std::max(task_max_duration, t->get_registered_duration_max(sp));\n}\n- Statistics::show_sub_task(task_total_sec, task_name, task_n_calls, subtask_n_elmts,\n+ Statistics::show_sub_task(task_total_sec, task_n_calls, subtask_n_elmts,\nsubtask_name, subtask_n_calls, subtask_tot_duration,\nsubtask_min_duration, subtask_max_duration, stream);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Statistics/Statistics.hpp", "new_path": "src/Tools/Display/Statistics/Statistics.hpp", "diff": "@@ -46,7 +46,6 @@ private:\nstd::ostream &stream = std::cout);\nstatic void show_sub_task(const float total_sec,\n- const std::string task_name,\nconst uint32_t task_n_calls,\nconst size_t subtask_n_elmts,\nconst std::string subtask_name,\n" } ]
C++
MIT License
aff3ct/aff3ct
Do not display the task name for sub-tasks.
8,490
11.10.2017 10:08:46
-7,200
f7408daf2960d7adc518b4c66410718f798520c7
Decompose the binding of the sockets and the simu loop in the EXIT simu.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/EXIT/EXIT.hpp", "new_path": "src/Simulation/EXIT/EXIT.hpp", "diff": "@@ -52,6 +52,7 @@ public:\nprotected:\nvoid _build_communication_chain();\n+ void sockets_binding ();\nvoid simulation_loop ();\nvoid release_objects ();\n" } ]
C++
MIT License
aff3ct/aff3ct
Decompose the binding of the sockets and the simu loop in the EXIT simu.
8,490
11.10.2017 10:09:21
-7,200
b4395da1ac3a400d4065950ed4248c928e234ae3
Fix AZCW BFER simus.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "diff": "@@ -35,39 +35,6 @@ BFER_ite_threads<B,R,Q>\n{\n}\n-template <typename B, typename R, typename Q>\n-void BFER_ite_threads<B,R,Q>\n-::__build_communication_chain(const int tid)\n-{\n- BFER_ite<B,R,Q>::__build_communication_chain(tid);\n-\n- auto &source = *this->source [tid];\n- auto &crc = *this->crc [tid];\n- auto &encoder = *this->codec [tid]->get_encoder();\n- auto &interleaver_bit = *this->interleaver_bit[tid];\n- auto &modem = *this->modem [tid];\n-\n- if (this->params.src->type == \"AZCW\")\n- {\n- auto src_data = (uint8_t*)(source [\"generate\" ][\"U_K\" ].get_dataptr());\n- auto crc_data = (uint8_t*)(crc [\"build\" ][\"U_K2\"].get_dataptr());\n- auto enc_data = (uint8_t*)(encoder [\"encode\" ][\"X_N\" ].get_dataptr());\n- auto itl_data = (uint8_t*)(interleaver_bit[\"interleave\"][\"itl\" ].get_dataptr());\n-\n- auto src_bytes = source [\"generate\" ][\"U_K\" ].get_databytes();\n- auto crc_bytes = crc [\"build\" ][\"U_K2\"].get_databytes();\n- auto enc_bytes = encoder [\"encode\" ][\"X_N\" ].get_databytes();\n- auto itl_bytes = interleaver_bit[\"interleave\"][\"itl\" ].get_databytes();\n-\n- std::fill(src_data, src_data + src_bytes, 0);\n- std::fill(crc_data, crc_data + crc_bytes, 0);\n- std::fill(enc_data, enc_data + enc_bytes, 0);\n- std::fill(itl_data, itl_data + itl_bytes, 0);\n-\n- modem[\"modulate\"][\"X_N1\"].bind(interleaver_bit[\"interleave\"][\"itl\"]);\n- }\n-}\n-\ntemplate <typename B, typename R, typename Q>\nvoid BFER_ite_threads<B,R,Q>\n::_launch()\n@@ -131,7 +98,28 @@ void BFER_ite_threads<B,R,Q>\nauto &decoder_siso = *codec.get_decoder_siso();\nauto &decoder_siho = *codec.get_decoder_siho();\n- if (this->params.src->type != \"AZCW\")\n+ if (this->params.src->type == \"AZCW\")\n+ {\n+ auto src_data = (uint8_t*)(source [\"generate\" ][\"U_K\" ].get_dataptr());\n+ auto crc_data = (uint8_t*)(crc [\"build\" ][\"U_K2\"].get_dataptr());\n+ auto enc_data = (uint8_t*)(encoder [\"encode\" ][\"X_N\" ].get_dataptr());\n+ auto itl_data = (uint8_t*)(interleaver_bit[\"interleave\"][\"itl\" ].get_dataptr());\n+\n+ auto src_bytes = source [\"generate\" ][\"U_K\" ].get_databytes();\n+ auto crc_bytes = crc [\"build\" ][\"U_K2\"].get_databytes();\n+ auto enc_bytes = encoder [\"encode\" ][\"X_N\" ].get_databytes();\n+ auto itl_bytes = interleaver_bit[\"interleave\"][\"itl\" ].get_databytes();\n+\n+ std::fill(src_data, src_data + src_bytes, 0);\n+ std::fill(crc_data, crc_data + crc_bytes, 0);\n+ std::fill(enc_data, enc_data + enc_bytes, 0);\n+ std::fill(itl_data, itl_data + itl_bytes, 0);\n+\n+ modem[\"modulate\"][\"X_N1\"].bind(interleaver_bit[\"interleave\"][\"itl\"]);\n+ modem[\"modulate\"].exec();\n+ modem[\"modulate\"].reset_stats();\n+ }\n+ else\n{\ncrc [\"build\" ][\"U_K1\"].bind(source [\"generate\" ][\"U_K\" ]);\nencoder [\"encode\" ][\"U_K\" ].bind(crc [\"build\" ][\"U_K2\"]);\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp", "diff": "@@ -15,7 +15,6 @@ public:\nvirtual ~BFER_ite_threads();\nprotected:\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/BFER_std_threads.cpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "diff": "@@ -35,39 +35,6 @@ BFER_std_threads<B,R,Q>\n{\n}\n-template <typename B, typename R, typename Q>\n-void BFER_std_threads<B,R,Q>\n-::__build_communication_chain(const int tid)\n-{\n- BFER_std<B,R,Q>::__build_communication_chain(tid);\n-\n- auto &source = *this->source[tid];\n- auto &crc = *this->crc [tid];\n- auto &encoder = *this->codec [tid]->get_encoder();\n- auto &puncturer = *this->codec [tid]->get_puncturer();\n- auto &modem = *this->modem [tid];\n-\n- if (this->params.src->type == \"AZCW\")\n- {\n- auto src_data = (uint8_t*)(source [\"generate\"][\"U_K\" ].get_dataptr());\n- auto crc_data = (uint8_t*)(crc [\"build\" ][\"U_K2\"].get_dataptr());\n- auto enc_data = (uint8_t*)(encoder [\"encode\" ][\"X_N\" ].get_dataptr());\n- auto pct_data = (uint8_t*)(puncturer[\"puncture\"][\"X_N2\"].get_dataptr());\n-\n- auto src_bytes = source [\"generate\"][\"U_K\" ].get_databytes();\n- auto crc_bytes = crc [\"build\" ][\"U_K2\"].get_databytes();\n- auto enc_bytes = encoder [\"encode\" ][\"X_N\" ].get_databytes();\n- auto pct_bytes = puncturer[\"puncture\"][\"X_N2\"].get_databytes();\n-\n- std::fill(src_data, src_data + src_bytes, 0);\n- std::fill(crc_data, crc_data + crc_bytes, 0);\n- std::fill(enc_data, enc_data + enc_bytes, 0);\n- std::fill(pct_data, pct_data + pct_bytes, 0);\n-\n- modem[\"modulate\"][\"X_N1\"].bind(puncturer[\"puncture\"][\"X_N2\"]);\n- }\n-}\n-\ntemplate <typename B, typename R, typename Q>\nvoid BFER_std_threads<B,R,Q>\n::_launch()\n@@ -127,7 +94,28 @@ void BFER_std_threads<B,R,Q>\nauto &coset_bit = *this->coset_bit [tid];\nauto &monitor = *this->monitor [tid];\n- if (this->params.src->type != \"AZCW\")\n+ if (this->params.src->type == \"AZCW\")\n+ {\n+ auto src_data = (uint8_t*)(source [\"generate\"][\"U_K\" ].get_dataptr());\n+ auto crc_data = (uint8_t*)(crc [\"build\" ][\"U_K2\"].get_dataptr());\n+ auto enc_data = (uint8_t*)(encoder [\"encode\" ][\"X_N\" ].get_dataptr());\n+ auto pct_data = (uint8_t*)(puncturer[\"puncture\"][\"X_N2\"].get_dataptr());\n+\n+ auto src_bytes = source [\"generate\"][\"U_K\" ].get_databytes();\n+ auto crc_bytes = crc [\"build\" ][\"U_K2\"].get_databytes();\n+ auto enc_bytes = encoder [\"encode\" ][\"X_N\" ].get_databytes();\n+ auto pct_bytes = puncturer[\"puncture\"][\"X_N2\"].get_databytes();\n+\n+ std::fill(src_data, src_data + src_bytes, 0);\n+ std::fill(crc_data, crc_data + crc_bytes, 0);\n+ std::fill(enc_data, enc_data + enc_bytes, 0);\n+ std::fill(pct_data, pct_data + pct_bytes, 0);\n+\n+ modem[\"modulate\"][\"X_N1\"].bind(puncturer[\"puncture\"][\"X_N2\"]);\n+ modem[\"modulate\"].exec();\n+ modem[\"modulate\"].reset_stats();\n+ }\n+ else\n{\ncrc [\"build\" ][\"U_K1\"].bind(source [\"generate\"][\"U_K\" ]);\nencoder [\"encode\" ][\"U_K\" ].bind(crc [\"build\" ][\"U_K2\"]);\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.hpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.hpp", "diff": "@@ -15,7 +15,6 @@ public:\nvirtual ~BFER_std_threads();\nprotected:\n- virtual void __build_communication_chain(const int tid = 0);\nvirtual void _launch();\nprivate:\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix AZCW BFER simus.
8,483
13.10.2017 10:29:58
-7,200
4a3773a8f4cc95fa7f86feb843c1a76ed483513f
Correction of the BCH polynomial generator
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Code/BCH/Decoder_BCH.cpp", "new_path": "src/Factory/Module/Code/BCH/Decoder_BCH.cpp", "diff": "@@ -13,11 +13,11 @@ const std::string aff3ct::factory::Decoder_BCH::prefix = \"dec\";\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_BCH\n-::build(const parameters &params, const tools::Galois &GF)\n+::build(const parameters &params, const tools::BCH_Polynomial_Generator &GF_poly)\n{\nif (params.type == \"ALGEBRAIC\")\n{\n- if (params.implem == \"STD\") return new module::Decoder_BCH<B,Q>(params.K, params.N_cw, GF, params.n_frames);\n+ if (params.implem == \"STD\") return new module::Decoder_BCH<B,Q>(params.K, params.N_cw, GF_poly, params.n_frames);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n@@ -67,12 +67,12 @@ void Decoder_BCH\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::Galois&);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::build<B_16,Q_16>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::Galois&);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::build<B_32,Q_32>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::Galois&);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::build<B_64,Q_64>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::Galois&);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::build<B_16,Q_16>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::build<B_32,Q_32>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::build<B_64,Q_64>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::build<B,Q>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::Galois&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::build<B,Q>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Code/BCH/Decoder_BCH.hpp", "new_path": "src/Factory/Module/Code/BCH/Decoder_BCH.hpp", "diff": "#include \"Module/Decoder/Decoder_SIHO.hpp\"\n#include \"Module/Decoder/Decoder_SISO.hpp\"\n-#include \"Tools/Math/Galois.hpp\"\n+#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n#include \"../Decoder.hpp\"\n@@ -23,12 +23,12 @@ struct Decoder_BCH : public Decoder\n{\nvirtual ~parameters() {}\n- int t = 5; // correction power of th BCH\n- int m; // Gallois field order\n+ int t = 5; // correction power of the BCH\n+ int m; // Galois field order\n};\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_SIHO<B,Q>* build(const parameters &params, const tools::Galois &GF);\n+ static module::Decoder_SIHO<B,Q>* build(const parameters &params, const tools::BCH_Polynomial_Generator &GF_poly);\nstatic void build_args(arg_map &req_args, arg_map &opt_args, const std::string p = prefix);\nstatic void store_args(const arg_val_map &vals, parameters &params, const std::string p = prefix);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Code/BCH/Encoder_BCH.cpp", "new_path": "src/Factory/Module/Code/BCH/Encoder_BCH.cpp", "diff": "@@ -12,9 +12,9 @@ const std::string aff3ct::factory::Encoder_BCH::prefix = \"enc\";\ntemplate <typename B>\nmodule::Encoder<B>* Encoder_BCH\n-::build(const parameters &params, const tools::Galois &GF)\n+::build(const parameters &params, const tools::BCH_Polynomial_Generator &GF_poly)\n{\n- if (params.type == \"BCH\") return new module::Encoder_BCH<B>(params.K, params.N_cw, GF, params.n_frames);\n+ if (params.type == \"BCH\") return new module::Encoder_BCH<B>(params.K, params.N_cw, GF_poly, params.n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n@@ -44,11 +44,11 @@ void Encoder_BCH\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::build<B_8 >(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::Galois&);\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::build<B_16>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::Galois&);\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::build<B_32>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::Galois&);\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::build<B_64>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::Galois&);\n+template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::build<B_8 >(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::build<B_16>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::build<B_32>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::build<B_64>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n#else\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::build<B>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::Galois&);\n+template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::build<B>(const aff3ct::factory::Encoder::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Code/BCH/Encoder_BCH.hpp", "new_path": "src/Factory/Module/Code/BCH/Encoder_BCH.hpp", "diff": "#include <string>\n#include \"Module/Encoder/Encoder.hpp\"\n-#include \"Tools/Math/Galois.hpp\"\n+#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n#include \"../Encoder.hpp\"\n@@ -18,7 +18,7 @@ struct Encoder_BCH : public Encoder\nstatic const std::string prefix;\ntemplate <typename B = int>\n- static module::Encoder<B>* build(const parameters &params, const tools::Galois &GF);\n+ static module::Encoder<B>* build(const parameters &params, const tools::BCH_Polynomial_Generator &GF_poly);\nstatic void build_args(arg_map &req_args, arg_map &opt_args, const std::string p = prefix);\nstatic void store_args(const arg_val_map &vals, parameters &params, const std::string p = prefix);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "diff": "@@ -11,10 +11,10 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_BCH<B, R>\n-::Decoder_BCH(const int& K, const int& N, const tools::Galois &GF, const int n_frames, const std::string name)\n+::Decoder_BCH(const int& K, const int& N, const tools::BCH_Polynomial_Generator &GF_poly, const int n_frames, const std::string name)\n: Decoder_SIHO_HIHO<B,R>(K, N, n_frames, 1, name),\nelp(N+2, std::vector<int>(N)), discrepancy(N+2), l(N+2), u_lu(N+2), s(N+1), loc(200), reg(201),\n- m(GF.get_m()), t(GF.get_t()), d(GF.get_d()), alpha_to(GF.get_alpha_to()), index_of(GF.get_index_of()),\n+ m(GF_poly.get_m()), t(GF_poly.get_t()), d(GF_poly.get_d()), alpha_to(GF_poly.get_alpha_to()), index_of(GF_poly.get_index_of()),\nYH_N(N)\n{\nif (K <= 3)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp", "new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp", "diff": "#include <vector>\n-#include \"Tools/Math/Galois.hpp\"\n+#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n#include \"../Decoder_SIHO_HIHO.hpp\"\n@@ -34,7 +34,7 @@ protected:\nstd::vector<B> YH_N; // hard decision input vector\npublic:\n- Decoder_BCH(const int& K, const int& N, const tools::Galois &GF, const int n_frames = 1,\n+ Decoder_BCH(const int& K, const int& N, const tools::BCH_Polynomial_Generator &GF, const int n_frames = 1,\nconst std::string name = \"Decoder_BCH\");\nvirtual ~Decoder_BCH();\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp", "new_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp", "diff": "#include <vector>\n#include <cmath>\n+#include <iostream>\n#include \"Encoder_BCH.hpp\"\n@@ -8,8 +9,22 @@ using namespace aff3ct::module;\ntemplate <typename B>\nEncoder_BCH<B>\n-::Encoder_BCH(const int& K, const int& N, const tools::Galois &GF, const int n_frames, const std::string name)\n- : Encoder<B>(K, N, n_frames, name), g(GF.get_g()), bb(N - K)\n+::Encoder_BCH(const int& K, const int& N, const tools::BCH_Polynomial_Generator& GF_poly, const int n_frames,\n+ const std::string name)\n+ : Encoder<B>(K, N, n_frames, name), g(GF_poly.get_g()), bb(N - K)\n+{\n+ if ((this->N - this->K) != GF_poly.get_n_rdncy())\n+ {\n+ std::stringstream message;\n+ message << \"'N - K' is different than 'n_rdncy' ('K' = \" << K << \", 'N' = \" << N << \", 'n_rdncy' = \"\n+ << GF_poly.get_n_rdncy() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n+template <typename B>\n+Encoder_BCH<B>\n+::~Encoder_BCH()\n{\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "new_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "diff": "#include <vector>\n#include \"../Encoder.hpp\"\n-#include \"Tools/Math/Galois.hpp\"\n+#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\nnamespace aff3ct\n{\n@@ -19,10 +19,10 @@ protected:\nstd::vector<B> bb; // coefficients of redundancy polynomial x^(length-k) i(x) modulo g(x)\npublic:\n- Encoder_BCH(const int& K, const int& N, const tools::Galois &GF, const int n_frames = 1,\n+ Encoder_BCH(const int& K, const int& N, const tools::BCH_Polynomial_Generator& GF, const int n_frames = 1,\nconst std::string name = \"Encoder_BCH\");\n- virtual ~Encoder_BCH() {}\n+ virtual ~Encoder_BCH();\nprotected:\nvirtual void _encode(const B *U_K, B *X_N, const int frame_id);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/BCH/BCH_Polynomial_Generator.cpp", "diff": "+#include <sstream>\n+\n+#include \"BCH_Polynomial_Generator.hpp\"\n+\n+#include \"Tools/Exception/exception.hpp\"\n+\n+using namespace aff3ct::tools;\n+\n+BCH_Polynomial_Generator\n+::BCH_Polynomial_Generator(const int& K, const int& N, const int& t)\n+ : Galois(K, N), t(t), d(2 * t + 1)\n+{\n+ if (t < 1)\n+ {\n+ std::stringstream message;\n+ message << \"The correction power 't' has to be strictly positive ('t' = \" << t << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ compute_polynomial();\n+}\n+\n+BCH_Polynomial_Generator\n+::~BCH_Polynomial_Generator()\n+{\n+}\n+\n+int BCH_Polynomial_Generator\n+::get_d() const\n+{\n+ return d;\n+}\n+\n+int BCH_Polynomial_Generator\n+::get_t() const\n+{\n+ return t;\n+}\n+\n+\n+int BCH_Polynomial_Generator\n+::get_n_rdncy() const\n+{\n+ return g.size() -1;\n+}\n+\n+const std::vector<int>& BCH_Polynomial_Generator\n+::get_g() const\n+{\n+ return g;\n+}\n+\n+void BCH_Polynomial_Generator\n+::compute_polynomial()\n+{\n+ int rdncy = 0;\n+\n+ bool test;\n+\n+ std::vector<int> zeros, min;\n+ std::vector<std::vector<int>> cycle_sets(2, std::vector<int>(1));\n+\n+ /* Generate cycle sets modulo N, N = 2**m - 1 */\n+ cycle_sets[0][0] = 0;\n+ cycle_sets[1][0] = 1;\n+\n+ int cycle_set_representative = 0;\n+ do\n+ {\n+ /* Generate the last cycle set */\n+ auto& cycle_set = cycle_sets.back();\n+ cycle_set.reserve(32);\n+ do\n+ {\n+ cycle_set.push_back((cycle_set.back() * 2) % N);\n+ }\n+ while (((cycle_set.back() * 2) % this->N) != cycle_set.front());\n+\n+ /* find next cycle set representative */\n+ do\n+ {\n+ cycle_set_representative++;\n+ test = false;\n+\n+ /* Examine each cycle sets */\n+ for (unsigned i = 1; (i < cycle_sets.size()) && !test; i++)\n+ for (unsigned j = 0; (j < cycle_sets[i].size()) && !test; j++)\n+ test = (cycle_set_representative == cycle_sets[i][j]);\n+ }\n+ while (test && (cycle_set_representative < (this->N - 1)));\n+\n+ if (!test)\n+ {\n+ /* add a new cycle set starting with the new representative */\n+ cycle_sets.push_back(std::vector<int>(1, cycle_set_representative));\n+ }\n+ }\n+ while (cycle_set_representative < (this->N - 1));\n+\n+\n+ /* Search for roots 1, 2, ..., d-1 in cycle sets */\n+ for (unsigned i = 1; i < cycle_sets.size(); i++)\n+ {\n+ test = false;\n+\n+ for (unsigned j = 0; (j < cycle_sets[i].size()) && !test; j++)\n+ for (int root = 1; (root < d) && !test; root++)\n+ if (root == cycle_sets[i][j])\n+ {\n+ test = true;\n+ min.push_back((int)i);\n+ rdncy += cycle_sets[i].size();\n+ }\n+ }\n+\n+\n+ if (this->K > this->N - rdncy)\n+ {\n+ std::stringstream message;\n+ message << \"'K' seems to be too big for this correction power 't' ('K' = \" << this->K << \", 't' = \" << t\n+ << \", 'N' = \" << this->N << \", 'rdncy' = \" << rdncy << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+\n+ zeros.resize(rdncy+1);\n+ int kaux = 1;\n+ test = true;\n+\n+ for (unsigned i = 0; i < min.size() && test; i++)\n+ for (unsigned j = 0; j < cycle_sets[min[i]].size() && test; j++)\n+ {\n+ zeros[kaux] = cycle_sets[min[i]][j];\n+ kaux++;\n+ test = (kaux <= rdncy);\n+ }\n+\n+\n+ g.resize(rdncy+1);\n+\n+ /* Compute the generator polynomial */\n+ g[0] = alpha_to[zeros[1]];\n+ g[1] = 1; /* g(x) = (X + zeros[1]) initially */\n+ for (int i = 2; i <= rdncy; i++)\n+ {\n+ g[i] = 1;\n+ for (int j = i - 1; j > 0; j--)\n+ if (g[j] != 0)\n+ g[j] = g[j - 1] ^ alpha_to[(index_of[g[j]] + zeros[i]) % N];\n+ else\n+ g[j] = g[j - 1];\n+\n+ g[0] = alpha_to[(index_of[g[0]] + zeros[i]) % N];\n+ }\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/BCH/BCH_Polynomial_Generator.hpp", "diff": "+#ifndef BCH_Polynomial_Generator_HPP\n+#define BCH_Polynomial_Generator_HPP\n+\n+#include <vector>\n+\n+#include \"Tools/Math/Galois.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+class BCH_Polynomial_Generator : public Galois\n+{\n+protected:\n+ const int t;\n+ const int d;\n+\n+ std::vector<int> g; // coefficients of the generator polynomial, g(x)\n+\n+public:\n+ BCH_Polynomial_Generator(const int& K, const int& N, const int& t);\n+ virtual ~BCH_Polynomial_Generator();\n+\n+ int get_d () const;\n+ int get_t () const; // get the correction power\n+ int get_n_rdncy() const; // get the number of redundancy bits\n+\n+ const std::vector<int>& get_g() const; // get the coefficients of the generator polynomial\n+\n+private:\n+ void compute_polynomial();\n+};\n+}\n+}\n+\n+#endif /* GALOIS_HPP */\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Codec/BCH/Codec_BCH.cpp", "new_path": "src/Tools/Codec/BCH/Codec_BCH.cpp", "diff": "@@ -8,9 +8,9 @@ Codec_BCH<B,Q>\n::Codec_BCH(const factory::Encoder ::parameters &enc_params,\nconst factory::Decoder_BCH::parameters &dec_params)\n: Codec<B,Q>(enc_params, dec_params), dec_par(dec_params),\n- GF(dec_params.K, dec_params.N_cw, dec_params.t)\n+ GF_poly(dec_params.K, dec_params.N_cw, dec_params.t)\n{\n- // assertion are made in the Galois Field (GF)\n+ // assertion are made in the Galois Field and BCH_Polynomial_Generator (GF_poly)\n}\ntemplate <typename B, typename Q>\n@@ -23,14 +23,14 @@ template <typename B, typename Q>\nmodule::Encoder<B>* Codec_BCH<B,Q>\n::build_encoder(const int tid, const module::Interleaver<int>* itl)\n{\n- return factory::Encoder_BCH::build<B>(this->enc_params, GF);\n+ return factory::Encoder_BCH::build<B>(this->enc_params, GF_poly);\n}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Codec_BCH<B,Q>\n::build_decoder(const int tid, const module::Interleaver<int>* itl, module::CRC<B>* crc)\n{\n- return factory::Decoder_BCH::build<B,Q>(dec_par, GF);\n+ return factory::Decoder_BCH::build<B,Q>(dec_par, GF_poly);\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Codec/BCH/Codec_BCH.hpp", "new_path": "src/Tools/Codec/BCH/Codec_BCH.hpp", "diff": "#ifndef CODEC_BCH_HPP_\n#define CODEC_BCH_HPP_\n-#include \"Tools/Math/Galois.hpp\"\n+#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n#include \"Factory/Module/Code/BCH/Encoder_BCH.hpp\"\n#include \"Factory/Module/Code/BCH/Decoder_BCH.hpp\"\n@@ -18,7 +18,7 @@ class Codec_BCH : public Codec<B,Q>\nprotected:\nconst factory::Decoder_BCH::parameters& dec_par;\n- const tools::Galois GF;\n+ const tools::BCH_Polynomial_Generator GF_poly;\npublic:\nCodec_BCH(const factory::Encoder ::parameters &enc_params,\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Math/Galois.cpp", "new_path": "src/Tools/Math/Galois.cpp", "diff": "using namespace aff3ct::tools;\nGalois\n-::Galois(const int& K, const int& N, const int& t)\n- : K(K), N(N), m((int)std::ceil(std::log2(N))), t(t), d(2 * t + 1), alpha_to(N +1), index_of(N +1),\n- p(m +1, 0), g(N - K + 1)\n+::Galois(const int& K, const int& N)\n+ : K(K), N(N), m((int)std::ceil(std::log2(N))), alpha_to(N +1), index_of(N +1), p(m +1, 0)\n{\nif (K <= 0)\n{\n@@ -49,6 +48,13 @@ Galois\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (m <= 1)\n+ {\n+ std::stringstream message;\n+ message << \"'m' has to be strictly greater than 1 ('m' = \" << m << \", 'N' = \" << N << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N != ((1 << m) -1))\n{\nstd::stringstream message;\n@@ -58,7 +64,6 @@ Galois\nSelect_Polynomial();\nGenerate_GF();\n- Compute_BCH_Generator_Polynomial();\n}\nGalois\n@@ -84,18 +89,6 @@ int Galois\nreturn m;\n}\n-int Galois\n-::get_t() const\n-{\n- return t;\n-}\n-\n-int Galois\n-::get_d() const\n-{\n- return d;\n-}\n-\nconst std::vector<int>& Galois\n::get_alpha_to() const\n{\n@@ -114,12 +107,6 @@ const std::vector<int>& Galois\nreturn p;\n}\n-const std::vector<int>& Galois\n-::get_g() const\n-{\n- return g;\n-}\n-\nvoid Galois\n::Select_Polynomial()\n{\n@@ -173,105 +160,3 @@ void Galois\n}\nindex_of[0] = -1;\n}\n-\n-void Galois\n-::Compute_BCH_Generator_Polynomial()\n-{\n- int ii, jj, ll, kaux;\n- int test, aux, nocycles, root, noterms, rdncy;\n- int cycle[1024][21], size[1024], min[1024], zeros[1024];\n-\n- /* Generate cycle sets modulo n, n = 2**m - 1 */\n- cycle[0][0] = 0;\n- size[0] = 1;\n- cycle[1][0] = 1;\n- size[1] = 1;\n- jj = 1; /* cycle set index */\n- do\n- {\n- /* Generate the jj-th cycle set */\n- ii = 0;\n- do\n- {\n- ii++;\n- cycle[jj][ii] = (cycle[jj][ii - 1] * 2) % N;\n- size[jj]++;\n- aux = (cycle[jj][ii] * 2) % N;\n- }\n- while (aux != cycle[jj][0]);\n- /* Next cycle set representative */\n- ll = 0;\n- do\n- {\n- ll++;\n- test = 0;\n- for (ii = 1; ((ii <= jj) && (!test)); ii++)\n- /* Examine previous cycle sets */\n- for (kaux = 0; ((kaux < size[ii]) && (!test)); kaux++)\n- if (ll == cycle[ii][kaux])\n- test = 1;\n- }\n- while ((test) && (ll < (N - 1)));\n- if (!(test))\n- {\n- jj++; /* next cycle set index */\n- cycle[jj][0] = ll;\n- size[jj] = 1;\n- }\n- }\n- while (ll < (N - 1));\n- nocycles = jj; /* number of cycle sets modulo n */\n-\n- //d = 2 * t + 1;\n-\n- /* Search for roots 1, 2, ..., d-1 in cycle sets */\n- kaux = 0;\n- rdncy = 0;\n- for (ii = 1; ii <= nocycles; ii++)\n- {\n- min[kaux] = 0;\n- test = 0;\n- for (jj = 0; ((jj < size[ii]) && (!test)); jj++)\n- for (root = 1; ((root < d) && (!test)); root++)\n- if (root == cycle[ii][jj])\n- {\n- test = 1;\n- min[kaux] = ii;\n- }\n- if (min[kaux])\n- {\n- rdncy += size[min[kaux]];\n- kaux++;\n- }\n- }\n- noterms = kaux;\n- kaux = 1;\n- for (ii = 0; ii < noterms; ii++)\n- for (jj = 0; jj < size[min[ii]]; jj++)\n- {\n- zeros[kaux] = cycle[min[ii]][jj];\n- kaux++;\n- }\n-\n- if (K > N - rdncy)\n- {\n- std::stringstream message;\n- message << \"'K' seems to be too big for this correction power 't' ('K' = \" << K << \", 't' = \" << t\n- << \", 'N' = \" << N << \", 'rdncy' = \" << rdncy << \").\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- /* Compute the generator polynomial */\n- g[0] = alpha_to[zeros[1]];\n- g[1] = 1; /* g(x) = (X + zeros[1]) initially */\n- for (ii = 2; ii <= rdncy; ii++)\n- {\n- g[ii] = 1;\n- for (jj = ii - 1; jj > 0; jj--)\n- if (g[jj] != 0)\n- g[jj] = g[jj - 1] ^ alpha_to[(index_of[g[jj]] + zeros[ii]) % N];\n- else\n- g[jj] = g[jj - 1];\n- g[0] = alpha_to[(index_of[g[0]] + zeros[ii]) % N];\n- }\n-}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Math/Galois.hpp", "new_path": "src/Tools/Math/Galois.hpp", "diff": "@@ -13,33 +13,26 @@ protected:\nconst int K;\nconst int N; // number of non-nul elements in the field : N = 2^m - 1\nconst int m; // order of the Galois Field\n- const int t;\n- const int d;\nstd::vector<int> alpha_to; // log table of GF(2**m)\nstd::vector<int> index_of; // antilog table of GF(2**m)\nstd::vector<int> p; // coefficients of a primitive polynomial used to generate GF(2**m)\n- std::vector<int> g; // coefficients of the generator polynomial, g(x)\npublic:\n- Galois(const int& K, const int& N, const int& t);\n+ Galois(const int& K, const int& N);\nvirtual ~Galois();\nint get_K() const;\nint get_N() const;\nint get_m() const;\n- int get_t() const;\n- int get_d() const;\nconst std::vector<int>& get_alpha_to() const;\nconst std::vector<int>& get_index_of() const;\nconst std::vector<int>& get_p () const;\n- const std::vector<int>& get_g () const;\nprivate:\nvoid Select_Polynomial();\nvoid Generate_GF();\n- void Compute_BCH_Generator_Polynomial();\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Correction of the BCH polynomial generator
8,490
13.10.2017 16:36:39
-7,200
867e588b1087a9a5b952877bed1338b66e03474b
Simplify SystemC.
[ { "change_type": "MODIFY", "old_path": "src/Module/SC_Module.cpp", "new_path": "src/Module/SC_Module.cpp", "diff": "@@ -246,8 +246,11 @@ void SC_Module_container::create_module(const int id)\nfill(sc_modules.begin(), sc_modules.end(), nullptr);\n}\n- if ((size_t)id < sc_modules.size() && sc_modules[id] == nullptr)\n+ if ((size_t)id < sc_modules.size())\n{\n+ if (sc_modules[id] != nullptr)\n+ erase_module(id);\n+\nsc_modules[id] = new SC_Module(module[id], (module.get_name() + \"::\" + module[id].get_name()).c_str());\n}\nelse\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.cpp", "diff": "@@ -98,47 +98,6 @@ void SC_BFER_ite<B,R,Q>\nthis->crc[tid]->sc.create_module(crc::tsk::extract);\n}\n-template <typename B, typename R, typename Q>\n-void SC_BFER_ite<B,R,Q>\n-::erase_sc_modules()\n-{\n- using namespace module;\n- const auto tid = 0;\n-\n- // create the sc_module inside the objects of the communication chain\n- this->source [tid] ->sc.erase_module(src::tsk::generate );\n- this->crc [tid] ->sc.erase_module(crc::tsk::build );\n- this->codec [tid]->get_encoder()->sc.erase_module(enc::tsk::encode );\n- this->interleaver_bit[tid] ->sc.erase_module(itl::tsk::interleave);\n- this->modem [tid] ->sc.erase_module(mdm::tsk::modulate );\n- this->modem [tid] ->sc.erase_module(mdm::tsk::filter );\n- if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n- {\n- this->channel[tid]->sc.erase_module(chn::tsk::add_noise_wg );\n- this->modem [tid]->sc.erase_module(mdm::tsk::demodulate_wg );\n- this->modem [tid]->sc.erase_module(mdm::tsk::tdemodulate_wg);\n- }\n- else\n- {\n- this->channel[tid]->sc.erase_module(chn::tsk::add_noise );\n- this->modem [tid]->sc.erase_module(mdm::tsk::demodulate );\n- this->modem [tid]->sc.erase_module(mdm::tsk::tdemodulate);\n- }\n- this->interleaver_llr[tid] ->sc.erase_module(itl::tsk::interleave );\n- this->quantizer [tid] ->sc.erase_module(qnt::tsk::process );\n- this->interleaver_llr[tid] ->sc.erase_module(itl::tsk::deinterleave);\n- this->codec [tid]->get_decoder_siho()->sc.erase_module(dec::tsk::decode_siho );\n- this->codec [tid]->get_decoder_siso()->sc.erase_module(dec::tsk::decode_siso );\n- this->monitor [tid] ->sc.erase_module(mnt::tsk::check_errors);\n- if (this->params.coset)\n- {\n- this->coset_real[tid]->sc.erase_module(cst::tsk::apply);\n- this->coset_real_i ->sc.erase_module(cst::tsk::apply);\n- this->coset_bit [tid]->sc.erase_module(cst::tsk::apply);\n- }\n- this->crc[tid]->sc.erase_module(crc::tsk::extract);\n-}\n-\ntemplate <typename B, typename R, typename Q>\nvoid SC_BFER_ite<B,R,Q>\n::release_objects()\n@@ -192,8 +151,6 @@ void SC_BFER_ite<B,R,Q>\ndelete this->funnel; this->funnel = nullptr;\ndelete this->predicate; this->predicate = nullptr;\n- this->erase_sc_modules();\n-\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// /!\\ VERY DIRTY WAY TO CREATE A NEW SIMULATION CONTEXT IN SYSTEMC, BE CAREFUL THIS IS NOT IN THE STD! /!\\ //\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp", "new_path": "src/Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp", "diff": "@@ -33,7 +33,6 @@ public:\nprotected:\nvoid create_sc_modules();\n- void erase_sc_modules();\nvirtual void __build_communication_chain(const int tid = 0);\nvirtual void release_objects();\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/SystemC/SC_BFER_std.cpp", "new_path": "src/Simulation/BFER/Standard/SystemC/SC_BFER_std.cpp", "diff": "@@ -82,43 +82,6 @@ void SC_BFER_std<B,R,Q>\nthis->crc[tid]->sc.create_module(crc::tsk::extract);\n}\n-template <typename B, typename R, typename Q>\n-void SC_BFER_std<B,R,Q>\n-::erase_sc_modules()\n-{\n- using namespace module;\n-\n- const auto tid = 0;\n-\n- // erase the sc_module inside the objects of the communication chain\n- this->source [tid] ->sc.erase_module(src::tsk::generate );\n- this->crc [tid] ->sc.erase_module(crc::tsk::build );\n- this->codec [tid]->get_encoder() ->sc.erase_module(enc::tsk::encode );\n- this->codec [tid]->get_puncturer()->sc.erase_module(pct::tsk::puncture );\n- this->codec [tid]->get_puncturer()->sc.erase_module(pct::tsk::depuncture);\n- this->modem [tid] ->sc.erase_module(mdm::tsk::modulate );\n- this->modem [tid] ->sc.erase_module(mdm::tsk::filter );\n- if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n- {\n- this->channel[tid]->sc.erase_module(chn::tsk::add_noise_wg );\n- this->modem [tid]->sc.erase_module(mdm::tsk::demodulate_wg);\n- }\n- else\n- {\n- this->channel[tid]->sc.erase_module(chn::tsk::add_noise );\n- this->modem [tid]->sc.erase_module(mdm::tsk::demodulate);\n- }\n- this->quantizer[tid] ->sc.erase_module(qnt::tsk::process );\n- this->codec [tid]->get_decoder_siho()->sc.erase_module(dec::tsk::decode_siho );\n- this->monitor [tid] ->sc.erase_module(mnt::tsk::check_errors);\n- if (this->params.coset)\n- {\n- this->coset_real[tid]->sc.erase_module(cst::tsk::apply);\n- this->coset_bit [tid]->sc.erase_module(cst::tsk::apply);\n- }\n- this->crc[tid]->sc.erase_module(crc::tsk::extract);\n-}\n-\ntemplate <typename B, typename R, typename Q>\nvoid SC_BFER_std<B,R,Q>\n::_launch()\n@@ -145,8 +108,6 @@ void SC_BFER_std<B,R,Q>\nthis->duplicator[i] = nullptr;\n}\n- this->erase_sc_modules();\n-\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////\n// /!\\ VERY DIRTY WAY TO CREATE A NEW SIMULATION CONTEXT IN SYSTEMC, BE CAREFUL THIS IS NOT IN THE STD! /!\\ //\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/SystemC/SC_BFER_std.hpp", "new_path": "src/Simulation/BFER/Standard/SystemC/SC_BFER_std.hpp", "diff": "@@ -23,7 +23,6 @@ public:\nprotected:\nvoid create_sc_modules();\n- void erase_sc_modules();\nvirtual void __build_communication_chain(const int tid = 0);\nvirtual void _launch();\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify SystemC.
8,490
16.10.2017 11:46:58
-7,200
206bf4a0e6a29c6af24c19d7c6d4b11d90768b83
Add new method in the factories in order to be able to catch all the prefixes and names dynamically.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Factory.cpp", "new_path": "src/Factory/Factory.cpp", "diff": "@@ -75,3 +75,26 @@ std::string Factory::parameters\n{\nreturn this->prefix;\n}\n+\n+std::vector<std::string> Factory::parameters\n+::get_names() const\n+{\n+ std::vector<std::string> n;\n+ n.push_back(this->name);\n+ return n;\n+}\n+std::vector<std::string> Factory::parameters\n+::get_short_names() const\n+{\n+ std::vector<std::string> sn;\n+ sn.push_back(this->short_name);\n+ return sn;\n+}\n+\n+std::vector<std::string> Factory::parameters\n+::get_prefixes() const\n+{\n+ std::vector<std::string> p;\n+ p.push_back(this->prefix);\n+ return p;\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Factory.hpp", "new_path": "src/Factory/Factory.hpp", "diff": "@@ -57,6 +57,10 @@ struct Factory\nstd::string get_short_name () const;\nstd::string get_prefix () const;\n+ virtual std::vector<std::string> get_names () const;\n+ virtual std::vector<std::string> get_short_names() const;\n+ virtual std::vector<std::string> get_prefixes () const;\n+\nvirtual void get_description(arg_map &req_args, arg_map &opt_args ) const = 0;\nvirtual void store (const arg_val_map &vals ) = 0;\nvirtual void get_headers (std::map<std::string,header_list>& headers, const bool full = true) const = 0;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec.cpp", "new_path": "src/Factory/Module/Codec/Codec.cpp", "diff": "@@ -34,6 +34,35 @@ void Codec::parameters\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"This codec does not support to be punctured.\");\n}\n+std::vector<std::string> Codec::parameters\n+::get_names() const\n+{\n+ auto n = Factory::parameters::get_names();\n+ if (enc != nullptr) { auto nn = enc->get_names(); for (auto &x : nn) n.push_back(x); }\n+ if (dec != nullptr) { auto nn = dec->get_names(); for (auto &x : nn) n.push_back(x); }\n+ if (itl != nullptr) { auto nn = itl->get_names(); for (auto &x : nn) n.push_back(x); }\n+ return n;\n+}\n+std::vector<std::string> Codec::parameters\n+::get_short_names() const\n+{\n+ auto sn = Factory::parameters::get_short_names();\n+ if (enc != nullptr) { auto nn = enc->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ if (dec != nullptr) { auto nn = dec->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ if (itl != nullptr) { auto nn = itl->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ return sn;\n+}\n+\n+std::vector<std::string> Codec::parameters\n+::get_prefixes() const\n+{\n+ auto p = Factory::parameters::get_prefixes();\n+ if (enc != nullptr) { auto nn = enc->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ if (dec != nullptr) { auto nn = dec->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ if (itl != nullptr) { auto nn = itl->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ return p;\n+}\n+\nvoid Codec::parameters\n::get_description(arg_map &req_args, arg_map &opt_args) const\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec.hpp", "new_path": "src/Factory/Module/Codec/Codec.hpp", "diff": "@@ -39,6 +39,10 @@ struct Codec : Factory\nvirtual Codec::parameters* clone() const;\nvirtual void enable_puncturer();\n+ virtual std::vector<std::string> get_names () const;\n+ virtual std::vector<std::string> get_short_names() const;\n+ virtual std::vector<std::string> get_prefixes () const;\n+\n// parameters construction\nvirtual void get_description(arg_map &req_args, arg_map &opt_args ) const;\nvirtual void store (const arg_val_map &vals );\n" } ]
C++
MIT License
aff3ct/aff3ct
Add new method in the factories in order to be able to catch all the prefixes and names dynamically.
8,490
16.10.2017 11:47:40
-7,200
cce3402bd30cd1b95feb67630979f67d0b538014
Do not display the same required argument twice.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -234,13 +234,20 @@ void Arguments_reader\nstd::cout << \"Usage: \" << this->m_program_name;\n+ std::vector<std::string> existing_flags;\n+\nfor (auto it = this->m_required_args.begin(); it != this->m_required_args.end(); ++it)\n{\nconst auto last = it->first.size() -1;\n+ if (std::find(existing_flags.begin(), existing_flags.end(), it->first[last]) == existing_flags.end())\n+ {\nif(it->second[0] != \"\")\nstd::cout << \" \" + print_tag(it->first[last]) << \" <\" << it->second[0] << \">\";\nelse\nstd::cout << \" \" + print_tag(it->first[last]);\n+\n+ existing_flags.push_back(it->first[last]);\n+ }\n}\nstd::cout << \" [optional args...]\" << std::endl << std::endl;\n" } ]
C++
MIT License
aff3ct/aff3ct
Do not display the same required argument twice.
8,490
16.10.2017 14:14:41
-7,200
4283cd9ec571379f3933c34779dbda61a9a27946
Remove the 'get_module_name' method.
[ { "change_type": "MODIFY", "old_path": "src/Module/Socket.hpp", "new_path": "src/Module/Socket.hpp", "diff": "@@ -75,8 +75,8 @@ public:\n<< \", 's.name' = \" << s.get_name()\n<< \", 'task.name' = \" << task.get_name()\n<< \", 's.task.name' = \" << s.task.get_name()\n- << \", 'task.module.name' = \" << task.get_module_name()\n- << \", 's.task.module.name' = \" << s.task.get_module_name()\n+// << \", 'task.module.name' = \" << task.get_module_name()\n+// << \", 's.task.module.name' = \" << s.task.get_module_name()\n<< \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -90,8 +90,8 @@ public:\n<< \", 's.name' = \" << s.get_name()\n<< \", 'task.name' = \" << task.get_name()\n<< \", 's.task.name' = \" << s.task.get_name()\n- << \", 'task.module.name' = \" << task.get_module_name()\n- << \", 's.task.module.name' = \" << s.task.get_module_name()\n+// << \", 'task.module.name' = \" << task.get_module_name()\n+// << \", 's.task.module.name' = \" << s.task.get_module_name()\n<< \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -133,7 +133,7 @@ public:\n<< \", 'get_n_elmts()' = \" << get_n_elmts()\n<< \", 'name' = \" << get_name()\n<< \", 'task.name' = \" << task.get_name()\n- << \", 'task.module.name' = \" << task.get_module_name()\n+// << \", 'task.module.name' = \" << task.get_module_name()\n<< \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -163,7 +163,7 @@ public:\n<< \", 'datatype' = \" << type_to_string[this->datatype]\n<< \", 'socket.name' = \" << get_name()\n<< \", 'task.name' = \" << task.get_name()\n- << \", 'module.name' = \" << task.get_module_name()\n+// << \", 'module.name' = \" << task.get_module_name()\n<< \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -14,7 +14,6 @@ using namespace aff3ct::module;\nTask::Task(const Module &module, const std::string name, const bool autoalloc, const bool autoexec,\nconst bool stats, const bool fast, const bool debug)\n: module(module),\n- module_name(module.get_name()),\nname(name),\nautoalloc(autoalloc),\nautoexec(autoexec),\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.hpp", "new_path": "src/Module/Task.hpp", "diff": "@@ -35,7 +35,6 @@ class Task\nprotected:\nconst Module &module;\n- const std::string &module_name;\nconst std::string name;\nbool autoalloc;\nbool autoexec;\n@@ -93,7 +92,6 @@ public:\ninline bool is_last_input_socket(const Socket &s_in) const { return last_input_socket == &s_in; }\ninline bool can_exec ( ) const;\n- inline const std::string& get_module_name( ) const { return this->module_name; }\ninline const Module& get_module ( ) const { return this->module; }\ninline std::string get_name ( ) const { return this->name; }\ninline uint32_t get_n_calls ( ) const { return this->n_calls; }\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove the 'get_module_name' method.
8,490
16.10.2017 15:00:41
-7,200
405cacc644b7da7292788415791ad15b1b232ae8
Add some new specific functions to manage the arguments and the headers automatically.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Factory.cpp", "new_path": "src/Factory/Factory.cpp", "diff": "#include <algorithm>\n#include <iostream>\n#include <utility>\n+#include <sstream>\n#include <vector>\n#include <map>\n#include \"Tools/general_utils.h\"\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Factory.hpp\"\n@@ -16,38 +18,6 @@ bool aff3ct::factory::exist(const arg_val_map &vals, const std::vector<std::stri\nreturn (vals.find(tags) != vals.end());\n}\n-void aff3ct::factory::Header::print_parameters(std::string grp_key, std::string grp_name, header_list header,\n- int max_n_chars, std::ostream& stream)\n-{\n- auto key = tools::string_split(grp_key, '-');\n-\n- if (key.size() == 1)\n- {\n- stream << \"# * \" << tools::format(grp_name, tools::Style::BOLD | tools::Style::UNDERLINED) << \" \";\n- for (auto i = 0; i < 46 - (int)grp_name.length(); i++) std::cout << \"-\";\n- stream << std::endl;\n- }\n- else if (key.size() > 1)\n- {\n- stream << \"# \" << tools::format(grp_name, tools::Style::BOLD | tools::Style::UNDERLINED) << \" \";\n- for (auto i = 0; i < 45 - (int)grp_name.length(); i++) std::cout << \"-\";\n- stream << std::endl;\n- }\n-\n- for (auto i = 0; i < (int)header.size(); i++)\n- {\n- stream << \"# ** \" << tools::style(header[i].first, tools::Style::BOLD);\n- for (auto j = 0; j < max_n_chars - (int)header[i].first.length(); j++) stream << \" \";\n- stream << \" = \" << header[i].second << std::endl;\n- }\n-}\n-\n-void aff3ct::factory::Header::compute_max_n_chars(const header_list& header, int& max_n_chars)\n-{\n- for (unsigned i = 0; i < header.size(); i++)\n- max_n_chars = std::max(max_n_chars, (int)header[i].first.length());\n-}\n-\nFactory::parameters\n::parameters(const std::string name, const std::string short_name, const std::string prefix)\n: name(name), short_name(short_name), prefix(prefix)\n@@ -98,3 +68,111 @@ std::vector<std::string> Factory::parameters\np.push_back(this->prefix);\nreturn p;\n}\n+\n+std::pair<arg_map, arg_map> Factory\n+::get_description(const std::vector<Factory::parameters*> &params)\n+{\n+ std::pair<arg_map, arg_map> args;\n+ for (auto *p : params)\n+ p->get_description(args.first, args.second);\n+\n+ return args;\n+}\n+\n+void Factory\n+::store(std::vector<Factory::parameters*> &params, const arg_val_map &vals)\n+{\n+ for (auto *p : params)\n+ p->store(vals);\n+}\n+\n+aff3ct::factory::arg_grp Factory\n+::create_groups(const std::vector<Factory::parameters*> &params)\n+{\n+ // create groups of arguments\n+ aff3ct::factory::arg_grp grps;\n+ for (auto *p : params)\n+ {\n+ auto prefixes = p->get_prefixes ();\n+ auto short_names = p->get_short_names();\n+\n+ if (prefixes.size() != short_names.size())\n+ {\n+ std::stringstream message;\n+ message << \"'prefixes.size()' has to be equal to 'short_names.size()' ('prefixes.size()' = \"\n+ << prefixes.size() << \", 'short_names.size()' = \" << short_names.size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (size_t i = 0; i < prefixes.size(); i++)\n+ grps.push_back({prefixes[i], short_names[i] + \" parameter(s)\"});\n+ }\n+\n+ return grps;\n+}\n+\n+void aff3ct::factory::Header::print_parameters(std::string grp_key, std::string grp_name, header_list header,\n+ int max_n_chars, std::ostream& stream)\n+{\n+ auto key = tools::string_split(grp_key, '-');\n+\n+ if (key.size() == 1)\n+ {\n+ stream << \"# * \" << tools::format(grp_name, tools::Style::BOLD | tools::Style::UNDERLINED) << \" \";\n+ for (auto i = 0; i < 46 - (int)grp_name.length(); i++) std::cout << \"-\";\n+ stream << std::endl;\n+ }\n+ else if (key.size() > 1)\n+ {\n+ stream << \"# \" << tools::format(grp_name, tools::Style::BOLD | tools::Style::UNDERLINED) << \" \";\n+ for (auto i = 0; i < 45 - (int)grp_name.length(); i++) std::cout << \"-\";\n+ stream << std::endl;\n+ }\n+\n+ for (auto i = 0; i < (int)header.size(); i++)\n+ {\n+ stream << \"# ** \" << tools::style(header[i].first, tools::Style::BOLD);\n+ for (auto j = 0; j < max_n_chars - (int)header[i].first.length(); j++) stream << \" \";\n+ stream << \" = \" << header[i].second << std::endl;\n+ }\n+}\n+\n+void aff3ct::factory::Header::print_parameters(const std::vector<Factory::parameters*> &params, std::ostream& stream)\n+{\n+ int max_n_chars = 0;\n+ for (auto *p : params)\n+ {\n+ std::map<std::string,aff3ct::factory::header_list> headers;\n+ p->get_headers(headers, true);\n+\n+ for (auto &h : headers)\n+ aff3ct::factory::Header::compute_max_n_chars(h.second, max_n_chars);\n+ }\n+\n+ for (auto *p : params)\n+ {\n+ std::map<std::string,aff3ct::factory::header_list> headers;\n+ p->get_headers(headers, true);\n+\n+ auto prefixes = p->get_prefixes();\n+ auto short_names = p->get_short_names();\n+\n+ if (prefixes.size() != short_names.size())\n+ {\n+ std::stringstream message;\n+ message << \"'prefixes.size()' has to be equal to 'short_names.size()' ('prefixes.size()' = \"\n+ << prefixes.size() << \", 'short_names.size()' = \" << short_names.size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (size_t i = 0; i < prefixes.size(); i++)\n+ if (headers[prefixes[i]].size())\n+ aff3ct::factory::Header::print_parameters(prefixes[i], short_names[i], headers[prefixes[i]], max_n_chars);\n+ }\n+}\n+\n+void aff3ct::factory::Header::compute_max_n_chars(const header_list& header, int& max_n_chars)\n+{\n+ for (unsigned i = 0; i < header.size(); i++)\n+ max_n_chars = std::max(max_n_chars, (int)header[i].first.length());\n+}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Factory.hpp", "new_path": "src/Factory/Factory.hpp", "diff": "@@ -25,14 +25,6 @@ using arg_val_map = std::map<std::vector<std::string>, std::string>;\nbool exist(const arg_val_map &vals, const std::vector<std::string> &tags);\n-struct Header\n-{\n- static void print_parameters(std::string grp_key, std::string grp_name, header_list header, int max_n_chars,\n- std::ostream& stream = std::cout);\n-\n- static void compute_max_n_chars(const header_list& header, int& max_n_chars);\n-};\n-\n/*!\n* \\class Factory\n*\n@@ -70,6 +62,21 @@ struct Factory\nconst std::string short_name;\nconst std::string prefix;\n};\n+\n+ static std::pair<arg_map, arg_map> get_description(const std::vector<Factory::parameters*> &params);\n+ static void store(std::vector<Factory::parameters*> &params, const arg_val_map &vals);\n+ static aff3ct::factory::arg_grp create_groups(const std::vector<Factory::parameters*> &params);\n+};\n+\n+struct Header\n+{\n+ static void print_parameters(std::string grp_key, std::string grp_name, header_list header, int max_n_chars,\n+ std::ostream& stream = std::cout);\n+\n+ static void print_parameters(const std::vector<Factory::parameters*> &params,\n+ std::ostream& stream = std::cout);\n+\n+ static void compute_max_n_chars(const header_list& header, int& max_n_chars);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add some new specific functions to manage the arguments and the headers automatically.
8,490
16.10.2017 17:49:44
-7,200
035574e6eb3c356f64f8353aa8c130b637f963da
Move sub encoder after the scaling factor and the Flip and check.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "new_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "diff": "@@ -54,10 +54,10 @@ std::vector<std::string> Decoder_turbo::parameters<D1,D2>\n::get_names() const\n{\nauto n = Decoder::parameters::get_names();\n- if (sub1 != nullptr) { auto nn = sub1->get_names(); for (auto &x : nn) n.push_back(x); }\n- if (sub2 != nullptr) { auto nn = sub2->get_names(); for (auto &x : nn) n.push_back(x); }\nif (sf != nullptr) { auto nn = sf ->get_names(); for (auto &x : nn) n.push_back(x); }\nif (fnc != nullptr) { auto nn = fnc ->get_names(); for (auto &x : nn) n.push_back(x); }\n+ if (sub1 != nullptr) { auto nn = sub1->get_names(); for (auto &x : nn) n.push_back(x); }\n+ if (sub2 != nullptr) { auto nn = sub2->get_names(); for (auto &x : nn) n.push_back(x); }\nif (itl != nullptr) { auto nn = itl ->get_names(); for (auto &x : nn) n.push_back(x); }\nreturn n;\n}\n@@ -67,10 +67,10 @@ std::vector<std::string> Decoder_turbo::parameters<D1,D2>\n::get_short_names() const\n{\nauto sn = Decoder::parameters::get_short_names();\n- if (sub1 != nullptr) { auto nn = sub1->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n- if (sub2 != nullptr) { auto nn = sub2->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (sf != nullptr) { auto nn = sf ->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (fnc != nullptr) { auto nn = fnc ->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ if (sub1 != nullptr) { auto nn = sub1->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ if (sub2 != nullptr) { auto nn = sub2->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (itl != nullptr) { auto nn = itl ->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nreturn sn;\n}\n@@ -80,10 +80,10 @@ std::vector<std::string> Decoder_turbo::parameters<D1,D2>\n::get_prefixes() const\n{\nauto p = Decoder::parameters::get_prefixes();\n- if (sub1 != nullptr) { auto nn = sub1->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n- if (sub2 != nullptr) { auto nn = sub2->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (sf != nullptr) { auto nn = sf ->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (fnc != nullptr) { auto nn = fnc ->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ if (sub1 != nullptr) { auto nn = sub1->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ if (sub2 != nullptr) { auto nn = sub2->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (itl != nullptr) { auto nn = itl ->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nreturn p;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "diff": "@@ -39,9 +39,9 @@ std::vector<std::string> Decoder_turbo_DB::parameters\n::get_names() const\n{\nauto n = Decoder::parameters::get_names();\n- if (sub != nullptr) { auto nn = sub->get_names(); for (auto &x : nn) n.push_back(x); }\nif (sf != nullptr) { auto nn = sf ->get_names(); for (auto &x : nn) n.push_back(x); }\nif (fnc != nullptr) { auto nn = fnc->get_names(); for (auto &x : nn) n.push_back(x); }\n+ if (sub != nullptr) { auto nn = sub->get_names(); for (auto &x : nn) n.push_back(x); }\nif (itl != nullptr) { auto nn = itl->get_names(); for (auto &x : nn) n.push_back(x); }\nreturn n;\n}\n@@ -50,9 +50,9 @@ std::vector<std::string> Decoder_turbo_DB::parameters\n::get_short_names() const\n{\nauto sn = Decoder::parameters::get_short_names();\n- if (sub != nullptr) { auto nn = sub->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (sf != nullptr) { auto nn = sf ->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (fnc != nullptr) { auto nn = fnc->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ if (sub != nullptr) { auto nn = sub->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (itl != nullptr) { auto nn = itl->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nreturn sn;\n}\n@@ -61,9 +61,9 @@ std::vector<std::string> Decoder_turbo_DB::parameters\n::get_prefixes() const\n{\nauto p = Decoder::parameters::get_prefixes();\n- if (sub != nullptr) { auto nn = sub->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (sf != nullptr) { auto nn = sf ->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (fnc != nullptr) { auto nn = fnc->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ if (sub != nullptr) { auto nn = sub->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (itl != nullptr) { auto nn = itl->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nreturn p;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Move sub encoder after the scaling factor and the Flip and check.
8,490
18.10.2017 11:55:56
-7,200
9674ee61ccc45fdc4a5f122e6c63db207427b71c
Fix the puncturer in the turbo code factories.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo/Codec_turbo.cpp", "new_path": "src/Factory/Module/Codec/Turbo/Codec_turbo.cpp", "diff": "@@ -162,9 +162,9 @@ void Codec_turbo::parameters\n{\nCodec_SIHO::parameters::get_headers(headers, full);\nenc->get_headers(headers, full);\n+ dec->get_headers(headers, full);\nif (this->pct)\npct->get_headers(headers, full);\n- dec->get_headers(headers, full);\n}\ntemplate <typename B, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -157,9 +157,9 @@ void Codec_turbo_DB::parameters\nCodec_SIHO::parameters::get_headers(headers, full);\nenc->get_headers(headers, full);\n+ dec->get_headers(headers, full);\nif (this->pct)\npct->get_headers(headers, full);\n- dec->get_headers(headers, full);\n}\ntemplate <typename B, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/Turbo_DB/Turbo_DB.cpp", "new_path": "src/Launcher/Code/Turbo_DB/Turbo_DB.cpp", "diff": "#include <iostream>\n+#include \"Launcher/Simulation/BFER_std.hpp\"\n+\n#include \"Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp\"\n#include \"Turbo_DB.hpp\"\n@@ -13,6 +15,9 @@ Turbo_DB<L,B,R,Q>\n: L(argc, argv, stream), params_cdc(new factory::Codec_turbo_DB::parameters(\"cdc\"))\n{\nthis->params.set_cdc(params_cdc);\n+\n+ if (typeid(L) == typeid(BFER_std<B,R,Q>))\n+ params_cdc->enable_puncturer();\n}\ntemplate <class L, typename B, typename R, typename Q>\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the puncturer in the turbo code factories.
8,490
19.10.2017 07:57:32
-7,200
e76f9139604c0f12f485f1648ff516c64d7898c6
Rm the GEN sim type because it does not exist anymore.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -81,7 +81,7 @@ void factory::Launcher::parameters\nopt_args[{p+\"-type\"}] =\n{\"string\",\n\"select the type of simulation to launch (default is BFER).\",\n- \"BFER, BFERI, EXIT, GEN\"};\n+ \"BFER, BFERI, EXIT\"};\n#ifdef MULTI_PREC\nopt_args[{p+\"-prec\", \"p\"}] =\n" } ]
C++
MIT License
aff3ct/aff3ct
Rm the GEN sim type because it does not exist anymore.
8,490
19.10.2017 13:19:16
-7,200
f22a9e0ab08645e962994bd5ae0d2db39fe05f28
Fix the codec type.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec.cpp", "new_path": "src/Factory/Module/Codec/Codec.cpp", "diff": "@@ -85,6 +85,8 @@ void Codec::parameters\nconst auto code_rate = (float)this->K / (float)this->N;\nauto v = tools::string_split(this->get_name(), ' ');\nauto name = v.size() >= 2 ? v[1] : \"UNKNOWN\";\n+ for (size_t i = 2; i < v.size(); i++)\n+ name += \"_\" + v[i];\nstd::transform(name.begin(), name.end(), name.begin(), toupper);\nheaders[p].push_back(std::make_pair(\"Type\", name ));\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the codec type.
8,490
19.10.2017 17:37:02
-7,200
f11d816e78423883aa73c2a8625ab9c92c20a931
Autostop AFF3CT when the --sim-stop-time param take effect.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -262,6 +262,10 @@ void BFER<B,R,Q>\nthis->dumper_red->clear();\n}\n+ if (this->monitor_red->get_n_fe() < this->monitor_red->get_fe_limit() &&\n+ (max_fra == 0 || this->monitor_red->get_n_fe() < max_fra))\n+ module::Monitor::stop();\n+\nthis->monitor_red->reset();\nfor (auto &m : modules)\nfor (auto mm : m.second)\n" } ]
C++
MIT License
aff3ct/aff3ct
Autostop AFF3CT when the --sim-stop-time param take effect.
8,490
19.10.2017 18:52:29
-7,200
065a3155e77deb0b986b8164212d4054116b4ce7
Fix Turbo DB pct conf.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -127,6 +127,7 @@ void Codec_turbo_DB::parameters\nif (this->pct)\n{\nthis->pct->K = this->enc->K;\n+ this->pct->N = this->enc->N_cw;\nthis->pct->N_cw = this->enc->N_cw;\nthis->pct->n_frames = this->enc->n_frames;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix Turbo DB pct conf.
8,490
20.10.2017 17:12:51
-7,200
70128ae641daf141317fb67232f622fcc8a246ec
Fix the turbo code puncturer.
[ { "change_type": "MODIFY", "old_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.cpp", "new_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.cpp", "diff": "@@ -27,11 +27,11 @@ Puncturer_polar_wangliu<B,Q>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (fb_generator.get_N() != this->N_code)\n+ if (fb_generator.get_N() != this->N_cw)\n{\nstd::stringstream message;\n- message << \"'fb_generator.get_N()' has to be equal to 'N_code' ('fb_generator.get_N()' = \"\n- << fb_generator.get_N() << \", 'N_code' = \" << this->N_code << \").\";\n+ message << \"'fb_generator.get_N()' has to be equal to 'N_cw' ('fb_generator.get_N()' = \"\n+ << fb_generator.get_N() << \", 'N_cw' = \" << this->N_cw << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n@@ -79,7 +79,7 @@ void Puncturer_polar_wangliu<B,Q>\nstd::copy(Y_N1, Y_N1 + this->N, Y_N2);\n// +inf (bit = 0)\n- std::fill(Y_N2 + this->N, Y_N2 + this->N_code, tools::sat_vals<Q>().second);\n+ std::fill(Y_N2 + this->N, Y_N2 + this->N_cw, tools::sat_vals<Q>().second);\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Puncturer/Puncturer.hpp", "new_path": "src/Module/Puncturer/Puncturer.hpp", "diff": "@@ -50,7 +50,7 @@ class Puncturer : public Module\nprotected:\nconst int K; /*!< Number of information bits in one frame */\nconst int N; /*!< Size of one frame (= number of bits in one frame) */\n- const int N_code; /*!< Real size of the codeword (Puncturer::N_code >= Puncturer::N) */\n+ const int N_cw; /*!< Real size of the codeword (Puncturer::N_cw >= Puncturer::N) */\npublic:\n/*!\n@@ -58,13 +58,13 @@ public:\n*\n* \\param K: number of information bits in the frame.\n* \\param N: size of one frame.\n- * \\param N_code: real size of the codeword (Puncturer::N_code >= Puncturer::N).\n+ * \\param N_cw: real size of the codeword (Puncturer::N_cw >= Puncturer::N).\n* \\param n_frames: number of frames to process in the Puncturer.\n* \\param name: Puncturer's name.\n*/\n- Puncturer(const int K, const int N, const int N_code, const int n_frames = 1,\n+ Puncturer(const int K, const int N, const int N_cw, const int n_frames = 1,\nconst std::string name = \"Puncturer\")\n- : Module(n_frames, name, \"Puncturer\"), K(K), N(N), N_code(N_code)\n+ : Module(n_frames, name, \"Puncturer\"), K(K), N(N), N_cw(N_cw)\n{\nif (K <= 0)\n{\n@@ -80,10 +80,10 @@ public:\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (N_code <= 0)\n+ if (N_cw <= 0)\n{\nstd::stringstream message;\n- message << \"'N_code' has to be greater than 0 ('N_code' = \" << N_code << \").\";\n+ message << \"'N_cw' has to be greater than 0 ('N_cw' = \" << N_cw << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -94,15 +94,15 @@ public:\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (N > N_code)\n+ if (N > N_cw)\n{\nstd::stringstream message;\n- message << \"'N' has to be smaller or equal to 'N_code' ('N' = \" << N << \", 'N_code' = \" << N_code << \").\";\n+ message << \"'N' has to be smaller or equal to 'N_cw' ('N' = \" << N << \", 'N_cw' = \" << N_cw << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\nauto &p1 = this->create_task(\"puncture\");\n- auto &p1s_X_N1 = this->template create_socket_in <B>(p1, \"X_N1\", this->N_code * this->n_frames);\n+ auto &p1s_X_N1 = this->template create_socket_in <B>(p1, \"X_N1\", this->N_cw * this->n_frames);\nauto &p1s_X_N2 = this->template create_socket_out<B>(p1, \"X_N2\", this->N * this->n_frames);\nthis->create_codelet(p1, [this, &p1s_X_N1, &p1s_X_N2]() -> int\n{\n@@ -114,7 +114,7 @@ public:\nauto &p2 = this->create_task(\"depuncture\");\nauto &p2s_Y_N1 = this->template create_socket_in <Q>(p2, \"Y_N1\", this->N * this->n_frames);\n- auto &p2s_Y_N2 = this->template create_socket_out<Q>(p2, \"Y_N2\", this->N_code * this->n_frames);\n+ auto &p2s_Y_N2 = this->template create_socket_out<Q>(p2, \"Y_N2\", this->N_cw * this->n_frames);\nthis->create_codelet(p2, [this, &p2s_Y_N1, &p2s_Y_N2]() -> int\n{\nthis->depuncture(static_cast<Q*>(p2s_Y_N1.get_dataptr()),\n@@ -139,9 +139,9 @@ public:\nreturn N;\n}\n- int get_N_code() const\n+ int get_N_cw() const\n{\n- return N_code;\n+ return N_cw;\n}\n/*!\n@@ -153,11 +153,11 @@ public:\ntemplate <class A = std::allocator<B>>\nvoid puncture(const std::vector<B,A>& X_N1, std::vector<B,A>& X_N2) const\n{\n- if (this->N_code * this->n_frames != (int)X_N1.size())\n+ if (this->N_cw * this->n_frames != (int)X_N1.size())\n{\nstd::stringstream message;\n- message << \"'X_N1.size()' has to be equal to 'N_code' * 'n_frames' ('X_N1.size()' = \" << X_N1.size()\n- << \", 'N_code' = \" << this->N_code << \", 'n_frames' = \" << this->n_frames << \").\";\n+ message << \"'X_N1.size()' has to be equal to 'N_cw' * 'n_frames' ('X_N1.size()' = \" << X_N1.size()\n+ << \", 'N_cw' = \" << this->N_cw << \", 'n_frames' = \" << this->n_frames << \").\";\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -175,7 +175,7 @@ public:\nvirtual void puncture(const B *X_N1, B *X_N2) const\n{\nfor (auto f = 0; f < this->n_frames; f++)\n- this->_puncture(X_N1 + f * this->N_code,\n+ this->_puncture(X_N1 + f * this->N_cw,\nX_N2 + f * this->N,\nf);\n}\n@@ -197,11 +197,11 @@ public:\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n- if (this->N_code * this->n_frames != (int)Y_N2.size())\n+ if (this->N_cw * this->n_frames != (int)Y_N2.size())\n{\nstd::stringstream message;\n- message << \"'Y_N2.size()' has to be equal to 'N_code' * 'n_frames' ('Y_N2.size()' = \" << Y_N2.size()\n- << \", 'N_code' = \" << this->N_code << \", 'n_frames' = \" << this->n_frames << \").\";\n+ message << \"'Y_N2.size()' has to be equal to 'N_cw' * 'n_frames' ('Y_N2.size()' = \" << Y_N2.size()\n+ << \", 'N_cw' = \" << this->N_cw << \", 'n_frames' = \" << this->n_frames << \").\";\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -212,7 +212,7 @@ public:\n{\nfor (auto f = 0; f < this->n_frames; f++)\nthis->_depuncture(Y_N1 + f * this->N,\n- Y_N2 + f * this->N_code,\n+ Y_N2 + f * this->N_cw,\nf);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp", "new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp", "diff": "@@ -98,16 +98,33 @@ void Puncturer_turbo<B,Q>\nauto k = 0;\nif (this->buff_enc)\n{\n+ int off[3] = {0, this->K + this->tail_bits/4, this->N_cw - (this->K + this->tail_bits/4)};\nfor (auto j = 0; j < 3; j++)\n{\nauto p = 0;\n+ auto o = off[j];\nfor (auto i = 0; i < this->K; i++)\n{\nif (pattern_bits[j][p])\n- X_N2[k++] = X_N1[this->K * j +i];\n-\n+ X_N2[k++] = X_N1[o +i];\np = (p +1) % period;\n}\n+\n+ if (j == 0)\n+ {\n+ std::copy(X_N1 + o + this->K, X_N1 + o + this->K + this->tail_bits/4, X_N2 + k);\n+ k += this->tail_bits/4;\n+ }\n+ else if (j == 1)\n+ {\n+ std::copy(X_N1 + o + this->K, X_N1 + o + this->K + this->tail_bits/2, X_N2 + k);\n+ k += this->tail_bits/2;\n+ }\n+ else\n+ {\n+ std::copy(X_N1 + o + this->K, X_N1 + o + this->K + this->tail_bits/4, X_N2 + k);\n+ k += this->tail_bits/4;\n+ }\n}\n}\nelse\n@@ -121,10 +138,10 @@ void Puncturer_turbo<B,Q>\np = (p +1) % period;\n}\n- }\nstd::copy(X_N1 + 3 * this->K, X_N1 + 3 * this->K + this->tail_bits, X_N2 + k);\n}\n+}\ntemplate <typename B, typename Q>\nvoid Puncturer_turbo<B,Q>\n@@ -135,15 +152,32 @@ void Puncturer_turbo<B,Q>\nauto k = 0;\nif (this->buff_enc)\n{\n+ int off[3] = {0, this->K + this->tail_bits/4, this->N_cw - (this->K + this->tail_bits/4)};\nfor (auto j = 0; j < 3; j++)\n{\nauto p = 0;\n+ auto o = off[j];\nfor (auto i = 0; i < this->K; i++)\n{\n- Y_N2[this->K * j +i] = pattern_bits[j][p] ? Y_N1[k++] : (Q)0;\n-\n+ Y_N2[o +i] = pattern_bits[j][p] ? Y_N1[k++] : (Q)0;\np = (p +1) % period;\n}\n+\n+ if (j == 0)\n+ {\n+ std::copy(Y_N1 + k, Y_N1 + k + this->tail_bits/4, Y_N2 + o + this->K);\n+ k += this->tail_bits/4;\n+ }\n+ else if (j == 1)\n+ {\n+ std::copy(Y_N1 + k, Y_N1 + k + this->tail_bits/2, Y_N2 + o + this->K);\n+ k += this->tail_bits/2;\n+ }\n+ else\n+ {\n+ std::copy(Y_N1 + k, Y_N1 + k + this->tail_bits/4, Y_N2 + o + this->K);\n+ k += this->tail_bits/4;\n+ }\n}\n}\nelse\n@@ -157,10 +191,10 @@ void Puncturer_turbo<B,Q>\np = (p +1) % period;\n}\n- }\nstd::copy(Y_N1 + k, Y_N1 + k + this->tail_bits, Y_N2 + 3 * this->K);\n}\n+}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the turbo code puncturer.
8,490
20.10.2017 18:55:02
-7,200
4e3388e8ed52917250497040ae7bfab2391a2aaf
Prevent to completely stop the simu when ctrl+c is used.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -262,7 +262,7 @@ void BFER<B,R,Q>\nthis->dumper_red->clear();\n}\n- if (this->monitor_red->get_n_fe() < this->monitor_red->get_fe_limit() &&\n+ if (!module::Monitor::is_interrupt() && this->monitor_red->get_n_fe() < this->monitor_red->get_fe_limit() &&\n(max_fra == 0 || this->monitor_red->get_n_fe() < max_fra))\nmodule::Monitor::stop();\n" } ]
C++
MIT License
aff3ct/aff3ct
Prevent to completely stop the simu when ctrl+c is used.
8,490
23.10.2017 14:11:17
-7,200
e306625cff043707b58d62fb78cb13de93198f7e
Fix RSC poly param.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp", "new_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp", "diff": "@@ -97,10 +97,10 @@ void Decoder_RSC::parameters\nif(exist(vals, {p+\"-std\" })) this->standard = vals.at({p+\"-std\" });\nif(exist(vals, {p+\"-no-buff\"})) this->buffered = false;\n- if (this->standard == \"LTE\")\n+ if (this->standard == \"LTE\" && !exist(vals, {p+\"-poly\"}))\nthis->poly = {013, 015};\n- if (this->standard == \"CCSDS\")\n+ if (this->standard == \"CCSDS\" && !exist(vals, {p+\"-poly\"}))\nthis->poly = {023, 033};\nif (exist(vals, {p+\"-poly\"}))\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix RSC poly param.
8,486
23.10.2017 16:42:49
-7,200
800526efc10e620d68f740e2ff30dce751ec3da8
Extraction of systematic bits for RSC codes.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "new_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "diff": "@@ -127,6 +127,19 @@ void Codec_RSC<B,Q>\nY_N[i*2] += ext[i];\n}\n+template <typename B, typename Q>\n+void Codec_RSC<B,Q>\n+::_extract_sys_bit(const Q *Y_N, B *V_K, const int frame_id)\n+{\n+ if (buffered_encoding)\n+ for (auto i = 0; i < this->K; i++)\n+ V_K[i] = Y_N[i] >= 0 ? (B)0 : (B)1;\n+ else\n+ for (auto i = 0; i < this->K; i++)\n+ V_K[i] = Y_N[2*i] >= 0 ? (B)0 : (B)1;\n+}\n+\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC/Codec_RSC.hpp", "new_path": "src/Module/Codec/RSC/Codec_RSC.hpp", "diff": "@@ -27,6 +27,7 @@ protected:\nvoid _extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id);\nvoid _extract_sys_llr(const Q *Y_N, Q *sys, const int frame_id);\nvoid _add_sys_ext (const Q *ext, Q *Y_N, const int frame_id);\n+ void _extract_sys_bit(const Q *Y_N, B *V_K, const int frame_id);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Extraction of systematic bits for RSC codes.
8,486
23.10.2017 16:44:13
-7,200
3f35c88992ed1b53cb7ec1534d9e41579ea81e96
New task tmodulate for soft modulation.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/Modem.hpp", "new_path": "src/Module/Modem/Modem.hpp", "diff": "@@ -26,12 +26,13 @@ namespace module\n{\nnamespace tsk\n{\n- enum list { modulate, filter, demodulate, tdemodulate, demodulate_wg, tdemodulate_wg, SIZE };\n+ enum list { modulate, tmodulate, filter, demodulate, tdemodulate, demodulate_wg, tdemodulate_wg, SIZE };\n}\nnamespace sck\n{\nnamespace modulate { enum list { X_N1, X_N2 , SIZE }; }\n+ namespace tmodulate { enum list { X_N1, X_N2 , SIZE }; }\nnamespace filter { enum list { Y_N1, Y_N2 , SIZE }; }\nnamespace demodulate { enum list { Y_N1, Y_N2 , SIZE }; }\nnamespace tdemodulate { enum list { Y_N1, Y_N2, Y_N3, SIZE }; }\n@@ -160,6 +161,17 @@ public:\nreturn 0;\n});\n+ auto &p7 = this->create_task(\"tmodulate\");\n+ auto &p7s_X_N1 = this->template create_socket_in <Q>(p7, \"X_N1\", this->N * this->n_frames);\n+ auto &p7s_X_N2 = this->template create_socket_out<R>(p7, \"X_N2\", this->N_mod * this->n_frames);\n+ this->create_codelet(p7, [this, &p7s_X_N1, &p7s_X_N2]() -> int\n+ {\n+ this->tmodulate(static_cast<Q*>(p7s_X_N1.get_dataptr()),\n+ static_cast<R*>(p7s_X_N2.get_dataptr()));\n+\n+ return 0;\n+ });\n+\nauto &p2 = this->create_task(\"filter\");\nauto &p2s_Y_N1 = this->template create_socket_in <R>(p2, \"Y_N1\", this->N_mod * this->n_frames);\nauto &p2s_Y_N2 = this->template create_socket_out<R>(p2, \"Y_N2\", this->N_fil * this->n_frames);\n@@ -299,6 +311,42 @@ public:\nf);\n}\n+ /*!\n+ * \\brief soft Modulates a vector of LLRs.\n+ *\n+ * \\param X_N1: a vector of LLRs.\n+ * \\param X_N2: a vector of soft symbols.\n+ */\n+ template <class AQ = std::allocator<Q>, class AR = std::allocator<R>>\n+ void tmodulate(const std::vector<Q,AQ>& X_N1, std::vector<R,AR>& X_N2)\n+ {\n+ if (this->N * this->n_frames != (int)X_N1.size())\n+ {\n+ std::stringstream message;\n+ message << \"'X_N1.size()' has to be equal to 'N' * 'n_frames' ('X_N1.size()' = \" << X_N1.size()\n+ << \", 'N' = \" << this->N << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (this->N_mod * this->n_frames != (int)X_N2.size())\n+ {\n+ std::stringstream message;\n+ message << \"'X_N2.size()' has to be equal to 'N_mod' * 'n_frames' ('X_N2.size()' = \" << X_N2.size()\n+ << \", 'N_mod' = \" << this->N_mod << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->tmodulate(X_N1.data(), X_N2.data());\n+ }\n+\n+ virtual void tmodulate(const Q *X_N1, R *X_N2)\n+ {\n+ for (auto f = 0; f < this->n_frames; f++)\n+ this->_tmodulate(X_N1 + f * this->N,\n+ X_N2 + f * this->N_mod,\n+ f);\n+ }\n+\n/*!\n* \\brief Filters a vector of noised and modulated bits/symbols.\n*\n@@ -605,6 +653,10 @@ protected:\nthrow tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n+ virtual void _tmodulate(const Q *X_N1, R *X_N2, const int frame_id)\n+ {\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ }\nvirtual void _filter(const R *Y_N1, R *Y_N2, const int frame_id)\n{\nthrow tools::unimplemented_error(__FILE__, __LINE__, __func__);\n" } ]
C++
MIT License
aff3ct/aff3ct
New task tmodulate for soft modulation.
8,486
23.10.2017 16:45:19
-7,200
788c69005c07d2f639a8a28d9025c1203dad1a8c
tmodulate implementation + bit order inversion in modem user + 0 padding.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/User/Modem_user.hpp", "new_path": "src/Module/Modem/User/Modem_user.hpp", "diff": "@@ -38,6 +38,7 @@ public:\n}\nprotected:\n+ void _tmodulate ( const Q *X_N1, R *X_N2, const int frame_id);\nvoid _modulate ( const B *X_N1, R *X_N2, const int frame_id);\nvoid _filter ( const R *Y_N1, R *Y_N2, const int frame_id);\nvoid _demodulate ( const Q *Y_N1, Q *Y_N2, const int frame_id);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/User/Modem_user.hxx", "new_path": "src/Module/Modem/User/Modem_user.hxx", "diff": "@@ -98,7 +98,7 @@ void Modem_user<B,R,Q,MAX>\n{\nunsigned idx = 0;\nfor (auto j = 0; j < this->bits_per_symbol; j++)\n- idx += unsigned(unsigned(1 << (this->bits_per_symbol -j -1)) * X_N1[i * this->bits_per_symbol +j]);\n+ idx += unsigned(unsigned(1 << j) * X_N1[i * this->bits_per_symbol +j]);\nauto symbol = this->constellation[idx];\nX_N2[2*i ] = symbol.real();\n@@ -110,7 +110,7 @@ void Modem_user<B,R,Q,MAX>\n{\nunsigned idx = 0;\nfor (auto j = 0; j < size_in - (loop_size * this->bits_per_symbol); j++)\n- idx += unsigned(unsigned(1 << (this->bits_per_symbol -j -1)) * X_N1[loop_size * this->bits_per_symbol +j]);\n+ idx += unsigned(unsigned(1 << j) * X_N1[loop_size * this->bits_per_symbol +j]);\nauto symbol = this->constellation[idx];\nX_N2[size_out -2] = symbol.real();\n@@ -155,7 +155,7 @@ void Modem_user<B,R,Q,MAX>\nauto complex_Yk = std::complex<Q>(Y_N1[2*k], Y_N1[2*k+1]);\nfor (auto j = 0; j < this->nbr_symbols; j++)\n- if ((j &(1 << (this->bits_per_symbol -b -1))) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -std::norm(complex_Yk - std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\nelse\n@@ -194,7 +194,7 @@ void Modem_user<B,R,Q,MAX>\nauto complex_Hk = std::complex<Q>((Q)H_N [2*k], (Q)H_N [2*k+1]);\nfor (auto j = 0; j < this->nbr_symbols; j++)\n- if ((j &(1 << (this->bits_per_symbol -b -1))) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -std::norm(complex_Yk -\ncomplex_Hk * std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\n@@ -234,13 +234,22 @@ void Modem_user<B,R,Q,MAX>\nauto tempL = (Q)(std::norm(complex_Yk - std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\n- for (auto l = 0; l < b; l++)\n- tempL += (j & (1 << (this->bits_per_symbol -l -1))) * Y_N2[k * this->bits_per_symbol +l];\n+ for (auto l = 0; l < this->bits_per_symbol; l++)\n+ {\n+ if (l == b)\n+ continue;\n- for (auto l = b + 1; l < this->bits_per_symbol; l++)\n- tempL += (j & (1 << (this->bits_per_symbol -l -1))) * Y_N2[k * this->bits_per_symbol +l];\n+ if (( (j>>l) & 1 ) == 1)\n+ {\n+ if (k * this->bits_per_symbol +l < size)\n+ tempL += Y_N2[k * this->bits_per_symbol +l];\n+ else\n+ tempL += std::numeric_limits<Q>::infinity();\n+ }\n+ }\n+ tempL = std::isnan(tempL) ? (Q)0.0 : tempL;\n- if ((j & (1 << (this->bits_per_symbol-b-1))) == 0)\n+ if ( ( (j>>b) & 1) == 0)\nL0 = MAX(L0, -tempL);\nelse\nL1 = MAX(L1, -tempL);\n@@ -279,13 +288,22 @@ void Modem_user<B,R,Q,MAX>\ncomplex_Hk * std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\n- for (auto l = 0; l < b; l++)\n- tempL += (j & (1 << (this->bits_per_symbol -l -1))) * Y_N2[k * this->bits_per_symbol +l];\n+ for (auto l = 0; l < this->bits_per_symbol; l++)\n+ {\n+ if (l == b)\n+ continue;\n- for (auto l = b + 1; l < this->bits_per_symbol; l++)\n- tempL += (j & (1 << (this->bits_per_symbol -l -1))) * Y_N2[k * this->bits_per_symbol +l];\n+ if (( (j>>l) & 1 ) == 1)\n+ {\n+ if (k * this->bits_per_symbol +l < size)\n+ tempL += Y_N2[k * this->bits_per_symbol +l];\n+ else\n+ tempL += std::numeric_limits<Q>::infinity();\n+ }\n+ }\n+ tempL = std::isnan(tempL) ? (Q)0.0 : tempL;\n- if ((j & (1 << (this->bits_per_symbol-b-1))) == 0)\n+ if ( ( (j>>b) & 1) == 0)\nL0 = MAX(L0, -tempL);\nelse\nL1 = MAX(L1, -tempL);\n@@ -294,5 +312,55 @@ void Modem_user<B,R,Q,MAX>\nY_N3[n] = (L0 - L1);\n}\n}\n+\n+/*\n+* \\brief Soft Mapper\n+*/\n+template <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\n+void Modem_user<B, R, Q, MAX>\n+::_tmodulate(const Q *X_N1, R *X_N2, const int frame_id)\n+{\n+ auto size_in = this->N;\n+ auto size_out = this->N_mod;\n+\n+ auto loop_size = size_in / this->bits_per_symbol;\n+\n+ for (auto i = 0; i < loop_size; i++)\n+ {\n+ X_N2[2*i] = 0.0f;\n+ X_N2[2*i+1] = 0.0f;\n+\n+ for (auto m = 0; m < this->nbr_symbols; m++)\n+ {\n+ std::complex<R> soft_symbol = this->constellation[m];\n+ auto p = 1.0f;\n+ for (auto j = 0; j < this->bits_per_symbol; j++)\n+ {\n+ auto p0 = 1.0f/(1.0f + std::exp(-X_N1[i*this->bits_per_symbol + j]));\n+ p *= ((m >> j) & 1) == 0 ? p0 : 1 - p0;\n+ }\n+ X_N2[2*i] += p * soft_symbol.real();\n+ X_N2[2*i+1] += p * soft_symbol.imag();\n+ }\n+ }\n+\n+ // last elements if \"size_in\" is not a multiple of the number of bits per symbol\n+ if (loop_size * this->bits_per_symbol < size_in)\n+ {\n+ auto r = size_in - (loop_size * this->bits_per_symbol);\n+ for (auto m = 0; m < (1<<r); m++)\n+ {\n+ std::complex<R> soft_symbol = this->constellation[m];\n+ for (auto j = 0; j < r; j++)\n+ {\n+ auto p0 = 1.0f/(1.0f + std::exp(-X_N1[loop_size*this->bits_per_symbol + j]));\n+ soft_symbol *= ((m >> j) & 1) == 0 ? p0 : 1 - p0;\n+ }\n+ X_N2[size_out - 2] += soft_symbol.real()/this->nbr_symbols;\n+ X_N2[size_out - 1] += soft_symbol.imag()/this->nbr_symbols;\n+ }\n+ }\n+}\n+\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
tmodulate implementation + bit order inversion in modem user + 0 padding.
8,490
25.10.2017 10:09:53
-7,200
fcb6fde0eadd4fb56ef367f438353b0762f01e0c
Fix the info bits detection in G and H LDPC matrices.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Code/LDPC/AList/AList.cpp", "new_path": "src/Tools/Code/LDPC/AList/AList.cpp", "diff": "@@ -100,6 +100,11 @@ std::vector<unsigned> AList\n{\nstd::string line;\n+ // look for the position in the file where the info bits begin\n+ while (std::getline(stream, line))\n+ if (line == \"# Positions of the information bits in the codewords:\" || stream.eof() || stream.fail() || stream.bad())\n+ break;\n+\ngetline(stream, line);\nauto values = split(line);\nif (values.size() != 1)\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the info bits detection in G and H LDPC matrices.
8,490
25.10.2017 10:37:03
-7,200
b58a84672b2bff2be53d31dd86981b5dd2eec85f
Fix bad display of titles in some specific cases (in the headers).
[ { "change_type": "MODIFY", "old_path": "src/Factory/Factory.cpp", "new_path": "src/Factory/Factory.cpp", "diff": "@@ -175,14 +175,28 @@ void aff3ct::factory::Header::print_parameters(const std::vector<Factory::parame\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n+ bool print_first_title = false;\n+ for (size_t i = 1; i < prefixes.size(); i++)\n+ {\n+ auto h = headers[prefixes[i]];\n+ auto key = tools::string_split(prefixes[i], '-');\n+\n+ if (key[0] == prefixes[0] && h.size())\n+ {\n+ print_first_title = true;\n+ break;\n+ }\n+ }\n+\nfor (size_t i = 0; i < prefixes.size(); i++)\n{\nauto h = headers[prefixes[i]];\n+ auto print_head = (i == 0) ? print_first_title || h.size() : h.size();\nif (full || (!full && h.size() && (h[0].first != \"Type\" || h[0].second != \"NO\")))\n{\nauto n = short_names[i];\n- if (h.size() && (std::find(dup_h.begin(), dup_h.end(), h) == dup_h.end() ||\n+ if (print_head && (std::find(dup_h.begin(), dup_h.end(), h) == dup_h.end() ||\nstd::find(dup_n.begin(), dup_n.end(), n) == dup_n.end()))\n{\naff3ct::factory::Header::print_parameters(prefixes[i], n, h, max_n_chars);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bad display of titles in some specific cases (in the headers).
8,490
25.10.2017 10:48:11
-7,200
c9baccd3158960e872ba14c7d38a27147ef11f30
Add a the possibility to use the fe from the original simu.
[ { "change_type": "MODIFY", "old_path": "tests/tests.py", "new_path": "tests/tests.py", "diff": "@@ -9,7 +9,7 @@ PathBuild = \"../build\"\nSensibility = 1.0\nNthreads = 0 # if 0 then AFF3CT takes all the available threads\nRecursiveScan = True\n-MaxFE = 100\n+MaxFE = 100 # 0 takes fe from the original simulation\nWeakRate = 0.8 # 0 < WeakRate < 1\nMaxTimeSNR = 10 # max time to spend per SNR (in sec), 0 = illimited\n@@ -115,6 +115,7 @@ for fn in fileNames:\nargsAFFECT.append(\"--ter-freq\")\nargsAFFECT.append(\"0\")\n+ if MaxFE:\nargsAFFECT.append(\"-e\")\nargsAFFECT.append(str(MaxFE))\nargsAFFECT.append(\"-t\")\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a the possibility to use the fe from the original simu.
8,486
26.10.2017 00:48:05
-7,200
a8a47d43b2706b58c520c55974714eefb44a78d5
Correction of small bug in tmodulate + removal of bps multiple of 2 constraint.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/User/Modem_user.hxx", "new_path": "src/Module/Modem/User/Modem_user.hxx", "diff": "@@ -30,13 +30,6 @@ Modem_user<B,R,Q,MAX>\nif (const_path.empty())\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"'const_path' should not be empty.\");\n- if (bits_per_symbol % 2)\n- {\n- std::stringstream message;\n- message << \"'bits_per_symbol' has to be a multiple of 2 ('bits_per_symbol' = \" << bits_per_symbol << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\nstd::fstream const_file(const_path, std::ios_base::in);\nstd::string temp;\n@@ -246,6 +239,7 @@ void Modem_user<B,R,Q,MAX>\nelse\ntempL += std::numeric_limits<Q>::infinity();\n}\n+\n}\ntempL = std::isnan(tempL) ? (Q)0.0 : tempL;\n@@ -336,7 +330,7 @@ void Modem_user<B, R, Q, MAX>\nauto p = 1.0f;\nfor (auto j = 0; j < this->bits_per_symbol; j++)\n{\n- auto p0 = 1.0f/(1.0f + std::exp(-X_N1[i*this->bits_per_symbol + j]));\n+ auto p0 = 1.0f/(1.0f + std::exp(-(R)(X_N1[i*this->bits_per_symbol + j])));\np *= ((m >> j) & 1) == 0 ? p0 : 1 - p0;\n}\nX_N2[2*i] += p * soft_symbol.real();\n@@ -348,16 +342,20 @@ void Modem_user<B, R, Q, MAX>\nif (loop_size * this->bits_per_symbol < size_in)\n{\nauto r = size_in - (loop_size * this->bits_per_symbol);\n+ X_N2[size_out - 2] = 0.0f;\n+ X_N2[size_out - 1] = 0.0f;\n+\nfor (auto m = 0; m < (1<<r); m++)\n{\nstd::complex<R> soft_symbol = this->constellation[m];\n+ auto p = 1.0f;\nfor (auto j = 0; j < r; j++)\n{\n- auto p0 = 1.0f/(1.0f + std::exp(-X_N1[loop_size*this->bits_per_symbol + j]));\n- soft_symbol *= ((m >> j) & 1) == 0 ? p0 : 1 - p0;\n+ auto p0 = 1.0f/(1.0f + std::exp(-(R)X_N1[loop_size*this->bits_per_symbol + j]));\n+ p *= ((m >> j) & 1) == 0 ? p0 : 1 - p0;\n}\n- X_N2[size_out - 2] += soft_symbol.real()/this->nbr_symbols;\n- X_N2[size_out - 1] += soft_symbol.imag()/this->nbr_symbols;\n+ X_N2[size_out - 2] += p*soft_symbol.real();\n+ X_N2[size_out - 1] += p*soft_symbol.imag();\n}\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Correction of small bug in tmodulate + removal of bps multiple of 2 constraint.
8,483
30.10.2017 15:28:23
-3,600
7e1708c66b0fb54f89aeb6837020fac971a946eb
Add threshold on err tracker; Correct Modem_CPM factor computation
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.cpp", "new_path": "src/Factory/Module/Modem/Modem.cpp", "diff": "@@ -124,21 +124,8 @@ void Modem::parameters\nauto p = this->get_prefix();\n// ----------------------------------------------------------------------------------------------------- modulator\n- if(exist(vals, {p+\"-fra-size\", \"N\"})) this->N = std::stoi(vals.at({p+\"-fra-size\", \"N\"}));\n- if(exist(vals, {p+\"-fra\", \"F\"})) this->n_frames = std::stoi(vals.at({p+\"-fra\", \"F\"}));\nif(exist(vals, {p+\"-type\" })) this->type = vals.at({p+\"-type\" });\nif(exist(vals, {p+\"-cpm-std\" })) this->cpm_std = vals.at({p+\"-cpm-std\" });\n- if(exist(vals, {p+\"-bps\" })) this->bps = std::stoi(vals.at({p+\"-bps\" }));\n- if(exist(vals, {p+\"-ups\" })) this->upf = std::stoi(vals.at({p+\"-ups\" }));\n- if(exist(vals, {p+\"-const-path\" })) this->const_path = vals.at({p+\"-const-path\" });\n- if(exist(vals, {p+\"-cpm-L\" })) this->cpm_L = std::stoi(vals.at({p+\"-cpm-L\" }));\n- if(exist(vals, {p+\"-cpm-p\" })) this->cpm_p = std::stoi(vals.at({p+\"-cpm-p\" }));\n- if(exist(vals, {p+\"-cpm-k\" })) this->cpm_k = std::stoi(vals.at({p+\"-cpm-k\" }));\n- if(exist(vals, {p+\"-cpm-map\" })) this->mapping = vals.at({p+\"-cpm-map\" });\n- if(exist(vals, {p+\"-cpm-ws\" })) this->wave_shape = vals.at({p+\"-cpm-ws\" });\n-\n- if (this->type.find(\"BPSK\") != std::string::npos || this->type == \"PAM\")\n- this->complex = false;\nif (this->type == \"CPM\")\n{\n@@ -163,6 +150,21 @@ void Modem::parameters\n}\n}\n+ if(exist(vals, {p+\"-fra-size\", \"N\"})) this->N = std::stoi(vals.at({p+\"-fra-size\", \"N\"}));\n+ if(exist(vals, {p+\"-fra\", \"F\"})) this->n_frames = std::stoi(vals.at({p+\"-fra\", \"F\"}));\n+ if(exist(vals, {p+\"-bps\" })) this->bps = std::stoi(vals.at({p+\"-bps\" }));\n+ if(exist(vals, {p+\"-ups\" })) this->upf = std::stoi(vals.at({p+\"-ups\" }));\n+ if(exist(vals, {p+\"-const-path\" })) this->const_path = vals.at({p+\"-const-path\" });\n+ if(exist(vals, {p+\"-cpm-L\" })) this->cpm_L = std::stoi(vals.at({p+\"-cpm-L\" }));\n+ if(exist(vals, {p+\"-cpm-p\" })) this->cpm_p = std::stoi(vals.at({p+\"-cpm-p\" }));\n+ if(exist(vals, {p+\"-cpm-k\" })) this->cpm_k = std::stoi(vals.at({p+\"-cpm-k\" }));\n+ if(exist(vals, {p+\"-cpm-map\" })) this->mapping = vals.at({p+\"-cpm-map\" });\n+ if(exist(vals, {p+\"-cpm-ws\" })) this->wave_shape = vals.at({p+\"-cpm-ws\" });\n+\n+ if (this->type.find(\"BPSK\") != std::string::npos || this->type == \"PAM\")\n+ this->complex = false;\n+\n+\n// force the number of bits per symbol to 1 when BPSK mod\nif (this->type == \"BPSK\" || this->type == \"BPSK_FAST\")\nthis->bps = 1;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/BFER/BFER.cpp", "new_path": "src/Factory/Simulation/BFER/BFER.cpp", "diff": "@@ -117,6 +117,10 @@ void BFER::parameters\n{\"string\",\n\"base path for the files where the bad frames will be stored or read.\"};\n+ opt_args[{p+\"-err-trk-thold\"}] =\n+ {\"positive_int\",\n+ \"dump only frames with a bit error count above or equal to this threshold.\"};\n+\nopt_args[{p+\"-coded\"}] =\n{\"\",\n\"enable the coded monitoring (extends the monitored bits to the entire codeword).\"};\n@@ -135,6 +139,7 @@ void BFER::parameters\nif(exist(vals, {p+\"-snr-type\", \"E\"})) this->snr_type = vals.at({p+\"-snr-type\", \"E\"});\nif(exist(vals, {p+\"-err-trk-path\" })) this->err_track_path = vals.at({p+\"-err-trk-path\" });\n+ if(exist(vals, {p+\"-err-trk-thold\" })) this->err_track_threshold = std::stoi(vals.at({p+\"-err-trk-thold\"}));\nif(exist(vals, {p+\"-err-trk-rev\" })) this->err_track_revert = true;\nif(exist(vals, {p+\"-err-trk\" })) this->err_track_enable = true;\nif(exist(vals, {p+\"-coset\", \"c\"})) this->coset = true;\n@@ -164,6 +169,8 @@ void BFER::parameters\nstd::string enable_rev_track = (this->err_track_revert) ? \"on\" : \"off\";\nheaders[p].push_back(std::make_pair(\"Bad frames replay\", enable_rev_track));\n+ headers[p].push_back(std::make_pair(\"Bad frames threshold\", std::to_string(this->err_track_threshold)));\n+\nif (this->err_track_enable || this->err_track_revert)\n{\nstd::string path = this->err_track_path + std::string(\"_$snr.[src,enc,chn]\");\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/BFER/BFER.hpp", "new_path": "src/Factory/Simulation/BFER/BFER.hpp", "diff": "@@ -30,6 +30,7 @@ struct BFER : Simulation\n// optional parameters\nstd::string snr_type = \"EB\";\nstd::string err_track_path = \"error_tracker\";\n+ int err_track_threshold = 0;\nbool err_track_revert = false;\nbool err_track_enable = false;\nbool coset = false;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/BCJR/CPM_BCJR.hxx", "new_path": "src/Module/Modem/CPM/BCJR/CPM_BCJR.hxx", "diff": "@@ -14,25 +14,13 @@ namespace aff3ct\nnamespace module\n{\ntemplate<typename Q>\n-inline Q negative_inf(){return -std::numeric_limits<Q>::max(); }\n-\n-template<>\n-inline short negative_inf<short>(){return -(1 << (sizeof(short) * 8 -2)); }\n-\n-template<>\n-inline signed char negative_inf<signed char>(){return -63; }\n+inline Q negative_inf(){return std::numeric_limits<Q>::lowest(); }\ntemplate<typename Q>\ninline Q positive_inf(){return std::numeric_limits<Q>::max(); }\n-template<>\n-inline short positive_inf<short>(){return (1 << (sizeof(short) * 8 -2)); }\n-\n-template<>\n-inline signed char positive_inf<signed char>(){return 63; }\n-\ntemplate <typename Q, tools::proto_max<Q> MAX>\n-inline void BCJR_normalize(Q *metrics, const int &i, const int &n_states)\n+inline void BCJR_normalize(Q *metrics, const int &n_states)\n{\n// normalization\nauto norm_val = negative_inf<Q>();\n@@ -43,18 +31,6 @@ inline void BCJR_normalize(Q *metrics, const int &i, const int &n_states)\nmetrics[j] -= norm_val;\n}\n-template <signed char, tools::proto_max<signed char> MAX>\n-inline void BCJR_normalize(signed char *metrics, const int &i, const int &n_states)\n-{\n- // normalization\n- auto norm_val = negative_inf<signed char>();\n- for (auto j = 0; j < n_states; j++)\n- norm_val = MAX(norm_val, metrics[j]);\n-\n- for (auto j = 0; j < n_states; j++)\n- metrics[j] = tools::saturate<signed char>(metrics[j] - norm_val, -63, +63);\n-}\n-\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 _n_symbols)\n@@ -164,13 +140,13 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\nfor (int i = 0; i < dec_size/cpm.n_b_per_s; i++)\nfor (int tr = 0; tr < cpm.m_order; tr++)\n- {\nfor (int b = 0; b < cpm.n_b_per_s; b++)\n{\n- const auto bit_state = cpm.transition_to_binary[tr * cpm.n_b_per_s + b]; // transition_to_binary what bit state we should have for the given transition and bit position\n- const auto sign = (bit_state == 0) ? 1 : -1; //associated coeff\n- symb_apriori_prob[i * cpm.m_order + tr] += (Q)sign*Ldec_N[i * cpm.n_b_per_s + b]/(Q)2; //match -> add prob else remove\n- }\n+ // transition_to_binary what bit state we should have for the given transition and bit position\n+ const int bit_state = cpm.transition_to_binary[tr * cpm.n_b_per_s + b];\n+ // match -> add probability else remove\n+ symb_apriori_prob[i * cpm.m_order + tr] += (bit_state == 0) ? Ldec_N[i * cpm.n_b_per_s + b]/2\n+ : -Ldec_N[i * cpm.n_b_per_s + b]/2;\n}\n}\n@@ -215,8 +191,8 @@ void CPM_BCJR<SIN,SOUT,Q,MAX>\n}\n// normalize alpha and beta vectors (not impact on the decoding performances)\n- BCJR_normalize<Q,MAX>(&alpha[ (i +0) * 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+ BCJR_normalize<Q,MAX>(&alpha[ (i +0) * cpm.max_st_id], cpm.max_st_id);\n+ BCJR_normalize<Q,MAX>(&beta [(n_symbols - (i +1)) * cpm.max_st_id], cpm.max_st_id);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/Modem_CPM.hxx", "new_path": "src/Module/Modem/CPM/Modem_CPM.hxx", "diff": "@@ -248,7 +248,7 @@ R Modem_CPM<B,R,Q,MAX>\nelse\n{\nstd::string message = \"Unknown CPM wave shape ('cpm.wave_shape' = \" + cpm.wave_shape + \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message);\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message);\n}\n}\n@@ -267,7 +267,7 @@ void Modem_CPM<B,R,Q,MAX>\nR factor = (R)1;\nif (!no_sig2)\n- factor = (R)1 / (this->sigma * this->sigma);\n+ factor = (R)2 / (this->sigma * this->sigma);\nif (cpm.filters_type == \"TOTAL\")\n{\n@@ -282,7 +282,7 @@ void Modem_CPM<B,R,Q,MAX>\nelse\n{\nstd::string message = \"Unknown CPM filter bank type ('cpm.filters_type' = \" + cpm.filters_type + \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message);\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER.cpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER.cpp", "diff": "@@ -52,7 +52,7 @@ int Monitor_BFER<B>\nn_frame_errors++;\nfor (auto c : this->callbacks_fe)\n- c(frame_id);\n+ c(bit_errors_count, frame_id);\nif (this->fe_limit_achieved() && frame_id == this->n_frames -1)\nfor (auto c : this->callbacks_fe_limit_achieved)\n@@ -131,10 +131,11 @@ float Monitor_BFER<B>\ntemplate <typename B>\nvoid Monitor_BFER<B>\n-::add_handler_fe(std::function<void(int)> callback)\n+::add_handler_fe(std::function<void(unsigned, int)> callback)\n{\nthis->callbacks_fe.push_back(callback);\n}\n+\ntemplate <typename B>\nvoid Monitor_BFER<B>\n::add_handler_check(std::function<void(void)> callback)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER.hpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER.hpp", "diff": "@@ -21,7 +21,7 @@ protected:\nunsigned long long n_frame_errors;\nunsigned long long n_analyzed_frames;\n- std::vector<std::function<void(int )>> callbacks_fe;\n+ std::vector<std::function<void(unsigned, int )>> callbacks_fe;\nstd::vector<std::function<void( void)>> callbacks_check;\nstd::vector<std::function<void( void)>> callbacks_fe_limit_achieved;\n@@ -71,7 +71,7 @@ public:\nfloat get_fer() const;\nfloat get_ber() const;\n- virtual void add_handler_fe (std::function<void(int )> callback);\n+ virtual void add_handler_fe (std::function<void(unsigned, int )> callback);\nvirtual void add_handler_check (std::function<void( void)> callback);\nvirtual void add_handler_fe_limit_achieved(std::function<void( void)> callback);\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -309,7 +309,7 @@ void BFER<B,R,Q>\nsimu->__build_communication_chain(tid);\nif (simu->params.err_track_enable)\n- simu->monitor[tid]->add_handler_fe(std::bind(&tools::Dumper::add, simu->dumper[tid], std::placeholders::_1));\n+ simu->monitor[tid]->add_handler_fe(std::bind(&tools::Dumper::add, simu->dumper[tid], std::placeholders::_1, std::placeholders::_2));\n}\ncatch (std::exception const& e)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "new_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp", "diff": "@@ -104,18 +104,18 @@ void BFER_ite<B,R,Q>\nsource[src::tsk::generate].set_autoalloc(true);\nauto src_data = (B*)(source[src::tsk::generate][src::sck::generate::U_K].get_dataptr());\nauto src_size = (source[src::tsk::generate][src::sck::generate::U_K].get_databytes() / sizeof(B)) / this->params.src->n_frames;\n- this->dumper[tid]->register_data(src_data, (unsigned int)src_size, \"src\", false, this->params.src->n_frames, {});\n+ this->dumper[tid]->register_data(src_data, (unsigned int)src_size, this->params.err_track_threshold, \"src\", false, this->params.src->n_frames, {});\nencoder[enc::tsk::encode].set_autoalloc(true);\nauto enc_data = (B*)(encoder[enc::tsk::encode][enc::sck::encode::X_N].get_dataptr());\nauto enc_size = (encoder[enc::tsk::encode][enc::sck::encode::X_N].get_databytes() / sizeof(B)) / this->params.src->n_frames;\n- this->dumper[tid]->register_data(enc_data, (unsigned int)enc_size, \"enc\", false, this->params.src->n_frames,\n+ this->dumper[tid]->register_data(enc_data, (unsigned int)enc_size, this->params.err_track_threshold, \"enc\", false, this->params.src->n_frames,\n{(unsigned)this->params.cdc->enc->K});\n- this->dumper[tid]->register_data(channel.get_noise(), \"chn\", true, this->params.src->n_frames, {});\n+ this->dumper[tid]->register_data(channel.get_noise(), this->params.err_track_threshold, \"chn\", true, this->params.src->n_frames, {});\nif (interleaver_core[tid]->is_uniform())\n- this->dumper[tid]->register_data(interleaver.get_lut(), \"itl\", false, this->params.src->n_frames, {});\n+ this->dumper[tid]->register_data(interleaver.get_lut(), this->params.err_track_threshold, \"itl\", false, this->params.src->n_frames, {});\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "new_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "diff": "@@ -80,7 +80,7 @@ void BFER_std<B,R,Q>\nthis->monitor[tid]->add_handler_check(std::bind(&tools::Interleaver_core<>::refresh, interleaver));\nif (this->params.err_track_enable && interleaver->is_uniform())\n- this->dumper[tid]->register_data(interleaver->get_lut(), \"itl\", false, this->params.src->n_frames, {});\n+ this->dumper[tid]->register_data(interleaver->get_lut(), this->params.err_track_threshold, \"itl\", false, this->params.src->n_frames, {});\n}\ncatch (const std::exception&) { /* do nothing if the is no interleaver */ }\n@@ -95,15 +95,15 @@ void BFER_std<B,R,Q>\nsource[src::tsk::generate].set_autoalloc(true);\nauto src_data = (B*)(source[src::tsk::generate][src::sck::generate::U_K].get_dataptr());\nauto src_size = (source[src::tsk::generate][src::sck::generate::U_K].get_databytes() / sizeof(B)) / this->params.src->n_frames;\n- this->dumper[tid]->register_data(src_data, (unsigned int)src_size, \"src\", false, this->params.src->n_frames, {});\n+ this->dumper[tid]->register_data(src_data, (unsigned int)src_size, this->params.err_track_threshold, \"src\", false, this->params.src->n_frames, {});\nencoder[enc::tsk::encode].set_autoalloc(true);\nauto enc_data = (B*)(encoder[enc::tsk::encode][enc::sck::encode::X_N].get_dataptr());\nauto enc_size = (encoder[enc::tsk::encode][enc::sck::encode::X_N].get_databytes() / sizeof(B)) / this->params.src->n_frames;\n- this->dumper[tid]->register_data(enc_data, (unsigned int)enc_size, \"enc\", false, this->params.src->n_frames,\n+ this->dumper[tid]->register_data(enc_data, (unsigned int)enc_size, this->params.err_track_threshold, \"enc\", false, this->params.src->n_frames,\n{(unsigned)this->params.cdc->enc->K});\n- this->dumper[tid]->register_data(channel.get_noise(), \"chn\", true, this->params.src->n_frames, {});\n+ this->dumper[tid]->register_data(channel.get_noise(), this->params.err_track_threshold, \"chn\", true, this->params.src->n_frames, {});\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Dumper/Dumper.cpp", "new_path": "src/Tools/Display/Dumper/Dumper.cpp", "diff": "@@ -21,8 +21,8 @@ Dumper\ntemplate <typename T>\nvoid Dumper\n-::register_data(const T *ptr, const unsigned size, const std::string file_ext, const bool binary_mode,\n- const unsigned n_frames, std::vector<unsigned> headers)\n+::register_data(const T *ptr, const unsigned size, const unsigned add_threshold, const std::string file_ext,\n+ const bool binary_mode, const unsigned n_frames, std::vector<unsigned> headers)\n{\nif (ptr == nullptr)\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"'ptr' can't be null.\");\n@@ -54,12 +54,14 @@ void Dumper\nthis->registered_data_bin .push_back(binary_mode);\nthis->registered_data_head .push_back(headers );\nthis->registered_data_n_frames.push_back(n_frames );\n+\n+ this->add_threshold = add_threshold;\n}\ntemplate <typename T, class A>\nvoid Dumper\n-::register_data(const std::vector<T,A> &data, const std::string file_ext, const bool binary_mode,\n- const unsigned n_frames, std::vector<unsigned> headers)\n+::register_data(const std::vector<T,A> &data, const unsigned add_threshold, const std::string file_ext,\n+ const bool binary_mode, const unsigned n_frames, std::vector<unsigned> headers)\n{\nif (n_frames == 0)\n{\n@@ -68,11 +70,13 @@ void Dumper\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n};\n- this->register_data(data.data(), (unsigned)(data.size() / n_frames), file_ext, binary_mode, n_frames, headers);\n+ this->register_data(data.data(), (unsigned)(data.size() / n_frames), add_threshold,\n+ file_ext, binary_mode, n_frames, headers);\n}\n+\nvoid Dumper\n-::add(const int32_t frame_id)\n+::add(const unsigned n_err, const int frame_id)\n{\nif (frame_id < 0)\n{\n@@ -81,7 +85,10 @@ void Dumper\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- for (auto i = 0; i < (int32_t)this->registered_data_ptr.size(); i++)\n+ if (n_err < this->add_threshold)\n+ return;\n+\n+ for (auto i = 0; i < (int)this->registered_data_ptr.size(); i++)\n{\nif ((unsigned)frame_id < this->registered_data_n_frames[i])\n{\n@@ -103,7 +110,7 @@ void Dumper\nif (base_path.empty())\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"'base_path' can't be empty.\");\n- for (auto i = 0; i < (int32_t)this->registered_data_ptr.size(); i++)\n+ for (auto i = 0; i < (int)this->registered_data_ptr.size(); i++)\n{\nconst auto size = this->registered_data_size [i];\nconst auto size_of = this->registered_data_sizeof[i];\n@@ -211,39 +218,39 @@ void Dumper\n}\n// ==================================================================================== explicit template instantiation\n-template void Dumper::register_data<int8_t >(const int8_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint8_t >(const uint8_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int16_t >(const int16_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint16_t>(const uint16_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int32_t >(const int32_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint32_t>(const uint32_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int64_t >(const int64_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint64_t>(const uint64_t*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<float >(const float*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<double >(const double*, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-\n-template void Dumper::register_data<int8_t, std::allocator<int8_t >>(const std::vector<int8_t, std::allocator<int8_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint8_t, std::allocator<uint8_t >>(const std::vector<uint8_t, std::allocator<uint8_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int16_t, std::allocator<int16_t >>(const std::vector<int16_t, std::allocator<int16_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint16_t, std::allocator<uint16_t>>(const std::vector<uint16_t, std::allocator<uint16_t>>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int32_t, std::allocator<int32_t >>(const std::vector<int32_t, std::allocator<int32_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint32_t, std::allocator<uint32_t>>(const std::vector<uint32_t, std::allocator<uint32_t>>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int64_t, std::allocator<int64_t >>(const std::vector<int64_t, std::allocator<int64_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint64_t, std::allocator<uint64_t>>(const std::vector<uint64_t, std::allocator<uint64_t>>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<float, std::allocator<float >>(const std::vector<float, std::allocator<float >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<double, std::allocator<double >>(const std::vector<double, std::allocator<double >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int8_t >(const int8_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint8_t >(const uint8_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int16_t >(const int16_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint16_t>(const uint16_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int32_t >(const int32_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint32_t>(const uint32_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int64_t >(const int64_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint64_t>(const uint64_t*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<float >(const float*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<double >(const double*, const unsigned, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+\n+template void Dumper::register_data<int8_t, std::allocator<int8_t >>(const std::vector<int8_t, std::allocator<int8_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint8_t, std::allocator<uint8_t >>(const std::vector<uint8_t, std::allocator<uint8_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int16_t, std::allocator<int16_t >>(const std::vector<int16_t, std::allocator<int16_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint16_t, std::allocator<uint16_t>>(const std::vector<uint16_t, std::allocator<uint16_t>>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int32_t, std::allocator<int32_t >>(const std::vector<int32_t, std::allocator<int32_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint32_t, std::allocator<uint32_t>>(const std::vector<uint32_t, std::allocator<uint32_t>>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int64_t, std::allocator<int64_t >>(const std::vector<int64_t, std::allocator<int64_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint64_t, std::allocator<uint64_t>>(const std::vector<uint64_t, std::allocator<uint64_t>>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<float, std::allocator<float >>(const std::vector<float, std::allocator<float >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<double, std::allocator<double >>(const std::vector<double, std::allocator<double >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n#include <mipp.h>\n-template void Dumper::register_data<int8_t, mipp::allocator<int8_t >>(const std::vector<int8_t, mipp::allocator<int8_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint8_t, mipp::allocator<uint8_t >>(const std::vector<uint8_t, mipp::allocator<uint8_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int16_t, mipp::allocator<int16_t >>(const std::vector<int16_t, mipp::allocator<int16_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint16_t, mipp::allocator<uint16_t>>(const std::vector<uint16_t, mipp::allocator<uint16_t>>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int32_t, mipp::allocator<int32_t >>(const std::vector<int32_t, mipp::allocator<int32_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint32_t, mipp::allocator<uint32_t>>(const std::vector<uint32_t, mipp::allocator<uint32_t>>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<int64_t, mipp::allocator<int64_t >>(const std::vector<int64_t, mipp::allocator<int64_t >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<uint64_t, mipp::allocator<uint64_t>>(const std::vector<uint64_t, mipp::allocator<uint64_t>>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<float, mipp::allocator<float >>(const std::vector<float, mipp::allocator<float >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n-template void Dumper::register_data<double, mipp::allocator<double >>(const std::vector<double, mipp::allocator<double >>&, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int8_t, mipp::allocator<int8_t >>(const std::vector<int8_t, mipp::allocator<int8_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint8_t, mipp::allocator<uint8_t >>(const std::vector<uint8_t, mipp::allocator<uint8_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int16_t, mipp::allocator<int16_t >>(const std::vector<int16_t, mipp::allocator<int16_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint16_t, mipp::allocator<uint16_t>>(const std::vector<uint16_t, mipp::allocator<uint16_t>>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int32_t, mipp::allocator<int32_t >>(const std::vector<int32_t, mipp::allocator<int32_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint32_t, mipp::allocator<uint32_t>>(const std::vector<uint32_t, mipp::allocator<uint32_t>>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<int64_t, mipp::allocator<int64_t >>(const std::vector<int64_t, mipp::allocator<int64_t >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<uint64_t, mipp::allocator<uint64_t>>(const std::vector<uint64_t, mipp::allocator<uint64_t>>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<float, mipp::allocator<float >>(const std::vector<float, mipp::allocator<float >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\n+template void Dumper::register_data<double, mipp::allocator<double >>(const std::vector<double, mipp::allocator<double >>&, const unsigned, const std::string, const bool, const unsigned, std::vector<unsigned>);\ntemplate void Dumper::_write_body_text<int8_t >(std::ofstream&, const std::vector<std::vector<char>>&, const unsigned);\ntemplate void Dumper::_write_body_text<int16_t>(std::ofstream&, const std::vector<std::vector<char>>&, const unsigned);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Display/Dumper/Dumper.hpp", "new_path": "src/Tools/Display/Dumper/Dumper.hpp", "diff": "@@ -19,6 +19,7 @@ class Dumper\nprotected:\nstd::vector<std::vector<std::vector<char>>> buffer;\n+ unsigned add_threshold;\nstd::vector<const char*> registered_data_ptr;\nstd::vector<unsigned> registered_data_size;\nstd::vector<unsigned> registered_data_sizeof;\n@@ -33,16 +34,16 @@ public:\nvirtual ~Dumper();\ntemplate <typename T>\n- void register_data(const T *ptr, const unsigned size, const std::string file_ext = \"dump\",\n- const bool binary_mode = false, const unsigned n_frames = 1,\n+ void register_data(const T *ptr, const unsigned size, const unsigned add_threshold = 0,\n+ const std::string file_ext = \"dump\", const bool binary_mode = false, const unsigned n_frames = 1,\nstd::vector<unsigned> headers = std::vector<unsigned>());\ntemplate <typename T, class A = std::allocator<T>>\n- void register_data(const std::vector<T,A> &data, const std::string file_ext = \"dump\",\n- const bool binary_mode = false, const unsigned n_frames = 1,\n+ void register_data(const std::vector<T,A> &data, const unsigned add_threshold = 0,\n+ const std::string file_ext = \"dump\", const bool binary_mode = false, const unsigned n_frames = 1,\nstd::vector<unsigned> headers = std::vector<unsigned>());\nvirtual void dump (const std::string& base_path );\n- virtual void add (const int frame_id = 0 );\n+ virtual void add (const unsigned n_err, const int frame_id = 0);\nvirtual void clear( );\nprotected:\n" }, { "change_type": "MODIFY", "old_path": "tests/refs", "new_path": "tests/refs", "diff": "-Subproject commit 79bcc9da007f44f54f152f97e60c05c10c208372\n+Subproject commit e46c6ed6fcb117c88368db9cdf6217de3e126011\n" } ]
C++
MIT License
aff3ct/aff3ct
Add threshold on err tracker; Correct Modem_CPM factor computation
8,483
30.10.2017 16:51:21
-3,600
d4c03b749197e88ad8ab6a81753d4c94981e9288
Remove get gain method in rayleigh channels
[ { "change_type": "MODIFY", "old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp", "new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp", "diff": "@@ -54,20 +54,13 @@ Channel_Rayleigh_LLR<R>\ndelete noise_generator;\n}\n-template <typename R>\n-void Channel_Rayleigh_LLR<R>\n-::get_gains(std::vector<R>& gains, const R sigma)\n-{\n- noise_generator->generate(gains, sigma);\n-}\n-\ntemplate <typename R>\nvoid Channel_Rayleigh_LLR<R>\n::add_noise_wg(const R *X_N, R *H_N, R *Y_N)\n{\nif (add_users && this->n_frames > 1)\n{\n- this->get_gains(this->gains, (R)1 / (R)std::sqrt((R)2));\n+ noise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\nnoise_generator->generate(this->noise.data(), this->N, this->sigma);\nstd::fill(Y_N, Y_N + this->N, (R)0);\n@@ -105,7 +98,7 @@ void Channel_Rayleigh_LLR<R>\n}\nelse\n{\n- this->get_gains(this->gains, (R)1 / (R)std::sqrt((R)2));\n+ noise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\nnoise_generator->generate(this->noise, this->sigma);\nif (this->complex)\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": "@@ -29,8 +29,6 @@ public:\nconst R sigma = (R)1, const int n_frames = 1, const std::string name = \"Channel_Rayleigh_LLR\");\nvirtual ~Channel_Rayleigh_LLR();\n- virtual void get_gains(std::vector<R>& gains, const R sigma);\n-\nvirtual void add_noise_wg(const R *X_N, R *H_N, R *Y_N); using Channel<R>::add_noise_wg;\n};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.cpp", "new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.cpp", "diff": "@@ -95,8 +95,9 @@ void Channel_Rayleigh_LLR_user<R>\ntemplate <typename R>\nvoid Channel_Rayleigh_LLR_user<R>\n-::get_gains(std::vector<R>& gains, const R sigma)\n+::add_noise_wg(const R *X_N, R *H_N, R *Y_N)\n{\n+ // get all the needed gains from the stock\nfor (unsigned i = 0; i < gains.size(); ++i)\n{\ngains[i] = gains_stock[gain_index];\n@@ -111,15 +112,11 @@ void Channel_Rayleigh_LLR_user<R>\ngain_index = 0;\n}\n}\n-}\n-template <typename R>\n-void Channel_Rayleigh_LLR_user<R>\n-::add_noise_wg(const R *X_N, R *H_N, R *Y_N)\n-{\n- this->get_gains(gains, (R)1 / (R)std::sqrt((R)2));\n+ // generate the noise\nnoise_generator->generate(this->noise, this->sigma);\n+ // use the noise and the gain to modify the signal\nfor (auto i = 0; i < this->N * this->n_frames; i++)\n{\nH_N[i] = this->gains[i];\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.hpp", "new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.hpp", "diff": "@@ -38,8 +38,6 @@ public:\nconst int n_frames = 1, const std::string name = \"Channel_Rayleigh_LLR_user\");\nvirtual ~Channel_Rayleigh_LLR_user();\n- virtual void get_gains(std::vector<R>& gains, const R sigma);\n-\nvirtual void add_noise_wg(const R *X_N, R *H_N, R *Y_N); using Channel<R>::add_noise_wg;\nprotected:\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove get gain method in rayleigh channels
8,483
30.10.2017 17:46:45
-3,600
829440cbbd9db1bacf12e7df9661fd03f57012cc
Split channel type into a type and an implementation arguments
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -52,8 +52,8 @@ _aff3ct() {\n--src-type --src-path --enc-type --enc-path --mdm-type --mdm-bps\\\n--mdm-ups --mdm-cpm-ws --mdm-cpm-map --mdm-cpm-L --mdm-cpm-p \\\n--mdm-cpm-k --mdm-cpm-std --mdm-const-path --mdm-max --mdm-psi \\\n- --mdm-ite \\\n- --mdm-no-sig2 --chn-type --chn-path --chn-blk-fad --qnt-type \\\n+ --mdm-ite --mdm-no-sig2 \\\n+ --chn-type --chn-implem --chn-path --chn-blk-fad --qnt-type \\\n--qnt-dec --qnt-bits --qnt-range --dec-type --dec-implem \\\n--ter-no --ter-freq --sim-seed --sim-mpi-comm --sim-pyber \\\n--sim-no-colors --sim-err-trk --sim-err-trk-rev \\\n@@ -317,8 +317,12 @@ _aff3ct() {\n;;\n--chn-type)\n- local params=\"NO AWGN AWGN_FAST AWGN_GSL AWGN_MKL RAYLEIGH RAYLEIGH_USER RAYLEIGH_FAST RAYLEIGH_GSL RAYLEIGH_MKL \\\n- USER\"\n+ local params=\"NO AWGN RAYLEIGH RAYLEIGH_USER USER\"\n+ COMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n+ ;;\n+\n+ --chn-implem)\n+ local params=\"STD FAST GSL MKL\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Channel/Channel.cpp", "new_path": "src/Factory/Module/Channel/Channel.cpp", "diff": "@@ -53,18 +53,23 @@ void Channel::parameters\n{\"positive_int\",\n\"set the number of inter frame level to process.\"};\n- std::string chan_avail = \"NO, USER, AWGN, AWGN_FAST, RAYLEIGH, RAYLEIGH_FAST, RAYLEIGH_USER\";\n+ opt_args[{p+\"-type\"}] =\n+ {\"string\",\n+ \"type of the channel to use in the simulation.\",\n+ \"NO, USER, AWGN, RAYLEIGH, RAYLEIGH_USER\"};\n+\n+ std::string implem_avail = \"STD, FAST\";\n#ifdef CHANNEL_GSL\n- chan_avail += \", AWGN_GSL, RAYLEIGH_GSL\";\n+ implem_avail += \", GSL\";\n#endif\n#ifdef CHANNEL_MKL\n- chan_avail += \", AWGN_MKL, RAYLEIGH_MKL\";\n+ implem_avail += \", MKL\";\n#endif\n- opt_args[{p+\"-type\"}] =\n+ opt_args[{p+\"-implem\"}] =\n{\"string\",\n- \"type of the channel to use in the simulation.\",\n- chan_avail};\n+ \"select the implementation of the algorithm to generate noise.\",\n+ implem_avail};\nopt_args[{p+\"-path\"}] =\n{\"string\",\n@@ -104,6 +109,7 @@ void Channel::parameters\nif(exist(vals, {p+\"-fra-size\", \"N\"})) this->N = std::stoi(vals.at({p+\"-fra-size\", \"N\"}));\nif(exist(vals, {p+\"-fra\", \"F\"})) this->n_frames = std::stoi(vals.at({p+\"-fra\", \"F\"}));\nif(exist(vals, {p+\"-type\" })) this->type = vals.at({p+\"-type\" });\n+ if(exist(vals, {p+\"-implem\" })) this->implem = vals.at({p+\"-implem\" });\nif(exist(vals, {p+\"-path\" })) this->path = vals.at({p+\"-path\" });\nif(exist(vals, {p+\"-blk-fad\" })) this->block_fading = vals.at({p+\"-blk-fad\" });\nif(exist(vals, {p+\"-sigma\" })) this->sigma = std::stof(vals.at({p+\"-sigma\" }));\n@@ -119,6 +125,7 @@ void Channel::parameters\nauto p = this->get_prefix();\nheaders[p].push_back(std::make_pair(\"Type\", this->type ));\n+ headers[p].push_back(std::make_pair(\"Implementation\", this->implem));\nif (full) headers[p].push_back(std::make_pair(\"Frame size (N)\", std::to_string(this->N)));\nif (full) headers[p].push_back(std::make_pair(\"Inter frame level\", std::to_string(this->n_frames)));\n@@ -146,24 +153,35 @@ template <typename R>\nmodule::Channel<R>* Channel::parameters\n::build() const\n{\n- if (type == \"AWGN\" ) return new module::Channel_AWGN_LLR <R>(N, new tools::Noise_std <R>(seed), add_users, sigma, n_frames);\n- else if (type == \"AWGN_FAST\" ) return new module::Channel_AWGN_LLR <R>(N, new tools::Noise_fast<R>(seed), add_users, sigma, n_frames);\n- else if (type == \"RAYLEIGH\" ) return new module::Channel_Rayleigh_LLR<R>(N, complex, new tools::Noise_std <R>(seed), add_users, sigma, n_frames);\n- else if (type == \"RAYLEIGH_FAST\") return new module::Channel_Rayleigh_LLR<R>(N, complex, new tools::Noise_fast<R>(seed), add_users, sigma, n_frames);\n- else if (type == \"USER\" ) return new module::Channel_user <R>(N, path, add_users, n_frames);\n- else if (type == \"NO\" ) return new module::Channel_NO <R>(N, add_users, n_frames);\n+ tools::Noise<R>* n = nullptr;\n+ if (implem == \"STD\" ) n = new tools::Noise_std <R>(seed);\n+ else if (implem == \"FAST\") n = new tools::Noise_fast<R>(seed);\n#ifdef CHANNEL_MKL\n- else if (type == \"AWGN_MKL\" ) return new module::Channel_AWGN_LLR <R>(N, new tools::Noise_MKL <R>(seed), add_users, sigma, n_frames);\n- else if (type == \"RAYLEIGH_MKL\" ) return new module::Channel_Rayleigh_LLR<R>(N, complex, new tools::Noise_MKL <R>(seed), add_users, sigma, n_frames);\n+ else if (implem == \"MKL\" ) n = new tools::Noise_MKL <R>(seed);\n#endif\n#ifdef CHANNEL_GSL\n- else if (type == \"AWGN_GSL\" ) return new module::Channel_AWGN_LLR <R>(N, new tools::Noise_GSL <R>(seed), add_users, sigma, n_frames);\n- else if (type == \"RAYLEIGH_GSL\" ) return new module::Channel_Rayleigh_LLR<R>(N, complex, new tools::Noise_GSL <R>(seed), add_users, sigma, n_frames);\n+ else if (implem == \"GSL\" ) n = new tools::Noise_GSL <R>(seed);\n#endif\n- else if (type == \"RAYLEIGH_USER\") return new module::Channel_Rayleigh_LLR_user<R>(N, complex, path, gain_occur, new tools::Noise_fast<R>(seed), add_users, sigma, n_frames);\n+ else\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+\n+\n+ if (type == \"AWGN\" ) return new module::Channel_AWGN_LLR <R>(N, n, add_users, sigma, n_frames);\n+ else if (type == \"RAYLEIGH\" ) return new module::Channel_Rayleigh_LLR <R>(N, complex, n, add_users, sigma, n_frames);\n+ else if (type == \"RAYLEIGH_USER\") return new module::Channel_Rayleigh_LLR_user<R>(N, complex, path, gain_occur, n, add_users, sigma, n_frames);\n+ else\n+ {\n+ module::Channel<R>* c = nullptr;\n+ if (type == \"USER\") c = new module::Channel_user<R>(N, path, add_users, n_frames);\n+ else if (type == \"NO\" ) c = new module::Channel_NO <R>(N, add_users, n_frames);\n+\n+ delete n;\n+\n+ if (c) return c;\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+}\ntemplate <typename R>\nmodule::Channel<R>* Channel\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Channel/Channel.hpp", "new_path": "src/Factory/Module/Channel/Channel.hpp", "diff": "@@ -25,6 +25,7 @@ struct Channel : public Factory\n// optional parameters\nstd::string type = \"AWGN\";\n+ std::string implem = \"STD\";\nstd::string path = \"\";\nstd::string block_fading = \"NO\";\nbool add_users = false;\n" }, { "change_type": "DELETE", "old_path": "tests/results/.empty", "new_path": "tests/results/.empty", "diff": "" }, { "change_type": "MODIFY", "old_path": "tests/tests.py", "new_path": "tests/tests.py", "diff": "@@ -11,7 +11,7 @@ Nthreads = 0 # if 0 then AFF3CT takes all the available threads\nRecursiveScan = True\nMaxFE = 100 # 0 takes fe from the original simulation\nWeakRate = 0.8 # 0 < WeakRate < 1\n-MaxTimeSNR = 10 # max time to spend per SNR (in sec), 0 = illimited\n+MaxTimeSNR = 600 # max time to spend per SNR (in sec), 0 = illimited\n# ================================================================== PARAMETERS\n# =============================================================================\n" } ]
C++
MIT License
aff3ct/aff3ct
Split channel type into a type and an implementation arguments
8,483
31.10.2017 09:25:21
-3,600
cec02285bcfa36ac9a8cfbac168f5436608db7e1
Correct OOK modem; Add OOK curve ref
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/OOK/Modem_OOK.cpp", "new_path": "src/Module/Modem/OOK/Modem_OOK.cpp", "diff": "@@ -13,7 +13,10 @@ Modem_OOK<B,R,Q>\n: Modem<B,R,Q>(N, sigma, n_frames, name),\ndisable_sig2(disable_sig2)\n{\n- this->set_sigma(sigma);\n+ if(disable_sig2)\n+ sigma_factor = (R)0.5;\n+ else\n+ sigma_factor = (R)1.0 / (2 * sigma * sigma);\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "tests/refs", "new_path": "tests/refs", "diff": "-Subproject commit 79bcc9da007f44f54f152f97e60c05c10c208372\n+Subproject commit 60b14ed1331eab86cc0bc284bf77c037f7cfd714\n" } ]
C++
MIT License
aff3ct/aff3ct
Correct OOK modem; Add OOK curve ref
8,490
31.10.2017 09:51:34
-3,600
a4ec63b36496275d5fdf4b3c75443d2a3af6c216
Do not show the 'Bad frames threshold' parameter when its value is 0.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/BFER/BFER.cpp", "new_path": "src/Factory/Simulation/BFER/BFER.cpp", "diff": "@@ -169,6 +169,7 @@ void BFER::parameters\nstd::string enable_rev_track = (this->err_track_revert) ? \"on\" : \"off\";\nheaders[p].push_back(std::make_pair(\"Bad frames replay\", enable_rev_track));\n+ if (this->err_track_threshold)\nheaders[p].push_back(std::make_pair(\"Bad frames threshold\", std::to_string(this->err_track_threshold)));\nif (this->err_track_enable || this->err_track_revert)\n" } ]
C++
MIT License
aff3ct/aff3ct
Do not show the 'Bad frames threshold' parameter when its value is 0.
8,483
31.10.2017 11:58:36
-3,600
0fc256905cd353258c3cebc7fa08e2a9d3114985
Add a strictly positive float/int conditional flag for arguments; Improve argument checker of the argument reader class
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.cpp", "new_path": "src/Factory/Simulation/Simulation.cpp", "diff": "@@ -41,7 +41,7 @@ void Simulation::parameters\n\"maximal signal/noise ratio to simulate.\"};\nopt_args[{p+\"-snr-step\", \"s\"}] =\n- {\"positive_float\",\n+ {\"strictly_positive_float\",\n\"signal/noise ratio step between each simulation.\"};\nopt_args[{p+\"-pyber\"}] =\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -66,7 +66,14 @@ int Launcher::read_arguments()\nbool miss_arg = !ar.parse_arguments(req_args, opt_args, cmd_warn);\nbool error = !ar.check_arguments(cmd_error);\n+ try\n+ {\nthis->store_args();\n+ }\n+ catch(std::exception&)\n+ {\n+ params.display_help = true;\n+ }\nif (params.display_help)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -394,9 +394,9 @@ bool Arguments_reader\nstd::string arg_error;\nif (this->m_required_args.find(it->first) != this->m_required_args.end())\n- try{ arg_error = this->check_argument(it->first, this->m_required_args); } catch(std::exception&) {}\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- try{ arg_error = this->check_argument(it->first, this->m_optional_args); } catch(std::exception&) {}\n+ arg_error = this->check_argument(it->first, this->m_optional_args);\nelse\nfor (auto i = 0; i < (int)it->first.size(); i++)\narg_error += print_tag(it->first[i]) + ((i < (int)it->first.size()-1)?\", \":\"\");\n@@ -411,38 +411,111 @@ bool Arguments_reader\nstd::string Arguments_reader\n::check_argument(const std::vector<std::string> &tags, const arg_map &args) const\n{\n- std::string error;\n+ // prepare the error message\n+ std::string error = \"The \\\"\";\n+ for (auto i = 0; i < (int)tags.size(); i++)\n+ error += print_tag(tags[i]) + ((i < (int)tags.size()-1)?\", \":\"\");\n+ error += \"\\\" argument \";\n+\n+ // check if the input is an integer\n+ if (args.at(tags)[0].find(\"int\") != std::string::npos)\n+ {\n+ int int_num = 0;\n+ try\n+ {\n+ int_num = std::stoi(this->m_args.at(tags));\n+ }\n+ catch(std::exception&)\n+ {\n+ error += \"has to be an integer.\";\n+ return error;\n+ }\n- // check if the input is positive\nif (args.at(tags)[0] == \"positive_int\")\n{\n- const auto int_num = std::stoi(this->m_args.at(tags));\nif (int_num < 0)\n{\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+ error += \"has to be a positive integer.\";\n+ return error;\n+ }\n+ }\n- error += \"\\\" argument has to be positive.\";\n+ // check if the input is strictly positive\n+ else if (args.at(tags)[0] == \"strictly_positive_int\")\n+ {\n+ if (int_num <= 0)\n+ {\n+ error += \"has to be a strictly positive integer.\";\nreturn error;\n}\n}\n- // check if the input is positive\n+ else if (args.at(tags)[0] != \"integer\")\n+ {\n+ std::stringstream message;\n+ message << error << \"has an unknown conditionnal flag '\" << args.at(tags)[0] << \"'.\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+\n+ // check if the input is an integer\n+ else if (args.at(tags)[0].find(\"float\") != std::string::npos)\n+ {\n+ float float_num = 0;\n+ try\n+ {\n+ float_num = std::stof(this->m_args.at(tags));\n+ }\n+ catch(std::exception&)\n+ {\n+ error += \"has to be a float.\";\n+ return error;\n+ }\n+\nif (args.at(tags)[0] == \"positive_float\")\n{\n- const auto float_num = std::stof(this->m_args.at(tags));\nif (float_num < 0.f)\n{\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+ error += \"has to be a positive float.\";\n+ return error;\n+ }\n+ }\n+\n+ // check if the input is strictly positive\n+ else if (args.at(tags)[0] == \"strictly_positive_float\")\n+ {\n+ if (float_num <= 0.f)\n+ {\n+ error += \"has to be a strictly positive float.\";\n+ return error;\n+ }\n+ }\n+\n+ else if (args.at(tags)[0] != \"float\")\n+ {\n+ std::stringstream message;\n+ message << error << \"has an unknown conditionnal flag '\" << args.at(tags)[0] << \"'.\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n- error += \"\\\" argument has to be positive.\";\n+ // check if the input is a string\n+ else if (args.at(tags)[0] == \"string\")\n+ {\n+ if (this->m_args.at(tags).empty())\n+ {\n+ error += \"has to be a string.\";\nreturn error;\n}\n}\n+ else if (args.at(tags)[0] != \"\")\n+ {\n+ std::stringstream message;\n+ message << error << \"has an unknown conditionnal flag '\" << args.at(tags)[0] << \"'.\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n// check if the input is in the list\nif (args.at(tags).size() >= 3)\n{\n@@ -465,16 +538,12 @@ std::string Arguments_reader\nset += entries[i] + \"|\";\nset += entries[entries.size() -1] + \">\";\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 in the \" + set + \" set.\";\n+ error += \"has to be in the \" + set + \" set.\";\nreturn error;\n}\n}\n- return error;\n+ return \"\";\n}\nstd::string Arguments_reader\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a strictly positive float/int conditional flag for arguments; Improve argument checker of the argument reader class
8,483
31.10.2017 17:29:32
-3,600
8292145c31ac206d799ab62eaf1550710d97b858
Add negative and non-zero conditional flags in argument checker method in argument reader class
[ { "change_type": "MODIFY", "old_path": "src/Tools/Arguments_reader.cpp", "new_path": "src/Tools/Arguments_reader.cpp", "diff": "@@ -440,7 +440,15 @@ std::string Arguments_reader\n}\n}\n- // check if the input is strictly positive\n+ else if (args.at(tags)[0] == \"negative_int\")\n+ {\n+ if (int_num > 0)\n+ {\n+ error += \"has to be a negative integer.\";\n+ return error;\n+ }\n+ }\n+\nelse if (args.at(tags)[0] == \"strictly_positive_int\")\n{\nif (int_num <= 0)\n@@ -450,6 +458,24 @@ std::string Arguments_reader\n}\n}\n+ else if (args.at(tags)[0] == \"strictly_negative_int\")\n+ {\n+ if (int_num >= 0)\n+ {\n+ error += \"has to be a strictly negative integer.\";\n+ return error;\n+ }\n+ }\n+\n+ else if (args.at(tags)[0] == \"non_zero_int\")\n+ {\n+ if (int_num == 0)\n+ {\n+ error += \"has to be a non-zero integer.\";\n+ return error;\n+ }\n+ }\n+\nelse if (args.at(tags)[0] != \"integer\")\n{\nstd::stringstream message;\n@@ -481,7 +507,15 @@ std::string Arguments_reader\n}\n}\n- // check if the input is strictly positive\n+ else if (args.at(tags)[0] == \"negative_float\")\n+ {\n+ if (float_num > 0.f)\n+ {\n+ error += \"has to be a negative float.\";\n+ return error;\n+ }\n+ }\n+\nelse if (args.at(tags)[0] == \"strictly_positive_float\")\n{\nif (float_num <= 0.f)\n@@ -491,6 +525,24 @@ std::string Arguments_reader\n}\n}\n+ else if (args.at(tags)[0] == \"strictly_negative_float\")\n+ {\n+ if (float_num >= 0.f)\n+ {\n+ error += \"has to be a strictly negative float.\";\n+ return error;\n+ }\n+ }\n+\n+ else if (args.at(tags)[0] == \"non_zero_float\")\n+ {\n+ if (float_num == 0.f)\n+ {\n+ error += \"has to be a non-zero float.\";\n+ return error;\n+ }\n+ }\n+\nelse if (args.at(tags)[0] != \"float\")\n{\nstd::stringstream message;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add negative and non-zero conditional flags in argument checker method in argument reader class
8,483
06.11.2017 09:19:13
-3,600
8855d2239a53689244bc2f9a58be5cd6a3c7f293
Change some others parameters into strictly positive values
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Monitor/BFER/Monitor_BFER.cpp", "new_path": "src/Factory/Module/Monitor/BFER/Monitor_BFER.cpp", "diff": "@@ -43,7 +43,7 @@ void Monitor_BFER::parameters\n\"set the number of inter frame level to process.\"};\nopt_args[{p+\"-max-fe\", \"e\"}] =\n- {\"positive_int\",\n+ {\"strictly_positive_int\",\n\"max number of frame errors for each SNR simulation.\"};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Monitor/EXIT/Monitor_EXIT.cpp", "new_path": "src/Factory/Module/Monitor/EXIT/Monitor_EXIT.cpp", "diff": "@@ -44,7 +44,7 @@ void Monitor_EXIT::parameters\n\"set the number of inter frame level to process.\"};\nopt_args[{p+\"-trials\", \"n\"}] =\n- {\"positive_int\",\n+ {\"strictly_positive_int\",\n\"number of frames to simulate per sigma A value.\"};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Quantizer/Quantizer.cpp", "new_path": "src/Factory/Module/Quantizer/Quantizer.cpp", "diff": "@@ -59,7 +59,7 @@ void Quantizer::parameters\n\"the number of bits used for the quantizer.\"};\nopt_args[{p+\"-range\"}] =\n- {\"positive_float\",\n+ {\"strictly_positive_float\",\n\"the min/max bound for the tricky quantizer.\"};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Tools/Code/Polar/Frozenbits_generator.cpp", "new_path": "src/Factory/Tools/Code/Polar/Frozenbits_generator.cpp", "diff": "@@ -42,7 +42,7 @@ void Frozenbits_generator::parameters\n\"the codeword size.\"};\nopt_args[{p+\"-sigma\"}] =\n- {\"positive_float\",\n+ {\"strictly_positive_float\",\n\"sigma value for the polar codes generation (adaptive frozen bits if sigma is not set).\"};\nopt_args[{p+\"-gen-method\"}] =\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Tools/Code/Turbo/Flip_and_check.cpp", "new_path": "src/Factory/Tools/Code/Turbo/Flip_and_check.cpp", "diff": "@@ -45,7 +45,7 @@ void Flip_and_check::parameters\n\"enables the flip and check decoder (requires \\\"--crc-type\\\").\"};\nopt_args[{p+\"-q\"}] =\n- {\"positive_int\",\n+ {\"strictly_positive_int\",\n\"set the search's space for the fnc algorithm.\"};\nopt_args[{p+\"-ite-m\"}] =\n@@ -57,7 +57,7 @@ void Flip_and_check::parameters\n\"set last iteration at which the fnc is used.\"};\nopt_args[{p+\"-ite-s\"}] =\n- {\"positive_int\",\n+ {\"strictly_positive_int\",\n\"set iteration step for the fnc algorithm.\"};\nopt_args[{p+\"-ite\", \"i\"}] =\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Tools/Code/Turbo/Scaling_factor.cpp", "new_path": "src/Factory/Tools/Code/Turbo/Scaling_factor.cpp", "diff": "@@ -44,7 +44,7 @@ void Scaling_factor::parameters\n\"CST, LTE, LTE_VEC, ARRAY, ADAPTIVE\"};\nopt_args[{p+\"-ite\"}] =\n- {\"positive_int\",\n+ {\"strictly_positive_int\",\n\"number of iterations.\"};\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Change some others parameters into strictly positive values
8,483
06.11.2017 09:34:39
-3,600
bac9871f18561d1cc1a67f9828c76912022cb6c6
Set back n_thread as a possibly zero value
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.cpp", "new_path": "src/Factory/Simulation/Simulation.cpp", "diff": "@@ -69,8 +69,8 @@ void Simulation::parameters\n\"display statistics module by module.\"};\nopt_args[{p+\"-threads\", \"t\"}] =\n- {\"strictly_positive_int\",\n- \"specify the number of threads used (default is the number of CPU cores).\"};\n+ {\"positive_int\",\n+ \"specify the number of threads used (0 or default is the number of CPU cores).\"};\nopt_args[{p+\"-seed\", \"S\"}] =\n{\"positive_int\",\n" } ]
C++
MIT License
aff3ct/aff3ct
Set back n_thread as a possibly zero value
8,483
07.11.2017 12:38:35
-3,600
5b58946838ff12b532a2617a8646a2b8f902b260
Modify test.py to write command line properly; Correction of arguments
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.cpp", "new_path": "src/Factory/Module/Modem/Modem.cpp", "diff": "@@ -115,7 +115,7 @@ void Modem::parameters\n\"PSI0, PSI1, PSI2, PSI3\"};\nopt_args[{p+\"-ite\"}] =\n- {\"strictly_positive int\",\n+ {\"strictly_positive_int\",\n\"select the number of iteration in the demodulator.\"};\n}\n" }, { "change_type": "MODIFY", "old_path": "tests/tests.py", "new_path": "tests/tests.py", "diff": "@@ -11,7 +11,7 @@ Nthreads = 0 # if 0 then AFF3CT takes all the available threads\nRecursiveScan = True\nMaxFE = 100 # 0 takes fe from the original simulation\nWeakRate = 0.8 # 0 < WeakRate < 1\n-MaxTimeSNR = 600 # max time to spend per SNR (in sec), 0 = illimited\n+MaxTimeSNR = 1 # max time to spend per SNR (in sec), 0 = illimited\n# ================================================================== PARAMETERS\n# =============================================================================\n@@ -105,13 +105,42 @@ for fn in fileNames:\nf.close()\n- argsAFFECT = []\n- argsAFFECT = runCommand.split(\" \")\n-\n+ # split the run command\n+ argsAFFECT = [\"\"]\nidx = 0\n- for a in argsAFFECT:\n- argsAFFECT[idx] = a.replace(\"\\\"\", \"\")\n+\n+ new = 0\n+ found_dashes = 0\n+ for s in runCommand:\n+ if found_dashes == 0:\n+ if s == ' ':\n+ if new == 0:\n+ argsAFFECT.append(\"\")\n+ idx = idx + 1\n+ new = 1\n+\n+ elif s == '\\\"':\n+ if new == 0:\n+ argsAFFECT.append(\"\")\n+ idx = idx + 1\n+ new = 1\n+ found_dashes = 1\n+\n+ else:\n+ argsAFFECT[idx] += s\n+ new = 0\n+\n+ else: # between dashes\n+ if s == '\\\"':\n+ argsAFFECT.append(\"\")\nidx = idx + 1\n+ found_dashes = 0\n+\n+ else:\n+ argsAFFECT[idx] += s\n+\n+ del argsAFFECT[idx]\n+\nargsAFFECT.append(\"--ter-freq\")\nargsAFFECT.append(\"0\")\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify test.py to write command line properly; Correction of arguments
8,483
07.11.2017 12:41:34
-3,600
e6e6addcedd6b91314239cd426a3f72e49346849
Correction argument
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.cpp", "new_path": "src/Factory/Module/Modem/Modem.cpp", "diff": "@@ -115,7 +115,7 @@ void Modem::parameters\n\"PSI0, PSI1, PSI2, PSI3\"};\nopt_args[{p+\"-ite\"}] =\n- {\"strictly_positive int\",\n+ {\"strictly_positive_int\",\n\"select the number of iteration in the demodulator.\"};\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Correction argument
8,483
07.11.2017 12:42:01
-3,600
4f450d931765194920fdabbc959cfbb848741783
Modify test script to write aff3ct command line correctly
[ { "change_type": "MODIFY", "old_path": "tests/tests.py", "new_path": "tests/tests.py", "diff": "@@ -11,7 +11,7 @@ Nthreads = 0 # if 0 then AFF3CT takes all the available threads\nRecursiveScan = True\nMaxFE = 100 # 0 takes fe from the original simulation\nWeakRate = 0.8 # 0 < WeakRate < 1\n-MaxTimeSNR = 600 # max time to spend per SNR (in sec), 0 = illimited\n+MaxTimeSNR = 1 # max time to spend per SNR (in sec), 0 = illimited\n# ================================================================== PARAMETERS\n# =============================================================================\n@@ -105,13 +105,42 @@ for fn in fileNames:\nf.close()\n- argsAFFECT = []\n- argsAFFECT = runCommand.split(\" \")\n-\n+ # split the run command\n+ argsAFFECT = [\"\"]\nidx = 0\n- for a in argsAFFECT:\n- argsAFFECT[idx] = a.replace(\"\\\"\", \"\")\n+\n+ new = 0\n+ found_dashes = 0\n+ for s in runCommand:\n+ if found_dashes == 0:\n+ if s == ' ':\n+ if new == 0:\n+ argsAFFECT.append(\"\")\n+ idx = idx + 1\n+ new = 1\n+\n+ elif s == '\\\"':\n+ if new == 0:\n+ argsAFFECT.append(\"\")\n+ idx = idx + 1\n+ new = 1\n+ found_dashes = 1\n+\n+ else:\n+ argsAFFECT[idx] += s\n+ new = 0\n+\n+ else: # between dashes\n+ if s == '\\\"':\n+ argsAFFECT.append(\"\")\nidx = idx + 1\n+ found_dashes = 0\n+\n+ else:\n+ argsAFFECT[idx] += s\n+\n+ del argsAFFECT[idx]\n+\nargsAFFECT.append(\"--ter-freq\")\nargsAFFECT.append(\"0\")\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify test script to write aff3ct command line correctly
8,483
07.11.2017 12:43:07
-3,600
91e1508ef64faf7cf9f370a884c07724435f7e58
Modify test time per SNR
[ { "change_type": "MODIFY", "old_path": "tests/tests.py", "new_path": "tests/tests.py", "diff": "@@ -11,7 +11,7 @@ Nthreads = 0 # if 0 then AFF3CT takes all the available threads\nRecursiveScan = True\nMaxFE = 100 # 0 takes fe from the original simulation\nWeakRate = 0.8 # 0 < WeakRate < 1\n-MaxTimeSNR = 1 # max time to spend per SNR (in sec), 0 = illimited\n+MaxTimeSNR = 600 # max time to spend per SNR (in sec), 0 = illimited\n# ================================================================== PARAMETERS\n# =============================================================================\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify test time per SNR
8,483
10.11.2017 09:30:46
-3,600
d4c57da57c394897a8d78f5b9e01aa31fccdb3f9
Modify argument map to have a pointer to the second member
[ { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -87,10 +87,10 @@ void factory::Launcher::parameters\nopt_args.add(\n{p+\"-prec\", \"p\"},\nnew tools::Integer<>({new tools::Including_set<int>({8, 16, 32})}),\n- \"the simulation precision in bit.\");\n+ \"the simulation precision in bits.\");\n#if defined(__x86_64) || defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)\n- auto* arg_type = dynamic_cast<tools::Argument_type_limited<int>*>(opt_args.at({p+\"-prec\", \"p\"}).type);\n+ auto* arg_type = dynamic_cast<tools::Argument_type_limited<int>*>(opt_args.at({p+\"-prec\", \"p\"})->type);\nauto* arg_range = dynamic_cast<tools::Set<int>*>(arg_type->get_ranges().front());\narg_range->add_options({64});\n#endif\n@@ -125,7 +125,7 @@ void factory::Launcher::parameters\n#ifdef MULTI_PREC\nopt_args[{p+\"-prec\", \"p\"}] =\n{\"positive_int\",\n- \"the simulation precision in bit.\",\n+ \"the simulation precision in bits.\",\n\"8, 16, 32\"};\n#if defined(__x86_64) || defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_handler.cpp", "new_path": "src/Tools/Arguments/Argument_handler.cpp", "diff": "@@ -92,7 +92,7 @@ std::vector<bool> Argument_handler\n{\nif (cur_tag == this->command[ix_arg_val]) // the tag has been found\n{\n- if(it_arg_info->second.type->get_title() == \"\") // do not wait for a value after the tag\n+ if(it_arg_info->second->type->get_title() == \"\") // do not wait for a value after the tag\n{\nauto it = arg_v.find(it_arg_info->first);\nif (it == arg_v.end())\n@@ -119,7 +119,7 @@ std::vector<bool> Argument_handler\n// check the found argument\ntry\n{\n- it_arg_info->second.type->check(this->command[ix_arg_val +1]);\n+ it_arg_info->second->type->check(this->command[ix_arg_val +1]);\nmessage = \"\";\n}\ncatch(std::exception& e)\n@@ -153,8 +153,8 @@ void Argument_handler\n{\nif (std::find(existing_flags.begin(), existing_flags.end(), it->first.back()) == existing_flags.end())\n{\n- if(it->second.type->get_title() != \"\")\n- std::cout << \" \" + print_tag(it->first.back()) << \" <\" << it->second.type->get_title() << \">\";\n+ if(it->second->type->get_title() != \"\")\n+ std::cout << \" \" + print_tag(it->first.back()) << \" <\" << it->second->type->get_title() << \">\";\nelse\nstd::cout << \" \" + print_tag(it->first.back());\n@@ -184,10 +184,10 @@ void Argument_handler\n// print arguments\nfor (auto it = req_args.begin(); it != req_args.end(); ++it)\n- this->print_help(it->first, it->second, max_n_char_arg, true);\n+ this->print_help(it->first, *it->second, max_n_char_arg, true);\nfor (auto it = opt_args.begin(); it != opt_args.end(); ++it)\n- this->print_help(it->first, it->second, max_n_char_arg, false);\n+ this->print_help(it->first, *it->second, max_n_char_arg, false);\nstd::cout << std::endl;\n}\n@@ -251,7 +251,7 @@ void Argument_handler\ntitle_displayed = true;\n}\n- this->print_help(it_arg->first, it_arg->second, max_n_char_arg, true);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, true);\n}\n}\n@@ -268,7 +268,7 @@ void Argument_handler\ntitle_displayed = true;\n}\n- this->print_help(it_arg->first, it_arg->second, max_n_char_arg, false);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, false);\n}\n}\n@@ -302,7 +302,7 @@ void Argument_handler\ntitle_displayed = true;\n}\n- this->print_help(it_arg->first, it_arg->second, max_n_char_arg, true);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, true);\n}\n}\n@@ -331,7 +331,7 @@ void Argument_handler\ntitle_displayed = true;\n}\n- this->print_help(it_arg->first, it_arg->second, max_n_char_arg, false);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, false);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_map.hpp", "new_path": "src/Tools/Arguments/Argument_map.hpp", "diff": "@@ -28,14 +28,27 @@ struct Argument_info\n: type(type), doc(doc)\n{}\n- virtual Argument_info clone() const\n+ virtual ~Argument_info()\n+ {\n+ clear();\n+ }\n+\n+ virtual void clear()\n+ {\n+ if (type != nullptr)\n+ delete type;\n+\n+ type = nullptr;\n+ }\n+\n+ virtual Argument_info* clone() const\n{\nArgument_type* arg_t = nullptr;\nif (type != nullptr)\narg_t = type->clone();\n- return Argument_info(arg_t, doc);\n+ return new Argument_info(arg_t, doc);\n}\nArgument_type* type = nullptr;\n@@ -43,10 +56,10 @@ struct Argument_info\n};\n-class Argument_map_info : public std::map<Argument_tag, Argument_info>\n+class Argument_map_info : public std::map<Argument_tag, Argument_info*>\n{\npublic:\n- using mother = std::map<Argument_tag, Argument_info>;\n+ using mother_t = std::map<Argument_tag, Argument_info*>;\npublic:\nArgument_map_info()\n@@ -54,7 +67,7 @@ public:\nArgument_map_info(const Argument_map_info& other)\n{\n- *this = other.clone();\n+ other.clone(*this);\n}\nvirtual ~Argument_map_info()\n@@ -62,6 +75,12 @@ public:\nclear();\n}\n+ Argument_map_info& operator=(const Argument_map_info& other)\n+ {\n+ other.clone(*this);\n+ return *this;\n+ }\n+\nvoid add(const Argument_tag& tags, Argument_type* arg_t, const std::string& doc)\n{\nif (tags.size() == 0)\n@@ -70,30 +89,42 @@ public:\nif (arg_t == nullptr)\nthrow std::invalid_argument(\"No argument type has been given ('arg_t' == 0).\");\n- (*this)[tags];\n- (*this)[tags].type = arg_t;\n- (*this)[tags].doc = doc;\n+ (*this)[tags] = new Argument_info(arg_t, doc);\n}\nvoid clear()\n{\nfor (auto it = this->begin(); it != this->end(); it++)\n- if (it->second.type != nullptr)\n- delete it->second.type;\n+ if (it->second != nullptr)\n+ delete it->second;\n- mother::clear();\n+ mother_t::clear();\n}\n- Argument_map_info clone() const\n+ /* \\brief: clone itself in the 'other' map\n+ * \\return a pointer to the clone map\n+ */\n+ Argument_map_info* clone() const\n{\n- Argument_map_info other;\n+ auto* other = new Argument_map_info();\nfor (auto it = this->begin(); it != this->end(); it++)\n- other[it->first] = it->second.clone();\n+ (*other)[it->first] = it->second->clone();\nreturn other;\n}\n+ /* \\brief: clone itself in the 'other' map\n+ * \\param 'other' is the other map in which this class will be cloned. Clear it first of all\n+ */\n+ void clone(Argument_map_info& other) const\n+ {\n+ other.clear();\n+\n+ for (auto it = this->begin(); it != this->end(); it++)\n+ other[it->first] = it->second->clone();\n+ }\n+\nbool exist(const Argument_tag &tags)\n{\nreturn (this->find(tags) != this->end());\n@@ -104,7 +135,7 @@ public:\nclass Argument_map_value : public std::map<Argument_tag, std::string>\n{\npublic:\n- using mother = std::map<Argument_tag, std::string>;\n+ using mother_t = std::map<Argument_tag, std::string>;\npublic:\n" }, { "change_type": "MODIFY", "old_path": "src/main.cpp", "new_path": "src/main.cpp", "diff": "@@ -79,11 +79,7 @@ void print_version()\nexit(EXIT_SUCCESS);\n}\n-#ifdef MULTI_PREC\n-void read_arguments(const int argc, const char** argv, factory::Launcher::parameters &params)\n-#else\n-void read_arguments(const int argc, const char** argv, factory::Launcher::parameters &params)\n-#endif\n+int read_arguments(const int argc, const char** argv, factory::Launcher::parameters &params)\n{\ntools::Argument_handler ah(argc, argv);\n@@ -113,8 +109,7 @@ void read_arguments(const int argc, const char** argv, factory::Launcher::parame\nfor (auto w = 0; w < (int)cmd_warn.size(); w++)\nstd::cerr << tools::format_warning(cmd_warn[w]) << std::endl;\n- if (cmd_error.size())\n- std::exit(EXIT_FAILURE);\n+ return cmd_error.size() ? EXIT_FAILURE : EXIT_SUCCESS;\n}\n#ifndef SYSTEMC\n@@ -128,7 +123,8 @@ int sc_main(int argc, char **argv)\n#endif\nfactory::Launcher::parameters params(\"sim\");\n- read_arguments(argc, (const char**)argv, params);\n+ if (read_arguments(argc, (const char**)argv, params) == EXIT_FAILURE)\n+ return EXIT_FAILURE;\nlauncher::Launcher *launcher = nullptr;\ntry\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify argument map to have a pointer to the second member
8,490
11.11.2017 23:39:36
-3,600
cb63988d6f5da99d55003e313f86c4535c49de51
Up. to the last MIPP version (with AVX512 ready).
[ { "change_type": "MODIFY", "old_path": "lib/MIPP", "new_path": "lib/MIPP", "diff": "-Subproject commit af3a522ce5766451cc68808cc48d905cd73921f2\n+Subproject commit 73e040ce1e92d4e242b7f3b0d5639aa92b72bcc7\n" }, { "change_type": "MODIFY", "old_path": "src/Module/CRC/Polynomial/CRC_polynomial_inter.cpp", "new_path": "src/Module/CRC/Polynomial/CRC_polynomial_inter.cpp", "diff": "@@ -62,7 +62,7 @@ void CRC_polynomial_inter<B>\nfor (auto i = 0; i < loop_size; i += n_frames)\n{\nauto r_buff_crc = mipp::loadu<B>(&this->buff_crc[i]);\n- auto r_mask = mipp::cvt_reg<mipp::N<B>()>(mipp::cmpeq<B>(r_buff_crc, r_zero));\n+ auto r_mask = mipp::toreg<mipp::N<B>()>(mipp::cmpeq<B>(r_buff_crc, r_zero));\nfor (auto j = 0; j <= crc_size; j++)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_std.hxx", "new_path": "src/Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_std.hxx", "diff": "@@ -138,7 +138,7 @@ void Decoder_RSC_BCJR_intra_std<B,R,MAX>\n}\nconst R m1e[8] = {1, 0, 0, 0, 0, 0, 0, 0};\n- const auto r_m1e = mipp::cvt_reg<R>(mipp::Reg<R>(1) == mipp::Reg<R>(m1e));\n+ const auto r_m1e = mipp::toReg<R>(mipp::Reg<R>(1) == mipp::Reg<R>(m1e));\n// compute beta values and the extrinsic values [trellis backward traversal <-] (vectorized)\nauto r_g4 = mipp::Reg<R>((R)0);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/PRNG/PRNG_MT19937_simd.cpp", "new_path": "src/Tools/Algo/PRNG/PRNG_MT19937_simd.cpp", "diff": "@@ -18,7 +18,7 @@ constexpr unsigned DIFF = SIZE-PERIOD;\n#define UNROLL(expr) \\\ny = M32(MT[i]) | L31(MT[i+1]); \\\n- m = mipp::cvt_reg<int>((y & 1) == 1) & 0x9908b0df; \\\n+ m = mipp::toReg<int>((y & 1) == 1) & 0x9908b0df; \\\nMT[i] = MT[expr] ^ (y >> 1) ^ m; \\\n++i;\n@@ -139,7 +139,7 @@ void PRNG_MT19937_simd::generate_numbers()\n// i = 623\ny = M32(MT[SIZE-1]) | L31(MT[0]);\n- m = mipp::cvt_reg<int>((y & 1) == 1) & 0x9908b0df;\n+ m = mipp::toReg<int>((y & 1) == 1) & 0x9908b0df;\nMT[SIZE-1] = MT[PERIOD-1] ^ (y >> 1) ^ m;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Up. to the last MIPP version (with AVX512 ready).
8,490
13.11.2017 10:49:57
-3,600
b495e6df0a383f5cce8ba00febc84fead3e207e7
Update the polar API for AVX512.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/functions_polar_intra_16bit.h", "new_path": "src/Tools/Code/Polar/API/functions_polar_intra_16bit.h", "diff": "@@ -27,7 +27,18 @@ struct f_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename R, proto_f<R> F, proto_f_i<R> FI>\n+struct f_intra_16bit <R, F, FI, 16>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, R *__restrict l_c, const int n_elmts = 0)\n+ {\n+ f_intra_unaligned<R,FI>::apply(l_a, l_b, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename R, proto_f<R> F, proto_f_i<R> FI>\nstruct f_intra_16bit <R, F, FI, 8>\n{\n@@ -79,7 +90,19 @@ struct g_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\n+struct g_intra_16bit <B, R, G, GI, 16>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n+ const int n_elmts = 0)\n+ {\n+ g_intra_unaligned<B,R,GI>::apply(l_a, l_b, s_a, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct g_intra_16bit <B, R, G, GI, 8>\n{\n@@ -134,7 +157,18 @@ struct g0_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename R, proto_g0<R> G0, proto_g0_i<R> G0I>\n+struct g0_intra_16bit <R, G0, G0I, 16>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, R *__restrict l_c, const int n_elmts = 0)\n+ {\n+ g0_intra_unaligned<R,G0I>::apply(l_a, l_b, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename R, proto_g0<R> G0, proto_g0_i<R> G0I>\nstruct g0_intra_16bit <R, G0, G0I, 8>\n{\n@@ -187,7 +221,19 @@ struct gr_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\n+struct gr_intra_16bit <B, R, G, GI, 16>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n+ const int n_elmts = 0)\n+ {\n+ gr_intra_unaligned<B,R,GI>::apply(l_a, l_b, s_a, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct gr_intra_16bit <B, R, G, GI, 8>\n{\n@@ -232,7 +278,18 @@ struct h_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct h_intra_16bit <B, R, H, HI, 16>\n+{\n+ static void apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ h_intra_unaligned<B,R,HI>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct h_intra_16bit <B, R, H, HI, 8>\n{\n@@ -283,7 +340,18 @@ struct rep_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct rep_intra_16bit <B, R, H, HI, 16>\n+{\n+ static void apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ rep_seq<B,R,H,8>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct rep_intra_16bit <B, R, H, HI, 8>\n{\n@@ -325,7 +393,18 @@ struct spc_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct spc_intra_16bit <B, R, H, HI, 32>\n+{\n+ static bool apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ return spc_seq<B,R,H,16>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct spc_intra_16bit <B, R, H, HI, 16>\n{\n@@ -368,7 +447,19 @@ struct xo_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, proto_xo<B> XO, proto_xo_i<B> XOI>\n+struct xo_intra_16bit <B, XO, XOI, 16>\n+{\n+ static void apply(const B *__restrict s_a, const B *__restrict s_b, B *__restrict s_c,\n+ const int n_elmts = 0)\n+ {\n+ xo_seq<B,XO,8>::apply(s_a, s_b, s_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, proto_xo<B> XO, proto_xo_i<B> XOI>\nstruct xo_intra_16bit <B, XO, XOI, 8>\n{\n@@ -423,7 +514,18 @@ struct xo0_intra_16bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B>\n+struct xo0_intra_16bit <B, 16>\n+{\n+ static void apply(const B *__restrict s_b, B *__restrict s_c, const int n_elmts = 0)\n+ {\n+ xo0_seq<B,8>::apply(s_b, s_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B>\nstruct xo0_intra_16bit <B, 8>\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/functions_polar_intra_32bit.h", "new_path": "src/Tools/Code/Polar/API/functions_polar_intra_32bit.h", "diff": "@@ -27,7 +27,18 @@ struct f_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename R, proto_f<R> F, proto_f_i<R> FI>\n+struct f_intra_32bit <R, F, FI, 8>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, R *__restrict l_c, const int n_elmts = 0)\n+ {\n+ f_intra_unaligned<R,FI>::apply(l_a, l_b, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename R, proto_f<R> F, proto_f_i<R> FI>\nstruct f_intra_32bit <R, F, FI, 4>\n{\n@@ -70,7 +81,18 @@ struct g_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+struct g_intra_32bit <B, R, G, GI, 8>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n+ const int n_elmts = 0)\n+ {\n+ g_intra_unaligned<B,R,GI>::apply(l_a, l_b, s_a, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct g_intra_32bit <B, R, G, GI, 4>\n{\n@@ -115,7 +137,18 @@ struct g0_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename R, proto_g0<R> G0, proto_g0_i<R> G0I>\n+struct g0_intra_32bit <R, G0, G0I, 8>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, R *__restrict l_c, const int n_elmts = 0)\n+ {\n+ g0_intra_unaligned<R,G0I>::apply(l_a, l_b, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename R, proto_g0<R> G0, proto_g0_i<R> G0I>\nstruct g0_intra_32bit <R, G0, G0I, 4>\n{\n@@ -159,7 +192,18 @@ struct gr_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+struct gr_intra_32bit <B, R, G, GI, 8>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n+ const int n_elmts = 0)\n+ {\n+ gr_intra_unaligned<B,R,GI>::apply(l_a, l_b, s_a, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct gr_intra_32bit <B, R, G, GI, 4>\n{\n@@ -194,7 +238,18 @@ struct h_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct h_intra_32bit <B, R, H, HI, 8>\n+{\n+ static void apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ h_intra_unaligned<B,R,HI>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct h_intra_32bit <B, R, H, HI, 4>\n{\n@@ -236,7 +291,18 @@ struct rep_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct rep_intra_32bit <B, R, H, HI, 8>\n+{\n+ static void apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ rep_seq<B,R,H,4>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct rep_intra_32bit <B, R, H, HI, 4>\n{\n@@ -269,7 +335,18 @@ struct spc_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct spc_intra_32bit <B, R, H, HI, 16>\n+{\n+ static bool apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ return spc_seq<B,R,H,8>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct spc_intra_32bit <B, R, H, HI, 8>\n{\n@@ -303,7 +380,19 @@ struct xo_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, proto_xo<B> XO, proto_xo_i<B> XOI>\n+struct xo_intra_32bit <B, XO, XOI, 8>\n+{\n+ static void apply(const B *__restrict s_a, const B *__restrict s_b, B *__restrict s_c,\n+ const int n_elmts = 0)\n+ {\n+ xo_seq<B,XO,4>::apply(s_a, s_b, s_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, proto_xo<B> XO, proto_xo_i<B> XOI>\nstruct xo_intra_32bit <B, XO, XOI, 4>\n{\n@@ -348,7 +437,18 @@ struct xo0_intra_32bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B>\n+struct xo0_intra_32bit <B, 8>\n+{\n+ static void apply(const B *__restrict s_b, B *__restrict s_c, const int n_elmts = 0)\n+ {\n+ xo0_seq<B,4>::apply(s_b, s_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B>\nstruct xo0_intra_32bit <B, 4>\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/functions_polar_intra_8bit.h", "new_path": "src/Tools/Code/Polar/API/functions_polar_intra_8bit.h", "diff": "@@ -27,7 +27,18 @@ struct f_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename R, proto_f<R> F, proto_f_i<R> FI>\n+struct f_intra_8bit <R, F, FI, 32>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, R *__restrict l_c, const int n_elmts = 0)\n+ {\n+ f_intra_unaligned<R,FI>::apply(l_a, l_b, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename R, proto_f<R> F, proto_f_i<R> FI>\nstruct f_intra_8bit <R, F, FI, 16>\n{\n@@ -88,7 +99,19 @@ struct g_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\n+struct g_intra_8bit <B, R, G, GI, 32>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n+ const int n_elmts = 0)\n+ {\n+ g_intra_unaligned<B,R,GI>::apply(l_a, l_b, s_a, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct g_intra_8bit <B, R, G, GI, 16>\n{\n@@ -153,7 +176,18 @@ struct g0_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename R, proto_g0<R> G0, proto_g0_i<R> G0I>\n+struct g0_intra_8bit <R, G0, G0I, 32>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, R *__restrict l_c, const int n_elmts = 0)\n+ {\n+ g0_intra_unaligned<R,G0I>::apply(l_a, l_b, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename R, proto_g0<R> G0, proto_g0_i<R> G0I>\nstruct g0_intra_8bit <R, G0, G0I, 16>\n{\n@@ -215,7 +249,19 @@ struct gr_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\n+struct gr_intra_8bit <B, R, G, GI, 32>\n+{\n+ static void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n+ const int n_elmts = 0)\n+ {\n+ gr_intra_unaligned<B,R,GI>::apply(l_a, l_b, s_a, l_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct gr_intra_8bit <B, R, G, GI, 16>\n{\n@@ -270,7 +316,18 @@ struct h_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct h_intra_8bit <B, R, H, HI, 32>\n+{\n+ static void apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ h_intra_unaligned<B,R,HI>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct h_intra_8bit <B, R, H, HI, 16>\n{\n@@ -330,7 +387,18 @@ struct rep_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct rep_intra_8bit <B, R, H, HI, 32>\n+{\n+ static void apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ rep_seq<B,R,H,16>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct rep_intra_8bit <B, R, H, HI, 16>\n{\n@@ -381,7 +449,18 @@ struct spc_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\n+struct spc_intra_8bit <B, R, H, HI, 64>\n+{\n+ static bool apply(const R *__restrict l_a, B *__restrict s_a, const int n_elmts = 0)\n+ {\n+ return spc_seq<B,R,H,32>::apply(l_a, s_a, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, typename R, proto_h<B,R> H, proto_h_i<B,R> HI>\nstruct spc_intra_8bit <B, R, H, HI, 32>\n{\n@@ -433,7 +512,19 @@ struct xo_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, proto_xo<B> XO, proto_xo_i<B> XOI>\n+struct xo_intra_8bit <B, XO, XOI, 32>\n+{\n+ static void apply(const B *__restrict s_a, const B *__restrict s_b, B *__restrict s_c,\n+ const int n_elmts = 0)\n+ {\n+ xo_seq<B,XO,16>::apply(s_a, s_b, s_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B, proto_xo<B> XO, proto_xo_i<B> XOI>\nstruct xo_intra_8bit <B, XO, XOI, 16>\n{\n@@ -498,7 +589,18 @@ struct xo0_intra_8bit\n}\n};\n-#ifdef __AVX__\n+#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B>\n+struct xo0_intra_8bit <B, 32>\n+{\n+ static void apply(const B *__restrict s_b, B *__restrict s_c, const int n_elmts = 0)\n+ {\n+ xo0_seq<B,16>::apply(s_b, s_c, n_elmts);\n+ }\n+};\n+#endif\n+\n+#if defined(__AVX__) || defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\ntemplate <typename B>\nstruct xo0_intra_8bit <B, 16>\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the polar API for AVX512.
8,490
13.11.2017 10:52:59
-3,600
8518986b68aba622df6f648854d55b18c38ea281
Fix bug in prev. commit...
[ { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/API/functions_polar_intra_32bit.h", "new_path": "src/Tools/Code/Polar/API/functions_polar_intra_32bit.h", "diff": "@@ -82,6 +82,7 @@ struct g_intra_32bit\n};\n#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct g_intra_32bit <B, R, G, GI, 8>\n{\nstatic void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n@@ -193,6 +194,7 @@ struct gr_intra_32bit\n};\n#if defined(__MIC__) || defined(__KNCNI__) || defined(__AVX512__) || defined(__AVX512F__)\n+template <typename B, typename R, proto_g<B,R> G, proto_g_i<B,R> GI>\nstruct gr_intra_32bit <B, R, G, GI, 8>\n{\nstatic void apply(const R *__restrict l_a, const R *__restrict l_b, const B *__restrict s_a, R *__restrict l_c,\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bug in prev. commit...
8,483
15.11.2017 09:31:09
-3,600
5ae747eac2b74894ae2464bc3f179a1270749da9
Change sim-debug-prec into a positive int argument (before > 2); When setting to the module task debug precision and limit, allow a null value.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.cpp", "new_path": "src/Factory/Simulation/Simulation.cpp", "diff": "@@ -64,7 +64,7 @@ void Simulation::parameters\nopt_args.add(\n{p+\"-debug-prec\"},\n- new tools::Integer<>({new tools::Min<int>(2)}),\n+ new tools::Integer<>({new tools::Positive<int>()}),\n\"set the precision of real elements when displayed in debug mode.\");\nopt_args.add(\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -33,9 +33,7 @@ void Simulation\nif (params.debug)\n{\nt->set_debug(true);\n- if (params.debug_limit)\nt->set_debug_limit((uint32_t)params.debug_limit);\n- if (params.debug_precision)\nt->set_debug_precision((uint8_t)params.debug_precision);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_map.hpp", "new_path": "src/Tools/Arguments/Argument_map.hpp", "diff": "@@ -34,6 +34,7 @@ struct Argument_info\nstd::string doc = \"\";\n};\n+\nclass Argument_map_info : public std::map<Argument_tag, Argument_info*>\n{\npublic:\n@@ -94,7 +95,6 @@ public:\n* \\return the floating-point value of an argument with its tags (to use after the parse_arguments method).\n*/\nfloat to_float(const Argument_tag &tags) const;\n-\n};\n" } ]
C++
MIT License
aff3ct/aff3ct
Change sim-debug-prec into a positive int argument (before > 2); When setting to the module task debug precision and limit, allow a null value.
8,483
15.11.2017 11:07:30
-3,600
6a7607d3430b61a73dcfb1abac9bf43824ec2b64
Change headers to call only argument tools in Factory header.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Factory.hpp", "new_path": "src/Factory/Factory.hpp", "diff": "#include <map>\n#include \"Tools/Display/bash_tools.h\"\n-#include \"Tools/Arguments/Argument_map.hpp\"\n#include \"Tools/Arguments/Argument_tools.hpp\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_map.hpp", "new_path": "src/Tools/Arguments/Argument_map.hpp", "diff": "#include \"Argument_type.hpp\"\n#include \"Argument_range.hpp\"\n-#include \"Argument_type_basics.hpp\"\n-#include \"Argument_range_basics.hpp\"\nnamespace aff3ct\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_tools.hpp", "new_path": "src/Tools/Arguments/Argument_tools.hpp", "diff": "#include <typeinfo>\n#include <stdexcept>\n#include \"Argument_map.hpp\"\n+#include \"Argument_type_basics.hpp\"\n+#include \"Argument_range_basics.hpp\"\nnamespace aff3ct\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Change headers to call only argument tools in Factory header.
8,483
28.11.2017 10:30:04
-3,600
522ce17dc62c9356fe24951c69c22d191e652862
Enhance get back trace of tools::exception to display clearly the called functions.
[ { "change_type": "MODIFY", "old_path": "src/Tools/Exception/exception.cpp", "new_path": "src/Tools/Exception/exception.cpp", "diff": "#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n-#include <execinfo.h>\n+#include <execinfo.h> // backtrace, backtrace_symbols\n+#include <cxxabi.h> // __cxa_demangle\n#include <unistd.h>\n#include <cstdlib>\n+#include <iostream>\n#endif\n#include \"exception.hpp\"\n@@ -54,7 +56,6 @@ const char* exception\n{\nreturn message.c_str();\n}\n-\nstd::string exception\n::get_back_trace()\n{\n@@ -67,8 +68,63 @@ std::string exception\nchar** bt_symbs = backtrace_symbols(bt_array, size);\nbt_str += \"\\nBacktrace:\";\n- for (size_t i = 0; i < size; i++)\n- bt_str += \"\\n\" + std::string(bt_symbs[i]);\n+ for (size_t i = 3; i < size; i++)\n+ {\n+ std::string symbol = bt_symbs[i];\n+\n+ auto pos_beg_func = symbol.find('(');\n+ auto pos_off = symbol.find('+');\n+ auto pos_end_func = symbol.find(')');\n+ auto pos_beg_addr = symbol.find('[');\n+ auto pos_end_addr = symbol.find(']');\n+\n+ if ( (pos_beg_func != std::string::npos)\n+ && (pos_off != std::string::npos)\n+ && (pos_end_func != std::string::npos)\n+ && (pos_beg_addr != std::string::npos)\n+ && (pos_end_addr != std::string::npos))\n+ {\n+ auto program = symbol.substr(0, pos_beg_func );\n+ auto function = symbol.substr(pos_beg_func +1, pos_off - pos_beg_func -1);\n+ auto offset = symbol.substr(pos_off, pos_end_func - pos_off );\n+ auto address = symbol.substr(pos_beg_addr, pos_end_addr - pos_beg_addr +1);\n+\n+ std::string function_name;\n+\n+ int status;\n+ auto demangled_name = abi::__cxa_demangle(function.data(), NULL, NULL, &status);\n+\n+ if (demangled_name != NULL)\n+ {\n+ function_name = demangled_name;\n+ free(demangled_name);\n+ }\n+ else\n+ {\n+ function_name = function + \"()\";\n+ }\n+\n+ if ( status == 0 // good\n+ || status == -2) // mangled_name is not a valid name under the C++ ABI mangling rules.\n+ {\n+ bt_str += \"\\n\" + program + \": \" + function_name + \" \" + offset + \" \" + address;\n+ }\n+ else // error\n+ {\n+ if (status == -3) // One of the arguments is invalid.\n+ {\n+ std::cerr << \"Invalid abi::__cxa_demangle argument(s).\" << std::endl;\n+ std::exit(EXIT_FAILURE);\n+ }\n+\n+ if (status == -1) // A memory allocation failiure occurred.\n+ {\n+ std::cerr << \"Memory allocation error in abi::__cxa_demangle.\" << std::endl;\n+ std::exit(EXIT_FAILURE);\n+ }\n+ }\n+ }\n+ }\nfree(bt_symbs);\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
Enhance get back trace of tools::exception to display clearly the called functions.
8,483
28.11.2017 15:47:25
-3,600
c024589f45e674c873b461ea51234f1b732327e3
Enhance even more the tools::exception; Create a system_functions.hpp with backtrace, addr2line and runSystemCommand functions; Call addr2line only when displaying exceptions to not have performance loss; addr2line can be disabled with flag -DNDEBUG for release because it works only with in debug with -g flag; Bug in addr2line, lines does not match always
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "#include \"Tools/general_utils.h\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/system_functions.hpp\"\n#include \"Factory/Module/Source/Source.hpp\"\n#include \"Factory/Module/CRC/CRC.hpp\"\n@@ -179,7 +180,7 @@ void Launcher::launch()\n}\ncatch (std::exception const& e)\n{\n- std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "#include \"Tools/general_utils.h\"\n#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/system_functions.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Display/Statistics/Statistics.hpp\"\n#include \"Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n@@ -221,7 +222,7 @@ void BFER<B,R,Q>\ncatch (std::exception const& e)\n{\nmodule::Monitor::stop();\n- std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\nsimu_error = true;\n}\n@@ -316,10 +317,11 @@ void BFER<B,R,Q>\nmodule::Monitor::stop();\nsimu->mutex_exception.lock();\n- if (simu->prev_err_message != e.what())\n+\n+ if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n{\n- std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n- simu->prev_err_message = e.what();\n+ std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ simu->prev_err_messages.push_back(e.what());\n}\nsimu->mutex_exception.unlock();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.hpp", "new_path": "src/Simulation/BFER/BFER.hpp", "diff": "@@ -31,7 +31,7 @@ private:\nprotected:\nstd::mutex mutex_exception;\n- std::string prev_err_message;\n+ std::vector<std::string> prev_err_messages;\n// a barrier to synchronize the threads\ntools::Barrier barrier;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "diff": "@@ -53,8 +53,8 @@ void BFER_ite_threads<B,R,Q>\nfor (auto tid = 1; tid < this->params.n_threads; tid++)\nthreads[tid -1].join();\n- if (!this->prev_err_message.empty())\n- throw std::runtime_error(this->prev_err_message);\n+ if (!this->prev_err_messages.empty())\n+ throw std::runtime_error(this->prev_err_messages.back());\n}\ntemplate <typename B, typename R, typename Q>\n@@ -71,9 +71,9 @@ void BFER_ite_threads<B,R,Q>\nmodule::Monitor::stop();\nsimu->mutex_exception.lock();\n- if (simu->prev_err_message != e.what())\n- if (std::strlen(e.what()) > simu->prev_err_message.size())\n- simu->prev_err_message = e.what();\n+ if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n+ if (simu->prev_err_messages.size() && std::strlen(e.what()) > simu->prev_err_messages.back().size())\n+ simu->prev_err_messages.push_back(e.what());\nsimu->mutex_exception.unlock();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "diff": "@@ -53,8 +53,8 @@ void BFER_std_threads<B,R,Q>\nfor (auto tid = 1; tid < this->params.n_threads; tid++)\nthreads[tid -1].join();\n- if (!this->prev_err_message.empty())\n- throw std::runtime_error(this->prev_err_message);\n+ if (!this->prev_err_messages.empty())\n+ throw std::runtime_error(this->prev_err_messages.back());\n}\ntemplate <typename B, typename R, typename Q>\n@@ -71,9 +71,9 @@ void BFER_std_threads<B,R,Q>\nmodule::Monitor::stop();\nsimu->mutex_exception.lock();\n- if (simu->prev_err_message != e.what())\n- if (std::strlen(e.what()) > simu->prev_err_message.size())\n- simu->prev_err_message = e.what();\n+ if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n+ if (simu->prev_err_messages.size() && std::strlen(e.what()) > simu->prev_err_messages.back().size())\n+ simu->prev_err_messages.push_back(e.what());\nsimu->mutex_exception.unlock();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Exception/exception.cpp", "new_path": "src/Tools/Exception/exception.cpp", "diff": "#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n-#include <execinfo.h> // backtrace, backtrace_symbols\n-#include <cxxabi.h> // __cxa_demangle\n#include <unistd.h>\n#include <cstdlib>\n#include <iostream>\n#endif\n#include \"exception.hpp\"\n+#include \"Tools/system_functions.hpp\"\n#define ENABLE_BACK_TRACE\n@@ -22,7 +21,7 @@ exception\n: message(message)\n{\n#if defined(ENABLE_BACK_TRACE)\n- this->message += get_back_trace();\n+ this->message += get_back_trace(3);\n#endif\n}\n@@ -42,7 +41,7 @@ exception\nthis->message += \"\\\"\" + message + \"\\\"\";\n#if defined(ENABLE_BACK_TRACE)\n- this->message += get_back_trace();\n+ this->message += get_back_trace(3);\n#endif\n}\n@@ -56,77 +55,3 @@ const char* exception\n{\nreturn message.c_str();\n}\n\\ No newline at end of file\n-std::string exception\n-::get_back_trace()\n-{\n- std::string bt_str;\n-#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n- const int bt_max_depth = 32;\n- void *bt_array[bt_max_depth];\n-\n- size_t size = backtrace(bt_array, bt_max_depth);\n- char** bt_symbs = backtrace_symbols(bt_array, size);\n-\n- bt_str += \"\\nBacktrace:\";\n- for (size_t i = 3; i < size; i++)\n- {\n- std::string symbol = bt_symbs[i];\n-\n- auto pos_beg_func = symbol.find('(');\n- auto pos_off = symbol.find('+');\n- auto pos_end_func = symbol.find(')');\n- auto pos_beg_addr = symbol.find('[');\n- auto pos_end_addr = symbol.find(']');\n-\n- if ( (pos_beg_func != std::string::npos)\n- && (pos_off != std::string::npos)\n- && (pos_end_func != std::string::npos)\n- && (pos_beg_addr != std::string::npos)\n- && (pos_end_addr != std::string::npos))\n- {\n- auto program = symbol.substr(0, pos_beg_func );\n- auto function = symbol.substr(pos_beg_func +1, pos_off - pos_beg_func -1);\n- auto offset = symbol.substr(pos_off, pos_end_func - pos_off );\n- auto address = symbol.substr(pos_beg_addr, pos_end_addr - pos_beg_addr +1);\n-\n- std::string function_name;\n-\n- int status;\n- auto demangled_name = abi::__cxa_demangle(function.data(), NULL, NULL, &status);\n-\n- if (demangled_name != NULL)\n- {\n- function_name = demangled_name;\n- free(demangled_name);\n- }\n- else\n- {\n- function_name = function + \"()\";\n- }\n-\n- if ( status == 0 // good\n- || status == -2) // mangled_name is not a valid name under the C++ ABI mangling rules.\n- {\n- bt_str += \"\\n\" + program + \": \" + function_name + \" \" + offset + \" \" + address;\n- }\n- else // error\n- {\n- if (status == -3) // One of the arguments is invalid.\n- {\n- std::cerr << \"Invalid abi::__cxa_demangle argument(s).\" << std::endl;\n- std::exit(EXIT_FAILURE);\n- }\n-\n- if (status == -1) // A memory allocation failiure occurred.\n- {\n- std::cerr << \"Memory allocation error in abi::__cxa_demangle.\" << std::endl;\n- std::exit(EXIT_FAILURE);\n- }\n- }\n- }\n- }\n- free(bt_symbs);\n-#endif\n-\n- return bt_str;\n-}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Exception/exception.hpp", "new_path": "src/Tools/Exception/exception.hpp", "diff": "@@ -26,9 +26,6 @@ public:\nvirtual ~exception() throw();\nvirtual const char* what() const throw();\n-\n-private:\n- static std::string get_back_trace();\n};\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/system_functions.cpp", "diff": "+#include <execinfo.h> // backtrace, backtrace_symbols\n+#include <cxxabi.h> // __cxa_demangle\n+#include <stdio.h>\n+#include <stdlib.h>\n+#include <vector>\n+#include <iostream>\n+\n+\n+#include \"system_functions.hpp\"\n+\n+std::string aff3ct::tools::get_back_trace(int first_call)\n+{\n+ std::string bt_str;\n+\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n+ const int bt_max_depth = 32;\n+ void *bt_array[bt_max_depth];\n+\n+ size_t size = backtrace(bt_array, bt_max_depth);\n+ char** bt_symbs = backtrace_symbols(bt_array, size);\n+\n+\n+ bt_str += \"\\nBacktrace:\";\n+ for (size_t i = first_call; i < size; i++)\n+ {\n+ std::string symbol = bt_symbs[i];\n+\n+ auto pos_beg_func = symbol.find('(' );\n+ auto pos_off = symbol.find('+', pos_beg_func);\n+ auto pos_end_func = symbol.find(')', pos_off );\n+ auto pos_beg_addr = symbol.find('[', pos_end_func);\n+ auto pos_end_addr = symbol.find(']', pos_beg_addr);\n+\n+ if ( (pos_beg_func != std::string::npos)\n+ && (pos_off != std::string::npos)\n+ && (pos_end_func != std::string::npos)\n+ && (pos_beg_addr != std::string::npos)\n+ && (pos_end_addr != std::string::npos))\n+ {\n+ auto program = symbol.substr(0, pos_beg_func );\n+ auto function = symbol.substr(pos_beg_func +1, pos_off - pos_beg_func -1);\n+ auto offset = symbol.substr(pos_off, pos_end_func - pos_off );\n+ auto address = symbol.substr(pos_beg_addr, pos_end_addr - pos_beg_addr +1);\n+\n+ std::string function_name;\n+\n+ int status;\n+ auto demangled_name = abi::__cxa_demangle(function.data(), NULL, NULL, &status);\n+\n+ if (demangled_name != NULL)\n+ {\n+ function_name = demangled_name;\n+ free(demangled_name);\n+ }\n+ else\n+ {\n+ function_name = function + \"()\";\n+ }\n+\n+ bt_str += \"\\n\" + program + \": \" + function_name + \" \" + offset + \" \" + address;\n+\n+ if ( status == 0 // good\n+ || status == -2) // mangled_name is not a valid name under the C++ ABI mangling rules.\n+ {} // does nothing more\n+ else if (status == -3) // One of the arguments is invalid.\n+ bt_str += \" !! Error: Invalid abi::__cxa_demangle argument(s) !!\";\n+ else if (status == -1) // A memory allocation failiure occurred.\n+ bt_str += \" !! Error: Memory allocation error in abi::__cxa_demangle !!\";\n+ }\n+ }\n+ free(bt_symbs);\n+#endif\n+\n+ return bt_str;\n+}\n+\n+std::string aff3ct::tools::runSystemCommand(std::string cmd)\n+{\n+ std::string data;\n+ FILE * stream;\n+\n+ const int max_buffer = 256;\n+ char buffer[max_buffer];\n+ cmd.append(\" 2>&1\");\n+\n+ stream = popen(cmd.c_str(), \"r\");\n+\n+ if (stream)\n+ {\n+ while (!feof(stream))\n+ if (fgets(buffer, max_buffer, stream) != NULL)\n+ data.append(buffer);\n+\n+ pclose(stream);\n+ }\n+\n+ return data;\n+}\n+\n+std::string aff3ct::tools::addr2line(const std::string& backtrace)\n+{\n+\n+#ifdef DNDEBUG\n+ return backtrace;\n+#else\n+ // TODO : Bug lines does not always match. Especially with the main function maybe because\n+ // of precompiler instructions (#ifdef) ?\n+\n+ std::string bt_str;\n+ // first separate the backtrace to find back the stack\n+ std::vector<std::string> stack;\n+ size_t pos = 0;\n+\n+ while (true)\n+ {\n+ size_t found_pos = backtrace.find('\\n', pos);\n+\n+ if (found_pos == std::string::npos)\n+ {\n+ stack.push_back(backtrace.substr(pos));\n+ break;\n+ }\n+ else\n+ stack.push_back(backtrace.substr(pos, found_pos -pos));\n+\n+ pos = found_pos +1;\n+ }\n+\n+ // parse each line to transform them and fill bt_str\n+ for (unsigned i = 0; i < stack.size(); ++i)\n+ {\n+ auto pos_beg_func = stack[i].find(':' );\n+ auto pos_off = stack[i].find('+', pos_beg_func);\n+ auto pos_beg_addr = stack[i].find('[', pos_off);\n+ auto pos_end_addr = stack[i].find(']', pos_beg_addr);\n+\n+ if ( (pos_beg_func != std::string::npos)\n+ && (pos_off != std::string::npos)\n+ && (pos_beg_addr != std::string::npos)\n+ && (pos_end_addr != std::string::npos))\n+ {\n+ auto program = stack[i].substr(0, pos_beg_func );\n+ auto function = stack[i].substr(pos_beg_func, pos_off - pos_beg_func );\n+ auto address = stack[i].substr(pos_beg_addr +1, pos_end_addr - pos_beg_addr -1);\n+\n+ std::string cmd = \"addr2line -e \" + program + \" \" + address;\n+ std::string filename_and_line = runSystemCommand(cmd);\n+ filename_and_line = filename_and_line.substr(0, filename_and_line.size() -1); // remove the '\\n'\n+\n+ bt_str += program + function + \" [\" + filename_and_line + \"]\";\n+ }\n+ else\n+ {\n+ bt_str += stack[i];\n+ }\n+\n+ if (i < (stack.size()-1))\n+ bt_str += '\\n';\n+ }\n+\n+ return bt_str;\n+\n+#endif\n+}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/system_functions.hpp", "diff": "+#ifndef SYSTEM_FUNCTIONS_H_\n+#define SYSTEM_FUNCTIONS_H_\n+\n+#include <string>\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+/*!\n+ * \\brief Get the back trace in the stack.\n+ *\n+ * \\param first_call: number of ignored called functions in the stack (1 means ignore call of this function)\n+ * \\return a string with the back trace with one function per line\n+ */\n+std::string get_back_trace(int first_call = 1);\n+\n+/*!\n+ * \\brief run the given system command (this function add \"2>&1\" at the end of the command)\n+ *\n+ * \\param cmd is the command to run on the system\n+ * \\return the standard and error output mixed\n+ */\n+std::string runSystemCommand(std::string cmd);\n+\n+/*!\n+ * \\brief transform in the backtrace the addresses into function name and line index\n+ *\n+ * \\param backtrace is the backtrace got with get_back_trace(int)\n+ * \\return the backtrace with function name and line index\n+ */\n+std::string addr2line(const std::string& backtrace);\n+\n+}\n+}\n+\n+#endif // SYSTEM_FUNCTIONS_H_\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/main.cpp", "new_path": "src/main.cpp", "diff": "#include \"Tools/version.h\"\n#include \"Tools/Arguments_reader.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/system_functions.hpp\"\n#include \"Launcher/Launcher.hpp\"\n#include \"Factory/Launcher/Launcher.hpp\"\n@@ -150,7 +151,7 @@ int sc_main(int argc, char **argv)\n}\ncatch(std::exception const& e)\n{\n- std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n}\n#ifdef ENABLE_MPI\n" } ]
C++
MIT License
aff3ct/aff3ct
Enhance even more the tools::exception; Create a system_functions.hpp with backtrace, addr2line and runSystemCommand functions; Call addr2line only when displaying exceptions to not have performance loss; addr2line can be disabled with flag -DNDEBUG for release because it works only with in debug with -g flag; Bug in addr2line, lines does not match always
8,483
28.11.2017 15:53:23
-3,600
d97689b499090f7193cced195c8fe2f18bd4e8b8
Add a catch where to apply the addr2line function
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -163,7 +163,7 @@ void Launcher::launch()\n}\ncatch (std::exception const& e)\n{\n- std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n}\nif (simu != nullptr)\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a catch where to apply the addr2line function
8,483
01.12.2017 14:41:06
-3,600
bd869fcd09b9b6e9f7b05d0b80fa37960c8aabb7
Test before the division if the denominator is null or not instead of after.
[ { "change_type": "MODIFY", "old_path": "src/Module/Channel/User/Channel_user.cpp", "new_path": "src/Module/Channel/User/Channel_user.cpp", "diff": "@@ -32,8 +32,6 @@ Channel_user<R>\nfile.clear(); // since ignore will have set eof.\nfile.seekg(8, std::ios_base::beg);\n- const unsigned sizeof_float = (unsigned)length / (n_fra * fra_size);\n-\nif (n_fra <= 0 || fra_size <= 0)\n{\nstd::stringstream message;\n@@ -42,6 +40,8 @@ Channel_user<R>\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n+ const unsigned sizeof_float = (unsigned)length / (n_fra * fra_size);\n+\nthis->noise_buff.resize(n_fra);\nfor (unsigned i = 0; i < (unsigned)n_fra; i++)\nthis->noise_buff[i].resize(fra_size);\n" } ]
C++
MIT License
aff3ct/aff3ct
Test before the division if the denominator is null or not instead of after.
8,483
04.12.2017 10:37:15
-3,600
c2e783d6ba68f0915913494886b4199ea07cd542
Deactivate #include call when not on linux or apple; Change call function to run a system command on windows
[ { "change_type": "MODIFY", "old_path": "src/Tools/system_functions.cpp", "new_path": "src/Tools/system_functions.cpp", "diff": "+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n#include <execinfo.h> // backtrace, backtrace_symbols\n#include <cxxabi.h> // __cxa_demangle\n+#endif\n+\n#include <stdio.h>\n#include <stdlib.h>\n#include <vector>\n#include <iostream>\n-\n+#include <string>\n+#include <stdexcept>\n#include \"system_functions.hpp\"\n@@ -83,7 +87,11 @@ std::string aff3ct::tools::runSystemCommand(std::string cmd)\nchar buffer[max_buffer];\ncmd.append(\" 2>&1\");\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\nstream = popen(cmd.c_str(), \"r\");\n+#elif defined(_WIN64) || defined(_WIN32)\n+ stream = _popen(cmd.c_str(), \"r\");\n+#endif\nif (stream)\n{\n@@ -91,20 +99,24 @@ std::string aff3ct::tools::runSystemCommand(std::string cmd)\nif (fgets(buffer, max_buffer, stream) != NULL)\ndata.append(buffer);\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\npclose(stream);\n+#elif defined(_WIN64) || defined(_WIN32)\n+ _pclose(stream);\n+#endif\n}\n+ else\n+ throw std::runtime_error(\"runSystemCommand error: Couldn't open the pipe to run system command.\");\nreturn data;\n}\nstd::string aff3ct::tools::addr2line(const std::string& backtrace)\n{\n-\n#ifdef DNDEBUG\nreturn backtrace;\n-#else\n- // TODO : Bug lines does not always match. Especially with the main function maybe because\n- // of precompiler instructions (#ifdef) ?\n+#elif (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n+ // TODO Bug: lines does not always match with the real line where are called the functions.\nstd::string bt_str;\n// first separate the backtrace to find back the stack\n@@ -160,5 +172,8 @@ std::string aff3ct::tools::addr2line(const std::string& backtrace)\nreturn bt_str;\n+#else\n+ return backtrace;\n+\n#endif\n}\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Deactivate #include call when not on linux or apple; Change call function to run a system command on windows
8,481
07.11.2017 10:33:40
-3,600
ffcb21b6f219b85ac82aa24d72587bd08656a49c
Add QC_matrix functions (load, expand and invert_H2)
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/LDPC/QC_matrix/QC_matrix.cpp", "diff": "+#include <Tools/Code/LDPC/QC_matrix/QC_matrix.hpp>\n+#include <string>\n+#include <sstream>\n+#include \"Tools/Code/LDPC/AList/AList.hpp\"\n+\n+#include \"Tools/Exception/exception.hpp\"\n+\n+\n+using namespace aff3ct::tools;\n+\n+std::vector<std::string> QC_matrix::split(const std::string &s)\n+{\n+ std::string buf; // have a buffer string\n+ std::stringstream ss(s); // insert the string into a stream\n+ std::vector<std::string> tokens; // create vector to hold our words\n+\n+ while (ss >> buf)\n+ tokens.push_back(buf);\n+\n+ return tokens;\n+}\n+\n+void QC_matrix::getline(std::istream &file, std::string &line)\n+{\n+ if (file.eof() || file.fail() || file.bad())\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"Something went wrong when getting a new line.\");\n+\n+ while (std::getline(file, line))\n+ if (line[0] != '#' && !std::all_of(line.begin(),line.end(),isspace))\n+ break;\n+}\n+\n+QC_matrix\n+::QC_matrix(const unsigned Nred, const unsigned Mred)\n+: Hred(Mred, mipp::vector<int16_t>(Nred, -1)),\n+ pctPattern(Nred, true),\n+ Z(0)\n+{\n+}\n+\n+QC_matrix\n+::~QC_matrix()\n+{\n+}\n+\n+Sparse_matrix QC_matrix::\n+expand_QC()\n+{\n+ unsigned Nred = (unsigned)this->Hred.size();\n+ unsigned Mred = (unsigned)this->Hred.front().size();\n+\n+ unsigned N = Nred * this->Z;\n+ unsigned M = Mred * this->Z;\n+\n+ Sparse_matrix H(N, M);\n+\n+ for (unsigned i = 0; i < Nred; i++)\n+ {\n+ for (unsigned j = 0; j < Mred; j++)\n+ {\n+ auto value = this->Hred[i][j];\n+\n+ unsigned idxLgn = i * this->Z;\n+ unsigned idxCol = j * this->Z;\n+\n+ switch (value)\n+ {\n+ case -1:\n+ break;\n+\n+ case 0:\n+ for (unsigned k = 0; k < this->Z; k++)\n+ H.add_connection(idxLgn + k, idxCol + k);\n+ break;\n+\n+ default:\n+ for (unsigned k = 0; k < this->Z; k++)\n+ H.add_connection(idxLgn + k, (unsigned)(idxCol + (k + value) % this->Z));\n+ break;\n+ }\n+ }\n+ }\n+ return H.transpose();\n+}\n+\n+std::vector<bool> QC_matrix::\n+get_pct_pattern() const\n+{\n+ return this->pctPattern;\n+}\n+\n+QC_matrix QC_matrix\n+::load(std::istream &stream)\n+{\n+ std::string line;\n+\n+ getline(stream, line);\n+ auto values = split(line);\n+ if (values.size() < 3)\n+ {\n+ std::stringstream message;\n+ message << \"'values.size()' has to be greater than 2 ('values.size()' = \" << values.size() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ unsigned Nred = 0, Mred = 0, Z = 0;\n+\n+ Nred = std::stoi(values[0]);\n+ Mred = std::stoi(values[1]);\n+ Z = std::stoi(values[2]);\n+\n+ if (Nred <= 0 || Mred <= 0 || Z <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'Nred', 'Mred' and 'Z' have to be greater than 0 ('Nred' = \" << Nred\n+ << \", 'Mred' = \" << Mred << \", 'Z' = \" << Z << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ QC_matrix matrix(Nred, Mred);\n+ matrix.Z = Z;\n+\n+ for (unsigned i = 0; i < Mred; i++)\n+ {\n+ getline(stream, line);\n+ values = split(line);\n+\n+ if (values.size() < Nred)\n+ {\n+ std::stringstream message;\n+ message << \"'values.size()' has to be greater or equal to 'Nred' ('values.size()' = \"\n+ << values.size() << \", 'i' = \" << i << \", 'Nred' = \" << Nred << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (unsigned j = 0; j < Nred; j++)\n+ {\n+ auto col_value = (j < values.size()) ? std::stoi(values[j]) : -1;\n+ matrix.Hred[i][j] = col_value;\n+ }\n+ }\n+\n+ //Try to get puncture pattern\n+ try\n+ {\n+ getline(stream, line);\n+ values = split(line);\n+ if (values.size() < Nred)\n+ {\n+ std::stringstream message;\n+ message << \"'values.size()' has to be greater or equal to 'Nred' ('values.size()' = \" << values.size() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (unsigned j = 0; j < Nred; j++)\n+ {\n+ auto col_value = (j < values.size()) ? std::stoi(values[j]) : 1;\n+ matrix.pctPattern[j] = col_value;\n+ }\n+ }\n+ catch (std::exception const&)\n+ {\n+ }\n+\n+ return matrix;\n+}\n+\n+QC_matrix::QCFull_matrix QC_matrix\n+::invert_H2(const Sparse_matrix& _H)\n+{\n+ Sparse_matrix H;\n+ if (_H.get_n_rows() > _H.get_n_cols())\n+ H = _H.transpose();\n+ else\n+ H = _H;\n+\n+ unsigned M = H.get_n_rows();\n+ unsigned N = H.get_n_cols();\n+ unsigned K = N - M;\n+\n+ QC_matrix::QCFull_matrix MatriceCalcul;\n+ MatriceCalcul.clear();\n+ MatriceCalcul.resize(M, mipp::vector<int8_t>(2 * M, 0));\n+\n+ //Copy H2 on left\n+ for (unsigned i = 0; i < M; i++)\n+ for (unsigned j = 0; j < H.get_cols_from_row(i).size(); j++)\n+ if (H.get_cols_from_row(i)[j] >= K)\n+ MatriceCalcul[i][H.get_cols_from_row(i)[j] - K] = 1;\n+\n+ //Create identity on right\n+ for (unsigned i = 0; i < M; i++)\n+ MatriceCalcul[i][M + i] = 1;\n+\n+ //Pivot de Gauss (Forward)\n+ for (unsigned indLgn = 0; indLgn < M; indLgn++)\n+ {\n+ if (MatriceCalcul[indLgn][indLgn] == 0)\n+ {\n+ unsigned indLgnSwap = 0;\n+ for (unsigned indLgn2 = indLgn + 1; indLgn2 < M; indLgn2++)\n+ {\n+ if (MatriceCalcul[indLgn2][indLgn] != 0)\n+ {\n+ indLgnSwap = indLgn2;\n+ break;\n+ }\n+ }\n+ if (indLgnSwap == 0)\n+ {\n+ std::stringstream message;\n+ message << \"Matrix H2 (H = [H1 H2]) is not invertible\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ std::swap(MatriceCalcul[indLgn], MatriceCalcul[indLgnSwap]);\n+ }\n+\n+ //XOR des lignes\n+ for (unsigned indLgn2 = indLgn + 1; indLgn2 < M; indLgn2++)\n+ {\n+ if (MatriceCalcul[indLgn2][indLgn] != 0)\n+ {\n+ const auto loop_size1 = (unsigned)(2 * M / mipp::nElReg<int8_t>());\n+ for (unsigned i = 0; i < loop_size1; i++)\n+ {\n+ const auto rLgn = mipp::Reg<int8_t>(&MatriceCalcul[indLgn][i * mipp::nElReg<int8_t>()]);\n+ const auto rLgn2 = mipp::Reg<int8_t>(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ auto rLgn3 = rLgn2 ^ rLgn;\n+ rLgn3.store(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ }\n+ for (unsigned i = loop_size1 * mipp::nElReg<int8_t>(); i < 2 * M; i++)\n+ MatriceCalcul[indLgn2][i] = MatriceCalcul[indLgn2][i] ^ MatriceCalcul[indLgn][i];\n+ }\n+ }\n+ }\n+\n+ //Pivot de Gauss (Backward)\n+ for (unsigned indLgn = M - 1; indLgn > 0; indLgn--)\n+ {\n+ //XOR des lignes\n+ for (unsigned indLgn2 = indLgn - 1; indLgn2 > 0; indLgn2--)\n+ {\n+ if (MatriceCalcul[indLgn2][indLgn] != 0)\n+ {\n+ const auto loop_size1 = (unsigned)(2 * M / mipp::nElReg<int8_t>());\n+ for (unsigned i = 0; i < loop_size1; i++)\n+ {\n+ const auto rLgn = mipp::Reg<int8_t>(&MatriceCalcul[indLgn][i * mipp::nElReg<int8_t>()]);\n+ const auto rLgn2 = mipp::Reg<int8_t>(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ auto rLgn3 = rLgn2 ^ rLgn;\n+ rLgn3.store(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ }\n+ for (unsigned i = loop_size1 * mipp::nElReg<int8_t>(); i < 2 * M; i++)\n+ MatriceCalcul[indLgn2][i] = MatriceCalcul[indLgn2][i] ^ MatriceCalcul[indLgn][i];\n+ }\n+ }\n+ }\n+\n+ QC_matrix::QCFull_matrix invH2;\n+ invH2.clear();\n+ invH2.resize(M, mipp::vector<int8_t>(M, 0));\n+\n+ for (unsigned i = 0; i < M; i++)\n+ for (unsigned j = 0; j < M; j++)\n+ invH2[i][j] = MatriceCalcul[i][M + j];\n+\n+ MatriceCalcul.clear();\n+\n+ return invH2;\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/LDPC/QC_matrix/QC_matrix.hpp", "diff": "+#ifndef QC_MATRIX_HPP_\n+#define QC_MATRIX_HPP_\n+\n+#include <iostream>\n+#include <vector>\n+#include <algorithm>\n+#include <mipp.h>\n+#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\n+\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+struct QC_matrix\n+{\n+public:\n+ using QCFull_matrix = std::vector<mipp::vector<int8_t>>;\n+\n+ QC_matrix(const unsigned n_rows = 0, const unsigned n_cols = 1);\n+ virtual ~QC_matrix();\n+\n+ Sparse_matrix expand_QC();\n+ std::vector<bool> get_pct_pattern() const;\n+\n+ static QC_matrix load(std::istream &stream);\n+\n+ /*\n+ * inverse H2 (H = [H1 H2] with size(H2) = M x M) to allow encoding with p = H1 x inv(H2) x u\n+ */\n+ static QCFull_matrix invert_H2(const Sparse_matrix& H);\n+\n+private:\n+ std::vector<mipp::vector<int16_t>> Hred;\n+ std::vector<bool> pctPattern;\n+ unsigned Z;\n+\n+ static std::vector<std::string> split(const std::string &s);\n+ static void getline(std::istream &file, std::string &line);\n+\n+};\n+}\n+}\n+\n+#endif /* QC_MATRIX_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add QC_matrix functions (load, expand and invert_H2) Signed-off-by: Adrien Cassagne <adrien.cassagne@inria.fr>
8,481
07.11.2017 10:40:17
-3,600
4438808d0a9764210b43e36c25ba84e91627ca7f
Add LDPC Puncturer
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -11,6 +11,7 @@ Codec_LDPC::parameters\n: Codec ::parameters(Codec_LDPC::name, prefix),\nCodec_SISO_SIHO::parameters(Codec_LDPC::name, prefix),\nenc(new Encoder_LDPC::parameters(\"enc\")),\n+ pct(new Puncturer_LDPC::parameters(\"pct\")),\ndec(new Decoder_LDPC::parameters(\"dec\"))\n{\nCodec::parameters::enc = enc;\n@@ -21,6 +22,7 @@ Codec_LDPC::parameters\n::~parameters()\n{\nif (enc != nullptr) { delete enc; enc = nullptr; }\n+ if (pct != nullptr) { delete pct; pct = nullptr; }\nif (dec != nullptr) { delete dec; dec = nullptr; }\nCodec::parameters::enc = nullptr;\n@@ -33,6 +35,7 @@ Codec_LDPC::parameters* Codec_LDPC::parameters\nauto clone = new Codec_LDPC::parameters(*this);\nif (enc != nullptr) { clone->enc = enc->clone(); }\n+ if (pct != nullptr) { clone->pct = pct->clone(); }\nif (dec != nullptr) { clone->dec = dec->clone(); }\nclone->set_enc(clone->enc);\n@@ -47,12 +50,17 @@ void Codec_LDPC::parameters\nCodec_SISO_SIHO::parameters::get_description(req_args, opt_args);\nenc->get_description(req_args, opt_args);\n+ pct->get_description(req_args, opt_args);\ndec->get_description(req_args, opt_args);\nauto penc = enc->get_prefix();\n+ auto ppct = pct->get_prefix();\nauto pdec = dec->get_prefix();\nopt_args.erase({penc+\"-h-path\" });\n+ req_args.erase({ppct+\"-info-bits\", \"K\" });\n+ opt_args.erase({ppct+\"-fra\", \"F\" });\n+ req_args.erase({ppct+\"-cw-size\", \"N_cw\"});\nreq_args.erase({pdec+\"-cw-size\", \"N\" });\nreq_args.erase({pdec+\"-info-bits\", \"K\" });\nopt_args.erase({pdec+\"-fra\", \"F\" });\n@@ -65,6 +73,13 @@ void Codec_LDPC::parameters\nenc->store(vals);\n+ this->pct->K = this->enc->K;\n+ this->pct->n_frames = this->enc->n_frames;\n+\n+ pct->store(vals);\n+\n+ this->pct->N_cw = this->enc->N_cw;\n+\nthis->dec->K = this->enc->K;\nthis->dec->N_cw = this->enc->N_cw;\nthis->dec->n_frames = this->enc->n_frames;\n@@ -75,7 +90,7 @@ void Codec_LDPC::parameters\nthis->K = this->enc->K;\nthis->N_cw = this->enc->N_cw;\n- this->N = this->enc->N_cw;\n+ this->N = this->pct->N;\n}\nvoid Codec_LDPC::parameters\n@@ -84,6 +99,7 @@ void Codec_LDPC::parameters\nCodec_SISO_SIHO::parameters::get_headers(headers, full);\nenc->get_headers(headers, full);\n+ pct->get_headers(headers, full);\ndec->get_headers(headers, full);\n}\n@@ -91,7 +107,7 @@ template <typename B, typename Q>\nmodule::Codec_LDPC<B,Q>* Codec_LDPC::parameters\n::build(module::CRC<B>* crc) const\n{\n- return new module::Codec_LDPC<B,Q>(*enc, *dec);\n+ return new module::Codec_LDPC<B,Q>(*enc, *dec, *pct);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.hpp", "new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.hpp", "diff": "#include <cmath>\n#include \"Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n+#include \"Factory/Module/Puncturer/LDPC/Puncturer_LDPC.hpp\"\n#include \"Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp\"\n#include \"Module/Codec/LDPC/Codec_LDPC.hpp\"\n@@ -26,6 +27,7 @@ struct Codec_LDPC : public Codec_SISO_SIHO\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// depending parameters\nEncoder_LDPC::parameters *enc;\n+ Puncturer_LDPC::parameters *pct;\nDecoder_LDPC::parameters *dec;\n// ---------------------------------------------------------------------------------------------------- METHODS\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.cpp", "diff": "+#include \"Tools/general_utils.h\"\n+#include \"Tools/Exception/exception.hpp\"\n+\n+#include \"Module/Puncturer/NO/Puncturer_NO.hpp\"\n+#include \"Module/Puncturer/LDPC/Puncturer_LDPC.hpp\"\n+\n+#include \"Puncturer_LDPC.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::factory;\n+\n+const std::string aff3ct::factory::Puncturer_LDPC::name = \"Puncturer LDPC\";\n+const std::string aff3ct::factory::Puncturer_LDPC::prefix = \"pct\";\n+\n+Puncturer_LDPC::parameters\n+::parameters(const std::string prefix)\n+: Puncturer::parameters(Puncturer_LDPC::name, prefix)\n+{\n+ this->type = \"LDPC\";\n+}\n+\n+Puncturer_LDPC::parameters\n+::~parameters()\n+{\n+}\n+\n+Puncturer_LDPC::parameters* Puncturer_LDPC::parameters\n+::clone() const\n+{\n+ return new Puncturer_LDPC::parameters(*this);\n+}\n+\n+void Puncturer_LDPC::parameters\n+::get_description(arg_map &req_args, arg_map &opt_args) const\n+{\n+ Puncturer::parameters::get_description(req_args, opt_args);\n+\n+ auto p = this->get_prefix();\n+\n+ req_args[{p+\"-cw-size\", \"N_cw\"}] =\n+ {\"positive_int\",\n+ \"the codeword size.\"};\n+\n+ opt_args[{p+\"-type\"}][2] += \", LDPC\";\n+\n+ opt_args[{p+\"-pattern\"}] =\n+ {\"string\",\n+ \"puncturing pattern for the LDPC encoder/decoder (size = N_Code/Z) (ex: \\\"1,1,1,0\\\").\"};\n+}\n+\n+std::vector<bool> generate_punct_vector(const std::string pattern)\n+{\n+\n+ std::vector<std::string> str_array = aff3ct::tools::string_split(pattern, ',');\n+ int N_pattern = (int)str_array.size();\n+\n+ if (N_pattern == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'pattern' shouldn't be null and should be delimited by a comma ('pattern' = \" << pattern\n+ << \", 'str_array.size()' = \" << str_array.size() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ std::vector<bool> pattern_vector(N_pattern, true);\n+\n+ for (auto j = 0; j < N_pattern; j++)\n+ {\n+ char c[2] = {str_array[j][0], '\\0'};\n+ pattern_vector[j] = std::stoi(std::string(c)) ? true : false;\n+ }\n+ return pattern_vector;\n+}\n+\n+void Puncturer_LDPC::parameters\n+::store(const arg_val_map &vals)\n+{\n+ Puncturer::parameters::store(vals);\n+\n+ auto p = this->get_prefix();\n+\n+ std::string strPattern;\n+ if(exist(vals, {p+\"-pattern\"}))\n+ {\n+ strPattern = vals.at({p+\"-pattern\"});\n+ this->pctPattern = generate_punct_vector(strPattern);\n+ }\n+\n+ if(exist(vals, {p+\"-cw-size\", \"N_cw\"})) this->N_cw = std::stoi(vals.at({p+\"-cw-size\", \"N_cw\"}));\n+}\n+\n+void Puncturer_LDPC::parameters\n+::get_headers(std::map<std::string,header_list>& headers, const bool full) const\n+{\n+ Puncturer::parameters::get_headers(headers, full);\n+\n+ auto p = this->get_prefix();\n+\n+ if (this->type != \"NO\")\n+ {\n+ headers[p].push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + std::string(this->pctPattern.begin(),this->pctPattern.end())) + \"}\"));\n+ }\n+}\n+\n+template <typename B, typename Q>\n+module::Puncturer<B,Q>* Puncturer_LDPC::parameters\n+::build() const\n+{\n+ if (this->type == \"LDPC\") return new module::Puncturer_LDPC<B,Q>(this->K, this->N, this->N_cw, this->pctPattern, this->n_frames);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+template <typename B, typename Q>\n+module::Puncturer<B,Q>* Puncturer_LDPC\n+::build(const parameters &params)\n+{\n+ return params.template build<B,Q>();\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Puncturer<B_8 ,Q_8 >* aff3ct::factory::Puncturer_LDPC::parameters::build<B_8 ,Q_8 >() const;\n+template aff3ct::module::Puncturer<B_16,Q_16>* aff3ct::factory::Puncturer_LDPC::parameters::build<B_16,Q_16>() const;\n+template aff3ct::module::Puncturer<B_32,Q_32>* aff3ct::factory::Puncturer_LDPC::parameters::build<B_32,Q_32>() const;\n+template aff3ct::module::Puncturer<B_64,Q_64>* aff3ct::factory::Puncturer_LDPC::parameters::build<B_64,Q_64>() const;\n+template aff3ct::module::Puncturer<B_8 ,Q_8 >* aff3ct::factory::Puncturer_LDPC::build<B_8 ,Q_8 >(const aff3ct::factory::Puncturer_LDPC::parameters&);\n+template aff3ct::module::Puncturer<B_16,Q_16>* aff3ct::factory::Puncturer_LDPC::build<B_16,Q_16>(const aff3ct::factory::Puncturer_LDPC::parameters&);\n+template aff3ct::module::Puncturer<B_32,Q_32>* aff3ct::factory::Puncturer_LDPC::build<B_32,Q_32>(const aff3ct::factory::Puncturer_LDPC::parameters&);\n+template aff3ct::module::Puncturer<B_64,Q_64>* aff3ct::factory::Puncturer_LDPC::build<B_64,Q_64>(const aff3ct::factory::Puncturer_LDPC::parameters&);\n+#else\n+template aff3ct::module::Puncturer<B,Q>* aff3ct::factory::Puncturer_LDPC::parameters::build<B,Q>() const;\n+template aff3ct::module::Puncturer<B,Q>* aff3ct::factory::Puncturer_LDPC::build<B,Q>(const aff3ct::factory::Puncturer_LDPC::parameters&);\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.hpp", "diff": "+#ifndef FACTORY_PUNCTURER_LDPC_HPP\n+#define FACTORY_PUNCTURER_LDPC_HPP\n+\n+#include <string>\n+\n+#include \"Module/Puncturer/Puncturer.hpp\"\n+\n+#include \"../Puncturer.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace factory\n+{\n+struct Puncturer_LDPC : public Puncturer\n+{\n+ static const std::string name;\n+ static const std::string prefix;\n+\n+ class parameters : public Puncturer::parameters\n+ {\n+ public:\n+ // ------------------------------------------------------------------------------------------------- PARAMETERS\n+ // optional parameters\n+ std::vector<bool> pctPattern;\n+\n+ // ---------------------------------------------------------------------------------------------------- METHODS\n+ parameters(const std::string p = Puncturer_LDPC::prefix);\n+ virtual ~parameters();\n+ Puncturer_LDPC::parameters* clone() const;\n+\n+ // parameters construction\n+ void get_description(arg_map &req_args, arg_map &opt_args ) const;\n+ void store (const arg_val_map &vals );\n+ void get_headers (std::map<std::string,header_list>& headers, const bool full = true) const;\n+\n+ // builder\n+ template <typename B = int, typename Q = float>\n+ module::Puncturer<B,Q>* build() const;\n+ };\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Puncturer<B,Q>* build(const parameters &params);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_PUNCTURER_LDPC_HPP */\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/LDPC/LDPC.cpp", "new_path": "src/Launcher/Code/LDPC/LDPC.cpp", "diff": "@@ -54,6 +54,7 @@ void LDPC<L,B,R,Q>\nL::store_args();\nparams_cdc->enc->n_frames = this->params.src->n_frames;\n+ params_cdc->pct->n_frames = this->params.src->n_frames;\nparams_cdc->dec->n_frames = this->params.src->n_frames;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "#include \"Module/Decoder/Decoder_SISO_SIHO.hpp\"\n#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n+#include \"Module/Puncturer/LDPC/Puncturer_LDPC.hpp\"\n#include \"Codec_LDPC.hpp\"\n@@ -20,9 +21,10 @@ template <typename B, typename Q>\nCodec_LDPC<B,Q>\n::Codec_LDPC(const factory::Encoder_LDPC::parameters &enc_params,\nconst factory::Decoder_LDPC::parameters &dec_params,\n+ factory::Puncturer_LDPC::parameters &pct_params,\nconst std::string name)\n-: Codec <B,Q>(enc_params.K, enc_params.N_cw, enc_params.N_cw, enc_params.tail_length, enc_params.n_frames, name),\n- Codec_SISO_SIHO<B,Q>(enc_params.K, enc_params.N_cw, enc_params.N_cw, enc_params.tail_length, enc_params.n_frames, name),\n+: Codec <B,Q>(enc_params.K, enc_params.N_cw, pct_params.N, enc_params.tail_length, enc_params.n_frames, name),\n+ Codec_SISO_SIHO<B,Q>(enc_params.K, enc_params.N_cw, pct_params.N, enc_params.tail_length, enc_params.n_frames, name),\ninfo_bits_pos(enc_params.K)\n{\n// ----------------------------------------------------------------------------------------------------- exceptions\n@@ -95,14 +97,14 @@ Codec_LDPC<B,Q>\nfile_H.close();\n// ---------------------------------------------------------------------------------------------------- allocations\n- factory::Puncturer::parameters pct_params;\n- pct_params.type = \"NO\";\n- pct_params.K = enc_params.K;\n- pct_params.N = enc_params.N_cw;\n- pct_params.N_cw = enc_params.N_cw;\n- pct_params.n_frames = enc_params.n_frames;\n-\n+ try\n+ {\n+ this->set_puncturer(factory::Puncturer_LDPC::build<B,Q>(pct_params));\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pct_params));\n+ }\ntry\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.hpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.hpp", "diff": "#include <cstdint>\n#include \"Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n+#include \"Factory/Module/Puncturer/LDPC/Puncturer_LDPC.hpp\"\n#include \"Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp\"\n#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\n@@ -21,10 +22,12 @@ protected:\ntools::Sparse_matrix H;\ntools::Sparse_matrix G;\nstd::vector<uint32_t> info_bits_pos;\n+ std::vector<bool> pctPattern;\npublic:\nCodec_LDPC(const factory::Encoder_LDPC::parameters &enc_params,\nconst factory::Decoder_LDPC::parameters &dec_params,\n+ factory::Puncturer_LDPC::parameters &pct_params,\nconst std::string name = \"Codec_LDPC\");\nvirtual ~Codec_LDPC();\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Puncturer/LDPC/Puncturer_LDPC.cpp", "diff": "+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/general_utils.h\"\n+\n+#include \"Puncturer_LDPC.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B, typename Q>\n+Puncturer_LDPC<B,Q>\n+::Puncturer_LDPC(const int &K,\n+ const int &N,\n+ const int &N_cw,\n+ const std::vector<bool> &pattern,\n+ const int n_frames,\n+ const std::string name)\n+: Puncturer<B,Q>(K, N, N_cw, n_frames, name)\n+{\n+ auto N_pattern = (int)pattern.size();\n+ pattern_bits = pattern;\n+\n+ if (N_pattern == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'pattern' shouldn't be null).\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ Z = (int)(N_cw/N_pattern);\n+ if (Z < 1)\n+ {\n+ std::stringstream message;\n+ message << \"'Z' has to be strictly positive ('Z' = \" << Z << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ auto bit_count = 0; for (auto j = 0; j < N_pattern; j++) bit_count += pattern_bits[j] ? 1 : 0;\n+\n+ if (this->N != Z * bit_count)\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be equal to 'Z' * 'bit_count' ('N' = \" << this->N << \", Z' = \" << Z\n+ << \", 'bit_count' = \" << bit_count << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n+template <typename B, typename Q>\n+Puncturer_LDPC<B,Q>\n+::~Puncturer_LDPC()\n+{\n+}\n+\n+template <typename B, typename Q>\n+void Puncturer_LDPC<B,Q>\n+::_puncture(const B *X_N1, B *X_N2, const int frame_id) const\n+{\n+ auto k = 0;\n+ for (auto i = 0; i < (int)pattern_bits.size(); i++)\n+ if (pattern_bits[i])\n+ {\n+ std::copy_n(X_N1 + (i * this->Z), this->Z, X_N2 + k);\n+ k += Z;\n+ }\n+}\n+\n+template <typename B, typename Q>\n+void Puncturer_LDPC<B,Q>\n+::_depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const\n+{\n+ auto k = 0;\n+ for (auto i = 0; i < (int)pattern_bits.size(); i++)\n+ if (pattern_bits[i])\n+ {\n+ std::copy_n(Y_N1 + k, this->Z, Y_N2 + (i * this->Z));\n+ k += Z;\n+ }\n+ else\n+ std::fill_n(Y_N2 + (i * this->Z), this->Z, (Q)0);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Puncturer_LDPC<B_8,Q_8>;\n+template class aff3ct::module::Puncturer_LDPC<B_16,Q_16>;\n+template class aff3ct::module::Puncturer_LDPC<B_32,Q_32>;\n+template class aff3ct::module::Puncturer_LDPC<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Puncturer_LDPC<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Puncturer/LDPC/Puncturer_LDPC.hpp", "diff": "+#ifndef PUNCTURER_LDPC_HPP_\n+#define PUNCTURER_LDPC_HPP_\n+\n+#include <vector>\n+\n+#include \"../Puncturer.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename Q = float>\n+class Puncturer_LDPC : public Puncturer<B,Q>\n+{\n+protected:\n+ std::vector<bool> pattern_bits;\n+ int Z;\n+\n+public:\n+ Puncturer_LDPC(const int &K,\n+ const int &N,\n+ const int &N_cw,\n+ const std::vector<bool> &pattern,\n+ const int n_frames = 1,\n+ const std::string name = \"Puncturer_LDPC\");\n+ virtual ~Puncturer_LDPC();\n+\n+protected:\n+ void _puncture(const B *X_N1, B *X_N2, const int frame_id) const;\n+ void _depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const;\n+};\n+}\n+}\n+\n+#endif /* PUNCTURER_LDPC_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add LDPC Puncturer Signed-off-by: Adrien Cassagne <adrien.cassagne@inria.fr>
8,481
07.11.2017 10:43:33
-3,600
4f6e1f0a36eb461e5b1c415af759af5e4a31cdd7
Add QC matrix support for LDPC Decoder
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "@@ -43,10 +43,14 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\n- req_args[{p+\"-h-path\"}] =\n+ opt_args[{p+\"-h-path\"}] =\n{\"string\",\n\"path to the H matrix (AList formated file).\"};\n+ opt_args[{p+\"-qc-path\"}] =\n+ {\"string\",\n+ \"path to the QC matrix (QC formated file).\"};\n+\nopt_args[{p+\"-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\nopt_args[{p+\"-implem\"}].push_back(\"ONMS, SPA, LSPA, GALA\");\n@@ -85,6 +89,7 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\nif(exist(vals, {p+\"-h-path\" })) this->H_alist_path = vals.at({p+\"-h-path\" });\n+ if(exist(vals, {p+\"-qc-path\" })) this->QC_matrix_path = vals.at({p+\"-qc-path\" });\nif(exist(vals, {p+\"-ite\", \"i\"})) this->n_ite = std::stoi(vals.at({p+\"-ite\", \"i\"}));\nif(exist(vals, {p+\"-off\" })) this->offset = std::stof(vals.at({p+\"-off\" }));\nif(exist(vals, {p+\"-norm\" })) this->norm_factor = std::stof(vals.at({p+\"-norm\" }));\n@@ -100,7 +105,10 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\n+ if (!this->H_alist_path.empty())\nheaders[p].push_back(std::make_pair(\"H matrix path\", this->H_alist_path));\n+ if (!this->QC_matrix_path.empty())\n+ headers[p].push_back(std::make_pair(\"QC matrix path\", this->QC_matrix_path));\nif (!this->simd_strategy.empty())\nheaders[p].push_back(std::make_pair(\"SIMD strategy\", this->simd_strategy));\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp", "diff": "@@ -25,6 +25,7 @@ struct Decoder_LDPC : public Decoder\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// optional parameters\nstd::string H_alist_path = \"\";\n+ std::string QC_matrix_path = \"\";\nstd::string simd_strategy = \"\";\nfloat norm_factor = 1.f;\nfloat offset = 0.f;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Code/LDPC/AList/AList.hpp\"\n+#include \"Tools/Code/LDPC/QC_matrix/QC_matrix.hpp\"\n#include \"Factory/Module/Puncturer/Puncturer.hpp\"\n@@ -52,6 +53,20 @@ Codec_LDPC<B,Q>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (dec_params.QC_matrix_path.empty() && dec_params.H_alist_path.empty())\n+ {\n+ std::stringstream message;\n+ message << \"'dec_params.QC_matrix_path' or 'dec_params.H_alist_path' has to be set to a matrix file.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (!dec_params.QC_matrix_path.empty() && !dec_params.H_alist_path.empty())\n+ {\n+ std::stringstream message;\n+ message << \"'dec_params.QC_matrix_path' and 'dec_params.H_alist_path' can't be use together.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n// ---------------------------------------------------------------------------------------------------------- tools\nbool is_info_bits_pos = false;\nif (!enc_params.G_alist_path.empty() && enc_params.type == \"LDPC\")\n@@ -72,6 +87,20 @@ Codec_LDPC<B,Q>\nfile_G.close();\n}\n+ if (!dec_params.QC_matrix_path.empty())\n+ {\n+ std::ifstream file_QC(dec_params.QC_matrix_path, std::ifstream::in);\n+ tools::QC_matrix QC = tools::QC_matrix::load(file_QC);\n+ H = QC.expand_QC();\n+ pct_params.pctPattern = QC.get_pct_pattern();\n+\n+ std::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n+\n+ file_QC.close();\n+ }\n+\n+ if (!dec_params.H_alist_path.empty())\n+ {\nstd::ifstream file_H(dec_params.H_alist_path, std::ifstream::in);\nH = tools::AList::read(file_H);\n@@ -95,6 +124,7 @@ Codec_LDPC<B,Q>\n}\nfile_H.close();\n+ }\n// ---------------------------------------------------------------------------------------------------- allocations\ntry\n" } ]
C++
MIT License
aff3ct/aff3ct
Add QC matrix support for LDPC Decoder Signed-off-by: Adrien Cassagne <adrien.cassagne@inria.fr>
8,481
07.11.2017 10:45:05
-3,600
3bbea75460c6ab6bdb08a023eb8dec71956515c4
Add approximate min star LDPC decoder
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "#include \"Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.hpp\"\n+#include \"Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp\"\n#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@@ -53,7 +54,7 @@ void Decoder_LDPC::parameters\nopt_args[{p+\"-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\n- opt_args[{p+\"-implem\"}].push_back(\"ONMS, SPA, LSPA, GALA\");\n+ opt_args[{p+\"-implem\"}].push_back(\"ONMS, SPA, LSPA, GALA, AMS\");\nopt_args[{p+\"-ite\", \"i\"}] =\n{\"positive_int\",\n@@ -137,6 +138,7 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_LDPC::parameters\nif (this->implem == \"ONMS\") return new module::Decoder_LDPC_BP_flooding_ONMS <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->norm_factor, (Q)this->offset, this->enable_syndrome, this->syndrome_depth, this->n_frames);\nelse if (this->implem == \"SPA\" ) return new module::Decoder_LDPC_BP_flooding_SPA <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\nelse if (this->implem == \"LSPA\") return new module::Decoder_LDPC_BP_flooding_LSPA <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n+ else if (this->implem == \"AMS\" ) return new module::Decoder_LDPC_BP_flooding_AMS <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n}\nelse if (this->type == \"BP_LAYERED\" && this->simd_strategy.empty())\n{\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.cpp", "diff": "+#include <limits>\n+#include <sstream>\n+#include <typeinfo>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Math/utils.h\"\n+\n+#include \"Decoder_LDPC_BP_flooding_approximate_min_star.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename R>\n+inline R Correction_linear2(const R x)\n+{\n+ if (x > 2.625)\n+ return (R)0;\n+ else if (x < 1.0)\n+ return -0.3750 * x + 0.6825;\n+ else\n+ return -0.1875 * x + 0.5;\n+}\n+\n+template <typename R>\n+inline R MinStar(const R a, const R b)\n+{\n+ return std::min(a, b) + (R)std::log1p(std::exp(-(a + b))) - (R)std::log1p(std::exp(-std::abs(a - b)));\n+}\n+\n+template <typename R>\n+inline R MinStar_linear2(const R a, const R b)\n+{\n+ return (R)(std::min(a, b) + Correction_linear2(a + b) - Correction_linear2(std::abs(a - b)));\n+}\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\n+::Decoder_LDPC_BP_flooding_approximate_min_star(const int &K, const int &N, const int& n_ite,\n+ const tools::Sparse_matrix &H,\n+ const std::vector<unsigned> &info_bits_pos,\n+ const bool enable_syndrome,\n+ const int syndrome_depth,\n+ const int n_frames,\n+ const std::string name)\n+: Decoder(K, N, n_frames, 1, name),\n+ Decoder_LDPC_BP_flooding<B,R>(K, N, n_ite, H, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name)\n+{\n+ /*if (typeid(R) == typeid(signed char))\n+ {\n+ std::stringstream message;\n+ message << \"This decoder does not work in 8-bit fixed-point (try in 16-bit).\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }*/\n+}\n+\n+template <typename B, typename R>\n+Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\n+::~Decoder_LDPC_BP_flooding_approximate_min_star()\n+{\n+}\n+\n+// normalized offest min-sum implementation\n+template <typename B, typename R>\n+bool Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\n+::BP_process(const R *Y_N, std::vector<R> &V_to_C, std::vector<R> &C_to_V)\n+{\n+ // beginning of the iteration upon all the matrix lines\n+ R *C_to_V_ptr = C_to_V.data();\n+ R *V_to_C_ptr = V_to_C.data();\n+\n+ for (auto i = 0; i < this->n_V_nodes; i++)\n+ {\n+ // VN node accumulate all the incoming messages\n+ const auto length = this->n_parities_per_variable[i];\n+\n+ auto sum_C_to_V = (R)0;\n+ for (auto j = 0; j < length; j++)\n+ sum_C_to_V += C_to_V_ptr[j];\n+\n+ // update the intern values\n+ const auto temp = Y_N[i] + sum_C_to_V;\n+\n+ // generate the outcoming messages to the CNs\n+ for (auto j = 0; j < length; j++)\n+ V_to_C_ptr[j] = temp - C_to_V_ptr[j];\n+\n+ C_to_V_ptr += length; // jump to the next node\n+ V_to_C_ptr += length; // jump to the next node\n+ }\n+\n+ auto syndrome = 0;\n+ auto transpose_ptr = this->transpose.data();\n+\n+ for (auto i = 0; i < this->n_C_nodes; i++)\n+ {\n+ const auto length = this->n_variables_per_parity[i];\n+\n+ auto sign = 0;\n+ auto min = std::numeric_limits<R>::max();\n+ auto deltaMin = std::numeric_limits<R>::max();\n+\n+ // accumulate the incoming information in CN\n+ for (auto j = 0; j < length; j++)\n+ {\n+ const auto value = V_to_C[transpose_ptr[j]];\n+ const auto c_sign = std::signbit((float)value) ? -1 : 0;\n+ const auto v_abs = (R)std::abs(value);\n+ const auto v_temp = min;\n+\n+ sign ^= c_sign;\n+ min = std::min(min, v_abs);\n+ deltaMin = MinStar_linear2(deltaMin, (v_abs == min) ? v_temp : v_abs);\n+ }\n+\n+ auto delta = MinStar_linear2(deltaMin, min);\n+ delta = (delta < 0) ? 0 : delta;\n+ deltaMin = (deltaMin < 0) ? 0 : deltaMin;\n+\n+ // regenerate the CN outcoming values\n+ for (auto j = 0; j < length; j++)\n+ {\n+ const auto value = V_to_C[transpose_ptr[j]];\n+ const auto v_abs = (R)std::abs(value);\n+ const auto v_res = ((v_abs == min) ? deltaMin : delta); // cmov\n+ const auto v_sig = sign ^ (std::signbit((float)value) ? -1 : 0); // xor bit\n+ const auto v_to_st = (R)std::copysign(v_res, v_sig); // magnitude of v_res, sign of v_sig\n+\n+ C_to_V[transpose_ptr[j]] = v_to_st;\n+ }\n+\n+ transpose_ptr += length;\n+ syndrome = syndrome || sign;\n+ }\n+\n+ return (syndrome == 0);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_8,Q_8>;\n+template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_16,Q_16>;\n+template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_32,Q_32>;\n+template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.hpp", "diff": "+#ifndef DECODER_LDPC_BP_FLOODING_AMS_HPP_\n+#define DECODER_LDPC_BP_FLOODING_AMS_HPP_\n+\n+#include \"../Decoder_LDPC_BP_flooding.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_LDPC_BP_flooding_approximate_min_star : public Decoder_LDPC_BP_flooding<B,R>\n+{\n+public:\n+ Decoder_LDPC_BP_flooding_approximate_min_star(const int &K, const int &N, const int& n_ite,\n+ const tools::Sparse_matrix &H,\n+ const std::vector<unsigned> &info_bits_pos,\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_flooding_approximate_min_star\");\n+ virtual ~Decoder_LDPC_BP_flooding_approximate_min_star();\n+\n+protected:\n+ // BP functions for decoding\n+ virtual bool BP_process(const R *Y_N, std::vector<R> &V_to_C, std::vector<R> &C_to_V);\n+};\n+\n+template <typename B = int, typename R = float>\n+using Decoder_LDPC_BP_flooding_AMS = Decoder_LDPC_BP_flooding_approximate_min_star<B,R>;\n+}\n+}\n+\n+#endif /* DECODER_LDPC_BP_FLOODING_AMS_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add approximate min star LDPC decoder Signed-off-by: Adrien Cassagne <adrien.cassagne@inria.fr>
8,481
07.11.2017 10:47:52
-3,600
1f26940439ef8d9aaed5581d60b0e71bcd94080b
Add a LDPC encoder for systematic QC matrix
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -87,6 +87,7 @@ void Codec_LDPC::parameters\ndec->store(vals);\nthis->enc->H_alist_path = this->dec->H_alist_path;\n+ this->enc->QC_matrix_path = this->dec->QC_matrix_path;\nthis->K = this->enc->K;\nthis->N_cw = this->enc->N_cw;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp", "new_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp", "diff": "#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n#include \"Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp\"\n+#include \"Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.hpp\"\n#include \"Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp\"\n#include \"Encoder_LDPC.hpp\"\n@@ -37,7 +38,7 @@ void Encoder_LDPC::parameters\nauto p = this->get_prefix();\n- opt_args[{p+\"-type\"}][2] += \", LDPC, LDPC_H, LDPC_DVBS2\";\n+ opt_args[{p+\"-type\"}][2] += \", LDPC, LDPC_H, LDPC_DVBS2, LDPC_QC\";\nopt_args[{p+\"-h-path\"}] =\n{\"string\",\n@@ -46,6 +47,10 @@ void Encoder_LDPC::parameters\nopt_args[{p+\"-g-path\"}] =\n{\"string\",\n\"path to the G matrix (AList formated file, required by the \\\"LDPC\\\" encoder).\"};\n+\n+ opt_args[{p+\"-qc-path\"}] =\n+ {\"string\",\n+ \"path to the QC matrix (QC formated file, required by the \\\"LDPC_QC\\\" encoder).\"};\n}\nvoid Encoder_LDPC::parameters\n@@ -57,6 +62,7 @@ void Encoder_LDPC::parameters\nif(exist(vals, {p+\"-h-path\" })) this->H_alist_path = vals.at({p+\"-h-path\" });\nif(exist(vals, {p+\"-g-path\" })) this->G_alist_path = vals.at({p+\"-g-path\" });\n+ if(exist(vals, {p+\"-qc-path\"})) this->QC_matrix_path = vals.at({p+\"-qc-path\"});\n}\nvoid Encoder_LDPC::parameters\n@@ -70,6 +76,8 @@ void Encoder_LDPC::parameters\nheaders[p].push_back(std::make_pair(\"G matrix path\", this->G_alist_path));\nif (this->type == \"LDPC_H\")\nheaders[p].push_back(std::make_pair(\"H matrix path\", this->H_alist_path));\n+ if (this->type == \"LDPC_QC\")\n+ headers[p].push_back(std::make_pair(\"QC matrix path\", this->QC_matrix_path));\n}\ntemplate <typename B>\n@@ -78,6 +86,7 @@ module::Encoder_LDPC<B>* Encoder_LDPC::parameters\n{\nif (this->type == \"LDPC\" ) return new module::Encoder_LDPC <B>(this->K, this->N_cw, G, this->n_frames);\nelse if (this->type == \"LDPC_H\" ) return new module::Encoder_LDPC_from_H <B>(this->K, this->N_cw, H, this->n_frames);\n+ else if (this->type == \"LDPC_QC\" ) return new module::Encoder_LDPC_from_QC<B>(this->K, this->N_cw, H, this->n_frames);\nelse if (this->type == \"LDPC_DVBS2\") return new module::Encoder_LDPC_DVBS2 <B>(this->K, this->N_cw, this->n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp", "new_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp", "diff": "@@ -24,6 +24,7 @@ struct Encoder_LDPC : public Encoder\n// optional\nstd::string H_alist_path = \"\";\nstd::string G_alist_path = \"\";\n+ std::string QC_matrix_path = \"\";\n// ---------------------------------------------------------------------------------------------------- METHODS\nparameters(const std::string p = Encoder_LDPC::prefix);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.cpp", "diff": "+#include <iostream>\n+#include <vector>\n+#include <numeric>\n+#include <functional>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Math/matrix.h\"\n+\n+#include \"Encoder_LDPC_from_QC.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B>\n+Encoder_LDPC_from_QC<B>\n+::Encoder_LDPC_from_QC(const int K, const int N, const tools::Sparse_matrix &_H, const int n_frames,\n+ const std::string name)\n+: Encoder_LDPC<B>(K, N, n_frames, name), H((_H.get_n_rows() > _H.get_n_cols())?_H.transpose():_H), invH2(tools::QC_matrix::invert_H2(_H))\n+{\n+ if ((N-K) != (int)H.get_n_rows())\n+ {\n+ std::stringstream message;\n+ message << \"The built H matrix has a dimension '(N-K)' different than the given one ('(N-K)' = \" << (N-K)\n+ << \", 'H.get_n_rows()' = \" << H.get_n_rows() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (N != (int)H.get_n_cols())\n+ {\n+ std::stringstream message;\n+ message << \"The built H matrix has a dimension 'N' different than the given one ('N' = \" << N\n+ << \", 'H.get_n_cols()' = \" << H.get_n_cols() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n+template <typename B>\n+Encoder_LDPC_from_QC<B>\n+::~Encoder_LDPC_from_QC()\n+{\n+}\n+\n+template <typename B>\n+void Encoder_LDPC_from_QC<B>\n+::_encode(const B *U_K, B *X_N, const int frame_id)\n+{\n+ unsigned M = this->N - this->K;\n+\n+ //Systematic part\n+ std::copy_n(U_K, this->K, X_N);\n+\n+ //Calculate parity part\n+ mipp::vector<int8_t> tableauCalcul(M, 0);\n+ for (unsigned i = 0; i < M; i++)\n+ {\n+ for (unsigned j = 0; j < H.get_cols_from_row(i).size(); j++)\n+ if (H.get_cols_from_row(i)[j] < (unsigned)this->K)\n+ tableauCalcul[i] ^= U_K[ H.get_cols_from_row(i)[j] ];\n+ else\n+ break;\n+ }\n+\n+ for (unsigned i = 0; i < M; i++)\n+ {\n+ X_N[this->K + i] = 0;\n+ for (unsigned j = 0; j < M; j++)\n+ X_N[this->K + i] += tableauCalcul[j] & invH2[i][j];\n+ X_N[this->K + i] %= 2;\n+ }\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Encoder_LDPC_from_QC<B_8>;\n+template class aff3ct::module::Encoder_LDPC_from_QC<B_16>;\n+template class aff3ct::module::Encoder_LDPC_from_QC<B_32>;\n+template class aff3ct::module::Encoder_LDPC_from_QC<B_64>;\n+#else\n+template class aff3ct::module::Encoder_LDPC_from_QC<B>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.hpp", "diff": "+#ifndef ENCODER_LDPC_FROM_QC_HPP_\n+#define ENCODER_LDPC_FROM_QC_HPP_\n+\n+#include <vector>\n+\n+#include \"../Encoder_LDPC.hpp\"\n+\n+#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\n+#include \"Tools/Code/LDPC/QC_matrix/QC_matrix.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+\n+template <typename B = int>\n+class Encoder_LDPC_from_QC : public Encoder_LDPC<B>\n+{\n+protected:\n+ tools::Sparse_matrix H;\n+ tools::QC_matrix::QCFull_matrix invH2;\n+\n+public:\n+ Encoder_LDPC_from_QC(const int K, const int N, const tools::Sparse_matrix &H, const int n_frames = 1,\n+ const std::string name = \"Encoder_LDPC_from_QC\");\n+ virtual ~Encoder_LDPC_from_QC();\n+\n+protected:\n+ virtual void _encode(const B *U_K, B *X_N, const int frame_id);\n+};\n+\n+}\n+}\n+\n+#endif /* ENCODER_LDPC_FROM_QC_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a LDPC encoder for systematic QC matrix Signed-off-by: Adrien Cassagne <adrien.cassagne@inria.fr>
8,490
12.12.2017 16:22:04
-3,600
947e9212d2298657d53d28cffd713d17f37dda5a
Add the MIN choice in the AMS decoder.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Math/max.h\"\n#include \"Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp\"\n@@ -44,6 +45,11 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\n+ opt_args[{p+\"-min\"}] =\n+ {\"string\",\n+ \"the MIN implementation for the nodes (AMS decoder).\",\n+ \"MIN, MINL, MINS\"};\n+\nopt_args[{p+\"-h-path\"}] =\n{\"string\",\n\"path to the H matrix (AList formated file).\"};\n@@ -58,7 +64,7 @@ void Decoder_LDPC::parameters\nopt_args[{p+\"-ite\", \"i\"}] =\n{\"positive_int\",\n- \"maximal number of iterations in the turbo decoder.\"};\n+ \"maximal number of iterations in the LDPC decoder.\"};\nopt_args[{p+\"-off\"}] =\n{\"float\",\n@@ -89,6 +95,7 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\n+ if(exist(vals, {p+\"-min\" })) this->min = vals.at({p+\"-min\" });\nif(exist(vals, {p+\"-h-path\" })) this->H_alist_path = vals.at({p+\"-h-path\" });\nif(exist(vals, {p+\"-qc-path\" })) this->QC_matrix_path = vals.at({p+\"-qc-path\" });\nif(exist(vals, {p+\"-ite\", \"i\"})) this->n_ite = std::stoi(vals.at({p+\"-ite\", \"i\"}));\n@@ -127,6 +134,9 @@ void Decoder_LDPC::parameters\nif (this->enable_syndrome)\nheaders[p].push_back(std::make_pair(\"Stop criterion depth\", std::to_string(this->syndrome_depth)));\n+\n+ if (this->implem == \"AMS\")\n+ headers[p].push_back(std::make_pair(\"Min type\", this->min));\n}\ntemplate <typename B, typename Q>\n@@ -138,7 +148,14 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_LDPC::parameters\nif (this->implem == \"ONMS\") return new module::Decoder_LDPC_BP_flooding_ONMS <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->norm_factor, (Q)this->offset, this->enable_syndrome, this->syndrome_depth, this->n_frames);\nelse if (this->implem == \"SPA\" ) return new module::Decoder_LDPC_BP_flooding_SPA <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\nelse if (this->implem == \"LSPA\") return new module::Decoder_LDPC_BP_flooding_LSPA <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n- else if (this->implem == \"AMS\" ) return new module::Decoder_LDPC_BP_flooding_AMS <B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n+ else if (this->implem == \"AMS\" ) {\n+ if (this->min == \"MIN\")\n+ return new module::Decoder_LDPC_BP_flooding_AMS<B,Q,tools::min<Q>> (this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n+ else if (this->min == \"MINL\")\n+ return new module::Decoder_LDPC_BP_flooding_AMS<B,Q,tools::min_star_linear2<Q>> (this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n+ else if (this->min == \"MINS\")\n+ return new module::Decoder_LDPC_BP_flooding_AMS<B,Q,tools::min_star<Q>> (this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n+ }\n}\nelse if (this->type == \"BP_LAYERED\" && this->simd_strategy.empty())\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp", "diff": "@@ -24,6 +24,7 @@ struct Decoder_LDPC : public Decoder\npublic:\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// optional parameters\n+ std::string min = \"MINL\";\nstd::string H_alist_path = \"\";\nstd::string QC_matrix_path = \"\";\nstd::string simd_strategy = \"\";\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.hpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.hpp", "diff": "#ifndef DECODER_LDPC_BP_FLOODING_AMS_HPP_\n#define DECODER_LDPC_BP_FLOODING_AMS_HPP_\n+#include \"Tools/Math/max.h\"\n+\n#include \"../Decoder_LDPC_BP_flooding.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\n-template <typename B = int, typename R = float>\n+template <typename B = int, typename R = float, tools::proto_min<R> MIN = tools::min_star_linear2>\nclass Decoder_LDPC_BP_flooding_approximate_min_star : public Decoder_LDPC_BP_flooding<B,R>\n{\npublic:\n@@ -25,9 +27,11 @@ protected:\nvirtual bool BP_process(const R *Y_N, std::vector<R> &V_to_C, std::vector<R> &C_to_V);\n};\n-template <typename B = int, typename R = float>\n-using Decoder_LDPC_BP_flooding_AMS = Decoder_LDPC_BP_flooding_approximate_min_star<B,R>;\n+template <typename B = int, typename R = float, tools::proto_min<R> MIN = tools::min_star_linear2>\n+using Decoder_LDPC_BP_flooding_AMS = Decoder_LDPC_BP_flooding_approximate_min_star<B,R,MIN>;\n}\n}\n+#include \"Decoder_LDPC_BP_flooding_approximate_min_star.hxx\"\n+\n#endif /* DECODER_LDPC_BP_FLOODING_AMS_HPP_ */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.cpp", "new_path": "src/Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.hxx", "diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n-#include \"Tools/Math/max.h\"\n#include \"Decoder_LDPC_BP_flooding_approximate_min_star.hpp\"\n-using namespace aff3ct;\n-using namespace aff3ct::module;\n-\n-template <typename B, typename R>\n-Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B, typename R, tools::proto_min<R> MIN>\n+Decoder_LDPC_BP_flooding_approximate_min_star<B,R,MIN>\n::Decoder_LDPC_BP_flooding_approximate_min_star(const int &K, const int &N, const int& n_ite,\nconst tools::Sparse_matrix &H,\nconst std::vector<unsigned> &info_bits_pos,\n@@ -27,15 +27,15 @@ Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"This decoder only supports floating-point LLRs.\");\n}\n-template <typename B, typename R>\n-Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\n+template <typename B, typename R, tools::proto_min<R> MIN>\n+Decoder_LDPC_BP_flooding_approximate_min_star<B,R,MIN>\n::~Decoder_LDPC_BP_flooding_approximate_min_star()\n{\n}\n// normalized offest min-sum implementation\n-template <typename B, typename R>\n-bool Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\n+template <typename B, typename R, tools::proto_min<R> MIN>\n+bool Decoder_LDPC_BP_flooding_approximate_min_star<B,R,MIN>\n::BP_process(const R *Y_N, std::vector<R> &V_to_C, std::vector<R> &C_to_V)\n{\n// beginning of the iteration upon all the matrix lines\n@@ -83,12 +83,12 @@ bool Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\nsign ^= c_sign;\nmin = std::min(min, v_abs);\n- deltaMin = tools::min_star_linear2(deltaMin, (v_abs == min) ? v_temp : v_abs);\n+ deltaMin = MIN(deltaMin, (v_abs == min) ? v_temp : v_abs);\n}\n- auto delta = tools::min_star_linear2(deltaMin, min);\n- delta = (delta < 0) ? 0 : delta;\n- deltaMin = (deltaMin < 0) ? 0 : deltaMin;\n+ auto delta = MIN(deltaMin, min);\n+ delta = std::max((R)0, delta );\n+ deltaMin = std::max((R)0, deltaMin);\n// regenerate the CN outcoming values\nfor (auto j = 0; j < length; j++)\n@@ -108,15 +108,5 @@ bool Decoder_LDPC_BP_flooding_approximate_min_star<B,R>\nreturn (syndrome == 0);\n}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_8,Q_8>;\n-template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_16,Q_16>;\n-template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_32,Q_32>;\n-template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B_64,Q_64>;\n-#else\n-template class aff3ct::module::Decoder_LDPC_BP_flooding_approximate_min_star<B,Q>;\n-#endif\n-// ==================================================================================== explicit template instantiation\n+}\n+}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the MIN choice in the AMS decoder.
8,490
13.12.2017 10:51:40
-3,600
ea7cf0380aba66a62bff5bc9405339ecac0d2928
Improve the LDPC puncturer integration.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -11,8 +11,8 @@ Codec_LDPC::parameters\n: Codec ::parameters(Codec_LDPC::name, prefix),\nCodec_SISO_SIHO::parameters(Codec_LDPC::name, prefix),\nenc(new Encoder_LDPC::parameters(\"enc\")),\n- pct(new Puncturer_LDPC::parameters(\"pct\")),\n- dec(new Decoder_LDPC ::parameters(\"dec\"))\n+ dec(new Decoder_LDPC::parameters(\"dec\")),\n+ pct(nullptr)\n{\nCodec::parameters::enc = enc;\nCodec::parameters::dec = dec;\n@@ -44,26 +44,62 @@ Codec_LDPC::parameters* Codec_LDPC::parameters\nreturn clone;\n}\n+void Codec_LDPC::parameters\n+::enable_puncturer()\n+{\n+ this->pct = new Puncturer_LDPC::parameters(\"pct\");\n+}\n+\n+std::vector<std::string> Codec_LDPC::parameters\n+::get_names() const\n+{\n+ auto n = Codec::parameters::get_names();\n+ if (pct != nullptr) { auto nn = pct->get_names(); for (auto &x : nn) n.push_back(x); }\n+ return n;\n+}\n+\n+std::vector<std::string> Codec_LDPC::parameters\n+::get_short_names() const\n+{\n+ auto sn = Codec::parameters::get_short_names();\n+ if (pct != nullptr) { auto nn = pct->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ return sn;\n+}\n+\n+std::vector<std::string> Codec_LDPC::parameters\n+::get_prefixes() const\n+{\n+ auto p = Codec::parameters::get_prefixes();\n+ if (pct != nullptr) { auto nn = pct->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ return p;\n+}\n+\nvoid Codec_LDPC::parameters\n::get_description(arg_map &req_args, arg_map &opt_args) const\n{\nCodec_SISO_SIHO::parameters::get_description(req_args, opt_args);\nenc->get_description(req_args, opt_args);\n- pct->get_description(req_args, opt_args);\ndec->get_description(req_args, opt_args);\nauto penc = enc->get_prefix();\n- auto ppct = pct->get_prefix();\nauto pdec = dec->get_prefix();\nopt_args.erase({penc+\"-h-path\" });\n- req_args.erase({ppct+\"-info-bits\", \"K\" });\n- opt_args.erase({ppct+\"-fra\", \"F\" });\n- req_args.erase({ppct+\"-cw-size\", \"N_cw\"});\nreq_args.erase({pdec+\"-cw-size\", \"N\" });\nreq_args.erase({pdec+\"-info-bits\", \"K\" });\nopt_args.erase({pdec+\"-fra\", \"F\" });\n+\n+ if (this->pct)\n+ {\n+ pct->get_description(req_args, opt_args);\n+\n+ auto ppct = pct->get_prefix();\n+\n+ req_args.erase({ppct+\"-info-bits\", \"K\" });\n+ opt_args.erase({ppct+\"-fra\", \"F\" });\n+ req_args.erase({ppct+\"-cw-size\", \"N_cw\"});\n+ }\n}\nvoid Codec_LDPC::parameters\n@@ -73,12 +109,15 @@ void Codec_LDPC::parameters\nenc->store(vals);\n+ if (this->pct)\n+ {\nthis->pct->K = this->enc->K;\nthis->pct->n_frames = this->enc->n_frames;\npct->store(vals);\nthis->pct->N_cw = this->enc->N_cw;\n+ }\nthis->dec->K = this->enc->K;\nthis->dec->N_cw = this->enc->N_cw;\n@@ -90,7 +129,7 @@ void Codec_LDPC::parameters\nthis->K = this->enc->K;\nthis->N_cw = this->enc->N_cw;\n- this->N = this->pct->N;\n+ this->N = this->pct ? this->pct->N : this->N_cw;\n}\nvoid Codec_LDPC::parameters\n@@ -99,15 +138,16 @@ void Codec_LDPC::parameters\nCodec_SISO_SIHO::parameters::get_headers(headers, full);\nenc->get_headers(headers, full);\n- pct->get_headers(headers, full);\ndec->get_headers(headers, full);\n+ if (this->pct)\n+ pct->get_headers(headers, full);\n}\ntemplate <typename B, typename Q>\nmodule::Codec_LDPC<B,Q>* Codec_LDPC::parameters\n::build(module::CRC<B>* crc) const\n{\n- return new module::Codec_LDPC<B,Q>(*enc, *dec, *pct);\n+ return new module::Codec_LDPC<B,Q>(*enc, *dec, pct);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.hpp", "new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.hpp", "diff": "@@ -27,13 +27,18 @@ struct Codec_LDPC : public Codec_SISO_SIHO\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// depending parameters\nEncoder_LDPC ::parameters *enc;\n- Puncturer_LDPC::parameters *pct;\nDecoder_LDPC ::parameters *dec;\n+ Puncturer_LDPC::parameters *pct;\n// ---------------------------------------------------------------------------------------------------- METHODS\nparameters(const std::string p = Codec_LDPC::prefix);\nvirtual ~parameters();\nCodec_LDPC::parameters* clone() const;\n+ void enable_puncturer();\n+\n+ virtual std::vector<std::string> get_names () const;\n+ virtual std::vector<std::string> get_short_names() const;\n+ virtual std::vector<std::string> get_prefixes () const;\n// parameters construction\nvoid get_description(arg_map &req_args, arg_map &opt_args ) const;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.cpp", "new_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.cpp", "diff": "@@ -50,7 +50,6 @@ void Puncturer_LDPC::parameters\nstd::vector<bool> generate_punct_vector(const std::string pattern)\n{\n-\nstd::vector<std::string> str_array = aff3ct::tools::split(pattern, ',');\nint N_pattern = (int)str_array.size();\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Code/LDPC/LDPC.cpp", "new_path": "src/Launcher/Code/LDPC/LDPC.cpp", "diff": "#include <iostream>\n#include <mipp.h>\n+#include \"Launcher/Simulation/BFER_std.hpp\"\n+\n#include \"Factory/Module/Codec/LDPC/Codec_LDPC.hpp\"\n#include \"LDPC.hpp\"\n@@ -14,6 +16,9 @@ LDPC<L,B,R,Q>\n: L(argc, argv, stream), params_cdc(new factory::Codec_LDPC::parameters(\"cdc\"))\n{\nthis->params.set_cdc(params_cdc);\n+\n+ if (typeid(L) == typeid(BFER_std<B,R,Q>))\n+ params_cdc->enable_puncturer();\n}\ntemplate <class L, typename B, typename R, typename Q>\n@@ -54,6 +59,7 @@ void LDPC<L,B,R,Q>\nL::store_args();\nparams_cdc->enc->n_frames = this->params.src->n_frames;\n+ if (params_cdc->pct)\nparams_cdc->pct->n_frames = this->params.src->n_frames;\nparams_cdc->dec->n_frames = this->params.src->n_frames;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -49,10 +49,10 @@ template <typename B, typename Q>\nCodec_LDPC<B,Q>\n::Codec_LDPC(const factory::Encoder_LDPC ::parameters &enc_params,\nconst factory::Decoder_LDPC ::parameters &dec_params,\n- factory::Puncturer_LDPC::parameters &pct_params,\n+ factory::Puncturer_LDPC::parameters *pct_params,\nconst std::string name)\n-: Codec <B,Q>(enc_params.K, enc_params.N_cw, pct_params.N, enc_params.tail_length, enc_params.n_frames, name),\n- Codec_SISO_SIHO<B,Q>(enc_params.K, enc_params.N_cw, pct_params.N, enc_params.tail_length, enc_params.n_frames, name),\n+: Codec <B,Q>(enc_params.K, enc_params.N_cw, pct_params ? pct_params->N : enc_params.N_cw, enc_params.tail_length, enc_params.n_frames, name),\n+ Codec_SISO_SIHO<B,Q>(enc_params.K, enc_params.N_cw, pct_params ? pct_params->N : enc_params.N_cw, enc_params.tail_length, enc_params.n_frames, name),\ninfo_bits_pos(enc_params.K)\n{\n// ----------------------------------------------------------------------------------------------------- exceptions\n@@ -131,7 +131,8 @@ Codec_LDPC<B,Q>\nstd::ifstream file_H(dec_params.H_path, std::ifstream::in);\ntools::QC_matrix QC = tools::QC_matrix::load(file_H);\nH = QC.expand_QC();\n- pct_params.pattern = QC.get_pct_pattern();\n+ if (pct_params)\n+ pct_params->pattern = QC.get_pct_pattern();\nstd::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n@@ -171,13 +172,27 @@ Codec_LDPC<B,Q>\n}\n// ---------------------------------------------------------------------------------------------------- allocations\n+ if (!pct_params)\n+ {\n+ factory::Puncturer::parameters pctno_params;\n+ pctno_params.type = \"NO\";\n+ pctno_params.K = enc_params.K;\n+ pctno_params.N = enc_params.N_cw;\n+ pctno_params.N_cw = enc_params.N_cw;\n+ pctno_params.n_frames = enc_params.n_frames;\n+\n+ this->set_puncturer(factory::Puncturer::build<B,Q>(pctno_params));\n+ }\n+ else\n+ {\ntry\n{\n- this->set_puncturer(factory::Puncturer_LDPC::build<B,Q>(pct_params));\n+ this->set_puncturer(factory::Puncturer_LDPC::build<B,Q>(*pct_params));\n}\ncatch (tools::cannot_allocate const&)\n{\n- this->set_puncturer(factory::Puncturer::build<B,Q>(pct_params));\n+ this->set_puncturer(factory::Puncturer::build<B,Q>(*pct_params));\n+ }\n}\ntry\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.hpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.hpp", "diff": "@@ -27,7 +27,7 @@ protected:\npublic:\nCodec_LDPC(const factory::Encoder_LDPC::parameters &enc_params,\nconst factory::Decoder_LDPC::parameters &dec_params,\n- factory::Puncturer_LDPC::parameters &pct_params,\n+ factory::Puncturer_LDPC::parameters *pct_params,\nconst std::string name = \"Codec_LDPC\");\nvirtual ~Codec_LDPC();\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the LDPC puncturer integration.
8,490
13.12.2017 12:05:54
-3,600
54bf3ee8ef61fa415d79de156f2452119436b584
Simplify the LDPC QC reader a little bit.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Code/LDPC/AList/AList.hpp\"\n-#include \"Tools/Code/LDPC/QC_matrix/QC_matrix.hpp\"\n+#include \"Tools/Code/LDPC/QC/QC.hpp\"\n#include \"Tools/general_utils.h\"\n#include \"Factory/Module/Puncturer/Puncturer.hpp\"\n@@ -96,8 +96,7 @@ Codec_LDPC<B,Q>\nif (G_format == \"QC\")\n{\nstd::ifstream file_G(enc_params.G_path, std::ifstream::in);\n- tools::QC_matrix QC = tools::QC_matrix::load(file_G);\n- G = QC.expand_QC();\n+ G = tools::QC::read(file_G);\nfile_G.close();\n}\nelse if (G_format == \"ALIST\")\n@@ -129,10 +128,9 @@ Codec_LDPC<B,Q>\nif (H_format == \"QC\")\n{\nstd::ifstream file_H(dec_params.H_path, std::ifstream::in);\n- tools::QC_matrix QC = tools::QC_matrix::load(file_H);\n- H = QC.expand_QC();\n+ H = tools::QC::read(file_H);\nif (pct_params)\n- pct_params->pattern = QC.get_pct_pattern();\n+ pct_params->pattern = tools::QC::read_pct_pattern(file_H);\nstd::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.cpp", "new_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.cpp", "diff": "@@ -17,7 +17,9 @@ template <typename B>\nEncoder_LDPC_from_QC<B>\n::Encoder_LDPC_from_QC(const int K, const int N, const tools::Sparse_matrix &_H, const int n_frames,\nconst std::string name)\n-: Encoder_LDPC<B>(K, N, n_frames, name), H((_H.get_n_rows() > _H.get_n_cols())?_H.transpose():_H), invH2(tools::QC_matrix::invert_H2(_H))\n+: Encoder_LDPC<B>(K, N, n_frames, name),\n+ H((_H.get_n_rows() > _H.get_n_cols())?_H.transpose():_H),\n+ invH2(tools::LDPC_matrix_handler::invert_H2(_H))\n{\nif ((N-K) != (int)H.get_n_rows())\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.hpp", "new_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.hpp", "diff": "#include \"../Encoder_LDPC.hpp\"\n#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\n-#include \"Tools/Code/LDPC/QC_matrix/QC_matrix.hpp\"\n+#include \"Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp\"\nnamespace aff3ct\n{\n@@ -18,7 +18,7 @@ class Encoder_LDPC_from_QC : public Encoder_LDPC<B>\n{\nprotected:\ntools::Sparse_matrix H;\n- tools::QC_matrix::QCFull_matrix invH2;\n+ tools::LDPC_matrix_handler::QCFull_matrix invH2;\npublic:\nEncoder_LDPC_from_QC(const int K, const int N, const tools::Sparse_matrix &H, const int n_frames = 1,\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": "@@ -249,3 +249,107 @@ std::vector<unsigned> LDPC_matrix_handler\nreturn itl_vec;\n}\n+\n+LDPC_matrix_handler::QCFull_matrix LDPC_matrix_handler\n+::invert_H2(const Sparse_matrix& _H)\n+{\n+ Sparse_matrix H;\n+ if (_H.get_n_rows() > _H.get_n_cols())\n+ H = _H.transpose();\n+ else\n+ H = _H;\n+\n+ unsigned M = H.get_n_rows();\n+ unsigned N = H.get_n_cols();\n+ unsigned K = N - M;\n+\n+ QCFull_matrix MatriceCalcul;\n+ MatriceCalcul.clear();\n+ MatriceCalcul.resize(M, mipp::vector<int8_t>(2 * M, 0));\n+\n+ //Copy H2 on left\n+ for (unsigned i = 0; i < M; i++)\n+ for (unsigned j = 0; j < H.get_cols_from_row(i).size(); j++)\n+ if (H.get_cols_from_row(i)[j] >= K)\n+ MatriceCalcul[i][H.get_cols_from_row(i)[j] - K] = 1;\n+\n+ //Create identity on right\n+ for (unsigned i = 0; i < M; i++)\n+ MatriceCalcul[i][M + i] = 1;\n+\n+ //Pivot de Gauss (Forward)\n+ for (unsigned indLgn = 0; indLgn < M; indLgn++)\n+ {\n+ if (MatriceCalcul[indLgn][indLgn] == 0)\n+ {\n+ unsigned indLgnSwap = 0;\n+ for (unsigned indLgn2 = indLgn + 1; indLgn2 < M; indLgn2++)\n+ {\n+ if (MatriceCalcul[indLgn2][indLgn] != 0)\n+ {\n+ indLgnSwap = indLgn2;\n+ break;\n+ }\n+ }\n+ if (indLgnSwap == 0)\n+ {\n+ std::stringstream message;\n+ message << \"Matrix H2 (H = [H1 H2]) is not invertible\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ std::swap(MatriceCalcul[indLgn], MatriceCalcul[indLgnSwap]);\n+ }\n+\n+ //XOR des lignes\n+ for (unsigned indLgn2 = indLgn + 1; indLgn2 < M; indLgn2++)\n+ {\n+ if (MatriceCalcul[indLgn2][indLgn] != 0)\n+ {\n+ const auto loop_size1 = (unsigned)(2 * M / mipp::nElReg<int8_t>());\n+ for (unsigned i = 0; i < loop_size1; i++)\n+ {\n+ const auto rLgn = mipp::Reg<int8_t>(&MatriceCalcul[indLgn][i * mipp::nElReg<int8_t>()]);\n+ const auto rLgn2 = mipp::Reg<int8_t>(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ auto rLgn3 = rLgn2 ^ rLgn;\n+ rLgn3.store(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ }\n+ for (unsigned i = loop_size1 * mipp::nElReg<int8_t>(); i < 2 * M; i++)\n+ MatriceCalcul[indLgn2][i] = MatriceCalcul[indLgn2][i] ^ MatriceCalcul[indLgn][i];\n+ }\n+ }\n+ }\n+\n+ //Pivot de Gauss (Backward)\n+ for (unsigned indLgn = M - 1; indLgn > 0; indLgn--)\n+ {\n+ //XOR des lignes\n+ for (unsigned indLgn2 = indLgn - 1; indLgn2 > 0; indLgn2--)\n+ {\n+ if (MatriceCalcul[indLgn2][indLgn] != 0)\n+ {\n+ const auto loop_size1 = (unsigned)(2 * M / mipp::nElReg<int8_t>());\n+ for (unsigned i = 0; i < loop_size1; i++)\n+ {\n+ const auto rLgn = mipp::Reg<int8_t>(&MatriceCalcul[indLgn][i * mipp::nElReg<int8_t>()]);\n+ const auto rLgn2 = mipp::Reg<int8_t>(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ auto rLgn3 = rLgn2 ^ rLgn;\n+ rLgn3.store(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n+ }\n+ for (unsigned i = loop_size1 * mipp::nElReg<int8_t>(); i < 2 * M; i++)\n+ MatriceCalcul[indLgn2][i] = MatriceCalcul[indLgn2][i] ^ MatriceCalcul[indLgn][i];\n+ }\n+ }\n+ }\n+\n+ QCFull_matrix invH2;\n+ invH2.clear();\n+ invH2.resize(M, mipp::vector<int8_t>(M, 0));\n+\n+ for (unsigned i = 0; i < M; i++)\n+ for (unsigned j = 0; j < M; j++)\n+ invH2[i][j] = MatriceCalcul[i][M + j];\n+\n+ MatriceCalcul.clear();\n+\n+ return invH2;\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": "#include <vector>\n#include <algorithm>\n#include <numeric>\n+#include <mipp.h>\n#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\n@@ -15,6 +16,7 @@ struct LDPC_matrix_handler\n{\npublic:\nusing Full_matrix = std::vector<std::vector<bool>>;\n+ using QCFull_matrix = std::vector<mipp::vector<int8_t>>;\n/*\n* convert a binary sparse matrix to a binary full matrix\n@@ -69,10 +71,13 @@ public:\nstatic std::vector<unsigned> interleave_info_bits_pos(const std::vector<unsigned>& info_bits_pos,\nstd::vector<unsigned>& old_cols_pos);\n-protected :\n+ /*\n+ * inverse H2 (H = [H1 H2] with size(H2) = M x M) to allow encoding with p = H1 x inv(H2) x u\n+ */\n+ static QCFull_matrix invert_H2(const Sparse_matrix& H);\n+protected :\nstatic void transform_H_to_G(Full_matrix& mat, std::vector<unsigned>& info_bits_pos);\n-\n};\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/LDPC/QC/QC.cpp", "diff": "+#include \"../QC/QC.hpp\"\n+\n+#include <string>\n+#include <sstream>\n+\n+#include \"Tools/Code/LDPC/AList/AList.hpp\"\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/general_utils.h\"\n+\n+\n+using namespace aff3ct::tools;\n+\n+Sparse_matrix QC\n+::read(std::istream &stream)\n+{\n+ // ----------------------------------------------------------------------------------------- read matrix from file\n+ std::string line;\n+\n+ getline(stream, line);\n+ auto values = split(line);\n+ if (values.size() < 3)\n+ {\n+ std::stringstream message;\n+ message << \"'values.size()' has to be greater than 2 ('values.size()' = \" << values.size() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ unsigned N_red = 0, M_red = 0, Z = 0;\n+\n+ N_red = std::stoi(values[0]);\n+ M_red = std::stoi(values[1]);\n+ Z = std::stoi(values[2]);\n+\n+ if (N_red <= 0 || M_red <= 0 || Z <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'N_red', 'M_red' and 'Z' have to be greater than 0 ('N_red' = \" << N_red\n+ << \", 'M_red' = \" << M_red << \", 'Z' = \" << Z << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ std::vector<mipp::vector<int16_t>> H_red(M_red, mipp::vector<int16_t>(N_red, -1));\n+\n+ for (unsigned i = 0; i < M_red; i++)\n+ {\n+ getline(stream, line);\n+ values = split(line);\n+\n+ if (values.size() < N_red)\n+ {\n+ std::stringstream message;\n+ message << \"'values.size()' has to be greater or equal to 'N_red' ('values.size()' = \"\n+ << values.size() << \", 'i' = \" << i << \", 'N_red' = \" << N_red << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ for (unsigned j = 0; j < N_red; j++)\n+ {\n+ auto col_value = (j < values.size()) ? std::stoi(values[j]) : -1;\n+ H_red[i][j] = col_value;\n+ }\n+ }\n+\n+ // ---------------------------------------------------------------------------- expand QC format into sparse format\n+ unsigned N = M_red * Z;\n+ unsigned M = N_red * Z;\n+\n+ Sparse_matrix H(N, M);\n+\n+ for (unsigned i = 0; i < M_red; i++)\n+ {\n+ for (unsigned j = 0; j < N_red; j++)\n+ {\n+ auto value = H_red[i][j];\n+\n+ unsigned idxLgn = i * Z;\n+ unsigned idxCol = j * Z;\n+\n+ switch (value)\n+ {\n+ case -1:\n+ break;\n+\n+ case 0:\n+ for (unsigned k = 0; k < Z; k++)\n+ H.add_connection(idxLgn + k, idxCol + k);\n+ break;\n+\n+ default:\n+ for (unsigned k = 0; k < Z; k++)\n+ H.add_connection(idxLgn + k, (unsigned)(idxCol + (k + value) % Z));\n+ break;\n+ }\n+ }\n+ }\n+\n+ return H.transpose();\n+}\n+\n+std::vector<bool> QC\n+::read_pct_pattern(std::istream &stream, int N_red)\n+{\n+ std::string line;\n+ std::vector<bool> pattern;\n+\n+ // try to get puncture pattern\n+ try\n+ {\n+ getline(stream, line);\n+ auto values = split(line);\n+ if ((int)values.size() < N_red && N_red != -1)\n+ {\n+ std::stringstream message;\n+ message << \"'values.size()' has to be greater or equal to 'N_red' ('values.size()' = \"\n+ << values.size() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ else\n+ N_red = (unsigned)values.size();\n+\n+ for (auto j = 0; j < N_red; j++)\n+ {\n+ auto col_value = (j < (int)values.size()) ? std::stoi(values[j]) : 1;\n+ pattern.push_back(col_value);\n+ }\n+ }\n+ catch (std::exception const&)\n+ {\n+ std::stringstream message;\n+ message << \"Something went wrong when trying to read the LDPC puncturing pattern.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return pattern;\n+}\n+\n+void QC\n+::write(const Sparse_matrix &matrix, std::ostream &stream)\n+{\n+ AList::write(matrix, stream);\n+}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Code/LDPC/QC/QC.hpp", "diff": "+#ifndef QC_HPP_\n+#define QC_HPP_\n+\n+#include <algorithm>\n+#include <iostream>\n+#include <vector>\n+#include <mipp.h>\n+\n+#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+struct QC\n+{\n+public:\n+ static Sparse_matrix read ( std::istream &stream );\n+ static std::vector<bool> read_pct_pattern( std::istream &stream, int N_red = -1);\n+ static void write (const Sparse_matrix &matrix, std::ostream &stream );\n+};\n+}\n+}\n+\n+#endif /* QC_HPP_ */\n" }, { "change_type": "DELETE", "old_path": "src/Tools/Code/LDPC/QC_matrix/QC_matrix.cpp", "new_path": null, "diff": "-#include <string>\n-#include <sstream>\n-\n-#include \"Tools/Code/LDPC/AList/AList.hpp\"\n-#include \"Tools/general_utils.h\"\n-#include \"Tools/Exception/exception.hpp\"\n-\n-#include <Tools/Code/LDPC/QC_matrix/QC_matrix.hpp>\n-\n-using namespace aff3ct::tools;\n-\n-QC_matrix\n-::QC_matrix(const unsigned N_red, const unsigned M_red)\n-: H_red(M_red, mipp::vector<int16_t>(N_red, -1)),\n- pct_pattern(N_red, true),\n- Z(0)\n-{\n-}\n-\n-QC_matrix\n-::~QC_matrix()\n-{\n-}\n-\n-Sparse_matrix QC_matrix\n-::expand_QC()\n-{\n- unsigned N_red = (unsigned)this->H_red.size();\n- unsigned M_red = (unsigned)this->H_red.front().size();\n-\n- unsigned N = N_red * this->Z;\n- unsigned M = M_red * this->Z;\n-\n- Sparse_matrix H(N, M);\n-\n- for (unsigned i = 0; i < N_red; i++)\n- {\n- for (unsigned j = 0; j < M_red; j++)\n- {\n- auto value = this->H_red[i][j];\n-\n- unsigned idxLgn = i * this->Z;\n- unsigned idxCol = j * this->Z;\n-\n- switch (value)\n- {\n- case -1:\n- break;\n-\n- case 0:\n- for (unsigned k = 0; k < this->Z; k++)\n- H.add_connection(idxLgn + k, idxCol + k);\n- break;\n-\n- default:\n- for (unsigned k = 0; k < this->Z; k++)\n- H.add_connection(idxLgn + k, (unsigned)(idxCol + (k + value) % this->Z));\n- break;\n- }\n- }\n- }\n- return H.transpose();\n-}\n-\n-std::vector<bool> QC_matrix\n-::get_pct_pattern() const\n-{\n- return this->pct_pattern;\n-}\n-\n-QC_matrix QC_matrix\n-::load(std::istream &stream)\n-{\n- std::string line;\n-\n- getline(stream, line);\n- auto values = split(line);\n- if (values.size() < 3)\n- {\n- std::stringstream message;\n- message << \"'values.size()' has to be greater than 2 ('values.size()' = \" << values.size() << \").\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- unsigned N_red = 0, M_red = 0, Z = 0;\n-\n- N_red = std::stoi(values[0]);\n- M_red = std::stoi(values[1]);\n- Z = std::stoi(values[2]);\n-\n- if (N_red <= 0 || M_red <= 0 || Z <= 0)\n- {\n- std::stringstream message;\n- message << \"'N_red', 'M_red' and 'Z' have to be greater than 0 ('N_red' = \" << N_red\n- << \", 'M_red' = \" << M_red << \", 'Z' = \" << Z << \").\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- QC_matrix matrix(N_red, M_red);\n- matrix.Z = Z;\n-\n- for (unsigned i = 0; i < M_red; i++)\n- {\n- getline(stream, line);\n- values = split(line);\n-\n- if (values.size() < N_red)\n- {\n- std::stringstream message;\n- message << \"'values.size()' has to be greater or equal to 'N_red' ('values.size()' = \"\n- << values.size() << \", 'i' = \" << i << \", 'N_red' = \" << N_red << \").\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- for (unsigned j = 0; j < N_red; j++)\n- {\n- auto col_value = (j < values.size()) ? std::stoi(values[j]) : -1;\n- matrix.H_red[i][j] = col_value;\n- }\n- }\n-\n- //Try to get puncture pattern\n- try\n- {\n- getline(stream, line);\n- values = split(line);\n- if (values.size() < N_red)\n- {\n- std::stringstream message;\n- message << \"'values.size()' has to be greater or equal to 'N_red' ('values.size()' = \" << values.size() << \").\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- for (unsigned j = 0; j < N_red; j++)\n- {\n- auto col_value = (j < values.size()) ? std::stoi(values[j]) : 1;\n- matrix.pct_pattern[j] = col_value;\n- }\n- }\n- catch (std::exception const&)\n- {\n- }\n-\n- return matrix;\n-}\n-\n-QC_matrix::QCFull_matrix QC_matrix\n-::invert_H2(const Sparse_matrix& _H)\n-{\n- Sparse_matrix H;\n- if (_H.get_n_rows() > _H.get_n_cols())\n- H = _H.transpose();\n- else\n- H = _H;\n-\n- unsigned M = H.get_n_rows();\n- unsigned N = H.get_n_cols();\n- unsigned K = N - M;\n-\n- QC_matrix::QCFull_matrix MatriceCalcul;\n- MatriceCalcul.clear();\n- MatriceCalcul.resize(M, mipp::vector<int8_t>(2 * M, 0));\n-\n- //Copy H2 on left\n- for (unsigned i = 0; i < M; i++)\n- for (unsigned j = 0; j < H.get_cols_from_row(i).size(); j++)\n- if (H.get_cols_from_row(i)[j] >= K)\n- MatriceCalcul[i][H.get_cols_from_row(i)[j] - K] = 1;\n-\n- //Create identity on right\n- for (unsigned i = 0; i < M; i++)\n- MatriceCalcul[i][M + i] = 1;\n-\n- //Pivot de Gauss (Forward)\n- for (unsigned indLgn = 0; indLgn < M; indLgn++)\n- {\n- if (MatriceCalcul[indLgn][indLgn] == 0)\n- {\n- unsigned indLgnSwap = 0;\n- for (unsigned indLgn2 = indLgn + 1; indLgn2 < M; indLgn2++)\n- {\n- if (MatriceCalcul[indLgn2][indLgn] != 0)\n- {\n- indLgnSwap = indLgn2;\n- break;\n- }\n- }\n- if (indLgnSwap == 0)\n- {\n- std::stringstream message;\n- message << \"Matrix H2 (H = [H1 H2]) is not invertible\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- std::swap(MatriceCalcul[indLgn], MatriceCalcul[indLgnSwap]);\n- }\n-\n- //XOR des lignes\n- for (unsigned indLgn2 = indLgn + 1; indLgn2 < M; indLgn2++)\n- {\n- if (MatriceCalcul[indLgn2][indLgn] != 0)\n- {\n- const auto loop_size1 = (unsigned)(2 * M / mipp::nElReg<int8_t>());\n- for (unsigned i = 0; i < loop_size1; i++)\n- {\n- const auto rLgn = mipp::Reg<int8_t>(&MatriceCalcul[indLgn][i * mipp::nElReg<int8_t>()]);\n- const auto rLgn2 = mipp::Reg<int8_t>(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n- auto rLgn3 = rLgn2 ^ rLgn;\n- rLgn3.store(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n- }\n- for (unsigned i = loop_size1 * mipp::nElReg<int8_t>(); i < 2 * M; i++)\n- MatriceCalcul[indLgn2][i] = MatriceCalcul[indLgn2][i] ^ MatriceCalcul[indLgn][i];\n- }\n- }\n- }\n-\n- //Pivot de Gauss (Backward)\n- for (unsigned indLgn = M - 1; indLgn > 0; indLgn--)\n- {\n- //XOR des lignes\n- for (unsigned indLgn2 = indLgn - 1; indLgn2 > 0; indLgn2--)\n- {\n- if (MatriceCalcul[indLgn2][indLgn] != 0)\n- {\n- const auto loop_size1 = (unsigned)(2 * M / mipp::nElReg<int8_t>());\n- for (unsigned i = 0; i < loop_size1; i++)\n- {\n- const auto rLgn = mipp::Reg<int8_t>(&MatriceCalcul[indLgn][i * mipp::nElReg<int8_t>()]);\n- const auto rLgn2 = mipp::Reg<int8_t>(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n- auto rLgn3 = rLgn2 ^ rLgn;\n- rLgn3.store(&MatriceCalcul[indLgn2][i * mipp::nElReg<int8_t>()]);\n- }\n- for (unsigned i = loop_size1 * mipp::nElReg<int8_t>(); i < 2 * M; i++)\n- MatriceCalcul[indLgn2][i] = MatriceCalcul[indLgn2][i] ^ MatriceCalcul[indLgn][i];\n- }\n- }\n- }\n-\n- QC_matrix::QCFull_matrix invH2;\n- invH2.clear();\n- invH2.resize(M, mipp::vector<int8_t>(M, 0));\n-\n- for (unsigned i = 0; i < M; i++)\n- for (unsigned j = 0; j < M; j++)\n- invH2[i][j] = MatriceCalcul[i][M + j];\n-\n- MatriceCalcul.clear();\n-\n- return invH2;\n-}\n" }, { "change_type": "DELETE", "old_path": "src/Tools/Code/LDPC/QC_matrix/QC_matrix.hpp", "new_path": null, "diff": "-#ifndef QC_MATRIX_HPP_\n-#define QC_MATRIX_HPP_\n-\n-#include <iostream>\n-#include <vector>\n-#include <algorithm>\n-#include <mipp.h>\n-\n-#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-struct QC_matrix\n-{\n-private:\n- std::vector<mipp::vector<int16_t>> H_red;\n- std::vector<bool> pct_pattern;\n- unsigned Z;\n-\n-public:\n- using QCFull_matrix = std::vector<mipp::vector<int8_t>>;\n-\n- QC_matrix(const unsigned N_red = 0, const unsigned M_red = 1);\n- virtual ~QC_matrix();\n-\n- Sparse_matrix expand_QC();\n- std::vector<bool> get_pct_pattern() const;\n-\n- static QC_matrix load(std::istream &stream);\n-\n- /*\n- * inverse H2 (H = [H1 H2] with size(H2) = M x M) to allow encoding with p = H1 x inv(H2) x u\n- */\n- static QCFull_matrix invert_H2(const Sparse_matrix& H);\n-};\n-}\n-}\n-\n-#endif /* QC_MATRIX_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/version.cpp.in", "new_path": "src/Tools/version.cpp.in", "diff": "@@ -26,7 +26,7 @@ int aff3ct::version_major()\n}\nelse\n{\n- auto vs = tools::string_split(version, '.');\n+ auto vs = tools::split(version, '.');\nif (!vs.size())\nreturn -2;\n@@ -51,13 +51,13 @@ int aff3ct::version_minor()\n}\nelse\n{\n- auto vs = tools::string_split(version, '.');\n+ auto vs = tools::split(version, '.');\nif (vs.size() < 2)\nreturn -2;\nelse\n{\n- auto vs2 = tools::string_split(vs[1], '-');\n+ auto vs2 = tools::split(vs[1], '-');\nif (!vs2[0].size())\nreturn -3;\n@@ -77,13 +77,13 @@ int aff3ct::version_release()\n}\nelse\n{\n- auto vs = tools::string_split(version, '.');\n+ auto vs = tools::split(version, '.');\nif (vs.size() < 3)\nreturn -2;\nelse\n{\n- auto vs3 = tools::string_split(vs[2], '-');\n+ auto vs3 = tools::split(vs[2], '-');\nif (!vs3[0].size())\nreturn -3;\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the LDPC QC reader a little bit.
8,483
13.12.2017 12:15:23
-3,600
ebc367ee993b56e8c581992c622b2e129fd1f497
Add mean value in the Noise Generator
[ { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp", "new_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp", "diff": "@@ -97,8 +97,8 @@ void Noise_fast<R>\nmipp::Reg<R> sintheta, costheta;\nmipp::sincos(theta, sintheta, costheta);\n- auto awgn1 = radius * costheta;\n- auto awgn2 = radius * sintheta;\n+ auto awgn1 = radius * costheta + mu;\n+ auto awgn2 = radius * sintheta + mu;\nawgn1.store(&noise[i ]);\nawgn2.store(&noise[i + mipp::nElReg<R>()]);\n@@ -117,8 +117,8 @@ void Noise_fast<R>\nconst auto sintheta = std::sin(theta);\nconst auto costheta = std::cos(theta);\n- noise[i +0] = radius * sintheta;\n- noise[i +1] = radius * costheta;\n+ noise[i +0] = radius * sintheta + mu;\n+ noise[i +1] = radius * costheta + mu;\n}\n// distribute the last odd element\n@@ -132,7 +132,7 @@ void Noise_fast<R>\nconst auto sintheta = std::sin(theta);\n- noise[length -1] = radius * sintheta;\n+ noise[length -1] = radius * sintheta + mu;\n}\n}\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": "@@ -37,7 +37,7 @@ void Noise_GSL<R>\n::generate(R *noise, const unsigned length, const R sigma, const R mu)\n{\nfor (unsigned i = 0; i < length; i++)\n- noise[i] = (R)gsl_ran_gaussian(rng, sigma);\n+ noise[i] = (R)gsl_ran_gaussian(rng, sigma) + mu;\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Algo/Noise/Noise.hpp", "new_path": "src/Tools/Algo/Noise/Noise.hpp", "diff": "@@ -20,9 +20,9 @@ public:\n}\ntemplate <class A = std::allocator<R>>\n- void generate(std::vector<R,A> &noise, const R sigma)\n+ void generate(std::vector<R,A> &noise, const R sigma, const R mu = 0.0)\n{\n- this->generate(noise.data(), (unsigned)noise.size(), sigma);\n+ this->generate(noise.data(), (unsigned)noise.size(), sigma, mu);\n}\nvirtual void set_seed(const int seed) = 0;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add mean value in the Noise Generator
8,481
21.11.2017 15:29:08
-3,600
7c7a9b88b9084c23db51a1c7b8cae7f7ed642773
Edit tails symbols generation on CPM
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.cpp", "new_path": "src/Factory/Module/Modem/Modem.cpp", "diff": "@@ -176,7 +176,8 @@ void Modem::parameters\nthis->N,\nthis->bps,\nthis->upf,\n- this->cpm_L);\n+ this->cpm_L,\n+ this->cpm_p);\nthis->N_fil = get_buffer_size_after_filtering (this->type,\nthis->N,\n@@ -295,7 +296,8 @@ int Modem\nconst int N,\nconst int bps,\nconst int upf,\n- const int cpm_L)\n+ const int cpm_L,\n+ const int cpm_p)\n{\nif (type == \"BPSK\" ) return module::Modem_BPSK <>::size_mod(N );\nelse if (type == \"BPSK_FAST\") return module::Modem_BPSK_fast<>::size_mod(N );\n@@ -304,7 +306,7 @@ int Modem\nelse if (type == \"QAM\" ) return module::Modem_QAM <>::size_mod(N, bps );\nelse if (type == \"PSK\" ) return module::Modem_PSK <>::size_mod(N, bps );\nelse if (type == \"USER\" ) return module::Modem_user <>::size_mod(N, bps );\n- else if (type == \"CPM\" ) return module::Modem_CPM <>::size_mod(N, bps, cpm_L, upf);\n+ else if (type == \"CPM\" ) return module::Modem_CPM <>::size_mod(N, bps, cpm_L, cpm_p, upf);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Modem/Modem.hpp", "new_path": "src/Factory/Module/Modem/Modem.hpp", "diff": "@@ -82,7 +82,8 @@ struct Modem : public Factory\nconst int N,\nconst int bps = 1,\nconst int upf = 5,\n- const int cpm_L = 3);\n+ const int cpm_L = 3,\n+ const int cpm_p = 2);\nstatic int get_buffer_size_after_filtering(const std::string type,\nconst int N,\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/CPE/Encoder_CPE.hpp", "new_path": "src/Module/Modem/CPM/CPE/Encoder_CPE.hpp", "diff": "@@ -36,6 +36,8 @@ public:\nvirtual void generate_allowed_states (std::vector<int>& allowed_states ) = 0;\nvirtual void generate_allowed_wave_forms(std::vector<SOUT>& allowed_wave_forms) = 0;\n+ virtual void generate_tail_symb_transition() = 0;\n+\n// merge given bit on separate memory addresses to one variable\n// takes number_of_bits from the in_bits array by increasing the memory address\n// msb_to_lsb=true means that the first read bit is the msb and the number_of_bits one is the lsb.\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.cpp", "new_path": "src/Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.cpp", "diff": "#include <vector>\n#include <cmath>\n#include <sstream>\n+#include <algorithm>\n#include \"Tools/Exception/exception.hpp\"\n@@ -12,7 +13,8 @@ using namespace aff3ct::module;\ntemplate <typename SIN, typename SOUT>\nEncoder_CPE_Rimoldi<SIN, SOUT>\n::Encoder_CPE_Rimoldi(const int N, const CPM_parameters<SIN,SOUT>& cpm)\n-: Encoder_CPE<SIN,SOUT>(N, cpm)\n+: Encoder_CPE<SIN,SOUT>(N, cpm),\n+ tail_symb_transition(cpm.max_st_id, -1)\n{\n}\n@@ -55,14 +57,7 @@ SIN Encoder_CPE_Rimoldi<SIN, SOUT>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- // extract V_n\n- int val = state & ((1 << this->cpm.n_bits_p)-1);\n-\n- // sum V_n to the U_(n-L-1-i)\n- for (auto i = 0; i < this->cpm.L -1; i++)\n- val += (state >> (i*this->cpm.n_b_per_s+this->cpm.n_bits_p)) & ((1 << this->cpm.n_b_per_s)-1);\n-\n- return (SIN)(this->cpm.p - (val)%this->cpm.p) % this->cpm.p;\n+ return (SIN)tail_symb_transition[state];\n}\ntemplate<typename SIN, typename SOUT>\n@@ -180,6 +175,72 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\n}\n}\n+template<typename SIN, typename SOUT>\n+void Encoder_CPE_Rimoldi<SIN, SOUT>\n+::generate_tail_symb_transition()\n+{\n+ std::vector<int> state_found;\n+ auto n_tail_symb = 0;\n+ int next_state;\n+\n+ for (auto st = 0; st < this->cpm.n_st; ++st)\n+ for (auto tr = 0; tr < this->cpm.m_order; ++tr)\n+ {\n+ next_state = this->cpm.trellis_next_state[this->cpm.allowed_states[st]*this->cpm.m_order + tr];\n+ if (next_state == 0)\n+ {\n+ tail_symb_transition[this->cpm.allowed_states[st]] = tr;\n+ state_found.push_back(this->cpm.allowed_states[st]);\n+\n+ break;\n+ }\n+ }\n+\n+ n_tail_symb++;\n+\n+ while ((int)state_found.size() != this->cpm.n_st)\n+ {\n+ std::vector<int> state_found_aux(state_found);\n+\n+ for (auto st = 0; st < this->cpm.n_st; ++st)\n+ {\n+ auto cur_state = this->cpm.allowed_states[st];\n+\n+ if (std::find(state_found.begin(), state_found.end(), cur_state) == state_found.end()) // not in the list\n+ {\n+ auto pos_in_vect = (int)state_found.size();\n+\n+ for (auto tr = 0; tr < this->cpm.m_order; ++tr)\n+ {\n+ next_state = this->cpm.trellis_next_state[cur_state * this->cpm.m_order + tr];\n+ auto it = std::find(state_found.begin(), state_found.end(), next_state);\n+ auto found_pos = it - state_found.begin();\n+\n+ if (it != state_found.end() && found_pos < pos_in_vect)\n+ {\n+ pos_in_vect = found_pos;\n+ tail_symb_transition[cur_state] = tr;\n+ }\n+ }\n+\n+ if (pos_in_vect < (int)state_found.size())\n+ state_found_aux.push_back(cur_state);\n+ }\n+ }\n+\n+ state_found = state_found_aux;\n+ n_tail_symb++;\n+ }\n+\n+ if (n_tail_symb != this->cpm.tl)\n+ {\n+ std::stringstream message;\n+ message << \"'n_tail_symb' has to be equal to 'cpm.tl' ('n_tail_symb' = \"\n+ << n_tail_symb << \", 'cpm.tl' = \" << this->cpm.tl << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.hpp", "new_path": "src/Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.hpp", "diff": "@@ -12,6 +12,9 @@ namespace module\ntemplate <typename SIN = int, typename SOUT = int>\nclass Encoder_CPE_Rimoldi : public Encoder_CPE<SIN, SOUT>\n{\n+protected:\n+ std::vector<SIN> tail_symb_transition;\n+\npublic:\nEncoder_CPE_Rimoldi(const int N, const CPM_parameters<SIN,SOUT>& cpm);\nvirtual ~Encoder_CPE_Rimoldi() {}\n@@ -25,6 +28,7 @@ public:\nvoid generate_allowed_states (std::vector<int>& allowed_states );\nvoid generate_allowed_wave_forms (std::vector<SOUT>& allowed_wave_forms);\n+ void generate_tail_symb_transition( );\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/CPM_parameters.hpp", "new_path": "src/Module/Modem/CPM/CPM_parameters.hpp", "diff": "@@ -30,7 +30,7 @@ public :\nwave_shape (wave_shape ),\nm_order ((int)1 << n_b_per_s ),\nn_bits_p ((int)std::ceil(std::log2((double)p))),\n- tl (L ),\n+ tl ((int)(std::ceil((float)(p - 1) / (float)(m_order - 1))) + L - 1),\n// TODO: warning: from here parameters are working for Rimoldi decomposition only!\nn_wa ((int)(p * std::pow(m_order, L)) ),\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/Modem_CPM.hpp", "new_path": "src/Module/Modem/CPM/Modem_CPM.hpp", "diff": "@@ -58,19 +58,23 @@ public:\nvoid set_sigma(const R sigma);\n- static int size_mod(const int N, const int bps, const int L, const int ups)\n+ static int size_mod(const int N, const int bps, const int L, const int p, const int ups)\n{\n- return Modem<B,R,Q>::get_buffer_size_after_modulation(N, bps, L, ups, true);\n+ int m_order = (int)1 << bps;\n+ int n_tl = (int)(std::ceil((float)(p - 1) / (float)(m_order - 1))) + L - 1;\n+\n+ return Modem<B,R,Q>::get_buffer_size_after_modulation(N, bps, n_tl, ups, true);\n}\nstatic int size_fil(const int N, const int bps, const int L, const int p)\n{\nint m_order = (int)1 << bps;\n+ int n_tl = (int)(std::ceil((float)(p - 1) / (float)(m_order - 1))) + L - 1;\nint n_wa = (int)(p * std::pow(m_order, L));\nint n_bits_wa = (int)std::ceil(std::log2(n_wa));\nint max_wa_id = (int)(1 << n_bits_wa);\n- return Modem<B,R,Q>::get_buffer_size_after_filtering(N, bps, L, max_wa_id, false);\n+ return Modem<B,R,Q>::get_buffer_size_after_filtering(N, bps, n_tl, max_wa_id, false);\n}\nprotected:\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/Modem_CPM.hxx", "new_path": "src/Module/Modem/CPM/Modem_CPM.hxx", "diff": "@@ -31,7 +31,7 @@ Modem_CPM<B,R,Q,MAX>\nint n_frames,\nconst std::string name)\n: Modem<B,R,Q>(N,\n- Modem_CPM<B,R,Q,MAX>::size_mod(N, bits_per_symbol, cpm_L, sampling_factor),\n+ Modem_CPM<B,R,Q,MAX>::size_mod(N, bits_per_symbol, cpm_L, cpm_p, sampling_factor),\nModem_CPM<B,R,Q,MAX>::size_fil(N, bits_per_symbol, cpm_L, cpm_p),\nsigma,\nn_frames,\n@@ -74,6 +74,8 @@ Modem_CPM<B,R,Q,MAX>\ncpe.generate_anti_trellis (cpm.anti_trellis_original_state,\ncpm.anti_trellis_input_transition);\n+ cpe.generate_tail_symb_transition( );\n+\ngenerate_baseband ( );\ngenerate_projection ( );\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Edit tails symbols generation on CPM