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 |
20.06.2017 09:51:02
| -7,200 |
d3547ded645e08b8ece5d7ad87bee517ebb4bee5
|
Change argument reader and launcher to display all warnings just after the command line.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -443,6 +443,8 @@ int Launcher<B,R,Q>\nthis->build_args();\nauto display_help = true;\n+\n+ std::vector<std::string> cmd_warn;\nif (ar.parse_arguments(req_args, opt_args, cmd_warn))\n{\nthis->store_args();\n@@ -471,6 +473,17 @@ int Launcher<B,R,Q>\nif(ar.exist_arg({\"help\", \"h\"})) display_help = true;\n}\n+ std::vector<std::string> cmd_error;\n+ bool error = !ar.check_arguments(cmd_error);\n+\n+ for (unsigned e = 0; e < cmd_error.size(); e++)\n+ std::cerr << format_error(cmd_error[e]) << std::endl;\n+\n+ // print the warnings\n+ if (params.simulation.mpi_rank == 0)\n+ for (unsigned w = 0; w < cmd_warn.size(); w++)\n+ std::clog << format_warning(cmd_warn[w]) << std::endl;\n+\nif (display_help)\n{\nstd::vector<std::vector<std::string>> arg_grp;\n@@ -491,17 +504,10 @@ int Launcher<B,R,Q>\narg_grp.push_back({\"term\", \"Terminal parameter(s)\" });\nar.print_usage(arg_grp);\n- return EXIT_FAILURE;\n+ error = true;\n}\n- std::string error;\n- if (!ar.check_arguments(error))\n- {\n- std::cerr << apply_on_each_line(error, format_error) << std::endl;\n- return EXIT_FAILURE;\n- }\n-\n- return 0;\n+ return (error?EXIT_FAILURE:EXIT_SUCCESS);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -820,7 +826,7 @@ void Launcher<B,R,Q>\nsimu = nullptr;\n}\n- if (this->read_arguments())\n+ if (this->read_arguments() == EXIT_FAILURE)\nreturn;\n// write the command and he curve name in the PyBER format\n@@ -835,6 +841,7 @@ void Launcher<B,R,Q>\nif (params.simulation.mpi_rank == 0)\nthis->print_header();\n+\ntry\n{\nsimu = this->build_simu();\n@@ -845,15 +852,12 @@ void Launcher<B,R,Q>\n<< format_error(e.what()) << std::endl;\n}\n+\nif (simu != nullptr)\n{\n// launch the simulation\nif (params.simulation.mpi_rank == 0)\nstream << \"# \" << format_info(\"The simulation is running...\") << std::endl;\n- // print the warnings\n- if (params.simulation.mpi_rank == 0)\n- for (auto w = 0; w < (int)cmd_warn.size(); w++)\n- std::clog << format_warning(cmd_warn[w]) << std::endl;\ntry\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.hpp",
"new_path": "src/Launcher/Launcher.hpp",
"diff": "@@ -41,7 +41,6 @@ private:\nstd::unordered_map<std::type_index,std::string> type_names; /*!< An internal map to store a string associated to a type. */\nsimulation::Simulation *simu; /*!< A generic simulation pointer to allocate a specific simulation. */\nstd::string cmd_line;\n- std::vector<std::string> cmd_warn;\nprotected:\ntools::Arguments_reader ar; /*!< An argument reader to manage the parsing and the documentation of the command line parameters. */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "@@ -317,7 +317,7 @@ void Arguments_reader\n}\nbool Arguments_reader\n-::check_arguments(std::string &error)\n+::check_arguments(std::vector<std::string> &error)\n{\nfor (auto it = this->m_args.begin(); it != this->m_args.end(); ++it)\n{\n@@ -332,11 +332,7 @@ bool Arguments_reader\narg_error += print_tag(it->first[i]) + ((i < (int)it->first.size()-1)?\", \":\"\");\nif (arg_error.size())\n- {\n- if(error.size())\n- error += \"\\n\";\n- error += arg_error;\n- }\n+ error.push_back(arg_error);\n}\nreturn error.size() == 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.hpp",
"new_path": "src/Tools/Arguments_reader.hpp",
"diff": "@@ -154,7 +154,7 @@ public:\n*\n* \\return true if the arguments criteria are respected, false otherwise.\n*/\n- bool check_arguments(std::string &error);\n+ bool check_arguments(std::vector<std::string> &error);\nprivate:\n/*!\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/bash_tools.cpp",
"new_path": "src/Tools/Display/bash_tools.cpp",
"diff": "@@ -66,6 +66,12 @@ std::string bg_color_reset_command = \"\\e[49m\";\nstd::string aff3ct::tools::format(std::string str, Format f)\n+{\n+#ifndef ENABLE_COOL_BASH\n+ return str;\n+#else\n+\n+ if (enable_bash_tools)\n{\nconstexpr Format style_mask = (((Format)1 << 31) + (((Format)1 << 31) -1)) ^ (((Format)1 << 20) -1);\nstr = style(str, (Style)(f & style_mask));\n@@ -77,8 +83,11 @@ std::string aff3ct::tools::format(std::string str, Format f)\nconstexpr Format fg_intensity_mask = (((Format)1 << 10) -1) ^ (((Format)1 << 8) -1);\nconstexpr Format fg_color_mask = (((Format)1 << 8) -1);\nstr = fg_color(str, (FG::Color)(f & fg_color_mask), (FG::Intensity)(f & fg_intensity_mask));\n+ }\nreturn str;\n+\n+#endif\n}\nstd::string aff3ct::tools::style(std::string str, Style s)\n@@ -157,7 +166,7 @@ std::string aff3ct::tools::default_style(std::string str)\nstd::string aff3ct::tools::format_error(std::string str)\n{\n- return format(\"(EE) \" + str, FG::Color::RED | FG::Intensity::NORMAL);\n+ return format(\"(EE) \" + str, FG::Color::RED | FG::Intensity::INTENSE);\n}\nstd::string aff3ct::tools::format_critical_error(std::string str)\n@@ -203,8 +212,7 @@ std::string aff3ct::tools::apply_on_each_line(const std::string& str, format_fun\nold_pos = pos+1;\n}\n- if (pos == str.npos && old_pos == 0)\n- formated = fptr(str);\n+ formated += fptr(str.substr(old_pos, pos-old_pos));\nreturn formated;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "@@ -168,10 +168,11 @@ void read_arguments(const int argc, const char** argv, std::string &code_type, s\nstd::exit(EXIT_FAILURE);\n}\n- std::string error;\n+ std::vector<std::string> error;\nif (!ar.check_arguments(error))\n{\n- std::cerr << apply_on_each_line(error, format_error) << std::endl;\n+ for (auto w = 0; w < (int)error.size(); w++)\n+ std::cerr << format_error(error[w]) << std::endl;\nstd::exit(EXIT_FAILURE);\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change argument reader and launcher to display all warnings just after the command line.
|
8,483 |
20.06.2017 10:05:37
| -7,200 |
2f599a4a329148a9c286cd4a2054006f344bb5dc
|
Add information message to give help tags after an wrong argument error message.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -506,6 +506,16 @@ int Launcher<B,R,Q>\nar.print_usage(arg_grp);\nerror = true;\n}\n+ else if (error)\n+ {\n+ std::string message = \"For more information please display the help (\";\n+ std::vector<std::string> help_tag = {\"help\", \"h\"};\n+ for (unsigned i = 0; i < help_tag.size(); i++)\n+ message += Arguments_reader::print_tag(help_tag[i]) + ((i < help_tag.size()-1)?\", \":\"\");\n+\n+ message += \").\";\n+ std::cerr << format_info(message) << std::endl;\n+ }\nreturn (error?EXIT_FAILURE:EXIT_SUCCESS);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.hpp",
"new_path": "src/Tools/Arguments_reader.hpp",
"diff": "@@ -156,6 +156,12 @@ public:\n*/\nbool check_arguments(std::vector<std::string> &error);\n+ /*\n+ * return the given tag with its command line argument format.\n+ * Add \"-\" before if tag is one letter length else \"--\".\n+ */\n+ static std::string print_tag(const std::string& tag);\n+\nprivate:\n/*!\n* \\brief Returns true if the argument \"m_argv[pos_arg]\" is in args.\n@@ -198,8 +204,6 @@ private:\nvoid print_usage(const std::vector<std::string> &tags, const std::vector<std::string> &values,\nconst bool required = false);\n- std::string print_tag(const std::string& tag);\n-\n/*!\n* \\brief Splits a string in a vector of string, the delimiter is the comma.\n*\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add information message to give help tags after an wrong argument error message.
|
8,490 |
20.06.2017 11:31:42
| -7,200 |
30554988fb8ae55826c22a3909f2066d4fe457cd
|
Improve the exceptions in the module::CRC.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/CRC.hpp",
"new_path": "src/Module/CRC/CRC.hpp",
"diff": "#include <string>\n#include <vector>\n-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -47,7 +48,11 @@ public:\n: Module(n_frames, name), K(K)\n{\nif (K <= 0)\n- throw std::invalid_argument(\"aff3ct::module::CRC: \\\"K\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n@@ -79,11 +84,21 @@ public:\nvoid build(const mipp::vector<B>& U_K1, mipp::vector<B>& U_K2)\n{\nif (this->K * this->n_frames != (int)U_K1.size())\n- throw std::length_error(\"aff3ct::module::CRC: \\\"U_K1.size()\\\" has to be equal to \\\"K\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'U_K1.size()' has to be equal to 'K' * 'n_frames' ('U_K1.size()' = \" << U_K1.size()\n+ << \", 'K' = \" << this->K << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif ((this->K + this->get_size()) * this->n_frames != (int)U_K2.size())\n- throw std::length_error(\"aff3ct::module::CRC: \\\"U_K2.size()\\\" has to be equal to \"\n- \"\\\"K + size\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'U_K2.size()' has to be equal to ('K' + 'get_size()') * 'n_frames' ('U_K2.size()' = \"\n+ << U_K2.size() << \", 'K' = \" << this->K << \", 'get_size()' = \" << this->get_size()\n+ << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->build(U_K1.data(), U_K2.data());\n}\n@@ -99,11 +114,21 @@ public:\nvoid extract(const mipp::vector<B>& V_K1, mipp::vector<B>& V_K2)\n{\nif ((this->K + this->get_size()) * this->n_frames != (int)V_K1.size())\n- throw std::length_error(\"aff3ct::module::CRC: \\\"V_K1.size()\\\" has to be equal to \"\n- \"\\\"K + size\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'V_K1.size()' has to be equal to ('K' + 'get_size()') * 'n_frames' ('V_K1.size()' = \"\n+ << V_K1.size() << \", 'K' = \" << this->K << \", 'get_size()' = \" << this->get_size()\n+ << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (this->K * this->n_frames != (int)V_K2.size())\n- throw std::length_error(\"aff3ct::module::CRC: \\\"V_K2.size()\\\" has to be equal to \\\"K\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'V_K2.size()' has to be equal to 'K' * 'n_frames' ('V_K2.size()' = \" << V_K2.size()\n+ << \", 'K' = \" << this->K << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->extract(V_K1.data(), V_K2.data());\n}\n@@ -127,14 +152,22 @@ public:\n*/\nbool check(const mipp::vector<B>& V_K, const int n_frames = -1)\n{\n+ if (n_frames <= 0 && n_frames != -1)\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 or equal to -1 ('n_frames' = \" << n_frames << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((this->K + (int)this->get_size()) * n_frames != (int)V_K.size() &&\n(this->K + (int)this->get_size()) * this->n_frames != (int)V_K.size())\n- throw std::length_error(\"aff3ct::module::CRC: \\\"V_K.size()\\\" has to be equal to \"\n- \"\\\"K + size\\\" * \\\"n_frames\\\".\");\n-\n- if (n_frames <= 0 && n_frames != -1)\n- throw std::invalid_argument(\"aff3ct::module::CRC: \\\"n_frames\\\" has to be greater than 0 (or equal \"\n- \"to -1).\");\n+ {\n+ std::stringstream message;\n+ message << \"'V_K.size()' has to be equal to ('K' + 'size') * 'n_frames' ('V_K.size()' = \" << V_K.size()\n+ << \", 'K' = \" << this->K\n+ << \", 'n_frames' = \" << (n_frames != -1 ? n_frames : this->n_frames) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nreturn this->check(V_K.data(), n_frames);\n}\n@@ -161,14 +194,22 @@ public:\n*/\nbool check_packed(const mipp::vector<B>& V_K, const int n_frames = -1)\n{\n- if ((this->K + this->get_size()) * n_frames != (int)V_K.size() &&\n- (this->K + this->get_size()) * this->n_frames != (int)V_K.size())\n- throw std::length_error(\"aff3ct::module::CRC: \\\"V_K.size()\\\" has to be equal to \"\n- \"\\\"K + size\\\" * \\\"n_frames\\\".\");\n-\nif (n_frames <= 0 && n_frames != -1)\n- throw std::invalid_argument(\"aff3ct::module::CRC: \\\"n_frames\\\" has to be greater than 0 (or equal \"\n- \"to -1).\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 or equal to -1 ('n_frames' = \" << n_frames << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if ((this->K + (int)this->get_size()) * n_frames != (int)V_K.size() &&\n+ (this->K + (int)this->get_size()) * this->n_frames != (int)V_K.size())\n+ {\n+ std::stringstream message;\n+ message << \"'V_K.size()' has to be equal to ('K' + 'size') * 'n_frames' ('V_K.size()' = \" << V_K.size()\n+ << \", 'K' = \" << this->K\n+ << \", 'n_frames' = \" << (n_frames != -1 ? n_frames : this->n_frames) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nreturn this->check_packed(V_K.data(), n_frames);\n}\n@@ -187,23 +228,23 @@ public:\nprotected:\nvirtual void _build(const B *U_K1, B *U_K2, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::CRC: \\\"_build\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\nvirtual void _extract(const B *V_K1, B *V_K2, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::CRC: \\\"_extract\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\nvirtual bool _check(const B *V_K, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::CRC: \\\"_check\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\nreturn false;\n}\nvirtual bool _check_packed(const B *V_K, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::CRC: \\\"_check_packed\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\nreturn false;\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial.cpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial.cpp",
"diff": "-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Algo/Bit_packer.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n@@ -18,14 +19,14 @@ CRC_polynomial<B>\nbuff_crc (0 )\n{\nif (poly_key.empty())\n- throw std::invalid_argument(\"aff3ct::module::CRC_polynomial: \\\"poly_key\\\" can't be empty, choose a CRC.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"'poly_key' can't be empty, choose a CRC.\");\nif (!polynomial_packed)\n- throw std::invalid_argument(\"aff3ct::module::CRC_polynomial: CRC \\\"\" + poly_key + \"\\\" is not supported.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"CRC '\" + poly_key + \"' is not supported.\");\nauto crc_name = CRC_polynomial<B>::name(poly_key);\nif (size == 0 && crc_name.empty())\n- throw std::invalid_argument(\"aff3ct::module::CRC_polynomial: please specify the CRC \\\"size\\\".\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"Please specify the CRC 'size'.\");\nif (size)\npoly_size = size;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial_fast.cpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial_fast.cpp",
"diff": "-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Algo/Bit_packer.hpp\"\n@@ -14,8 +15,11 @@ CRC_polynomial_fast<B>\n: CRC_polynomial<B>(K, poly_key, size, n_frames, name), lut_crc32(256), polynomial_packed_rev(0)\n{\nif (this->get_size() > 32)\n- throw std::length_error(\"aff3ct::module::CRC_polynomial_fast: \\\"this->size()\\\" has to be equal or smaller \"\n- \"than 32.\");\n+ {\n+ std::stringstream message;\n+ message << \"'get_size()' has to be equal or smaller than 32 ('get_size()' = \" << this->get_size() << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n// reverse the order of the bits in the bitpacked polynomial\nfor (auto i = 0; i < (int)sizeof(this->polynomial_packed) * 8; i++)\n@@ -40,8 +44,7 @@ void CRC_polynomial_fast<B>\n::_build(const B *U_K1, B *U_K2, const int frame_id)\n{\n#if __BYTE_ORDER != __LITTLE_ENDIAN\n- throw std::runtime_error(\"aff3ct::module::CRC_polynomial_fast: the code of the fast CRC works only on \"\n- \"little endian CPUs (x86, ARM, ...)\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The code of the fast CRC works only on little endian CPUs.\");\n#endif\nBit_packer<B>::pack(U_K1, this->buff_crc.data(), this->K);\n@@ -67,8 +70,7 @@ bool CRC_polynomial_fast<B>\n::_check_packed(const B *V_K, const int frame_id)\n{\n#if __BYTE_ORDER != __LITTLE_ENDIAN\n- throw std::runtime_error(\"aff3ct::module::CRC_polynomial_fast: the code of the fast CRC works only on \"\n- \"little endian CPUs (x86, ARM, ...)\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The code of the fast CRC works only on little endian CPUs.\");\n#endif\nconst auto crc_size = this->get_size();\n@@ -109,8 +111,7 @@ unsigned CRC_polynomial_fast<B>\n::compute_crc_v1(const void* data, const int n_bits)\n{\n#if __BYTE_ORDER != __LITTLE_ENDIAN\n- throw std::runtime_error(\"aff3ct::module::CRC_polynomial_fast: the code of the fast CRC works only on \"\n- \"little endian CPUs (x86, ARM, ...)\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The code of the fast CRC works only on little endian CPUs.\");\n#endif\nunsigned crc = 0;\n@@ -147,8 +148,7 @@ unsigned CRC_polynomial_fast<B>\n::compute_crc_v2(const void* data, const int n_bits)\n{\n#if __BYTE_ORDER != __LITTLE_ENDIAN\n- throw std::runtime_error(\"aff3ct::module::CRC_polynomial_fast: the code of the fast CRC works only on \"\n- \"little endian CPUs (x86, ARM, ...)\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The code of the fast CRC works only on little endian CPUs.\");\n#endif\nunsigned crc = 0;\n@@ -185,8 +185,7 @@ unsigned CRC_polynomial_fast<B>\n::compute_crc_v3(const void* data, const int n_bits)\n{\n#if __BYTE_ORDER != __LITTLE_ENDIAN\n- throw std::runtime_error(\"aff3ct::module::CRC_polynomial_fast: the code of the fast CRC works only on \"\n- \"little endian CPUs (x86, ARM, ...)\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The code of the fast CRC works only on little endian CPUs.\");\n#endif\nunsigned crc = 0;\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": "-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"CRC_polynomial_inter.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nCRC_polynomial_inter<B>\n@@ -21,8 +23,12 @@ bool CRC_polynomial_inter<B>\nconst int real_n_frames = (n_frames != -1) ? n_frames : this->n_frames;\nif (real_n_frames != mipp::nElReg<B>())\n- throw std::invalid_argument(\"aff3ct::module::CRC_polynomial_inter: \\\"n_frames\\\" has to be equal to \"\n- \"\\\"mipp::nElReg<B>()\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'real_n_frames' has to be equal to 'mipp::nElReg<B>()' ('real_n_frames' = \" << real_n_frames\n+ << \", 'mipp::nElReg<B>()' = \" << mipp::nElReg<B>() << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->_generate_INTER(V_K, this->buff_crc.data(),\n0,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/SC_CRC.hpp",
"new_path": "src/Module/CRC/SC_CRC.hpp",
"diff": "#ifdef SYSTEMC_MODULE\n#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n#include <tlm_utils/simple_initiator_socket.h>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -48,7 +49,14 @@ private:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (crc.get_K() * crc.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n- throw std::length_error(\"aff3ct::module::CRC: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'crc.get_K()' * 'crc.get_n_frames()' has to be equal to 'trans.get_data_length()' / 'sizeof(B)'\"\n+ << \"('crc.get_K()' = \" << crc.get_K() << \", 'crc.get_n_frames()' = \" << crc.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto U_K1 = (B*)trans.get_data_ptr();\n@@ -87,7 +95,16 @@ private:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif ((crc.get_K() + crc.get_size()) * crc.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n- throw std::length_error(\"aff3ct::module::CRC: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"('crc.get_K()' + 'crc.get_size()') * 'crc.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(B)' ('crc.get_K()' = \" << crc.get_K()\n+ << \", 'crc.get_size()' = \" << crc.get_size()\n+ << \", 'crc.get_n_frames()' = \" << crc.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto V_K1 = (B*)trans.get_data_ptr();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::CRC.
|
8,490 |
21.06.2017 15:21:13
| -7,200 |
6fae1d3273c31293d516bc871c6cea373e174b1b
|
Improve the exceptions in the module::Encoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Encoder.hpp",
"new_path": "src/Module/Encoder/Encoder.hpp",
"diff": "#include <string>\n#include <vector>\n-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -49,11 +50,25 @@ public:\n: Module(n_frames, name), K(K), N(N)\n{\nif (K <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Encoder: \\\"K\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Encoder: \\\"N\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be greater than 0 ('N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (K > N)\n- throw std::invalid_argument(\"aff3ct::module::Encoder: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be smaller or equal to 'N' ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n@@ -82,12 +97,21 @@ public:\nvoid encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n{\nif (this->K * this->n_frames != (int)U_K.size())\n- throw std::length_error(\"aff3ct::module::Encoder: \\\"U_K.size()\\\" has to be equal to \"\n- \"\\\"K\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'U_K.size()' has to be equal to 'K' * 'n_frames' ('U_K.size()' = \" << U_K.size()\n+ << \", 'K' = \" << this->K\n+ << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (this->N * this->n_frames != (int)X_N.size())\n- throw std::length_error(\"aff3ct::module::Encoder: \\\"X_N.size()\\\" has to be equal to \"\n- \"\\\"N\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'X_N.size()' has to be equal to 'N' * 'n_frames' ('X_N.size()' = \"\n+ << \", 'N' = \" << this->N << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->encode(U_K.data(), X_N.data());\n}\n@@ -113,7 +137,7 @@ public:\nprotected:\nvirtual void _encode(const B *U_K, B *X_N, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::Encoder: \\\"_encode\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Encoder_sys.hpp",
"new_path": "src/Module/Encoder/Encoder_sys.hpp",
"diff": "#ifndef ENCODER_SYS_HPP_\n#define ENCODER_SYS_HPP_\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder.hpp\"\n@@ -58,12 +60,20 @@ public:\nvoid encode_sys(const mipp::vector<B>& U_K, mipp::vector<B>& par)\n{\nif (this->K * this->n_frames != (int)U_K.size())\n- throw std::length_error(\"aff3ct::module::Encoder_sys: \\\"U_K.size()\\\" has to be equal to \"\n- \"\\\"K\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'U_K.size()' has to be equal to 'K' * 'n_frames' ('U_K.size()' = \" << U_K.size()\n+ << \", 'K' = \" << this->K << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif ((this->N - this->K) * this->n_frames != (int)par.size())\n- throw std::length_error(\"aff3ct::module::Encoder_sys: \\\"par.size()\\\" has to be equal to \"\n- \"(\\\"N\\\" - \\\"K\\\") * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'par.size()' has to be equal to ('N' - 'K') * 'n_frames' ('par.size()' = \" << par.size()\n+ << \", 'N' = \" << this->N << \", 'K' = \" << this->K << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->encode_sys(U_K.data(), par.data());\n}\n@@ -79,7 +89,7 @@ public:\nprotected:\nvirtual void _encode_sys(const B *U_K, B *par, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::Encoder_sys: \\\"_encode_sys\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"diff": "-#include <stdexcept>\n#include <iostream>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/matrix.h\"\n#include \"Encoder_LDPC_DVBS2.hpp\"\n-using namespace aff3ct;\n-using namespace module;\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_LDPC_DVBS2<B>\n@@ -17,13 +18,27 @@ Encoder_LDPC_DVBS2<B>\nbuild_dvbs2();\nif (!dvbs2)\n- throw std::runtime_error(\"aff3ct::module::Encoder_LDPC_DVBS2: the given format does not match any known \"\n- \"generator matrix.\");\n+ {\n+ std::stringstream message;\n+ message << \"The given format doesn't match any known generator matrix ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (K != dvbs2->K_LDPC)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_LDPC_DVBS2: \\\"K\\\" has to be equal to \\\"dvbs2->K_LDPC\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be equal to 'dvbs2->K_LDPC' ('K' = \" << K\n+ << \", 'dvbs2->K_LDPC' = \" << dvbs2->K_LDPC << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N != dvbs2->N_LDPC)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_LDPC_DVBS2: \\\"N\\\" has to be equal to \\\"dvbs2->N_LDPC\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be equal to 'dvbs2->N_LDPC' ('N' = \" << N\n+ << \", 'dvbs2->N_LDPC' = \" << dvbs2->N_LDPC << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "#include <numeric>\n#include <iostream>\n-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/matrix.h\"\n#include \"Encoder_LDPC.hpp\"\n-using namespace aff3ct;\n-using namespace module;\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_LDPC<B>\n@@ -23,9 +24,21 @@ Encoder_LDPC<B>\nconst std::string name)\n: Encoder<B>(K, N, n_frames, name), tG(N * K, 0)\n{\n- if (K != (int)G.get_n_cols() || N != (int)G.get_n_rows())\n- throw std::invalid_argument(\"aff3ct::module::Encoder_LDPC: \\\"G\\\" matrix dimensions are not compatible with \"\n- \"\\\"K\\\" and \\\"N\\\".\");\n+ if (K != (int)G.get_n_cols())\n+ {\n+ std::stringstream message;\n+ message << \"The built G matrix has a dimension 'K' different than the given one ('K' = \" << K\n+ << \", 'G.get_n_cols()' = \" << G.get_n_cols() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (N != (int)G.get_n_rows())\n+ {\n+ std::stringstream message;\n+ message << \"The built G matrix has a dimension 'N' different than the given one ('N' = \" << N\n+ << \", 'G.get_n_rows()' = \" << G.get_n_rows() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nauto CN_to_VN = G.get_col_to_rows();\n@@ -47,9 +60,13 @@ template <typename B>\nvoid Encoder_LDPC<B>\n::get_info_bits_pos(std::vector<unsigned>& info_bits_pos)\n{\n- if (this->K > (int)info_bits_pos.size())\n- throw std::length_error(\"aff3ct::module::Encoder_LDPC: \\\"info_bits_pos.size()\\\" has to be equal or greater \"\n- \"than \\\"K\\\".\");\n+ if (this->K != (int)info_bits_pos.size())\n+ {\n+ std::stringstream message;\n+ message << \"'info_bits_pos.size()' has to be equal to 'K' ('info_bits_pos.size()' = \" << info_bits_pos.size()\n+ << \", 'K' = \" << this->K << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nstd::iota(info_bits_pos.begin(), info_bits_pos.begin() + this->K, 0);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "-#include <stdexcept>\n#include <iostream>\n#include <vector>\n#include <numeric>\n#include <functional>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/matrix.h\"\n#include \"Encoder_LDPC_from_H.hpp\"\n-using namespace aff3ct;\n-using namespace module;\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_LDPC_from_H<B>\n@@ -19,13 +20,21 @@ Encoder_LDPC_from_H<B>\n: Encoder_LDPC<B>(K, N, n_frames, name), G(tools::LDPC_matrix_handler::transform_H_to_G(H, info_bits_pos))\n{\n// warning G is transposed !\n- if (this->K != (int)G.get_n_cols())\n- throw std::runtime_error(\"aff3ct::module::Encoder_LDPC_from_H: the built G matrix has a dimension \\\"K\\\" \"\n- \"different than the given one.\");\n+ if (K != (int)G.get_n_cols())\n+ {\n+ std::stringstream message;\n+ message << \"The built G matrix has a dimension 'K' different than the given one ('K' = \" << K\n+ << \", 'G.get_n_cols()' = \" << G.get_n_cols() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n- if (this->N != (int)G.get_n_rows())\n- throw std::runtime_error(\"aff3ct::module::Encoder_LDPC_from_H: the built G matrix has a dimension \\\"N\\\" \"\n- \"different than the given one.\");\n+ if (N != (int)G.get_n_rows())\n+ {\n+ std::stringstream message;\n+ message << \"The built G matrix has a dimension 'N' different than the given one ('N' = \" << N\n+ << \", 'G.get_n_rows()' = \" << G.get_n_rows() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n@@ -39,8 +48,12 @@ void Encoder_LDPC_from_H<B>\n::get_info_bits_pos(std::vector<unsigned>& info_bits_pos)\n{\nif (this->K != (int)info_bits_pos.size())\n- throw std::length_error(\"aff3ct::module::Encoder_LDPC_from_H: \\\"info_bits_pos.size()\\\" has to be equal \"\n- \"or greater than \\\"K\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'info_bits_pos.size()' has to be equal to 'K' ('info_bits_pos.size()' = \" << info_bits_pos.size()\n+ << \", 'K' = \" << this->K << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nstd::copy(this->info_bits_pos.begin(), this->info_bits_pos.end(), info_bits_pos.begin());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Polar/Encoder_polar.cpp",
"new_path": "src/Module/Encoder/Polar/Encoder_polar.cpp",
"diff": "-#include <stdexcept>\n#include <vector>\n#include <cmath>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_polar.hpp\"\n@@ -13,8 +15,21 @@ Encoder_polar<B>\n: Encoder<B>(K, N, n_frames, name), m((int)std::log2(N)), frozen_bits(frozen_bits)\n{\nif (this->N != (int)frozen_bits.size())\n- throw std::length_error(\"aff3ct::module::Encoder_polar: \\\"frozen_bits.size()\\\" has to be equal to \"\n- \"\\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'frozen_bits.size()' has to be equal to 'N' ('frozen_bits.size()' = \" << frozen_bits.size()\n+ << \", 'N' = \" << N << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ auto k = 0; for (auto i = 0; i < this->N; i++) if (frozen_bits[i] == 0) k++;\n+ if (this->K != k)\n+ {\n+ std::stringstream message;\n+ message << \"The number of information bits in the frozen_bits is invalid ('K' = \" << K << \", 'k' = \"\n+ << k << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/RA/Encoder_RA.cpp",
"new_path": "src/Module/Encoder/RA/Encoder_RA.cpp",
"diff": "-#include <stdexcept>\n#include <vector>\n#include <cmath>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_RA.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_RA<B>\n@@ -12,9 +15,19 @@ Encoder_RA<B>\n: Encoder<B>(K, N, n_frames, name), rep_count(N/K), U(N), tmp_X_N(N), interleaver(interleaver)\n{\nif (N % K)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_RA: \\\"K\\\" has to be a multiple of \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be a multiple of 'N' ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)interleaver.get_size() != N)\n- throw std::length_error(\"aff3ct::module::Encoder_RA: \\\"interleaver.get_size()\\\" has to be equal to \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'interleaver.get_size()' has to be equal to 'N' ('interleaver.get_size()' = \"\n+ << interleaver.get_size() << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/RSC/Encoder_RSC_generic_json_sys.cpp",
"new_path": "src/Module/Encoder/RSC/Encoder_RSC_generic_json_sys.cpp",
"diff": "#include <vector>\n#include <cmath>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_RSC_generic_json_sys.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_RSC_generic_json_sys<B>\n@@ -13,7 +17,11 @@ Encoder_RSC_generic_json_sys<B>\nstream(stream), bit_counter(0), natural_domain(true), poly(poly)\n{\nif (n_frames != 1)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_RSC_generic_json_sys: \\\"n_frames\\\" has to be equal to 1.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be equal to 1 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/RSC/Encoder_RSC_generic_sys.cpp",
"new_path": "src/Module/Encoder/RSC/Encoder_RSC_generic_sys.cpp",
"diff": "-#include <stdexcept>\n#include <vector>\n#include <cmath>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_RSC_generic_sys.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_RSC_generic_sys<B>\n@@ -16,11 +19,19 @@ Encoder_RSC_generic_sys<B>\nsys_tail ()\n{\nif (poly.size() < 2)\n- throw std::length_error(\"aff3ct::module::Encoder_RSC_generic_sys: \\\"poly.size()\\\" has to be equal or greater \"\n- \"than 2.\");\n+ {\n+ std::stringstream message;\n+ message << \"'poly.size()' has to be equal or greater than 2 ('poly.size()' = \" << poly.size() << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (std::floor(std::log2(poly[0])) != std::floor(std::log2(poly[1])))\n- throw std::invalid_argument(\"aff3ct::module::Encoder_RSC_generic_sys: \\\"log2(poly[0])\\\" has to be equal \"\n- \"to \\\"log2(poly[1])\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"floor(log2('poly[0]')) has to be equal to floor(log2('poly[1]')) ('poly[0]' = \" << poly[0]\n+ << \", 'poly[1]' = \" << poly[1] << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nfor (auto s = 0; s < this->n_states; s++)\n{\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": "#ifdef _MSC_VER\n#include <iterator>\n#endif\n+#include <sstream>\n-#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_RSC_sys.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_RSC_sys<B>\n@@ -15,10 +17,20 @@ Encoder_RSC_sys<B>\n: Encoder_sys<B>(K, N, n_frames, name), n_ff(n_ff), n_states(1 << n_ff),\nbuffered_encoding(buffered_encoding)\n{\n- if (N - 2*n_ff != 2 * K)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_RSC_sys: \\\"N\\\" / \\\"K\\\" has to be a equal to 2.\");\nif (n_ff <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_RSC_sys: \\\"n_ff\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_ff' has to be greater than 0 ('n_ff' = \" << n_ff << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (N - 2 * n_ff != 2 * K)\n+ {\n+ std::stringstream message;\n+ message << \"'N' - 2 * 'n_ff' has to be equal to 2 * 'K' ('N' = \" << N << \", 'n_ff' = \" << n_ff\n+ << \", 'K' = \" << K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n@@ -130,19 +142,32 @@ void Encoder_RSC_sys<B>\n}\nif (state != 0)\n- throw std::runtime_error(\"aff3ct::module::Encoder_RSC_sys: \\\"state\\\" should be equal to 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'state' should be equal to 0 ('state' = \" << state << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (!only_parity)\n{\nif (j != this->N * stride)\n- throw std::runtime_error(\"aff3ct::module::Encoder_RSC_sys: \\\"j\\\" should be equal to \\\"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 runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nelse\n{\nj += this->n_ff * stride;\nif (j != (this->K + 2*this->n_ff) * stride)\n- throw std::runtime_error(\"aff3ct::module::Encoder_RSC_sys: \\\"j\\\" should be equal to \"\n- \"(\\\"K\\\" + 2 * \\\"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 runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Repetition/Encoder_repetition_sys.cpp",
"new_path": "src/Module/Encoder/Repetition/Encoder_repetition_sys.cpp",
"diff": "-#include <stdexcept>\n#include <vector>\n#include <cmath>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_repetition_sys.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_repetition_sys<B>\n@@ -12,7 +15,11 @@ Encoder_repetition_sys<B>\n: Encoder_sys<B>(K, N, n_frames, name), rep_count((N/K) -1), buffered_encoding(buffered_encoding)\n{\nif (N % K)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_repetition_sys: \\\"K\\\" has to be a multiple of \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be a multiple of 'N' ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n@@ -20,8 +27,7 @@ void Encoder_repetition_sys<B>\n::_encode_sys(const B *U_K, B *par, const int frame_id)\n{\nif (!buffered_encoding)\n- throw std::runtime_error(\"aff3ct::module::Encoder_repetition_sys: the \\\"_encode_sys\\\" method works only with \"\n- \"the \\\"buffered_encoding\\\" enabled.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"Works only with the 'buffered_encoding' enabled.\");\nfor (auto i = 0; i < rep_count; i++) // parity bits\nstd::copy(U_K, U_K + this->K, par + i * this->K);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/SC_Encoder.hpp",
"new_path": "src/Module/Encoder/SC_Encoder.hpp",
"diff": "#ifdef SYSTEMC_MODULE\n#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n#include <tlm_utils/simple_initiator_socket.h>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -48,7 +49,15 @@ private:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (encoder.get_K() * encoder.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n- throw std::length_error(\"aff3ct::module::Encoder: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.get_K()' * 'encoder.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(B)' ('encoder.get_K()' = \" << encoder.get_K()\n+ << \", 'encoder.get_n_frames()' = \" << encoder.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, \"aff3ct::module::Encoder: TLM input data size is invalid.\");\n+ }\nconst auto U_K = (B*)trans.get_data_ptr();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp",
"new_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp",
"diff": "-#include <stdexcept>\n#include <vector>\n#include <cmath>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_turbo.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\n// [sys | pn | pi | tailn | taili]\n@@ -21,9 +24,22 @@ Encoder_turbo<B>\npar_i(((N - (enco_n.tail_length() + enco_i.tail_length()) - K) / 2 + enco_i.tail_length()) * n_frames)\n{\nif (N - (enco_n.tail_length() + enco_i.tail_length()) != 3 * K)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_turbo: \\\"N\\\" / \\\"K\\\" has to be equal to 3.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' - ('enco_n.tail_length()' + 'enco_i.tail_length()') has to be equal to 3 * 'K' ('N' = \" << N\n+ << \", 'enco_n.tail_length()' = \" << enco_n.tail_length()\n+ << \", 'enco_i.tail_length()' = \" << enco_i.tail_length()\n+ << \", 'K' = \" << K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)pi.get_size() != K)\n- throw std::length_error(\"aff3ct::module::Encoder_turbo: \\\"pi.get_size()\\\" has to be equal to \\\"K\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'pi.get_size()' has to be equal to 'K' ('pi.get_size()' = \" << pi.get_size()\n+ << \", 'K' = \" << K << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.cpp",
"new_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.cpp",
"diff": "-#include <stdexcept>\n#include <vector>\n#include <cmath>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_turbo_legacy.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_turbo_legacy<B>\n@@ -18,9 +21,20 @@ Encoder_turbo_legacy<B>\nX_N_i((2 * (K + sub_enc.tail_length()/2))*n_frames)\n{\nif (N - 2 * sub_enc.tail_length() != 3 * K)\n- throw std::invalid_argument(\"aff3ct::module::Encoder_turbo_legacy: \\\"N\\\" / \\\"K\\\" has to be equal to 3.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' - 2 * 'sub_enc.tail_length()' has to be equal to 3 * 'K' ('N' = \" << N\n+ << \", 'sub_enc.tail_length()' = \" << sub_enc.tail_length() << \", 'K' = \" << K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)pi.get_size() != K)\n- throw std::length_error(\"aff3ct::module::Encoder_turbo_legacy: \\\"pi.get_size()\\\" has to be equal to \\\"K\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'pi.get_size()' has to be equal to 'K' ('pi.get_size()' = \" << pi.get_size()\n+ << \", 'K' = \" << K << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/User/Encoder_user.cpp",
"new_path": "src/Module/Encoder/User/Encoder_user.cpp",
"diff": "#include <fstream>\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Encoder_user.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_user<B>\n@@ -11,7 +14,7 @@ Encoder_user<B>\n: Encoder<B>(K, N, n_frames, name), codewords(), cw_counter(0)\n{\nif (filename.empty())\n- throw std::invalid_argument(\"aff3ct::module::Encoder_user: path to the file should not be empty.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"'filename' should not be empty.\");\nstd::ifstream file(filename.c_str(), std::ios::in);\n@@ -24,12 +27,20 @@ Encoder_user<B>\nfile >> src_size;\nif (n_cw <= 0 || src_size <= 0 || cw_size <= 0)\n- throw std::runtime_error(\"aff3ct::module::Encoder_user: \\\"n_cw\\\", \\\"src_size\\\" and \\\"cw_size\\\" have to be \"\n- \"greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_cw', 'src_size' and 'cw_size' have to be greater than 0 ('n_cw' = \" << n_cw\n+ << \", 'src_size' = \" << src_size << \", 'cw_size' = \" << cw_size << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (cw_size < src_size)\n- throw std::runtime_error(\"aff3ct::module::Encoder_user: \\\"cw_size\\\" has to be equal or greater than \"\n- \"\\\"src_size\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'cw_size' has to be equal or greater than 'src_size' ('cw_size' = \" << cw_size\n+ << \", 'src_size' = \" << src_size << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->codewords.resize(n_cw);\nfor (auto i = 0; i < n_cw; i++)\n@@ -49,17 +60,20 @@ Encoder_user<B>\n{\nfile.close();\n- throw std::runtime_error(\"aff3ct::module::Encoder_user: the number of information bits or the codeword \"\n- \"size is wrong (read: {\" + std::to_string(src_size) + \",\" +\n- std::to_string(cw_size) + \"}, expected: {\" + std::to_string(this->K) + \",\" +\n- std::to_string(this->N) + \"}).\");\n+ std::stringstream message;\n+ message << \"The number of information bits or the codeword size is wrong \"\n+ << \"(read: {\" << src_size << \",\" << cw_size << \"}, \"\n+ << \"expected: {\" << this->K << \",\" << this->N << \"}).\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\nfile.close();\n}\nelse\n{\n- throw std::invalid_argument(\"aff3ct::module::Encoder_user: can't open \\\"\" + filename + \"\\\" file.\");\n+ std::stringstream message;\n+ message << \"Can't open '\" + filename + \"' file.\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::Encoder.
|
8,490 |
21.06.2017 16:02:47
| -7,200 |
2ed489fa48bf863a5a5f95576883cc513957dccc
|
Improve the exceptions in the module::Interleaver.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp",
"new_path": "src/Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp",
"diff": "#ifndef INTERLEAVER_CCSDS_HPP\n#define INTERLEAVER_CCSDS_HPP\n-#include <stdexcept>\n#include <map>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"../Interleaver.hpp\"\n@@ -41,9 +43,10 @@ protected:\n}\nelse\n{\n- throw std::runtime_error(\"aff3ct::module::Interleaver_CCSDS: there is no CCSDS k_1 and k_2 parameters \"\n- \"for \\\"size\\\" = \" + std::to_string(size) + \"(supported size are K = {1784, 3568, \"\n- \"7136, 8920}.\");\n+ std::stringstream message;\n+ message << \"There is no CCSDS k_1 and k_2 parameters for 'size' = \" << size\n+ << \"(supported sizes are 1784, 3568, 7136 and 8920).\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Interleaver.hpp",
"new_path": "src/Module/Interleaver/Interleaver.hpp",
"diff": "#ifndef INTERLEAVER_HPP_\n#define INTERLEAVER_HPP_\n-#include <stdexcept>\n#include <typeinfo>\n#include <string>\n#include <vector>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -54,7 +56,11 @@ public:\nsize(size), uniform(uniform), pi(size * n_frames), pi_inv(size * n_frames), init_called(false)\n{\nif (size <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Interleaver: \\\"size\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'size' has to be greater than 0 ('size' = \" << size << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n@@ -117,12 +123,21 @@ public:\ninline void interleave(const mipp::vector<D> &natural_vec, mipp::vector<D> &interleaved_vec) const\n{\nif (natural_vec.size() != interleaved_vec.size())\n- throw std::length_error(\"aff3ct::module::Interleaver: \\\"natural_vec.size()\\\" has to be equal to \"\n- \"\\\"interleaved_vec.size()\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'natural_vec.size()' has to be equal to 'interleaved_vec.size()' ('natural_vec.size()' = \"\n+ << natural_vec.size() << \", 'interleaved_vec.size()' = \" << interleaved_vec.size() << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif ((int)natural_vec.size() < this->get_size() * this->n_frames)\n- throw std::length_error(\"aff3ct::module::Interleaver: \\\"natural_vec.size()\\\" has to be equal or greater \"\n- \"than \\\"this->get_size()\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'natural_vec.size()' has to be equal or greater than 'get_size()' * 'n_frames' \"\n+ << \"('natural_vec.size()' = \" << natural_vec.size() << \", 'get_size()' = \" << this->get_size()\n+ << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->interleave(natural_vec.data(), interleaved_vec.data());\n}\n@@ -162,12 +177,21 @@ public:\ninline void deinterleave(const mipp::vector<D> &interleaved_vec, mipp::vector<D> &natural_vec) const\n{\nif (natural_vec.size() != interleaved_vec.size())\n- throw std::length_error(\"aff3ct::module::Interleaver: \\\"natural_vec.size()\\\" has to be equal to \"\n- \"\\\"interleaved_vec.size()\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'natural_vec.size()' has to be equal to 'interleaved_vec.size()' ('natural_vec.size()' = \"\n+ << natural_vec.size() << \", 'interleaved_vec.size()' = \" << interleaved_vec.size() << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif ((int)natural_vec.size() < this->get_size() * this->n_frames)\n- throw std::length_error(\"aff3ct::module::Interleaver: \\\"natural_vec.size()\\\" has to be equal or greater \"\n- \"than \\\"this->get_size()\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'natural_vec.size()' has to be equal or greater than 'get_size()' * 'n_frames' \"\n+ << \"('natural_vec.size()' = \" << natural_vec.size() << \", 'get_size()' = \" << this->get_size()\n+ << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->deinterleave(interleaved_vec.data(), natural_vec.data());\n}\n@@ -271,8 +295,10 @@ private:\nconst int frame_id) const\n{\nif (!init_called)\n- throw std::length_error(\"aff3ct::module::Interleaver: \\\"init\\\" method has to be called first, before \"\n- \"trying to (de)interleave something.\");\n+ {\n+ std::string message = \"'init' method has to be called first, before trying to (de)interleave something.\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message);\n+ }\nif (frame_reordering)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/LTE/Interleaver_LTE.hpp",
"new_path": "src/Module/Interleaver/LTE/Interleaver_LTE.hpp",
"diff": "#ifndef INTERLEAVER_LTE_HPP\n#define INTERLEAVER_LTE_HPP\n-#include <stdexcept>\n#include <map>\n+#include <sstream>\n-#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Exception/exception.hpp\"\n#include \"../Interleaver.hpp\"\n@@ -227,8 +227,9 @@ protected:\n}\nelse\n{\n- throw std::runtime_error(\"aff3ct::module::Interleaver_LTE: there is no LTE f_1 and f_2 parameters \"\n- \"for \\\"size\\\" = \" + std::to_string(size) + \".\");\n+ std::stringstream message;\n+ message << \"There is no LTE f_1 and f_2 parameters for 'size' = \" << size << \".\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Random_column/Interleaver_random_column.hpp",
"new_path": "src/Module/Interleaver/Random_column/Interleaver_random_column.hpp",
"diff": "#ifndef INTERLEAVER_RANDOM_COLUMN_HPP\n#define INTERLEAVER_RANDOM_COLUMN_HPP\n-#include <stdexcept>\n#include <algorithm>\n#include <time.h>\n#include <random>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"../Interleaver.hpp\"\n@@ -28,8 +30,12 @@ public:\nrd_engine(), n_cols(n_cols), col_size(size / n_cols)\n{\nif (col_size * n_cols != size)\n- throw std::invalid_argument(\"aff3ct::module::Interleaver_random_column: \\\"size\\\" has to be equal to \"\n- \"\\\"n_cols\\\" * \\\"col_size\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'size' has to be equal to 'n_cols' * 'col_size' ('size' = \" << size\n+ << \", 'n_cols' = \" << n_cols << \", 'col_size' = \" << col_size << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nrd_engine.seed(seed);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Row_column/Interleaver_row_column.hpp",
"new_path": "src/Module/Interleaver/Row_column/Interleaver_row_column.hpp",
"diff": "#ifndef INTERLEAVER_ROW_COLUMN_HPP\n#define INTERLEAVER_ROW_COLUMN_HPP\n-#include <stdexcept>\n#include <algorithm>\n#include <time.h>\n#include <random>\n+#include <sstream>\n-#include \"../Interleaver.hpp\"\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/matrix.h\"\n+#include \"../Interleaver.hpp\"\nnamespace aff3ct\n{\n@@ -27,8 +28,12 @@ public:\n: Interleaver<T>(size, false, n_frames, name), n_cols(n_cols), n_rows(size / n_cols)\n{\nif (n_rows * n_cols != size)\n- throw std::invalid_argument(\"aff3ct::module::Interleaver_row_column: \\\"size\\\" has to be equal to \"\n- \"\\\"n_rows\\\" * \\\"n_cols\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'size' has to be equal to 'n_rows' * 'n_cols' ('size' = \" << size\n+ << \", 'n_rows' = \" << n_rows << \", 'n_cols' = \" << n_cols << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nvirtual ~Interleaver_row_column()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"new_path": "src/Module/Interleaver/SC_Interleaver.hpp",
"diff": "#ifdef SYSTEMC_MODULE\n#include <vector>\n#include <string>\n-#include <stdexcept>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n#include <tlm_utils/simple_initiator_socket.h>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -58,7 +59,7 @@ private:\ncase 4: _b_transport<int >(trans, t, vec_4); break;\ncase 8: _b_transport<long long>(trans, t, vec_8); break;\ndefault:\n- throw std::runtime_error(\"aff3ct::module::Interleaver: TLM unrecognized type of data.\");\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, \"Unrecognized type of data.\");\nbreak;\n}\n}\n@@ -69,7 +70,16 @@ private:\nmipp::vector<D> &interleaved_vec)\n{\nif (interleaver.get_size() * interleaver.get_n_frames() != (int)(trans.get_data_length() / sizeof(D)))\n- throw std::length_error(\"aff3ct::module::Interleaver: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'interleaver.get_size()' * 'interleaver.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(D)' \"\n+ << \"('interleaver.get_size()' = \" << interleaver.get_size()\n+ << \", 'interleaver.get_n_frames()' = \" << interleaver.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(D)' = \" << sizeof(D) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto natural_vec = (D*)trans.get_data_ptr();\n@@ -124,7 +134,7 @@ private:\ncase 4: _b_transport<int >(trans, t, vec_4); break;\ncase 8: _b_transport<long long>(trans, t, vec_8); break;\ndefault:\n- throw std::runtime_error(\"aff3ct::module::Interleaver: TLM unrecognized type of data.\");\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, \"Unrecognized type of data.\");\nbreak;\n}\n}\n@@ -135,7 +145,16 @@ private:\nmipp::vector<D> &natural_vec)\n{\nif (interleaver.get_size() * interleaver.get_n_frames() != (int)(trans.get_data_length() / sizeof(D)))\n- throw std::length_error(\"aff3ct::module::Interleaver: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'interleaver.get_size()' * 'interleaver.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(D)' \"\n+ << \"('interleaver.get_size()' = \" << interleaver.get_size()\n+ << \", 'interleaver.get_n_frames()' = \" << interleaver.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(D)' = \" << sizeof(D) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto interleaved_vec = (D*)trans.get_data_ptr();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"new_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"diff": "#ifndef INTERLEAVER_USER_HPP\n#define INTERLEAVER_USER_HPP\n-#include <stdexcept>\n#include <fstream>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"../Interleaver.hpp\"\n@@ -23,7 +25,7 @@ public:\n: Interleaver<T>(size, false, n_frames, name), cur_itl_id(0)\n{\nif (filename.empty())\n- throw std::invalid_argument(\"aff3ct::module::Interleaver_user: path to the file should not be empty.\");\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"'filename' should not be empty.\");\nstd::ifstream file(filename.c_str(), std::ios::in);\n@@ -66,17 +68,21 @@ public:\nelse\n{\nfile.close();\n- throw std::runtime_error(\"aff3ct::module::Interleaver_user: the interleaver \"\n- \"value is wrong, it already exists elsewhere \"\n- \"(read: \" + std::to_string(val) + \").\");\n+\n+ std::stringstream message;\n+ message << \"The interleaver value is wrong, it already exists elsewhere (read: \"\n+ << val << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\nelse\n{\nfile.close();\n- throw std::runtime_error(\"aff3ct::module::Interleaver_user: the interleaver \"\n- \"value is wrong (read: \" + std::to_string(val) + \", \"\n- \"expected: < \" + std::to_string(this->get_size()) + \").\");\n+\n+ std::stringstream message;\n+ message << \"The interleaver value is wrong (read: \" << val\n+ << \", expected: < \" << this->get_size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\n}\n@@ -84,9 +90,11 @@ public:\nelse\n{\nfile.close();\n- throw std::runtime_error(\"aff3ct::module::Interleaver_user: the interleaver value is \"\n- \"wrong (read: \" + std::to_string(val) + \", expected: \" +\n- std::to_string(this->get_size()) + \").\");\n+\n+ std::stringstream message;\n+ message << \"The interleaver value is wrong (read: \" << val << \", expected: \"\n+ << this->get_size() << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\nfile.close();\n@@ -94,12 +102,17 @@ public:\nelse\n{\nfile.close();\n- throw std::runtime_error(\"aff3ct::module::Interleaver_user: \\\"n_itl\\\" should be greater than 0.\");\n+\n+ std::stringstream message;\n+ message << \"'n_itl' should be greater than 0 ('n_itl' = \" << n_itl << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\nelse\n{\n- throw std::invalid_argument(\"aff3ct::module::Interleaver_user: can't open \\\"\" + filename + \"\\\" file.\");\n+ std::stringstream message;\n+ message << \"Can't open '\" + filename + \"' file.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::Interleaver.
|
8,490 |
22.06.2017 11:26:55
| -7,200 |
551e22edd501e58bdc2ee1ca6dfd996cdb0adf78
|
Improve the exceptions in the module::Monitor.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Monitor.hpp",
"new_path": "src/Module/Monitor/Monitor.hpp",
"diff": "#define MONITOR_HPP_\n#include <functional>\n-#include <stdexcept>\n#include <csignal>\n#include <chrono>\n#include <vector>\n#include <string>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -54,8 +56,12 @@ public:\nMonitor_i(const int size, int n_frames = 1, const std::string name = \"Monitor_i\")\n: Module(n_frames, name), size(size)\n{\n- if (this->size <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Monitor: \\\"size\\\" has to be greater than 0.\");\n+ if (size <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'size' has to be greater than 0 ('size' = \" << size << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nMonitor_i<B>::interrupt = false;\n@@ -142,10 +148,20 @@ public:\nvoid check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V)\n{\nif ((int)U.size() != this->size * this->n_frames)\n- throw std::length_error(\"aff3ct::module::Monitor: \\\"U.size()\\\" has to be equal to \\\"size * n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'U.size()' has to be equal to 'size' * 'n_frames' ('U.size()' = \" << U.size()\n+ << \", 'size' = \" << this->size << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif ((int)V.size() != this->size * this->n_frames)\n- throw std::length_error(\"aff3ct::module::Monitor: \\\"V.size()\\\" has to be equal to \\\"size * n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'V.size()' has to be equal to 'size' * 'n_frames' ('V.size()' = \" << V.size()\n+ << \", 'size' = \" << this->size << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->check_errors(U.data(), V.data());\n}\n@@ -199,7 +215,7 @@ public:\nprotected:\nvirtual void _check_errors(const B *U, const B *V, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::Monitor: \\\"_check_errors\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\nprivate:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/SC_Monitor.hpp",
"new_path": "src/Module/Monitor/SC_Monitor.hpp",
"diff": "#ifdef SYSTEMC_MODULE\n#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n#include <tlm_utils/simple_initiator_socket.h>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -44,7 +45,15 @@ private:\nvoid b_transport_source(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (monitor.get_size() * monitor.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n- throw std::length_error(\"aff3ct::module::Monitor: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'monitor.get_size()' * 'monitor.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(B)' ('monitor.get_size()' = \" << monitor.get_size()\n+ << \", 'monitor.get_n_frames()' = \" << monitor.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nU_K = (B*)trans.get_data_ptr();\n}\n@@ -52,10 +61,18 @@ private:\nvoid b_transport_decoder(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (U_K == nullptr)\n- throw std::runtime_error(\"aff3ct::module::Monitor: TLM \\\"U_K\\\" pointer can't be NULL.\");\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, \"'U_K' pointer can't be NULL.\");\nif (monitor.get_size() * monitor.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n- throw std::length_error(\"aff3ct::module::Monitor: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'monitor.get_size()' * 'monitor.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(B)' ('monitor.get_size()' = \" << monitor.get_size()\n+ << \", 'monitor.get_n_frames()' = \" << monitor.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto V_K = (B*)trans.get_data_ptr();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"diff": "#include <sys/stat.h>\n#include <sstream>\n#include <fstream>\n-#include <exception>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Monitor_reduction.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nMonitor_reduction<B>\n@@ -17,11 +20,15 @@ Monitor_reduction<B>\nmonitors (monitors )\n{\nif (monitors.size() == 0)\n- throw std::length_error(\"aff3ct::module::Monitor_reduction: \\\"monitors.size()\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'monitors.size()' has to be greater than 0 ('monitors.size()' = \" << monitors.size() << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nfor (size_t i = 0; i < monitors.size(); ++i)\nif (monitors[i] == nullptr)\n- throw std::logic_error(\"aff3ct::module::Monitor_reduction: \\\"monitors[i]\\\" can't be null.\");\n+ throw logic_error(__FILE__, __LINE__, __func__, \"'monitors[i]' can't be null.\");\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"diff": "#ifdef ENABLE_MPI\n#include <stddef.h>\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Monitor_reduction_mpi.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\nstruct monitor_vals\n{\n@@ -50,16 +53,25 @@ Monitor_reduction_mpi<B>\nblen[2] = 1; displacements[2] = offsetof(monitor_vals, n_fra); oldtypes[2] = MPI_UNSIGNED_LONG_LONG;\nif (auto ret = MPI_Type_create_struct(3, blen, displacements, oldtypes, &MPI_monitor_vals))\n- throw std::runtime_error(\"aff3ct::module::Monitor_reduction_mpi: \\\"MPI_Type_create_struct\\\" returned \\\"\" +\n- std::to_string(ret) + \"\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'MPI_Type_create_struct' returned '\" << ret << \"' error code.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (auto ret = MPI_Type_commit(&MPI_monitor_vals))\n- throw std::runtime_error(\"aff3ct::module::Monitor_reduction_mpi: \\\"MPI_Type_create_struct\\\" returned \\\"\" +\n- std::to_string(ret) + \"\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'MPI_Type_commit' returned '\" << ret << \"' error code.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (auto ret = MPI_Op_create(MPI_SUM_monitor_vals_func, true, &MPI_SUM_monitor_vals))\n- throw std::runtime_error(\"aff3ct::module::Monitor_reduction_mpi: \\\"MPI_Op_create\\\" returned \\\"\" +\n- std::to_string(ret) + \"\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'MPI_Op_create' returned '\" << ret << \"' error code.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::Monitor.
|
8,490 |
22.06.2017 12:06:10
| -7,200 |
3359b2725e15f56ad91f60de54962390162f8794
|
Improve the exceptions in the module::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": "#include <cmath>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n#include \"Puncturer_polar_wangliu.hpp\"\n@@ -17,6 +19,21 @@ Puncturer_polar_wangliu<B,Q>\n: Puncturer<B,Q>(K, N, (int)std::exp2(std::ceil(std::log2(N))), n_frames, name),\nfb_generator(fb_generator)\n{\n+ if (fb_generator.get_K() != K)\n+ {\n+ std::stringstream message;\n+ message << \"'fb_generator.get_K()' has to be equal to 'K' ('fb_generator.get_K()' = \" << fb_generator.get_K()\n+ << \", 'K' = \" << K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (fb_generator.get_N() != this->N_code)\n+ {\n+ std::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+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Puncturer.hpp",
"new_path": "src/Module/Puncturer/Puncturer.hpp",
"diff": "#ifndef PUNCTURER_HPP_\n#define PUNCTURER_HPP_\n-#include <stdexcept>\n#include <string>\n#include <vector>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -52,15 +54,39 @@ public:\n: Module(n_frames, name), K(K), N(N), N_code(N_code)\n{\nif (K <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"K\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"N\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be greater than 0 ('N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N_code <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"N_code\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N_code' has to be greater than 0 ('N_code' = \" << N_code << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (K > N)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be smaller or equal to 'N' ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N > N_code)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"N_code\\\" has to be equal or greater than \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be smaller or equal to 'N_code' ('N' = \" << N << \", 'N_code' = \" << N_code << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n@@ -92,12 +118,20 @@ public:\nvoid puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const\n{\nif (this->N_code * this->n_frames != (int)X_N1.size())\n- throw std::length_error(\"aff3ct::module::Puncturer: \\\"X_N1.size()\\\" has to be equal to \"\n- \"\\\"N_code\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::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+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (this->N * this->n_frames != (int)X_N2.size())\n- throw std::length_error(\"aff3ct::module::Puncturer: \\\"X_N2.size()\\\" has to be equal to \"\n- \"\\\"N\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'X_N2.size()' has to be equal to 'N' * 'n_frames' ('X_N2.size()' = \" << X_N2.size()\n+ << \", 'N' = \" << this->N << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->puncture(X_N1.data(), X_N2.data());\n}\n@@ -119,12 +153,20 @@ public:\nvoid depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const\n{\nif (this->N * this->n_frames != (int)Y_N1.size())\n- throw std::length_error(\"aff3ct::module::Puncturer: \\\"Y_N1.size()\\\" has to be equal to \"\n- \"\\\"N\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N1.size()' has to be equal to 'N' * 'n_frames' ('Y_N1.size()' = \" << Y_N1.size()\n+ << \", 'N' = \" << this->N << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (this->N_code * this->n_frames != (int)Y_N2.size())\n- throw std::length_error(\"aff3ct::module::Puncturer: \\\"Y_N2.size()\\\" has to be equal to \"\n- \"\\\"N_code\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::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+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->depuncture(Y_N1.data(), Y_N2.data());\n}\n@@ -140,12 +182,12 @@ public:\nprotected:\nvirtual void _puncture(const B *X_N1, B *X_N2, const int frame_id) const\n{\n- throw std::runtime_error(\"aff3ct::module::Puncturer: \\\"_puncture\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\nvirtual void _depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const\n{\n- throw std::runtime_error(\"aff3ct::module::Puncturer: \\\"_depuncture\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"new_path": "src/Module/Puncturer/SC_Puncturer.hpp",
"diff": "#ifdef SYSTEMC_MODULE\n#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n#include <tlm_utils/simple_initiator_socket.h>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -49,7 +50,15 @@ private:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (puncturer.get_N_code() * puncturer.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n- throw std::length_error(\"aff3ct::module::Puncturer: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'puncturer.get_N_code()' * 'puncturer.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(B)' ('puncturer.get_N_code()' = \" << puncturer.get_N_code()\n+ << \", 'puncturer.get_n_frames()' = \" << puncturer.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto X_N1 = (B*)trans.get_data_ptr();\n@@ -96,7 +105,15 @@ private:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (puncturer.get_N() * puncturer.get_n_frames() != (int)(trans.get_data_length() / sizeof(Q)))\n- throw std::length_error(\"aff3ct::module::Puncturer: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'puncturer.get_N()' * 'puncturer.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(Q)' ('puncturer.get_N()' = \" << puncturer.get_N()\n+ << \", 'puncturer.get_n_frames()' = \" << puncturer.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(Q)' = \" << sizeof(Q) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto Y_N1 = (Q*)trans.get_data_ptr();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/general_utils.h\"\n#include \"Puncturer_turbo.hpp\"\n@@ -20,23 +21,40 @@ Puncturer_turbo<B,Q>\npattern_bits(3), buff_enc(buff_enc), tail_bits(tail_bits)\n{\nif (tail_bits < 0)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"tail_bits\\\" has to be positive.\");\n+ {\n+ std::stringstream message;\n+ message << \"'tail_bits' has to be positive ('tail_bits' = \" << tail_bits << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nauto str_array = string_split(pattern, ',');\nif (str_array.size() != 3)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"pattern\\\" should give 3 different set \"\n- \"delimited by a comma.\");\n+ {\n+ std::stringstream message;\n+ message << \"'pattern' should give 3 different set delimited by a comma ('pattern' = \" << pattern\n+ << \", 'str_array.size()' = \" << str_array.size() << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (str_array[0].size() != str_array[1].size() || str_array[0].size() != str_array[2].size())\n- throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"pattern\\\" should give 3 different set \"\n- \"delimited by a comma and each of those sets has to contains an equal number \"\n- \"of bits.\");\n+ {\n+ std::stringstream message;\n+ message << \"'pattern' sets have to contains an equal number of bits ('pattern' = \" << pattern\n+ << \", 'str_array[0].size()' = \" << str_array[0].size()\n+ << \", 'str_array[1].size()' = \" << str_array[1].size()\n+ << \", 'str_array[2].size()' = \" << str_array[2].size() << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nauto period = (int)str_array[0].size();\nif (this->K % period)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"K\\\" has to be a multiple of \\\"n_bits\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'period' has to be a multiple of 'K' ('period' = \" << period << \", 'K' = \" << this->K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\npattern_bits[0].resize(period);\npattern_bits[1].resize(period);\n@@ -56,8 +74,13 @@ Puncturer_turbo<B,Q>\nauto bit_count = bit_sys_count + bit_pa1_count + bit_pa2_count;\nif ((this->N - tail_bits) != (K / period) * bit_count)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"N - tail_bits\\\" has to be equal to \"\n- \"\\\"(K / period) * bit_count\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' - 'tail_bits' has to be equal to ('K' / 'period') * 'bit_count' ('N' = \" << this->N\n+ << \", 'tail_bits' = \" << tail_bits << \", 'K' = \" << K << \", 'period' = \" << period\n+ << \", 'bit_count' = \" << bit_count << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.hpp",
"new_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.hpp",
"diff": "@@ -46,6 +46,16 @@ public:\n*/\nvirtual ~Frozenbits_generator() {}\n+ int get_K() const\n+ {\n+ return this->K;\n+ }\n+\n+ int get_N() const\n+ {\n+ return this->N;\n+ }\n+\n/*!\n* \\brief Sets the AWGN channel sigma value.\n*\n@@ -56,6 +66,11 @@ public:\nthis->sigma = sigma;\n}\n+ float get_sigma() const\n+ {\n+ return this->sigma;\n+ }\n+\n/*!\n* \\brief Generates the frozen bits vector.\n*\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::Puncturer.
|
8,490 |
22.06.2017 14:35:34
| -7,200 |
dfd3aa23c66bdd48ce55936f11a182cf8507479e
|
Improve the exceptions in the module::Quantizer.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Fast/Quantizer_fast.cpp",
"new_path": "src/Module/Quantizer/Fast/Quantizer_fast.cpp",
"diff": "-#include <stdexcept>\n#include <iostream>\n#include <algorithm>\n#include <cmath>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n#include \"Quantizer_fast.hpp\"\n@@ -20,8 +21,12 @@ Quantizer_fast<R,Q>\nfactor(1 << fixed_point_pos)\n{\nif (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be smaller \"\n- \"than \\\"sizeof(Q)\\\" * 8.\");\n+ {\n+ std::stringstream message;\n+ message << \"'fixed_point_pos' has to be smaller than 'sizeof(Q)' * 8 ('fixed_point_pos' = \" << fixed_point_pos\n+ << \", 'sizeof(Q)' = \" << sizeof(Q) << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nnamespace aff3ct\n@@ -57,22 +62,48 @@ Quantizer_fast<R,Q>\nfactor(1 << fixed_point_pos)\n{\nif (fixed_point_pos <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be greater than 0.\");\n- if (saturation_pos <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'fixed_point_pos' has to be greater than 0 ('fixed_point_pos' = \" << fixed_point_pos << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (saturation_pos < 2)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be equal or greater \"\n- \"than 2.\");\n+ {\n+ std::stringstream message;\n+ message << \"'saturation_pos' has to be greater than 1 ('saturation_pos' = \" << saturation_pos << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (fixed_point_pos > saturation_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be equal or greater \"\n- \"than \\\"fixed_point_pos\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'saturation_pos' has to be equal or greater than 'fixed_point_pos' ('saturation_pos' = \"\n+ << saturation_pos << \", 'fixed_point_pos' = \" << fixed_point_pos << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be smaller \"\n- \"than \\\"sizeof(Q)\\\" * 8.\");\n+ {\n+ std::stringstream message;\n+ message << \"'fixed_point_pos' has to be smaller than 'sizeof(Q)' * 8 ('fixed_point_pos' = \" << fixed_point_pos\n+ << \", 'sizeof(Q)' = \" << sizeof(Q) << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (val_max > +(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"val_max\\\" value is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'val_max' value is invalid ('val_max' = \" << val_max << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (val_min < -(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"val_min\\\" value is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'val_min' value is invalid ('val_min' = \" << val_min << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nnamespace aff3ct\n@@ -109,8 +140,8 @@ template<typename R, typename Q>\nvoid Quantizer_fast<R,Q>\n::process(const R *Y_N1, Q *Y_N2)\n{\n- throw std::runtime_error(\"aff3ct::module::Quantizer_fast: this class only support \\\"float to short\\\" \"\n- \"or \\\"float to signed char\\\".\");\n+ std::string message = \"Supports only 'float' to 'short' and 'float' to 'signed char' conversions.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message);\n}\nnamespace aff3ct\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Quantizer.hpp",
"new_path": "src/Module/Quantizer/Quantizer.hpp",
"diff": "#define QUANTIZER_HPP_\n#include <vector>\n-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -48,7 +49,11 @@ public:\n: Module(n_frames, name), N(N)\n{\nif (N <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer: \\\"N\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be greater than 0 ('N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n@@ -72,12 +77,21 @@ public:\nvoid process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n{\nif (this->N * this->n_frames != (int)Y_N1.size())\n- throw std::length_error(\"aff3ct::module::Quantizer: \\\"Y_N1.size()\\\" has to be equal to \"\n- \"\\\"N\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N1.size()' has to be equal to 'N' * 'n_frames' ('Y_N1.size()' = \" << Y_N1.size()\n+ << \", 'N' = \" << this->N << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (this->N * this->n_frames != (int)Y_N2.size())\n- throw std::length_error(\"aff3ct::module::Quantizer: \\\"Y_N2.size()\\\" has to be equal to \"\n- \"\\\"N\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N2.size()' has to be equal to 'N' * 'n_frames' ('Y_N2.size()' = \" << Y_N2.size()\n+ << \", 'N' = \" << this->N << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nthis->process(Y_N1.data(), Y_N2.data());\n}\n@@ -92,7 +106,7 @@ public:\nprotected:\nvirtual void _process(const R *Y_N1, Q *Y_N2, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::Quantizer: \\\"_process\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"new_path": "src/Module/Quantizer/SC_Quantizer.hpp",
"diff": "#ifdef SYSTEMC_MODULE\n#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n#include <systemc>\n#include <tlm>\n#include <tlm_utils/simple_target_socket.h>\n#include <tlm_utils/simple_initiator_socket.h>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -48,7 +49,15 @@ private:\nvoid b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n{\nif (quantizer.get_N() * quantizer.get_n_frames() != (int)(trans.get_data_length() / sizeof(R)))\n- throw std::length_error(\"aff3ct::module::Quantizer: TLM input data size is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'quantizer.get_N()' * 'quantizer.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(R)' ('quantizer.get_N()' = \" << quantizer.get_N()\n+ << \", 'quantizer.get_n_frames()' = \" << quantizer.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(R)' = \" << sizeof(R) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto Y_N1 = (R*)trans.get_data_ptr();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Standard/Quantizer_standard.cpp",
"new_path": "src/Module/Quantizer/Standard/Quantizer_standard.cpp",
"diff": "-#include <stdexcept>\n#include <algorithm>\n#include <cmath>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n#include \"Quantizer_standard.hpp\"\n@@ -19,8 +20,12 @@ Quantizer_standard<R,Q>\nfactor(1 << fixed_point_pos)\n{\nif (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"fixed_point_pos\\\" has to be smaller \"\n- \"than \\\"sizeof(Q)\\\" * 8.\");\n+ {\n+ std::stringstream message;\n+ message << \"'fixed_point_pos' has to be smaller than 'sizeof(Q)' * 8 ('fixed_point_pos' = \" << fixed_point_pos\n+ << \", 'sizeof(Q)' = \" << sizeof(Q) << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nnamespace aff3ct\n@@ -56,22 +61,48 @@ Quantizer_standard<R,Q>\nfactor(1 << fixed_point_pos)\n{\nif (fixed_point_pos <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be greater than 0.\");\n- if (saturation_pos <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'fixed_point_pos' has to be greater than 0 ('fixed_point_pos' = \" << fixed_point_pos << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (saturation_pos < 2)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"saturation_pos\\\" has to be equal or greater \"\n- \"than 2.\");\n+ {\n+ std::stringstream message;\n+ message << \"'saturation_pos' has to be greater than 1 ('saturation_pos' = \" << saturation_pos << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (fixed_point_pos > saturation_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"saturation_pos\\\" has to be equal or greater \"\n- \"than \\\"fixed_point_pos\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'saturation_pos' has to be equal or greater than 'fixed_point_pos' ('saturation_pos' = \"\n+ << saturation_pos << \", 'fixed_point_pos' = \" << fixed_point_pos << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"fixed_point_pos\\\" has to be smaller \"\n- \"than \\\"sizeof(Q)\\\" * 8.\");\n+ {\n+ std::stringstream message;\n+ message << \"'fixed_point_pos' has to be smaller than 'sizeof(Q)' * 8 ('fixed_point_pos' = \" << fixed_point_pos\n+ << \", 'sizeof(Q)' = \" << sizeof(Q) << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (val_max > +(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"val_max\\\" value is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'val_max' value is invalid ('val_max' = \" << val_max << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (val_min < -(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"val_min\\\" value is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'val_min' value is invalid ('val_min' = \" << val_min << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nnamespace aff3ct\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Tricky/Quantizer_tricky.cpp",
"new_path": "src/Module/Quantizer/Tricky/Quantizer_tricky.cpp",
"diff": "-#include <stdexcept>\n#include <algorithm>\n#include <cmath>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n#include \"Quantizer_tricky.hpp\"\n@@ -52,8 +53,12 @@ Quantizer_tricky<R,Q>\nsigma(sigma)\n{\nif (sizeof(Q) * 8 < (unsigned) saturation_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_tricky: \\\"saturation_pos\\\" has to be equal or smaller \"\n- \"than \\\"sizeof(Q)\\\" * 8.\");\n+ {\n+ std::stringstream message;\n+ message << \"'saturation_pos' has to be equal or smaller than 'sizeof(Q)' * 8 ('saturation_pos' = \"\n+ << saturation_pos << \", 'sizeof(Q)' = \" << sizeof(Q) << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nnamespace aff3ct\n@@ -124,8 +129,12 @@ Quantizer_tricky<R,Q>\nsigma(sigma)\n{\nif (sizeof(Q) * 8 < (unsigned) saturation_pos)\n- throw std::invalid_argument(\"aff3ct::module::Quantizer_tricky: \\\"saturation_pos\\\" has to be equal or smaller \"\n- \"than \\\"sizeof(Q)\\\" * 8.\");\n+ {\n+ std::stringstream message;\n+ message << \"'saturation_pos' has to be equal or smaller than 'sizeof(Q)' * 8 ('saturation_pos' = \"\n+ << saturation_pos << \", 'sizeof(Q)' = \" << sizeof(Q) << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename R, typename Q>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::Quantizer.
|
8,490 |
22.06.2017 15:07:20
| -7,200 |
d292a485b4cb8a4e652419e9c1efe6a746fa5d13
|
Improve the exceptions in the module::Source.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/Source.hpp",
"new_path": "src/Module/Source/Source.hpp",
"diff": "#include <vector>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -47,7 +48,11 @@ public:\n: Module(n_frames, name), K(K)\n{\nif (K <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Source: \\\"K\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n@@ -70,8 +75,12 @@ public:\nvoid generate(mipp::vector<B>& U_K)\n{\nif (this->K * this->n_frames != (int)U_K.size())\n- throw std::length_error(\"aff3ct::module::Source: \\\"U_K.size()\\\" has to be equal to \"\n- \"\\\"K\\\" * \\\"n_frames\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'U_K.size()' has to be equal to 'K' * 'n_frames' ('U_K.size()' = \" << U_K.size()\n+ << \", 'K' = \" << this->K << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->generate(U_K.data());\n}\n@@ -85,7 +94,7 @@ public:\nprotected:\nvirtual void _generate(B *U_K, const int frame_id)\n{\n- throw std::runtime_error(\"aff3ct::module::Source: \\\"_generate\\\" is unimplemented.\");\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/User/Source_user.cpp",
"new_path": "src/Module/Source/User/Source_user.cpp",
"diff": "#include <fstream>\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Source_user.hpp\"\nusing namespace aff3ct::module;\n+using namespace aff3ct::tools;\ntemplate <typename B>\nSource_user<B>\n@@ -11,7 +14,7 @@ Source_user<B>\n: Source<B>(K, n_frames, name), source(), src_counter(0)\n{\nif (filename.empty())\n- throw std::invalid_argument(\"aff3ct::module::Source_user: path to the file should not be empty.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"'filename' should not be empty.\");\nstd::ifstream file(filename.c_str(), std::ios::in);\n@@ -23,8 +26,12 @@ Source_user<B>\nfile >> src_size;\nif (n_src <= 0 || src_size <= 0)\n- throw std::runtime_error(\"aff3ct::module::Source_user: \\\"n_src\\\", and \\\"src_size\\\" have to be \"\n- \"greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_src', and 'src_size' have to be greater than 0 ('n_src' = \" << n_src\n+ << \", 'src_size' = \" << src_size << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->source.resize(n_src);\nfor (auto i = 0; i < n_src; i++)\n@@ -45,16 +52,15 @@ Source_user<B>\n{\nfile.close();\n- throw std::runtime_error(\"aff3ct::module::Source_user: the size is wrong (read: \" +\n- std::to_string(src_size) + \", expected: \" + std::to_string(this->K) + \").\");\n+ std::stringstream message;\n+ message << \"The size is wrong (read: \" << src_size << \", expected: \" << this->K << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\nfile.close();\n}\nelse\n- {\n- throw std::invalid_argument(\"aff3ct::module::Source_user: can't open \\\"\" + filename + \"\\\" file.\");\n- }\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"Can't open '\" + filename + \"' file.\");\n}\ntemplate <typename B>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the module::Source.
|
8,490 |
22.06.2017 15:31:24
| -7,200 |
04419ba96e139cff14b6efd2bdfa7efcf1fe4778
|
Improve the exceptions in the Module.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Module.hpp",
"new_path": "src/Module/Module.hpp",
"diff": "#define MODULE_HPP_\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\nnamespace aff3ct\n{\n@@ -36,7 +38,11 @@ public:\nModule(const int n_frames = 1, const std::string name = \"Module\") : n_frames(n_frames), name(name)\n{\nif (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Module: \\\"n_frames\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 ('n_frames' = \" << n_frames << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n/*!\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the Module.
|
8,490 |
22.06.2017 15:31:44
| -7,200 |
a24493f3f2fd6ce63b50d2a08cf50c47e5b34346
|
Improve the exceptions in the Simulation.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.cpp",
"diff": "#ifdef SYSTEMC\n-#include <stdexcept>\n-\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Algo/Predicate_ite.hpp\"\n@@ -29,12 +28,11 @@ SC_Simulation_BFER_ite<B,R,Q>\ndbg_R {nullptr, nullptr, nullptr},\ndbg_Q {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}\n{\n- if (this->params.simulation.n_threads > 1)\n- throw std::invalid_argument(\"aff3ct::simulation::SC_Simulation_BFERI_ite: SystemC simulation does not support \"\n- \"multi-threading.\");\n+ if (params.simulation.n_threads > 1)\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support multi-threading.\");\n+\nif (params.simulation.benchs)\n- throw std::invalid_argument(\"aff3ct::simulation::SC_Simulation_BFERI_ite: SystemC simulation does not support \"\n- \"the bench mode.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support the bench mode.\");\nif (params.simulation.time_report)\nstd::clog << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n@@ -58,8 +56,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nSimulation_BFER_ite<B,R,Q>::_build_communication_chain(tid);\nif (*this->interleaver[tid] != *this->interleaver_e)\n- throw std::runtime_error(\"aff3ct::simulation::SC_Simulation_BFERI_ite: \\\"interleaver[tid]\\\" and \"\n- \"\\\"interleaver_e\\\" have to be equal.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'interleaver[tid]' and 'interleaver_e' have to be equal.\");\n// create the sc_module inside the objects of the communication chain\nthis->source [tid]->create_sc_module ();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "#include <algorithm>\n#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Simulation_BFER_ite_threads.hpp\"\n@@ -40,13 +41,11 @@ Simulation_BFER_ite_threads<B,R,Q>\n<< std::endl;\nif (params.simulation.benchs)\n- throw std::invalid_argument(\"aff3ct::simulation::Simulation_BFER_ite_threads: the bench mode is not \"\n- \"supported.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"The bench mode is not supported.\");\n#ifdef ENABLE_MPI\nif (params.simulation.debug || params.simulation.benchs)\n- throw std::invalid_argument(\"aff3ct::simulation::Simulation_BFER_ite_threads: debug and bench modes are \"\n- \"unavailable in MPI.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"The debug and bench modes are unavailable in MPI.\");\n#endif\nif (this->params.monitor.err_track_revert)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "#include <cmath>\n#include <thread>\n#include <string>\n-#include <stdexcept>\n+#include <sstream>\n#include <algorithm>\n#include <functional>\n#include \"Tools/general_utils.h\"\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Factory/Factory_monitor.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n@@ -47,7 +48,11 @@ Simulation_BFER<B,R,Q>\ndurations(params.simulation.n_threads)\n{\nif (params.simulation.n_threads < 1)\n- throw std::invalid_argument(\"aff3ct::simulation::Simulation_BFER: \\\"n_threads\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_threads' has to be greater than 0 ('n_threads' = \" << params.simulation.n_threads << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (params.monitor.err_track_enable)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_Simulation_BFER_std.cpp",
"diff": "#ifdef STARPU\n#include <iostream>\n-#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"SPU_Simulation_BFER_std.hpp\"\n@@ -48,11 +48,9 @@ SPU_Simulation_BFER_std<B,R,Q>\nspu_V_K2(this->params.simulation.n_threads)\n{\nif (params.simulation.debug)\n- throw std::invalid_argument(\"aff3ct::simulation::SPU_Simulation_BFER_std: StarPU simulation does not support \"\n- \"the debug mode.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation does not support the debug mode.\");\nif (params.simulation.benchs)\n- throw std::invalid_argument(\"aff3ct::simulation::SPU_Simulation_BFER_std: StarPU simulation does not support \"\n- \"the bench mode.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation does not support the bench mode.\");\nif (params.simulation.time_report)\nstd::clog << bold_yellow(\"(WW) The time report is not available in the StarPU simulation.\") << std::endl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/SystemC/SC_Simulation_BFER_std.cpp",
"diff": "#ifdef SYSTEMC\n#include <iostream>\n-#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"SC_Simulation_BFER_std.hpp\"\n@@ -22,11 +22,9 @@ SC_Simulation_BFER_std<B,R,Q>\ndbg_Q {nullptr, nullptr, nullptr}\n{\nif (this->params.simulation.n_threads > 1)\n- throw std::invalid_argument(\"aff3ct::simulation::SC_Simulation_BFER_std: SystemC simulation does not support \"\n- \"multi-threading.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support multi-threading.\");\nif (params.simulation.benchs)\n- throw std::invalid_argument(\"aff3ct::simulation::SC_Simulation_BFER_std: SystemC simulation does not support \"\n- \"the bench mode.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support the bench mode.\");\nif (params.simulation.time_report)\nstd::clog << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "#include <string>\n#include <vector>\n#include <chrono>\n-#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n@@ -33,8 +33,7 @@ Simulation_BFER_std_threads<B,R,Q>\n{\n#ifdef ENABLE_MPI\nif (params.simulation.debug || params.simulation.benchs)\n- throw std::runtime_error(\"aff3ct::simulation::Simulation_BFER_std_threads: debug and bench modes are \"\n- \"unavailable in MPI.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The debug and bench modes are unavailable in MPI.\");\n#endif\nif (this->params.monitor.err_track_revert)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "#include <cmath>\n#include <algorithm>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/general_utils.h\"\n#include \"Tools/Math/utils.h\"\n@@ -98,7 +99,7 @@ void Simulation_EXIT<B,R>\nterminal = build_terminal ( );\nif (siso->get_n_frames() > 1)\n- throw std::runtime_error(\"aff3ct::simulation::Simulation_EXIT: inter frame is not supported.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The inter frame is not supported.\");\nif (X_K .size() != (unsigned)K_mod) X_K .resize(K_mod);\nif (X_N2 .size() != (unsigned)N_mod) X_N2 .resize(N_mod);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the Simulation.
|
8,490 |
22.06.2017 15:59:52
| -7,200 |
a0076992a27ac2be936ad717ddda040f538d0348
|
Improve the exceptions in the tools::Algo.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Bit_packer.hpp",
"new_path": "src/Tools/Algo/Bit_packer.hpp",
"diff": "#define BIT_PACKER_HPP_\n#include <cmath>\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n@@ -38,13 +40,28 @@ struct Bit_packer\nconst bool rev = false)\n{\nif (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (vec_in.size() % n_frames)\n- throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_in.size()\\\" has to be divisible by \"\n- \"\\\"n_frame\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'vec_in.size()' has to be divisible by 'n_frame' ('vec_in.size()' = \" << vec_in.size()\n+ << \", 'n_frames' = \" << n_frames << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)vec_out.size() < (int)(std::ceil((float)vec_in.size() / (sizeof(B) * 8.f))))\n- throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_out.size()\\\" has to be equal or greater than \"\n- \"\\\"ceil(vec_in.size() / (sizeof(B) * 8.f))\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'vec_out.size()' has to be equal or greater than ceil('vec_in.size()' / ('sizeof(B)' * 8.f)) \"\n+ << \"('vec_out.size()' = \" << vec_out.size() << \", 'vec_in.size()' = \" << vec_in.size()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nBit_packer<B>::pack(vec_in.data(), vec_out.data(), (int)(vec_in.size() / n_frames), n_frames, rev);\n}\n@@ -72,10 +89,19 @@ struct Bit_packer\nstatic inline void pack(mipp::vector<B> &vec, const int n_frames = 1, const bool rev = false)\n{\nif (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (vec.size() % n_frames)\n- throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec.size()\\\" has to be divisible by \"\n- \"\\\"n_frame\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'vec.size()' has to be divisible by 'n_frame' ('vec.size()' = \" << vec.size()\n+ << \", 'n_frames' = \" << n_frames << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nBit_packer<B>::pack(vec.data(), (int)(vec.size() / n_frames), n_frames, rev);\n}\n@@ -104,13 +130,28 @@ struct Bit_packer\nconst bool rev = false)\n{\nif (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (vec_out.size() % n_frames)\n- throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_out.size()\\\" has to be divisible by \"\n- \"\\\"n_frame\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'vec_out.size()' has to be divisible by 'n_frame' ('vec_out.size()' = \" << vec_out.size()\n+ << \", 'n_frames' = \" << n_frames << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)vec_in.size() < (int)(std::ceil((float)vec_out.size() / (sizeof(B) * 8.f))))\n- throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_in.size()\\\" has to be equal or greater than \"\n- \"\\\"ceil(vec_out.size() / (sizeof(B) * 8.f))\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'vec_in.size()' has to be equal or greater than ceil('vec_out.size()' / ('sizeof(B)' * 8.f)) \"\n+ << \"('vec_in.size()' = \" << vec_in.size() << \", 'vec_out.size()' = \" << vec_out.size()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nBit_packer<B>::unpack(vec_in.data(), vec_out.data(), (int)(vec_out.size() / n_frames), n_frames, rev);\n}\n@@ -138,10 +179,19 @@ struct Bit_packer\nstatic inline void unpack(mipp::vector<B> &vec, const int n_frames = 1, bool rev = false)\n{\nif (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (vec.size() % n_frames)\n- throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec.size()\\\" has to be divisible by \"\n- \"\\\"n_frame\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'vec.size()' has to be divisible by 'n_frame' ('vec.size()' = \" << vec.size()\n+ << \", 'n_frames' = \" << n_frames << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nBit_packer<B>::unpack(vec.data(), (int)(vec.size() / n_frames), n_frames, rev);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp",
"new_path": "src/Tools/Algo/Noise/Fast/Noise_fast.cpp",
"diff": "-#include <stdexcept>\n#include <cmath>\n+#include \"Tools/Exception/exception.hpp\"\n+\n#include \"Noise_fast.hpp\"\nusing namespace aff3ct::tools;\n@@ -35,16 +36,14 @@ template <typename R>\nmipp::Reg<R> Noise_fast<R>\n::get_random_simd()\n{\n- throw std::runtime_error(\"aff3ct::module::Noise_fast: the MT19937 random generator does not support \"\n- \"this type.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The MT19937 random generator does not support this type.\");\n}\ntemplate <typename R>\nR Noise_fast<R>\n::get_random()\n{\n- throw std::runtime_error(\"aff3ct::module::Noise_fast: the MT19937 random generator does not support \"\n- \"this type.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The MT19937 random generator does not support this type.\");\n}\nnamespace aff3ct\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": "#ifdef CHANNEL_GSL\n-#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Noise_GSL.hpp\"\n@@ -13,7 +13,7 @@ Noise_GSL<R>\nrng(gsl_rng_alloc(gsl_rng_mt19937))\n{\nif (rng == nullptr)\n- throw std::runtime_error(\"aff3ct::module::Noise_GSL: \\\"rng\\\" can't be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'rng' can't be null.\");\nthis->set_seed(seed);\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": "#ifdef CHANNEL_MKL\n-#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Noise_MKL.hpp\"\n@@ -38,8 +38,7 @@ template <typename R>\nvoid Noise_MKL<R>\n::generate(R *noise, const unsigned length, const R sigma)\n{\n- throw std::runtime_error(\"aff3ct::module::Noise_MKL: adding white Gaussian noise is impossible on this \"\n- \"type of data.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"Adding white Gaussian noise is impossible on this data type.\");\n}\nnamespace aff3ct\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Predicate_ite.hpp",
"new_path": "src/Tools/Algo/Predicate_ite.hpp",
"diff": "#ifndef PREDICATE_ITE_HPP\n#define PREDICATE_ITE_HPP\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Predicate.hpp\"\n@@ -32,8 +34,12 @@ public:\nPredicate_ite(const int n_ite)\n: n_ite(n_ite), cur_ite(0)\n{\n- if (n_ite < 0)\n- throw std::invalid_argument(\"aff3ct::tools::Predicate_ite: \\\"n_ite\\\" has to be equal or greater than 0.\");\n+ if (n_ite <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'n_ite' has to be equal or greater than 0 ('n_ite' = \" << n_ite << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nvirtual ~Predicate_ite()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"new_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"diff": "#include <sstream>\n#include <vector>\n#include <algorithm>\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Sparse_matrix.hpp\"\n@@ -98,18 +100,36 @@ void Sparse_matrix\n::add_connection(const size_t row_index, const size_t col_index)\n{\nif (col_index >= this->n_cols)\n- throw std::invalid_argument(\"aff3ct::tools::Sparse_matrix: \\\"col_index\\\" has to be smaller than \\\"cols\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'col_index' has to be smaller than 'n_cols' ('col_index' = \" << col_index\n+ << \", 'n_cols' = \" << this->n_cols << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (row_index >= this->n_rows)\n- throw std::invalid_argument(\"aff3ct::tools::Sparse_matrix: \\\"row_index\\\" has to be smaller than \\\"rows\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'row_index' has to be smaller than 'n_rows' ('row_index' = \" << row_index\n+ << \", 'n_rows' = \" << this->n_rows << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nfor (size_t i = 0; i < this->row_to_cols[row_index].size(); i++)\nif (this->row_to_cols[row_index][i] == col_index)\n- throw std::runtime_error(\"aff3ct::tools::Sparse_matrix: \\\"col_index\\\" already exists.\");\n+ {\n+ std::stringstream message;\n+ message << \"'col_index' already exists ('col_index' = \" << col_index << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nfor (size_t i = 0; i < this->col_to_rows[col_index].size(); i++)\nif (this->col_to_rows[col_index][i] == row_index)\n- throw std::runtime_error(\"aff3ct::tools::Sparse_matrix: \\\"row_index\\\" already exists.\");\n+ {\n+ std::stringstream message;\n+ message << \"'row_index' already exists ('row_index' = \" << row_index << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->row_to_cols[row_index].push_back((unsigned)col_index);\nthis->col_to_rows[col_index].push_back((unsigned)row_index);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Tree/Binary_tree.hxx",
"new_path": "src/Tools/Algo/Tree/Binary_tree.hxx",
"diff": "-#include <stdexcept>\n#include <vector>\n+#include \"Tools/Exception/exception.hpp\"\n+\n#include \"Binary_tree.hpp\"\nnamespace aff3ct\n@@ -43,9 +44,9 @@ void Binary_tree<T>\n::create_nodes(Binary_node<T>* cur_node, int cur_depth, std::vector<int> &lanes)\n{\nif (cur_node->left != nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Binary_tree: \\\"cur_node->left\\\" can't be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'cur_node->left' can't be null.\");\nif (cur_node->right != nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Binary_tree: \\\"cur_node->right\\\" can't be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'cur_node->right' can't be null.\");\nif (cur_depth < this->depth)\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the tools::Algo.
|
8,490 |
23.06.2017 10:59:45
| -7,200 |
7b832ab599de6ce519f9387536a75deaca98b469
|
Improve the exceptions in the tools::Codec.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"diff": "#include <fstream>\n+#include <sstream>\n#include <numeric>\n#include <algorithm>\n-#include <exception>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Code/LDPC/AList/AList.hpp\"\n#include \"Tools/Factory/LDPC/Factory_encoder_LDPC.hpp\"\n@@ -135,11 +136,29 @@ void Codec_LDPC<B,Q>\nconst auto N = this->params.code.N_code;\nif ((int)Y_N.size() != N * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_LDPC: invalid \\\"Y_N\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N.size()' has to be equal to 'N' * 'inter_frame_level' ('Y_N.size()' = \" << Y_N.size()\n+ << \", 'N' = \" << N << \", 'inter_frame_level' = \" << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)sys.size() != K * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_LDPC: invalid \\\"sys\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'sys.size()' has to be equal to 'K' * 'inter_frame_level' ('sys.size()' = \" << sys.size()\n+ << \", 'K' = \" << K << \", 'inter_frame_level' = \" << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)par.size() != (N - K) * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_LDPC: invalid \\\"par\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'par.size()' has to be equal to ('N' - 'K') * 'inter_frame_level' ('par.size()' = \" << par.size()\n+ << \", 'N' = \" << N << \", 'K' = \" << K << \", 'inter_frame_level' = \"\n+ << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n// extract systematic and parity information\nauto sys_idx = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Polar/Codec_polar.cpp",
"new_path": "src/Tools/Codec/Polar/Codec_polar.cpp",
"diff": "-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Tools/Factory/Polar/Factory_frozenbits_generator.hpp\"\n@@ -35,13 +36,17 @@ Codec_polar<B,Q>\nthis->params.simulation.bin_pb_path);\nif (fb_generator == nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Codec_polar: \\\"fb_generator\\\" can't be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'fb_generator' can't be null.\");\n}\nelse\n{\nif (this->params.code.N != this->params.code.N_code)\n- throw std::invalid_argument(\"aff3ct::tools::Codec_polar: \\\"params.code.N\\\" has to be equal \"\n- \"to \\\"params.code.N_code\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be equal to 'N_code' ('N' = \" << this->params.code.N\n+ << \", 'N_code' = \" << this->params.code.N_code << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n}\n@@ -187,11 +192,29 @@ void Codec_polar<B,Q>\nconst auto N = this->params.code.N_code;\nif ((int)Y_N.size() != N * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_polar: invalid \\\"Y_N\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N.size()' has to be equal to 'N' * 'inter_frame_level' ('Y_N.size()' = \" << Y_N.size()\n+ << \", 'N' = \" << N << \", 'inter_frame_level' = \" << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)sys.size() != K * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_polar: invalid \\\"sys\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'sys.size()' has to be equal to 'K' * 'inter_frame_level' ('sys.size()' = \" << sys.size()\n+ << \", 'K' = \" << K << \", 'inter_frame_level' = \" << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)par.size() != (N - K) * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_polar: invalid \\\"par\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'par.size()' has to be equal to ('N' - 'K') * 'inter_frame_level' ('par.size()' = \" << par.size()\n+ << \", 'N' = \" << N << \", 'K' = \" << K << \", 'inter_frame_level' = \"\n+ << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n// extract systematic and parity information\nauto par_idx = 0, sys_idx = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/RA/Codec_RA.cpp",
"new_path": "src/Tools/Codec/RA/Codec_RA.cpp",
"diff": "+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Factory/Factory_interleaver.hpp\"\n#include \"Tools/Factory/RA/Factory_encoder_RA.hpp\"\n#include \"Tools/Factory/RA/Factory_decoder_RA.hpp\"\n@@ -38,7 +39,7 @@ Encoder<B>* Codec_RA<B,Q>\n::build_encoder(const int tid, const Interleaver<int>* itl)\n{\nif (itl == nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Codec_RA: \\\"itl\\\" should not be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'itl' should not be null.\");\nreturn Factory_encoder_RA<B>::build(this->params.encoder.type,\nthis->params.code.K,\n@@ -52,7 +53,7 @@ Decoder<B,Q>* Codec_RA<B,Q>\n::build_decoder(const int tid, const Interleaver<int>* itl, CRC<B>* crc)\n{\nif (itl == nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Codec_RA: \\\"itl\\\" should not be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'itl' should not be null.\");\nreturn Factory_decoder_RA<B,Q>::build(this->params.decoder.type,\nthis->params.decoder.implem,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/RSC/Codec_RSC.cpp",
"new_path": "src/Tools/Codec/RSC/Codec_RSC.cpp",
"diff": "-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Factory/RSC/Factory_encoder_RSC.hpp\"\n#include \"Tools/Factory/RSC/Factory_decoder_RSC.hpp\"\n@@ -80,11 +81,30 @@ void Codec_RSC<B,Q,QD>\nconst auto tb_2 = this->params.code.tail_length / 2;\nif ((int)Y_N.size() != N * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_RSC: invalid \\\"Y_N\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N.size()' has to be equal to 'N' * 'inter_frame_level' ('Y_N.size()' = \" << Y_N.size()\n+ << \", 'N' = \" << N << \", 'inter_frame_level' = \" << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)sys.size() != (K + tb_2) * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_RSC: invalid \\\"sys\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'sys.size()' has to be equal to ('K' + 'tb_2') * 'inter_frame_level' ('sys.size()' = \" << sys.size()\n+ << \", 'K' = \" << K << \", 'tb_2' = \" << tb_2 << \", 'inter_frame_level' = \"\n+ << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)par.size() != (K + tb_2) * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_RSC: invalid \\\"par\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'par.size()' has to be equal to ('K' + 'tb_2') * 'inter_frame_level' ('par.size()' = \" << par.size()\n+ << \", 'K' = \" << K << \", 'tb_2' = \" << tb_2 << \", 'inter_frame_level' = \"\n+ << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n// extract systematic and parity information\nfor (auto f = 0; f < this->params.simulation.inter_frame_level; f++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Turbo/Codec_turbo.cpp",
"new_path": "src/Tools/Codec/Turbo/Codec_turbo.cpp",
"diff": "#include <functional>\n-#include <stdexcept>\n#include <cctype>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Factory/Factory_interleaver.hpp\"\n#include \"Tools/Factory/RSC/Factory_encoder_RSC.hpp\"\n#include \"Tools/Factory/Turbo/Factory_encoder_turbo.hpp\"\n@@ -31,8 +31,7 @@ Codec_turbo<B,Q,QD>\nif (!params.simulation.json_path.empty())\n{\nif (this->params.simulation.n_threads != 1)\n- throw std::runtime_error(\"aff3ct::tools::Codec_turbo: only single-threaded simulation is \"\n- \"available with JSON trace.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"JSON trace only supports single-threaded simulation.\");\njson_stream.open(params.simulation.json_path.c_str(), std::ios::out | std::ios::trunc);\n@@ -111,7 +110,7 @@ Encoder<B>* Codec_turbo<B,Q,QD>\n::build_encoder(const int tid, const Interleaver<int>* itl)\n{\nif (itl == nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Codec_turbo: \\\"itl\\\" should not be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'itl' should not be null.\");\nif (sub_enc[tid] != nullptr)\n{\n@@ -122,7 +121,7 @@ Encoder<B>* Codec_turbo<B,Q,QD>\nsub_enc[tid] = this->build_sub_encoder(tid);\nif (sub_enc[tid] == nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Codec_turbo: \\\"sub_enc\\\" can't be created.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'sub_enc' can't be created.\");\nreturn Factory_encoder_turbo<B>::build(this->params.encoder.type,\nthis->params.code.K,\n@@ -169,7 +168,7 @@ Decoder<B,Q>* Codec_turbo<B,Q,QD>\n::build_decoder(const int tid, const Interleaver<int>* itl, CRC<B>* crc)\n{\nif (itl == nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Codec_turbo: \\\"itl\\\" should not be null.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'itl' should not be null.\");\nclear_post_processing(tid);\n@@ -182,7 +181,7 @@ Decoder<B,Q>* Codec_turbo<B,Q,QD>\nsiso[tid] = this->build_sub_siso(tid);\nif (siso[tid] == nullptr)\n- throw std::runtime_error(\"aff3ct::tools::Codec_turbo: \\\"siso\\\" can't be created.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"'siso' can't be created.\");\nauto decoder = Factory_decoder_turbo<B,Q>::build(\"TURBO\",\ntypeid(B) == typeid(long long) ? \"STD\" : \"FAST\",\n@@ -222,7 +221,7 @@ Decoder<B,Q>* Codec_turbo<B,Q,QD>\nthis->params.decoder.fnc_ite_step,\ndecoder->get_simd_inter_frame_level()));\nelse\n- throw std::runtime_error(\"aff3ct::tools::Codec_turbo: the Flip aNd Check requires a CRC.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"The Flip aNd Check requires a CRC.\");\n}\nelse if (crc != nullptr && crc->get_size() > 0)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Uncoded/Codec_uncoded.cpp",
"new_path": "src/Tools/Codec/Uncoded/Codec_uncoded.cpp",
"diff": "-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Encoder/NO/Encoder_NO.hpp\"\n#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n@@ -14,7 +16,12 @@ Codec_uncoded<B,Q>\n: Codec_SISO<B,Q>(params)\n{\nif (params.code.K != params.code.N_code)\n- throw std::invalid_argument(\"aff3ct::tools::Codec_uncoded: \\\"K\\\" has to be equal to \\\"N_code\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be equal to 'N_code' ('K' = \" << params.code.K\n+ << \", 'N_code' = \" << params.code.N_code << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B, typename Q>\n@@ -54,11 +61,27 @@ void Codec_uncoded<B,Q>\nconst auto K = this->params.code.K;\nif ((int)Y_N.size() != K * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_uncoded: invalid \\\"Y_N\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N.size()' has to be equal to 'K' * 'inter_frame_level' ('Y_N.size()' = \" << Y_N.size()\n+ << \", 'K' = \" << K << \", 'inter_frame_level' = \" << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)sys.size() != K * this->params.simulation.inter_frame_level)\n- throw std::length_error(\"aff3ct::tools::Codec_uncoded: invalid \\\"sys\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'sys.size()' has to be equal to 'K' * 'inter_frame_level' ('sys.size()' = \" << sys.size()\n+ << \", 'K' = \" << K << \", 'inter_frame_level' = \" << this->params.simulation.inter_frame_level << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif ((int)par.size() != 0)\n- throw std::length_error(\"aff3ct::tools::Codec_uncoded: invalid \\\"par\\\" size.\");\n+ {\n+ std::stringstream message;\n+ message << \"'par.size()' has to be equal to 0 ('par.size()' = \" << 'par.size()' << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nstd::copy(Y_N.begin(), Y_N.end(), sys.begin());\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the tools::Codec.
|
8,490 |
23.06.2017 11:58:33
| -7,200 |
979a374887b71db6b7d0e2f5a4a161690f9f93c8
|
Improve the exceptions in the tools::Display.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Dumper/Dumper.cpp",
"new_path": "src/Tools/Display/Dumper/Dumper.cpp",
"diff": "#include <vector>\n#include <sstream>\n#include <iostream>\n-#include <stdexcept>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Dumper.hpp\"\n@@ -13,7 +14,11 @@ Dumper\n: n_frames(n_frames)\n{\nif (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"n_frames\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nDumper\n@@ -27,13 +32,24 @@ void Dumper\nstd::vector<unsigned> headers)\n{\nif (ptr == nullptr)\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"ptr\\\" can't be null.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"'ptr' can't be null.\");\n+\nif (size <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"size\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'size' has to be greater than 0 ('size' = \" << size << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (file_ext.empty())\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"file_ext\\\" can't be empty.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"'file_ext' can't be empty.\");\n+\nif (n_frames <= 0 && n_frames != -1)\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"n_frames\\\" has to be greater than 0 (or equal to -1).\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 or equal to -1 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->buffer.push_back(std::vector<std::vector<char>>());\n@@ -52,7 +68,11 @@ void Dumper\nstd::vector<unsigned> headers)\n{\nif (n_frames <= 0 && n_frames != -1)\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"n_frames\\\" has to be greater than 0 (or equal to -1).\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_frames' has to be greater than 0 or equal to -1 ('n_frames' = \" << n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ };\nthis->register_data(data.data(), data.size() / this->n_frames, file_ext, binary_mode, headers);\n}\n@@ -61,7 +81,12 @@ void Dumper\n::add(const int frame_id)\n{\nif (frame_id < 0 || frame_id >= this->n_frames)\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"frame_id\\\" is invalid.\");\n+ {\n+ std::stringstream message;\n+ message << \"'frame_id' has to be positive and smaller than 'n_frames' ('frame_id' = \" << frame_id\n+ << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nfor (auto i = 0; i < (int)this->registered_data_ptr.size(); i++)\n{\n@@ -80,7 +105,7 @@ void Dumper\n::dump(const std::string& base_path)\n{\nif (base_path.empty())\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: \\\"base_path\\\" can't be empty.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"'base_path' can't be empty.\");\nfor (auto i = 0; i < (int)this->registered_data_ptr.size(); i++)\n{\n@@ -152,7 +177,7 @@ void Dumper\nelse if (type == typeid(float )) this->_write_body_text<float >(file, buffer, size);\nelse if (type == typeid(double )) this->_write_body_text<double >(file, buffer, size);\nelse\n- throw std::invalid_argument(\"aff3ct::tools::Dumper: unsupported data type.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"Unsupported data type.\");\n}\ntemplate <typename T>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Dumper/Dumper_reduction.cpp",
"new_path": "src/Tools/Display/Dumper/Dumper_reduction.cpp",
"diff": "#include <vector>\n#include <sstream>\n#include <iostream>\n-#include <stdexcept>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Dumper_reduction.hpp\"\n@@ -27,8 +28,12 @@ void Dumper_reduction\nconst auto n_buff_cur = dumpers[i]->buffer.size();\nif (n_buff_cur != n_buff_ref)\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"n_buff_cur\\\" should be equal to \"\n- \"\\\"n_buff_ref\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_buff_cur' should be equal to 'n_buff_ref' ('n_buff_cur' = \" << n_buff_cur\n+ << \", 'n_buff_ref' = \" << n_buff_ref << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nfor (unsigned i = 0; i < n_buff_ref; i++)\n@@ -50,28 +55,60 @@ void Dumper_reduction\nconst auto head_cur = dumpers[j]->registered_data_head [i];\nif (size_cur != size_ref)\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"size_cur\\\" should be equal to \"\n- \"\\\"size_ref\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'size_cur' should be equal to 'size_ref' ('size_cur' = \" << size_cur\n+ << \", 'size_ref' = \" << size_ref << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (sizeof_cur != sizeof_ref)\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"sizeof_cur\\\" should be equal to \"\n- \"\\\"sizeof_ref\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'sizeof_cur' should be equal to 'sizeof_ref' ('sizeof_cur' = \" << sizeof_cur\n+ << \", 'sizeof_ref' = \" << sizeof_ref << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (type_cur != type_ref)\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"type_cur\\\" should be equal to \"\n- \"\\\"type_ref\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'type_cur' should be equal to 'type_ref' ('type_cur' = \" << type_cur.name()\n+ << \", 'type_ref' = \" << type_ref.name() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (ext_cur != ext_ref)\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"ext_cur\\\" should be equal to \"\n- \"\\\"ext_ref\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'ext_cur' should be equal to 'ext_ref' ('ext_cur' = \" << ext_cur\n+ << \", 'ext_ref' = \" << ext_ref << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (bin_cur != bin_ref)\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"bin_cur\\\" should be equal to \"\n- \"\\\"bin_ref\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'bin_cur' should be equal to 'bin_ref' ('bin_cur' = \" << bin_cur\n+ << \", 'bin_ref' = \" << bin_ref << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (head_cur != head_ref)\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"head_cur\\\" should be equal to \"\n- \"\\\"head_ref\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'head_cur' should be equal to 'head_ref'.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n}\n}\nelse\n- throw std::runtime_error(\"aff3ct::tools::Dumper_reduction: \\\"dumpers.size()\\\" should be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'dumpers.size()' should be greater than 0 ('dumpers.size()' = \" << dumpers.size() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nDumper_reduction\n@@ -82,7 +119,7 @@ Dumper_reduction\nvoid Dumper_reduction\n::add(const int frame_id)\n{\n- throw std::invalid_argument(\"aff3ct::tools::Dumper_reduction: \\\"add\\\" method can't be called on this class.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"This method can't be called on this class.\");\n}\nvoid Dumper_reduction\n@@ -91,7 +128,7 @@ void Dumper_reduction\nthis->checks();\nif (base_path.empty())\n- throw std::invalid_argument(\"aff3ct::tools::Dumper_reduction: \\\"base_path\\\" can't be empty.\");\n+ throw invalid_argument(__FILE__, __LINE__, __func__, \"'base_path' can't be empty.\");\nthis->buffer .resize(dumpers[0]->buffer.size());\nthis->registered_data_ptr.resize(dumpers[0]->registered_data_ptr.size());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx",
"new_path": "src/Tools/Display/Frame_trace/Frame_trace.hxx",
"diff": "-#include <stdexcept>\n#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Frame_trace.hpp\"\n@@ -45,10 +45,19 @@ void Frame_trace<B>\nbool enable_ref = !ref.empty();\nif (enable_ref && ref.size() != vec.size())\n- throw std::length_error(\"aff3ct::tools::Frame_trace: \\\"ref.size()\\\" has to be equal to \\\"vec.size()\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'ref.size()' has to be equal to 'vec.size()' ('ref.size()' = \" << ref.size()\n+ << \", 'vec.size()' = \" << vec.size() << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (this->n_bits < 0)\n- throw std::invalid_argument(\"aff3ct::tools::Frame_trace: \\\"n_bits\\\" has to be equal or greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_bits' has to be equal or greater than 0 ('n_bits' = \" << this->n_bits << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto n_bits = this->n_bits ? (this->n_bits <= (int)vec.size() ? this->n_bits : (int)vec.size()) : (int)vec.size();\nif (row_width == vec.size())\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"diff": "#include <iostream>\n#include <iomanip>\n#include <sstream>\n-#include <stdexcept>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n#include \"Terminal_BFER.hpp\"\n@@ -29,11 +29,25 @@ Terminal_BFER<B>\nreal_time_state(0 )\n{\nif (K <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER: \\\"K\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER: \\\"N\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be greater than 0 ('N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (K > N)\n- throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be smaller or equal to 'N' ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n@@ -54,7 +68,11 @@ Terminal_BFER<B>\nreal_time_state(0 )\n{\nif (K <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Terminal_BFER: \\\"K\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the tools::Display.
|
8,490 |
23.06.2017 14:14:15
| -7,200 |
65ae9aceb86fd396409b7e6488c131a360463ff7
|
Improve the exceptions in the tools::Math.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar_gen.cpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar_gen.cpp",
"diff": "+#include <sstream>\n+\n#include \"Tools/Exception/exception.hpp\"\n/* // GENERATED DECODERS // */\n@@ -1118,7 +1120,11 @@ void Factory_decoder_polar_gen<B,R>\n#endif\nif (fb_ptr == nullptr)\n- throw cannot_allocate(__FILE__, __LINE__, __func__);\n+ {\n+ std::stringstream message;\n+ message << \"'implem' frozen bits does not exist ('implem' = \" << implem << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nfor (auto i = 0; i < N; i++)\nfrozen_bits[i] = (B)fb_ptr[i];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/Galois.cpp",
"new_path": "src/Tools/Math/Galois.cpp",
"diff": "#include <cmath>\n-#include <stdexcept>\n#include <iostream>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Galois.hpp\"\n@@ -10,17 +12,47 @@ Galois\n::Galois(const int& K, const int& N, const int& m, const int& t)\n: K(K), N(N), m(m), t(t), d(2 * t + 1)\n{\n+ if (K <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (N <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be greater than 0 ('N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (K > N)\n- throw std::invalid_argument(\"aff3ct::tools::Galois: \\\"K\\\" has to be smaller or equal to \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be smaller or equal to 'N' ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (N >= 1048576) // 2^20\n- throw std::invalid_argument(\"aff3ct::tools::Galois: \\\"N\\\" has to be smaller than 1048576.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be smaller than 1048576 ('N' = \" << N << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (m != (int)std::ceil(std::log2(N +1)))\n- throw std::invalid_argument(\"aff3ct::tools::Galois: \\\"m\\\" has to be equal to \\\"log2(N +1)\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'m' has to be equal to ceil(log2('N' +1)) ('m' = \" << m << \", 'N' = \" << N << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (N != ((1 << m) -1))\n- throw std::invalid_argument(\"aff3ct::tools::Galois: \\\"N\\\" has to be a power of 2 minus 1.\");\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be a power of 2 minus 1 ('N' = \" << N << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nalpha_to.resize(N +1);\nindex_of.resize(N +1);\n@@ -177,7 +209,12 @@ void Galois\n}\nif (K > N - rdncy)\n- throw std::runtime_error(\"aff3ct::tools::Galois: \\\"K\\\" seems to be too big for this correction power \\\"t\\\".\");\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/* Compute the generator polynomial */\ng[0] = alpha_to[zeros[1]];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/matrix.hxx",
"new_path": "src/Tools/Math/matrix.hxx",
"diff": "-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"matrix.h\"\n@@ -13,11 +15,28 @@ inline void rgemm(const int M, const int N, const int K,\nmipp::vector<T> &tC)\n{\nif (A.size() != unsigned(M * K))\n- throw std::length_error(\"aff3ct::tools::rgemm: \\\"A.size()\\\" has to be equal to \\\"M\\\" * \\\"K\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'A.size()' has to be equal to 'M' * 'K' ('A.size()' = \" << A.size() << \", 'M' = \" << M\n+ << \", 'K' = \" << K << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (tB.size() != unsigned(K * N))\n- throw std::length_error(\"aff3ct::tools::rgemm: \\\"tB.size()\\\" has to be equal to \\\"K\\\" * \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'tB.size()' has to be equal to 'K' * 'N' ('tB.size()' = \" << tB.size() << \", 'K' = \" << K\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (tC.size() != unsigned(M * N))\n- throw std::length_error(\"aff3ct::tools::rgemm: \\\"tC.size()\\\" has to be equal to \\\"M\\\" * \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'tC.size()' has to be equal to 'M' * 'N' ('tC.size()' = \" << tC.size() << \", 'M' = \" << M\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nrgemm(M, N, K, A.data(), tB.data(), tC.data());\n}\n@@ -46,11 +65,28 @@ inline void cgemm(const int M, const int N, const int K,\nmipp::vector<T> &tC)\n{\nif (A.size() != unsigned(M * K * 2))\n- throw std::length_error(\"aff3ct::tools::cgemm: \\\"A.size()\\\" has to be equal to \\\"M\\\" * \\\"K\\\" * \\\"2\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'A.size()' has to be equal to 'M' * 'K' * 2 ('A.size()' = \" << A.size() << \", 'M' = \" << M\n+ << \", 'K' = \" << K << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (tB.size() != unsigned(K * N * 2))\n- throw std::length_error(\"aff3ct::tools::cgemm: \\\"tB.size()\\\" has to be equal to \\\"K\\\" * \\\"N\\\" * \\\"2\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'tB.size()' has to be equal to 'K' * 'N' * 2 ('tB.size()' = \" << tB.size() << \", 'K' = \" << K\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (tC.size() != unsigned(M * N * 2))\n- throw std::length_error(\"aff3ct::tools::cgemm: \\\"tC.size()\\\" has to be equal to \\\"M\\\" * \\\"N\\\" * \\\"2\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'tC.size()' has to be equal to 'M' * 'N' * 2 ('tC.size()' = \" << tC.size() << \", 'M' = \" << M\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\ncgemm(M, N, K, A.data(), tB.data(), tC.data());\n}\n@@ -92,11 +128,28 @@ inline void cgemm_r(const int M, const int N, const int K,\nmipp::vector<T> &tC)\n{\nif (A.size() != unsigned(M * K * 2))\n- throw std::length_error(\"aff3ct::tools::cgemm_r: \\\"A.size()\\\" has to be equal to \\\"M\\\" * \\\"K\\\" * \\\"2\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'A.size()' has to be equal to 'M' * 'K' * 2 ('A.size()' = \" << A.size() << \", 'M' = \" << M\n+ << \", 'K' = \" << K << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (tB.size() != unsigned(K * N * 2))\n- throw std::length_error(\"aff3ct::tools::cgemm_r: \\\"tB.size()\\\" has to be equal to \\\"K\\\" * \\\"N\\\" * \\\"2\\\".\");\n- if (tC.size() != unsigned(M * N * 1)) // because we only store the real part\n- throw std::length_error(\"aff3ct::tools::cgemm_r: \\\"tC.size()\\\" has to be equal to \\\"M\\\" * \\\"N\\\" * \\\"1\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'tB.size()' has to be equal to 'K' * 'N' * 2 ('tB.size()' = \" << tB.size() << \", 'K' = \" << K\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (tC.size() != unsigned(M * N * 1))\n+ {\n+ std::stringstream message;\n+ message << \"'tC.size()' has to be equal to 'M' * 'N' * 1 ('tC.size()' = \" << tC.size() << \", 'M' = \" << M\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\ncgemm_r(M, N, K, A.data(), tB.data(), tC.data());\n}\n@@ -132,9 +185,20 @@ inline void real_transpose(const int M, const int N,\nmipp::vector<T> &B)\n{\nif (A.size() != unsigned(M * N))\n- throw std::length_error(\"aff3ct::tools::real_transpose: \\\"A.size()\\\" has to be equal to \\\"M\\\" * \\\"N\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'A.size()' has to be equal to 'M' * 'N' ('A.size()' = \" << A.size() << \", 'M' = \" << M\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (B.size() != unsigned(N * M))\n- throw std::length_error(\"aff3ct::tools::real_transpose: \\\"B.size()\\\" has to be equal to \\\"N\\\" * \\\"M\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'B.size()' has to be equal to 'N' * 'M' ('B.size()' = \" << B.size() << \", 'N' = \" << N\n+ << \", 'M' = \" << M << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nreal_transpose(M, N, A.data(), B.data());\n}\n@@ -155,11 +219,20 @@ inline void complex_transpose(const int M, const int N,\nmipp::vector<T> &B)\n{\nif (A.size() != unsigned(M * N * 2))\n- throw std::length_error(\"aff3ct::tools::complex_transpose: \\\"A.size()\\\" has to be equal to \"\n- \"\\\"M\\\" * \\\"N\\\" * \\\"2\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'A.size()' has to be equal to 'M' * 'N' * 2 ('A.size()' = \" << A.size() << \", 'M' = \" << M\n+ << \", 'N' = \" << N << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (B.size() != unsigned(N * M * 2))\n- throw std::length_error(\"aff3ct::tools::complex_transpose: \\\"B.size()\\\" has to be equal to \"\n- \"\\\"N\\\" * \\\"M\\\" * \\\"2\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'B.size()' has to be equal to 'N' * 'M' * 2 ('B.size()' = \" << B.size() << \", 'N' = \" << N\n+ << \", 'M' = \" << M << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\ncomplex_transpose(M, N, A.data(), B.data());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/max.hxx",
"new_path": "src/Tools/Math/max.hxx",
"diff": "#include <cmath> // min(), fabs(), copysign()...\n#include <algorithm> // min()\n+#include \"Tools/Exception/exception.hpp\"\n+\n#include \"max.h\"\nnamespace aff3ct\n@@ -31,8 +33,7 @@ inline R max_star(const R& a, const R& b)\ntemplate <typename R>\ninline R max_star_safe(const R& a, const R& b)\n{\n- throw std::runtime_error(\"aff3ct::tools::max_star_safe: \\\"max_star_safe\\\" is not defined in fixed-point \"\n- \"arithmetic.\");\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"This method is not defined in fixed-point arithmetic.\");\nreturn (R)0;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/utils.h",
"new_path": "src/Tools/Math/utils.h",
"diff": "#ifndef MATH_UTILS_H\n#define MATH_UTILS_H\n-#include <stdexcept>\n+#include <sstream>\n#include <algorithm>\n#include <limits>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\nnamespace aff3ct\n@@ -75,9 +76,18 @@ template <typename R, typename function_type>\ninline R integral(function_type func, const R min, const R max, const int number_steps)\n{\nif (max < min)\n- throw std::invalid_argument(\"aff3ct::tools::integral: \\\"max\\\" has to be equal or greater than min.\");\n+ {\n+ std::stringstream message;\n+ message << \"'max' has to be equal or greater than 'min' ('max' = \" << max << \", 'min' = \" << min << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (number_steps <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::integral: \\\"number_steps\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'number_steps' has to be greater than 0 ('number_steps' = \" << number_steps << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nR step = (max - min) / number_steps; // width of rectangle\nR area = (R)0;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the tools::Math.
|
8,490 |
23.06.2017 15:33:47
| -7,200 |
589d3b8e1649a9ccd8672467024727b3013e3369
|
Improve the exceptions in the Tools.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "#include <iostream>\n-#include <stdexcept>\n+#include <sstream>\n#include <algorithm>\nusing namespace std;\n+#include \"Tools/Exception/exception.hpp\"\n+\n#include \"Arguments_reader.hpp\"\nusing namespace aff3ct::tools;\n@@ -12,7 +14,11 @@ Arguments_reader\n: m_argv(argc), max_n_char_arg(0)\n{\nif (argc <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Arguments_reader: \\\"argc\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'argc' has to be greater than 0 ('argc' = \" << argc << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nthis->m_program_name = argv[0];\n@@ -77,18 +83,30 @@ bool Arguments_reader\n::sub_parse_arguments(map<vector<string>, vector<string>> &args, unsigned short pos_arg)\n{\nif (pos_arg >= this->m_argv.size())\n- throw std::invalid_argument(\"aff3ct::tools::Arguments_reader: \\\"pos_arg\\\" has to be smaller than \"\n- \"\\\"this->m_argv.size()\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'pos_arg' has to be smaller than 'm_argv.size()' ('pos_arg' = \" << pos_arg\n+ << \", 'm_argv.size()' = \" << this->m_argv.size() << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nauto is_found = false;\nfor (auto it = args.begin(); it != args.end(); ++it)\n{\nif (it->first.size() <= 0)\n- throw std::runtime_error(\"aff3ct::tools::Arguments_reader: \\\"it->first.size()\\\" has to be greater \"\n- \"than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'it->first.size()' has to be greater than 0 ('it->first.size()' = \" << it->first.size() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (it->second.size() <= 0)\n- throw std::runtime_error(\"aff3ct::tools::Arguments_reader: \\\"it->second.size()\\\" has to be greater \"\n- \"than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'it->second.size()' has to be greater than 0 ('it->second.size()' = \" << it->second.size()\n+ << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n// remember the biggest argument length to display the doc after\nconst string delimiter = \", \";\n@@ -183,8 +201,12 @@ void Arguments_reader\nfor (auto i = 0; i < (int)arg_groups.size(); i++)\n{\nif (arg_groups[i].size() <= 1)\n- throw std::runtime_error(\"aff3ct::tools::Arguments_reader: \\\"arg_groups[i].size()\\\" has to be greater \"\n- \"than 1.\");\n+ {\n+ std::stringstream message;\n+ message << \"'arg_groups[i].size()' has to be greater than 1 ('i' = \" << i\n+ << \", 'arg_groups[i].size()' = \" << arg_groups[i].size() << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n// detect if there is at least one argument of this group\nauto display = false;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Reorderer/Reorderer.hxx",
"new_path": "src/Tools/Perf/Reorderer/Reorderer.hxx",
"diff": "#include <cmath>\n-#include <stdexcept>\n+#include <sstream>\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Math/utils.h\"\n#include \"Reorderer.hpp\"\n@@ -137,7 +138,12 @@ void Reorderer_static<T,N_FRAMES>\n::apply(const std::vector<const T*> in_data, T* out_data, const int data_length)\n{\nif (in_data.size() != N_FRAMES)\n- throw std::length_error(\"aff3ct::tools::Reorderer_static: \\\"in_data.size()\\\" has to be equal to \\\"N_FRAMES\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'in_data.size()' has to be equal to 'N_FRAMES' ('in_data.size()' = \" << in_data.size()\n+ << \", 'N_FRAMES' = \" << N_FRAMES << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconstexpr int n_fra = N_FRAMES;\n@@ -366,7 +372,12 @@ void Reorderer_static<T,N_FRAMES>\n::apply_rev(const T* in_data, std::vector<T*> out_data, const int data_length)\n{\nif (out_data.size() != N_FRAMES)\n- throw std::length_error(\"aff3ct::tools::Reorderer_static: \\\"out_data.size()\\\" has to be equal to \\\"N_FRAMES\\\".\");\n+ {\n+ std::stringstream message;\n+ message << \"'out_data.size()' has to be equal to 'N_FRAMES' ('out_data.size()' = \" << out_data.size()\n+ << \", 'N_FRAMES' = \" << N_FRAMES << \").\";\n+ throw length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\nconstexpr int n_fra = N_FRAMES;\nconstexpr int n_fra_2 = N_FRAMES / 2;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Transpose/transpose_AVX.cpp",
"new_path": "src/Tools/Perf/Transpose/transpose_AVX.cpp",
"diff": "#ifdef __AVX2__\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"transpose_AVX.h\"\n@@ -38,7 +40,7 @@ inline void _MM_TRANSPOSE8_PS(__m256 &row0, __m256 &row1, __m256 &row2, __m256 &\n//\n// TRANPOSITION DE MATRICE DE TAILLE Nx4\n//\n-void avx_trans_float(float *A, float *B, int n)\n+void aff3ct::tools::avx_trans_float(float *A, float *B, int n)\n{\nint i = n/8;\nwhile( i-- ){\n@@ -67,7 +69,7 @@ void avx_trans_float(float *A, float *B, int n)\n//\n// TRANPOSITION DE MATRICE DE TAILLE 4xN\n//\n-void avx_itrans_float(float *A, float *B, int n)\n+void aff3ct::tools::avx_itrans_float(float *A, float *B, int n)\n{\nint i = n/8;\nwhile( i-- ){\n@@ -99,10 +101,14 @@ void avx_itrans_float(float *A, float *B, int n)\n#define _mm256_unpacklo_epi128(a,b) (_mm256_permute2x128_si256(a,b,0x20))\n#define _mm256_unpackhi_epi128(a,b) (_mm256_permute2x128_si256(a,b,0x31))\n-void uchar_transpose_avx(const __m256i *src, __m256i *dst, int n)\n+void aff3ct::tools::uchar_transpose_avx(const __m256i *src, __m256i *dst, int n)\n{\nif (n % 32)\n- throw std::invalid_argument(\"aff3ct::tools::uchar_transpose_avx: \\\"n\\\" has to be divisible by 32.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n' has to be divisible by 32 ('n' = \" << n << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst int constN = n / 32; // NOMBRE DE PAQUET (256 bits) PAR TRAME\n__m256i *p_input = const_cast<__m256i*>(src);\n@@ -383,10 +389,14 @@ void uchar_transpose_avx(const __m256i *src, __m256i *dst, int n)\n}\n}\n-void uchar_itranspose_avx(const __m256i *src, __m256i *dst, int n)\n+void aff3ct::tools::uchar_itranspose_avx(const __m256i *src, __m256i *dst, int n)\n{\nif (n % 32)\n- throw std::invalid_argument(\"aff3ct::tools::uchar_itranspose_avx: \\\"n\\\" has to be divisible by 32.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n' has to be divisible by 32 ('n' = \" << n << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst int constN = n /32; // NOMBRE DE PAQUET (128 bits) PAR TRAME\n__m256i *p_input = const_cast<__m256i*>(src);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Transpose/transpose_AVX.h",
"new_path": "src/Tools/Perf/Transpose/transpose_AVX.h",
"diff": "#include <smmintrin.h>\n#include <immintrin.h>\n+namespace aff3ct\n+{\n+namespace tools\n+{\nvoid avx_trans_float (float *A, float *B, int n);\nvoid avx_itrans_float(float *A, float *B, int n);\nvoid uchar_transpose_avx(const __m256i *src, __m256i *dst, int n);\nvoid uchar_itranspose_avx(const __m256i *src, __m256i *dst, int n);\n+}\n+}\n#endif /* TRANSPOSE_AVX_H */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Transpose/transpose_NEON.cpp",
"new_path": "src/Tools/Perf/Transpose/transpose_NEON.cpp",
"diff": "#if defined(__ARM_NEON__) || defined(__ARM_NEON)\n#include <math.h>\n-#include <stdexcept>\n+#include <sstream>\n#include <stdio.h>\n#include <stdlib.h>\n#include <arm_neon.h>\n+#include \"Tools/Exception/exception.hpp\"\n+\n#include \"transpose_NEON.h\"\n#define DATA_TYPE trans_TYPE\n#define COMBINE_LOW(b,c) (cast_64_to_8( vcombine_u64(vget_low_u64 (cast_8_to_64(b)), vget_low_u64 (cast_8_to_64(c)))))\n#define COMBINE_HIGH(b,c) (cast_64_to_8( vcombine_u64(vget_high_u64 (cast_8_to_64(b)), vget_high_u64 (cast_8_to_64(c)))))\n-void uchar_transpose_neon(const DATA_TYPE *src, DATA_TYPE *dst, int n)\n+void aff3ct::tools::uchar_transpose_neon(const DATA_TYPE *src, DATA_TYPE *dst, int n)\n{\nif (n % 16)\n- throw std::invalid_argument(\"aff3ct::tools::uchar_transpose_neon: \\\"n\\\" has to be divisible by 16.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n' has to be divisible by 16 ('n' = \" << n << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst int N = n / 16; // NOMBRE DE PAQUET (128 bits) PAR TRAME\nt_u8x16 *p_input = const_cast<DATA_TYPE*>(src);\n@@ -208,10 +214,14 @@ void uchar_transpose_neon(const DATA_TYPE *src, DATA_TYPE *dst, int n)\n}\n-void uchar_itranspose_neon(const DATA_TYPE *src, DATA_TYPE *dst, int n)\n+void aff3ct::tools::uchar_itranspose_neon(const DATA_TYPE *src, DATA_TYPE *dst, int n)\n{\nif (n % 16)\n- throw std::invalid_argument(\"aff3ct::tools::uchar_itranspose_neon: \\\"n\\\" has to be divisible by 16.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n' has to be divisible by 16 ('n' = \" << n << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst int N = n / 16; // NOMBRE DE PAQUET (128 bits) PAR TRAME\nt_u8x16 *p_input = const_cast<DATA_TYPE*>(src);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Transpose/transpose_NEON.h",
"new_path": "src/Tools/Perf/Transpose/transpose_NEON.h",
"diff": "#include <arm_neon.h>\n+namespace aff3ct\n+{\n+namespace tools\n+{\n#define trans_TYPE uint8x16_t\nextern void uchar_transpose_neon(const trans_TYPE *src, trans_TYPE *dst, int n);\nextern void uchar_itranspose_neon(const trans_TYPE *src, trans_TYPE *dst, int n);\n+}\n+}\n#endif /* TRANSPOSE_NEON_H */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Transpose/transpose_SSE.cpp",
"new_path": "src/Tools/Perf/Transpose/transpose_SSE.cpp",
"diff": "#ifdef __SSE4_1__\n-#include <stdexcept>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"transpose_SSE.h\"\n+using namespace aff3ct::tools;\n+\n//\n// TRANPOSITION DE MATRICE DE TAILLE Nx4\n//\n-void sse_trans_float(float *A, float *B, int n)\n+void aff3ct::tools::sse_trans_float(float *A, float *B, int n)\n{\nint i = n/4;\nwhile( i-- ){\n@@ -28,7 +32,7 @@ void sse_trans_float(float *A, float *B, int n)\n//\n// TRANPOSITION DE MATRICE DE TAILLE 4xN\n//\n-void sse_itrans_float(float *A, float *B, int n)\n+void aff3ct::tools::sse_itrans_float(float *A, float *B, int n)\n{\nint i = n/4;\nwhile( i-- ){\n@@ -49,10 +53,14 @@ void sse_itrans_float(float *A, float *B, int n)\n#define LOAD_SIMD_FX _mm_load_si128\n#define STORE_SIMD_FX _mm_store_si128\n-void uchar_transpose_sse(const __m128i *src, __m128i *dst, int n)\n+void aff3ct::tools::uchar_transpose_sse(const __m128i *src, __m128i *dst, int n)\n{\nif (n % 16)\n- throw std::invalid_argument(\"aff3ct::tools::uchar_transpose_sse: \\\"n\\\" has to be divisible by 16.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n' has to be divisible by 16 ('n' = \" << n << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst int N = n /16; // NOMBRE DE PAQUET (128 bits) PAR TRAME\n__m128i *p_input = const_cast<__m128i*>(src);\n@@ -180,10 +188,14 @@ void uchar_transpose_sse(const __m128i *src, __m128i *dst, int n)\n#define LOAD_SIMD_FX _mm_load_si128\n#define STORE_SIMD_FX _mm_store_si128\n-void uchar_itranspose_sse(const __m128i *src, __m128i *dst, int n)\n+void aff3ct::tools::uchar_itranspose_sse(const __m128i *src, __m128i *dst, int n)\n{\nif (n % 16)\n- throw std::invalid_argument(\"aff3ct::tools::uchar_itranspose_sse: \\\"n\\\" has to be divisible by 16.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n' has to be divisible by 16 ('n' = \" << n << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst int N = n /16; // NOMBRE DE PAQUET (128 bits) PAR TRAME\n__m128i *p_input = const_cast<__m128i*>(src);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Transpose/transpose_SSE.h",
"new_path": "src/Tools/Perf/Transpose/transpose_SSE.h",
"diff": "#include <smmintrin.h>\n#include <immintrin.h>\n+namespace aff3ct\n+{\n+namespace tools\n+{\nvoid sse_trans_float (float *A, float *B, int n);\nvoid sse_itrans_float(float *A, float *B, int n);\nvoid uchar_transpose_sse (const __m128i *src, __m128i *dst, int n);\nvoid uchar_itranspose_sse(const __m128i *src, __m128i *dst, int n);\n+}\n+}\n#endif /* TRANSPOSE_SSE_H */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/Transpose/transpose_selector.cpp",
"new_path": "src/Tools/Perf/Transpose/transpose_selector.cpp",
"diff": "-#include <stdexcept>\n#include <iostream>\n+#include \"Tools/Exception/exception.hpp\"\n+\n#ifdef __AVX2__\n#include \"transpose_AVX.h\"\n#elif defined(__SSE4_1__)\n@@ -36,7 +37,7 @@ bool aff3ct::tools::char_transpose(const signed char *src, signed char *dst, int\nis_transposed = true;\n}\n#else\n- throw std::runtime_error(\"aff3ct::tools::char_transpose: transposition does not support this architecture \"\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"Transposition does not support this architecture \"\n\"(supported architectures are: NEON, NEONv2, SSE4.1 and AVX2).\");\n#endif\n@@ -67,7 +68,7 @@ bool aff3ct::tools::char_itranspose(const signed char *src, signed char *dst, in\nis_itransposed = true;\n}\n#else\n- throw std::runtime_error(\"aff3ct::tools::char_itranspose: transposition inv. does not support this architecture \"\n+ throw runtime_error(__FILE__, __LINE__, __func__, \"Transposition inverse does not support this architecture \"\n\"(supported architectures are: NEON, NEONv2, SSE4.1 and AVX2).\");\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Threads/Barrier.cpp",
"new_path": "src/Tools/Threads/Barrier.cpp",
"diff": "#include <string>\n#include <chrono>\n-#include <stdexcept>\n#include <iostream>\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Barrier.hpp\"\n@@ -12,7 +14,11 @@ Barrier\n: n_threads(n_threads), counter_barrier(n_threads), generation(0)\n{\nif (n_threads <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::Barrier: \\\"n_threads\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'n_threads' has to be greater than 0 ('n_threads' = \" << n_threads << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\nBarrier\n@@ -40,12 +46,11 @@ void Barrier\n// release the lock\nif (cond_barrier.wait_for(lock, std::chrono::milliseconds(6000)) == std::cv_status::timeout)\n{\n- throw std::invalid_argument(\"aff3ct::tools::Barrier: some threads did not reach the barrier \"\n- \"(counter_barrier = \" + std::to_string(counter_barrier) +\n- \", tid = \" + std::to_string(tid) +\n- \", generation = \" + std::to_string(generation) + \").\" +\n- \"This message should never happen: there is a bug in the \"\n- \"multithreaded code.\");\n+ std::stringstream message;\n+ message << \"aff3ct::tools::Barrier: some threads did not reach the barrier (counter_barrier = \"\n+ << counter_barrier << \", tid = \" << tid << \", generation = \" << generation\n+ << \"). \" << \"This message should never happen: there is a bug in the multithreaded code.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/general_utils.cpp",
"new_path": "src/Tools/general_utils.cpp",
"diff": "#include <cmath>\n#include <limits>\n#include <sstream>\n-#include <stdexcept>\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"general_utils.h\"\n@@ -20,9 +21,18 @@ template <typename R>\nR aff3ct::tools::sigma_to_esn0(const R sigma, const int upsample_factor)\n{\nif (upsample_factor <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::sigma_to_esn0: \\\"upsample_factor\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'upsample_factor' has to be greater than 0 ('upsample_factor' = \" << upsample_factor << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (sigma < (R)0)\n- throw std::invalid_argument(\"aff3ct::tools::sigma_to_esn0: \\\"sigma\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'sigma' has to be greater than 0 ('sigma' = \" << sigma << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (sigma == (R)0)\n{\n@@ -40,7 +50,11 @@ template <typename R>\nR aff3ct::tools::esn0_to_sigma(const R esn0, const int upsample_factor)\n{\nif (upsample_factor <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::esn0_to_sigma: \\\"upsample_factor\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'upsample_factor' has to be greater than 0 ('upsample_factor' = \" << upsample_factor << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto sigma = std::sqrt((R)upsample_factor / ((R)2 * std::pow((R)10, (esn0 / (R)10))));\nreturn sigma;\n@@ -50,10 +64,18 @@ template <typename R>\nR aff3ct::tools::esn0_to_ebn0(const R esn0, const R code_rate, const int bps)\n{\nif (code_rate <= (R)0 || code_rate > (R)1)\n- throw std::invalid_argument(\"aff3ct::tools::esn0_to_ebn0: \\\"code_rate\\\" has to be greater than 0 and \"\n- \"smaller or equal to 1.\");\n+ {\n+ std::stringstream message;\n+ message << \"'code_rate' has to be positive and smaller or equal to 1 ('code_rate' = \" << code_rate << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (bps <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::esn0_to_ebn0: \\\"bps\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'bps' has to be greater than 0 ('bps' = \" << bps << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto ebn0 = esn0 - (R)10 * std::log10(code_rate * (R)bps);\nreturn ebn0;\n@@ -63,10 +85,18 @@ template <typename R>\nR aff3ct::tools::ebn0_to_esn0(const R ebn0, const R code_rate, const int bps)\n{\nif (code_rate <= (R)0 || code_rate > (R)1)\n- throw std::invalid_argument(\"aff3ct::tools::ebn0_to_esn0: \\\"code_rate\\\" has to be greater than 0 and \"\n- \"smaller or equal to 1.\");\n+ {\n+ std::stringstream message;\n+ message << \"'code_rate' has to be positive and smaller or equal to 1 ('code_rate' = \" << code_rate << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (bps <= 0)\n- throw std::invalid_argument(\"aff3ct::tools::ebn0_to_esn0: \\\"bps\\\" has to be greater than 0.\");\n+ {\n+ std::stringstream message;\n+ message << \"'bps' has to be greater than 0 ('bps' = \" << bps << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nconst auto esn0 = ebn0 + (R)10 * std::log10(code_rate * (R)bps);\nreturn esn0;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the exceptions in the Tools.
|
8,490 |
23.06.2017 15:35:51
| -7,200 |
c82bd5e0a60cf31896a7b3cc38ec3c93d92bd5e9
|
Add the exceptions to the AFF3CT header.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n+#include <Tools/Exception/exception.hpp>\n#include <Tools/Threads/Barrier.hpp>\n#include <Tools/Math/Galois.hpp>\n#include <Tools/Factory/Factory_monitor.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the exceptions to the AFF3CT header.
|
8,490 |
23.06.2017 17:36:46
| -7,200 |
06476089dd0e5851df031dc352633647bb1050ce
|
Update the colors of the terminal.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -485,14 +485,6 @@ int Launcher<B,R,Q>\nstd::vector<std::string> cmd_error;\nbool error = !ar.check_arguments(cmd_error);\n- for (unsigned e = 0; e < cmd_error.size(); e++)\n- std::cerr << format_error(cmd_error[e]) << std::endl;\n-\n- // print the warnings\n- if (params.simulation.mpi_rank == 0)\n- for (unsigned w = 0; w < cmd_warn.size(); w++)\n- std::clog << format_warning(cmd_warn[w]) << std::endl;\n-\nif (display_help)\n{\nstd::vector<std::vector<std::string>> arg_grp;\n@@ -515,7 +507,17 @@ int Launcher<B,R,Q>\nar.print_usage(arg_grp);\nerror = true;\n}\n- else if (error)\n+\n+ // print the errors\n+ for (unsigned e = 0; e < cmd_error.size(); e++)\n+ std::cerr << format_error(cmd_error[e]) << std::endl;\n+\n+ // print the warnings\n+ if (params.simulation.mpi_rank == 0)\n+ for (unsigned w = 0; w < cmd_warn.size(); w++)\n+ std::clog << format_warning(cmd_warn[w]) << std::endl;\n+\n+ if (error && !display_help)\n{\nstd::string message = \"For more information please display the help (\";\nstd::vector<std::string> help_tag = {\"help\", \"h\"};\n@@ -860,23 +862,20 @@ void Launcher<B,R,Q>\nif (params.simulation.mpi_rank == 0)\nthis->print_header();\n-\ntry\n{\nsimu = this->build_simu();\n}\ncatch (std::exception const& e)\n{\n- std::cerr << format_error(\"An issue was encountered when building the simulation.\") << std::endl\n- << format_error(e.what()) << std::endl;\n+ std::cerr << apply_on_each_line(e.what(), &format_error) << std::endl;\n}\n-\nif (simu != nullptr)\n{\n// launch the simulation\nif (params.simulation.mpi_rank == 0)\n- stream << \"# \" << format_info(\"The simulation is running...\") << std::endl;\n+ stream << \"# \" << \"The simulation is running...\" << std::endl;\ntry\n{\n@@ -884,8 +883,7 @@ void Launcher<B,R,Q>\n}\ncatch (std::exception const& e)\n{\n- std::cerr << format_error(\"An issue was encountered when running the simulation.\") << std::endl\n- << format_error(e.what()) << std::endl;\n+ std::cerr << apply_on_each_line(e.what(), &format_error) << std::endl;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "@@ -119,9 +119,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nsimu->mutex_exception.lock();\nif (simu->prev_err_message != e.what())\n{\n- std::cerr << format_error(\"An issue was encountered during the simulation loop (tid = \"\n- + std::to_string(tid) + \").\") << std::endl\n- << format_error(e.what()) << std::endl;\n+ std::cerr << apply_on_each_line(e.what(), &format_error) << std::endl;\nsimu->prev_err_message = e.what();\n}\nsimu->mutex_exception.unlock();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -125,10 +125,7 @@ void Simulation_BFER<B,R,Q>\nmutex_exception.lock();\nif (prev_err_message != e.what())\n{\n- std::cerr << format_error(\"An issue was encountered when building the communication chain (tid = \"\n- + std::to_string(tid) + \").\") << std::endl\n- << format_error(e.what()) << std::endl;\n-\n+ std::cerr << apply_on_each_line(e.what(), &format_error) << std::endl;\nprev_err_message = e.what();\n}\nmutex_exception.unlock();\n@@ -213,9 +210,7 @@ void Simulation_BFER<B,R,Q>\ncatch (std::exception const& e)\n{\nMonitor<B>::stop();\n-\n- std::cerr << format_error(\"An issue was encountered during the simulation loop.\") << std::endl\n- << format_error(e.what()) << std::endl;\n+ std::cerr << apply_on_each_line(e.what(), &format_error) << std::endl;\n}\n// stop the terminal\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "@@ -133,9 +133,7 @@ void Simulation_BFER_std_threads<B,R,Q>\nsimu->mutex_exception.lock();\nif (simu->prev_err_message != e.what())\n{\n- std::cerr << format_error(\"An issue was encountered during the simulation loop (tid = \"\n- + std::to_string(tid) + \").\") << std::endl\n- << format_error(e.what()) << std::endl;\n+ std::cerr << apply_on_each_line(e.what(), &format_error) << std::endl;\nsimu->prev_err_message = e.what();\n}\nsimu->mutex_exception.unlock();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "@@ -184,7 +184,7 @@ void Arguments_reader\nvoid Arguments_reader\n::print_usage(std::vector<std::vector<std::string>> arg_groups)\n{\n- Format head_format = Style::BOLD | Style::ITALIC | FG::Color::YELLOW;\n+ Format head_format = Style::BOLD | Style::ITALIC | FG::Color::MAGENTA | FG::INTENSE;\nstd::cout << \"Usage: \" << this->m_program_name;\n@@ -314,7 +314,7 @@ void Arguments_reader\nif (values.size() < 3)\n{\nif (!values[0].empty())\n- std::cout << format(\" <\" + values[0] + \">\", arg_format);\n+ std::cout << format(\" <\" + values[0] + \">\", arg_format | FG::GRAY);\n}\nelse\n{\n@@ -324,7 +324,7 @@ void Arguments_reader\nset += entries[i] + \"|\";\nset += entries[entries.size() -1];\n- std::cout << format(\" <\" + values[0] + \"=\" + set + \">\", arg_format);\n+ std::cout << format(\" <\" + values[0] + \"=\" + set + \">\", arg_format | FG::GRAY);\n}\nif (required)\nstd::cout << format(\" {REQUIRED}\", arg_format | Style::BOLD | FG::Color::ORANGE);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/bash_tools.cpp",
"new_path": "src/Tools/Display/bash_tools.cpp",
"diff": "@@ -139,37 +139,37 @@ std::string aff3ct::tools::default_style(std::string str)\nstd::string aff3ct::tools::format_error(std::string str)\n{\n- return format(\"(EE) \" + str, FG::Color::RED | FG::Intensity::INTENSE);\n+ return format(\"(EE) \", FG::Color::RED | FG::Intensity::INTENSE | Style::BOLD) + str;\n}\nstd::string aff3ct::tools::format_critical_error(std::string str)\n{\n- return format(\"(EE) \" + str, FG::Color::WHITE | FG::Intensity::NORMAL | BG::Color::RED | BG::Intensity::INTENSE);\n+ return format(\"(EE) \", FG::Color::WHITE | FG::Intensity::NORMAL | BG::Color::RED | BG::Intensity::INTENSE) + str;\n}\nstd::string aff3ct::tools::format_warning(std::string str)\n{\n- return format(\"(WW) \" + str, FG::Color::ORANGE | FG::Intensity::NORMAL);\n+ return format(\"(WW) \", FG::Color::ORANGE | FG::Intensity::NORMAL | Style::BOLD) + str;\n}\nstd::string aff3ct::tools::format_critical_warning(std::string str)\n{\n- return format(\"(WW) \" + str, FG::Color::WHITE | FG::Intensity::NORMAL | BG::Color::ORANGE | BG::Intensity::INTENSE);\n+ return format(\"(WW) \", FG::Color::WHITE | FG::Intensity::NORMAL | BG::Color::ORANGE | BG::Intensity::INTENSE) + str;\n}\nstd::string aff3ct::tools::format_info(std::string str)\n{\n- return format(\"(II) \" + str, FG::Color::BLUE | FG::Intensity::NORMAL);\n+ return format(\"(II) \", FG::Color::BLUE | FG::Intensity::NORMAL | Style::BOLD) + str;\n}\nstd::string aff3ct::tools::format_critical_info(std::string str)\n{\n- return format(\"(II) \" + str, FG::Color::WHITE | FG::Intensity::NORMAL | BG::Color::BLUE | BG::Intensity::INTENSE);\n+ return format(\"(II) \", FG::Color::WHITE | FG::Intensity::NORMAL | BG::Color::BLUE | BG::Intensity::INTENSE) + str;\n}\nstd::string aff3ct::tools::format_positive_info(std::string str)\n{\n- return format(\"(II) \" + str, FG::Color::GREEN | FG::Intensity::NORMAL);\n+ return format(\"(II) \", FG::Color::GREEN | FG::Intensity::NORMAL) + str;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the colors of the terminal.
|
8,490 |
23.06.2017 18:53:13
| -7,200 |
5b8930d94b8ec8dee93f50112ac746445b37b38e
|
Put back the LICENSE.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "LICENSE",
"diff": "+MIT License\n+\n+Copyright (c) 2017 aff3ct\n+\n+Permission is hereby granted, free of charge, to any person obtaining a copy\n+of this software and associated documentation files (the \"Software\"), to deal\n+in the Software without restriction, including without limitation the rights\n+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+copies of the Software, and to permit persons to whom the Software is\n+furnished to do so, subject to the following conditions:\n+\n+The above copyright notice and this permission notice shall be included in all\n+copies or substantial portions of the Software.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+SOFTWARE.\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Put back the LICENSE.
|
8,490 |
23.06.2017 22:43:02
| -7,200 |
6403f196677f5c0141bafc455d74578ea3a9f995
|
Rm MIPP inc.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Code/Polar/API/functions_polar_intra_32bit.h>\n#include <Tools/Code/Polar/decoder_polar_functions.h>\n#include <Tools/Code/Polar/fb_extract.h>\n-#include <Tools/Perf/MIPP/math/sse_mathfun.h>\n-#include <Tools/Perf/MIPP/math/avx_mathfun.h>\n-#include <Tools/Perf/MIPP/math/neon_mathfun.h>\n-#include <Tools/Perf/MIPP/mipp_scalar_op.h>\n-#include <Tools/Perf/MIPP/mipp.h>\n#include <Tools/Perf/Transpose/transpose_AVX.h>\n#include <Tools/Perf/Transpose/transpose_SSE.h>\n#include <Tools/Perf/Transpose/transpose_selector.h>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rm MIPP inc.
|
8,490 |
26.06.2017 11:15:29
| -7,200 |
590dce6bf198ccaed6cff7227df3b53477495bcf
|
Remove PyBER from AFF3CT.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitmodules",
"new_path": ".gitmodules",
"diff": "[submodule \"lib/MIPP\"]\npath = lib/MIPP\nurl = ../MIPP\n-[submodule \"plotter/PyBER/lib/pyqtgraph\"]\n- path = plotter/PyBER/lib/pyqtgraph\n- url = https://github.com/pyqtgraph/pyqtgraph.git\n[submodule \"conf\"]\npath = conf\nurl = ../configuration_files\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/README.md",
"new_path": null,
"diff": "-# How to run PyBER\n-This project use python 3.x and some dependencies : PyQt 4.7+ or PyQt5, NumPy.\n-\n-## Installation (Ubuntu)\n-\n- sudo apt-get install python3 python3-pip\n- sudo pip3 install numpy pyqt5\n-\n-## Launch PyBER\n-\n- python3 pyBER.py\n-\n-The displayed files are the one contained in the `../../tests/` folder.\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/fileExplorer.py",
"new_path": null,
"diff": "-# The MIT License (MIT)\n-#\n-# Copyright (c) 2016 PyBER\n-#\n-# Permission is hereby granted, free of charge, to any person obtaining a copy\n-# of this software and associated documentation files (the \"Software\"), to deal\n-# in the Software without restriction, including without limitation the rights\n-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n-# copies of the Software, and to permit persons to whom the Software is\n-# furnished to do so, subject to the following conditions:\n-#\n-# The above copyright notice and this permission notice shall be included in all\n-# copies or substantial portions of the Software.\n-#\n-# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n-# SOFTWARE.\n-\n-import os\n-import sys\n-import reader\n-import subprocess\n-import lib.pyqtgraph.pyqtgraph as pg\n-from lib.pyqtgraph.pyqtgraph.Qt import QtCore, QtGui\n-from lib.pyqtgraph.pyqtgraph.dockarea import *\n-import numpy as np\n-\n-class AdvTreeView(QtGui.QTreeView):\n- wBER = []\n- wFER = []\n- wBEFE = []\n- wThr = []\n- wDeta = []\n- fsWatcher = []\n-\n- lBER = []\n- lFER = []\n- lBEFE = []\n- lThr = []\n-\n- EsEb = []\n-\n- dataSNR = []\n- dataBER = []\n- dataFER = []\n- dataBEFE = []\n- dataThr = []\n- dataDeta = []\n- dataName = []\n-\n- # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15, 16\n- colors = [0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16, 17]\n- lastSNR = []\n- paths = []\n- styles = [QtCore.Qt.SolidLine, QtCore.Qt.DashLine, QtCore.Qt.DotLine, QtCore.Qt.DashDotLine, QtCore.Qt.DashDotDotLine]\n- dashPatterns = [[1, 3, 4, 3], [2, 3, 4, 3], [1, 3, 1, 3], [4, 3, 4, 3], [3, 3, 2, 3], [4, 3, 1, 3]]\n-\n- def __init__(self, wBER, wFER, wBEFE, wThr, wDeta):\n- super().__init__()\n-\n- self.wBER = wBER\n- self.wFER = wFER\n- self.wBEFE = wBEFE\n- self.wThr = wThr\n- self.wDeta = wDeta\n-\n- # create a legend on the plots\n- self.lBER = self.wBER .addLegend()\n- self.lFER = self.wFER .addLegend()\n- self.lBEFE = self.wBEFE.addLegend()\n- self.lThr = self.wThr .addLegend()\n-\n- self.EsEb = \"Eb\"\n-\n- self.hideLegend()\n-\n- self.doubleClicked.connect(self.openFileOrDir)\n- self.fsWatcher = QtCore.QFileSystemWatcher()\n- self.fsWatcher.fileChanged.connect(self.updateDataAndCurve)\n-\n- def switchEsEb(self):\n- if self.EsEb == \"Eb\":\n- self.EsEb = \"Es\"\n- else:\n- self.EsEb = \"Eb\"\n-\n- self.wBER .setLabel('bottom', self.EsEb + \"/N0 (dB)\")\n- self.wFER .setLabel('bottom', self.EsEb + \"/N0 (dB)\")\n- self.wBEFE.setLabel('bottom', self.EsEb + \"/N0 (dB)\")\n- self.wThr .setLabel('bottom', self.EsEb + \"/N0 (dB)\")\n-\n- self.refresh()\n-\n- def refresh(self):\n- for path in self.paths:\n- self.updateData(path)\n- for name in self.dataName:\n- self.removeLegendItem(name)\n-\n- self.updateCurves()\n- self.updateDetails()\n-\n- def openFileOrDir(self, *args):\n- paths = [ self.model().filePath(index) for index in args ]\n- if len(paths):\n- if sys.platform == \"linux\" or sys.platform == \"linux2\":\n- subprocess.call([\"xdg-open\", paths[0]])\n- elif sys.platform == \"darwin\":\n- subprocess.call([\"open\", paths[0]])\n- else:\n- os.startfile(paths[0])\n-\n- def hideLegend(self):\n- # hide the legend\n- if self.lBER: self.lBER .anchor(itemPos=(0,1), parentPos=(0,1), offset=(-1000,-10))\n- if self.lFER: self.lFER .anchor(itemPos=(0,1), parentPos=(0,1), offset=(-1000,-10))\n- # if self.lBER: self.lBER .anchor(itemPos=(1,0), parentPos=(1,0), offset=( 1000,-10))\n- # if self.lFER: self.lFER .anchor(itemPos=(1,0), parentPos=(1,0), offset=( 1000,-10))\n- if self.lBEFE: self.lBEFE.anchor(itemPos=(1,0), parentPos=(1,0), offset=( 1000, 10))\n- if self.lThr: self.lThr .anchor(itemPos=(1,0), parentPos=(1,0), offset=( 1000, 10))\n-\n- def showLegend(self):\n- # display the legend\n- if self.lBER: self.lBER .anchor(itemPos=(0,1), parentPos=(0,1), offset=( 10,-10))\n- if self.lFER: self.lFER .anchor(itemPos=(0,1), parentPos=(0,1), offset=( 10,-10))\n- # if self.lBER: self.lBER .anchor(itemPos=(1,0), parentPos=(1,0), offset=(-10, 10))\n- # if self.lFER: self.lFER .anchor(itemPos=(1,0), parentPos=(1,0), offset=(-10, 10))\n- if self.lBEFE: self.lBEFE.anchor(itemPos=(1,0), parentPos=(1,0), offset=(-10, 10))\n- if self.lThr: self.lThr .anchor(itemPos=(1,0), parentPos=(1,0), offset=(-10, 10))\n-\n- def removeLegendItem(self, name):\n- if self.lBER: self.lBER .removeItem(name)\n- if self.lFER: self.lFER .removeItem(name)\n- if self.lBEFE: self.lBEFE.removeItem(name)\n- if self.lThr: self.lThr .removeItem(name)\n-\n- def getPathId(self, path):\n- if path in self.paths:\n- curId = 0\n- for p in self.paths:\n- if p == path:\n- return curId\n- else:\n- curId = curId +1\n- return -1\n- else:\n- return -1\n-\n- def updateData(self, path):\n- if path in self.paths:\n- pathId = self.getPathId(path)\n-\n- dataName = []\n- self.dataSNR[pathId], self.dataBER[pathId], self.dataFER[pathId], self.dataBEFE[pathId], self.dataThr[pathId], self.dataDeta[pathId], dataName = reader.dataReader(path, self.EsEb)\n-\n- if not self.dataName[pathId]:\n- if not dataName:\n- self.dataName[pathId] = \"Curve \" + str(pathId)\n- elif dataName in self.dataName:\n- self.dataName[pathId] = dataName + \"_\" + str(pathId)\n- else:\n- self.dataName[pathId] = dataName\n-\n- def plotCurve(self, pathId, dataSNR, dataBER, dataFER, dataBEFE, dataThr):\n- icolor = self.colors[pathId % len(self.colors)]\n- pen = pg.mkPen(color=(icolor,8), width=2, style=QtCore.Qt.CustomDashLine)\n- pen.setDashPattern(self.dashPatterns[pathId % len(self.dashPatterns)])\n-\n- self.removeLegendItem(self.dataName[pathId])\n-\n- self.wBER. plot(x=dataSNR, y=dataBER, pen=pen, symbol='x', name=self.dataName[pathId])\n- self.wFER. plot(x=dataSNR, y=dataFER, pen=pen, symbol='x', name=self.dataName[pathId])\n- self.wBEFE.plot(x=dataSNR, y=dataBEFE, pen=pen, symbol='x', name=self.dataName[pathId])\n- self.wThr. plot(x=dataSNR, y=dataThr, pen=pen, symbol='x', name=self.dataName[pathId])\n-\n- def updateCurve(self, path):\n- if path in self.paths:\n- pathId = self.getPathId(path)\n-\n- if self.dataSNR[pathId]:\n- if self.dataSNR[pathId][len(self.dataSNR[pathId]) -1] > self.lastSNR[pathId]:\n- curDataSNR = list(self.dataSNR [pathId]) # make a copy\n- curDataBER = list(self.dataBER [pathId]) # make a copy\n- curDataFER = list(self.dataFER [pathId]) # make a copy\n- curDataThr = list(self.dataThr [pathId]) # make a copy\n- curDataBEFE = list(self.dataBEFE[pathId]) # make a copy\n-\n- nPop = 0\n- for i in range(len(curDataSNR)):\n- if self.lastSNR[pathId] >= curDataSNR[i]:\n- nPop = i\n-\n- for i in range(nPop):\n- curDataSNR .pop(0)\n- curDataBER .pop(0)\n- curDataFER .pop(0)\n- curDataBEFE.pop(0)\n- curDataThr .pop(0)\n-\n- self.plotCurve(pathId, curDataSNR, curDataBER, curDataFER, curDataBEFE, curDataThr)\n- self.lastSNR[pathId] = self.dataSNR[pathId][len(self.dataSNR[pathId]) -1]\n- elif self.dataSNR[pathId][len(self.dataSNR[pathId]) -1] < self.lastSNR[pathId]:\n- self.updateCurves()\n- self.lastSNR[pathId] = self.dataSNR[pathId][len(self.dataSNR[pathId]) -1]\n- else:\n- self.updateCurves()\n- self.lastSNR[pathId] = -999.0\n-\n- def updateCurves(self):\n- self.wBER .clearPlots()\n- self.wFER .clearPlots()\n- self.wBEFE.clearPlots()\n- self.wThr .clearPlots()\n-\n- for pathId in range(len(self.paths)):\n- self.plotCurve(pathId, self.dataSNR[pathId], self.dataBER[pathId], self.dataFER[pathId], self.dataBEFE[pathId], self.dataThr[pathId])\n-\n- def updateDataAndCurve(self, path):\n- self.updateData(path)\n- self.updateCurve(path)\n-\n- def updateDetails(self):\n- self.wDeta.clear()\n-\n- for pathId in range(len(self.paths)):\n- icolor = self.colors[pathId % len(self.colors)]\n- path = self.paths[pathId]\n-\n- # for filename in self.paths:\n- pen = pg.mkPen(color=(icolor,8), width=2, style=QtCore.Qt.CustomDashLine)\n- pen.setDashPattern(self.dashPatterns[pathId % len(self.dashPatterns)])\n-\n- legendArea = DockArea()\n- dInfo = Dock(\"\", size=(250,900))\n-\n- legendArea.addDock(dInfo, 'bottom')\n-\n- firstTitle = True;\n- layoutLegend = QtGui.QFormLayout()\n- for entry in self.dataDeta[pathId]:\n- if len(entry) == 2 and entry[1]:\n- if entry[0] == \"Run command\":\n- runCmd = QtGui.QLineEdit(str(entry[1]))\n- runCmd.setReadOnly(True)\n- layoutLegend.addRow(\"<b>\" + entry[0] + \"</b>: \", runCmd)\n- else:\n- layoutLegend.addRow(\"<b>\" + entry[0] + \"</b>: \", QtGui.QLabel(entry[1]))\n- elif len(entry) == 1:\n- if not firstTitle:\n- line = QtGui.QFrame()\n- line.setFrameShape(QtGui.QFrame.HLine)\n- line.setFrameShadow(QtGui.QFrame.Sunken)\n- layoutLegend.addRow(line)\n- firstTitle = False\n- layoutLegend.addRow(\"<h3><u>\" + entry[0] + \"<u></h3>\", QtGui.QLabel(\"\"))\n- wCur = QtGui.QWidget();\n- wCur.setLayout(layoutLegend)\n-\n- sCur = QtGui.QScrollArea()\n- sCur.setWidget(wCur)\n- sCur.setWidgetResizable(True)\n- dInfo.addWidget(sCur)\n-\n- self.wDeta.addTab(legendArea, self.dataName[pathId])\n-\n- def selectionChanged(self, selected, deselected):\n- super().selectionChanged(selected, deselected)\n- newPaths = [ self.model().filePath(index) for index in self.selectedIndexes()\n- if not self.model().isDir(index)] # TODO: remove this restriction\n-\n- self.dataSNR = [0 for x in range(len(newPaths))]\n- self.dataBER = [0 for x in range(len(newPaths))]\n- self.dataFER = [0 for x in range(len(newPaths))]\n- self.dataBEFE = [0 for x in range(len(newPaths))]\n- self.dataThr = [0 for x in range(len(newPaths))]\n- self.dataDeta = [0 for x in range(len(newPaths))]\n- self.lastSNR = [0 for x in range(len(newPaths))]\n-\n- for name in self.dataName:\n- self.removeLegendItem(name)\n- self.dataName = [0 for x in range(len(newPaths))]\n-\n- if not len(newPaths):\n- self.hideLegend()\n- else:\n- self.showLegend()\n-\n- pathsToRemove = []\n- for p in self.paths:\n- if p not in newPaths:\n- pathsToRemove.append(p)\n-\n- for p in pathsToRemove:\n- pId = self.getPathId(p)\n- self.paths.pop(pId)\n-\n- pathsToAdd = []\n- for p in newPaths:\n- if p not in self.paths:\n- pathsToAdd.append(p)\n- for p in pathsToAdd:\n- self.paths.append(p)\n-\n- if len(pathsToRemove) > 0:\n- self.fsWatcher.removePaths(pathsToRemove)\n- if len(pathsToAdd) > 0:\n- self.fsWatcher.addPaths(pathsToAdd)\n-\n- for path in self.paths:\n- self.updateData(path)\n-\n- for pathId in range(len(self.paths)):\n- if len(self.dataSNR[pathId]) > 0:\n- self.lastSNR[pathId] = self.dataSNR[pathId][len(self.dataSNR[pathId]) -1]\n- else:\n- self.lastSNR[pathId] = -999.0\n-\n- self.updateCurves()\n- self.updateDetails()\n-\n-def generatePannel(wBER, wFER, wBEFE, wThr, wDeta):\n- if len(sys.argv) >= 2:\n- os.chdir(sys.argv[1])\n- else:\n- os.chdir(\"../../tests/\")\n-\n- model = QtGui.QFileSystemModel()\n- model.setReadOnly(True)\n- model.setRootPath(QtCore.QDir.currentPath())\n- model.setNameFilters(['*.perf', '*.dat', '*.txt', '*.data'])\n- model.setNameFilterDisables(False)\n-\n- view = AdvTreeView(wBER, wFER, wBEFE, wThr, wDeta)\n- view.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)\n- view.setModel(model)\n- view.hideColumn(1);\n- view.hideColumn(2);\n- view.hideColumn(3);\n- view.setColumnWidth(30, 1)\n- view.setRootIndex(model.index(QtCore.QDir.currentPath(), 0))\n- view.setAnimated(True)\n- view.setIconSize(QtCore.QSize(24,24))\n-\n- return view\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/lib/pyqtgraph",
"new_path": null,
"diff": "-Subproject commit 1426e334e1d20542400d77c72c132b04c6d17ddb\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/pyBER.py",
"new_path": null,
"diff": "-#!/usr/bin/python3\n-\n-# The MIT License (MIT)\n-#\n-# Copyright (c) 2016 PyBER\n-#\n-# Permission is hereby granted, free of charge, to any person obtaining a copy\n-# of this software and associated documentation files (the \"Software\"), to deal\n-# in the Software without restriction, including without limitation the rights\n-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n-# copies of the Software, and to permit persons to whom the Software is\n-# furnished to do so, subject to the following conditions:\n-#\n-# The above copyright notice and this permission notice shall be included in all\n-# copies or substantial portions of the Software.\n-#\n-# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n-# SOFTWARE.\n-\n-import lib.pyqtgraph.pyqtgraph.console\n-import lib.pyqtgraph.pyqtgraph as pg\n-from lib.pyqtgraph.pyqtgraph.Qt import QtCore, QtGui\n-from lib.pyqtgraph.pyqtgraph.dockarea import *\n-import numpy as np\n-import fileExplorer\n-\n-# uncomment those next lines to display the plot in black on white instead of white on black\n-# pg.setConfigOption('background', 'w')\n-# pg.setConfigOption('foreground', 'k')\n-\n-app = QtGui.QApplication(['PyBER plotter'])\n-win = QtGui.QMainWindow()\n-area = DockArea()\n-win.setCentralWidget(area)\n-win.resize(1280,800)\n-win.setWindowTitle('PyBER plotter')\n-win.setWindowIcon(QtGui.QIcon('woody_ico.png'))\n-\n-# Create docks, place them into the window one at a time.\n-# Note that size arguments are only a suggestion; docks will still have to\n-# fill the entire dock area and obey the limits of their internal widgets.\n-dFile = Dock(\"File explorer\", size=(275,400))\n-dDeta = Dock(\"Details\", size=(275,400))\n-dBER = Dock(\"Bit Error Rate (BER)\", size=(400,200))\n-dFER = Dock(\"Frame Error Rate (FER)\", size=(400,200))\n-dBEFE = Dock(\"BE/FE\", size=(400,125))\n-dThr = Dock(\"Simulation coded throughput\", size=(400,125))\n-\n-area.addDock(dFile, 'left' )\n-area.addDock(dBER, 'right', dFile)\n-area.addDock(dFER, 'right', dBER )\n-area.addDock(dBEFE, 'bottom', dBER )\n-area.addDock(dThr, 'bottom', dFER )\n-area.addDock(dDeta, 'bottom', dFile)\n-\n-# Add widgets into each dock\n-pg.setConfigOptions(antialias=True)\n-\n-wDeta = QtGui.QTabWidget()\n-dDeta.addWidget(wDeta)\n-\n-wBER = pg.PlotWidget(labels={'left': \"Bit Error Rate\", 'bottom': \"Eb/N0 (dB)\"})\n-wBER.plot(np.random.normal(size=100))\n-wBER.showGrid(True, True)\n-wBER.setLogMode(False, True)\n-wBER.showLabel('left', True)\n-wBER.showLabel('bottom', True)\n-dBER.addWidget(wBER)\n-\n-wFER = pg.PlotWidget(labels={'left': \"Frame Error Rate\", 'bottom': \"Eb/N0 (dB)\"})\n-wFER.plot(np.random.normal(size=100))\n-wFER.showGrid(True, True)\n-wFER.setLogMode(False, True)\n-wFER.showLabel('left', True)\n-wFER.showLabel('bottom', True)\n-dFER.addWidget(wFER)\n-\n-wBEFE = pg.PlotWidget(labels={'left': \"BE/FE\", 'bottom': \"Eb/N0 (dB)\"})\n-wBEFE.plot(np.random.normal(size=100))\n-wBEFE.showGrid(True, True)\n-wBEFE.showLabel('left', True)\n-wBEFE.showLabel('bottom', True)\n-dBEFE.addWidget(wBEFE)\n-\n-wThr = pg.PlotWidget(labels={'left': \"Throughput (Mbps)\", 'bottom': \"Eb/N0 (dB)\"})\n-wThr.plot(np.random.normal(size=100))\n-wThr.showGrid(True, True)\n-wThr.showLabel('left', True)\n-wThr.showLabel('bottom', True)\n-dThr.addWidget(wThr)\n-\n-wFile = fileExplorer.generatePannel(wBER, wFER, wBEFE, wThr, wDeta)\n-dFile.addWidget(wFile)\n-\n-# -----------------------------------------------------------------------------\n-\n-exitAction = QtGui.QAction('&Exit', win)\n-exitAction.setShortcut('Ctrl+Q')\n-exitAction.setStatusTip('Exit application')\n-exitAction.triggered.connect(lambda: sys.exit(0))\n-\n-switchEbEsAction = QtGui.QAction('&Switch Es/Eb', win)\n-switchEbEsAction.setShortcut('Ctrl+E')\n-switchEbEsAction.setStatusTip('Switch between Es/N0 and Eb/N0')\n-switchEbEsAction.triggered.connect(lambda: wFile.switchEsEb())\n-\n-refreshAction = QtGui.QAction('&Refresh', win)\n-refreshAction.setShortcut('F5')\n-refreshAction.setStatusTip('Refresh the displayed curves')\n-refreshAction.triggered.connect(lambda: wFile.refresh())\n-\n-# win.statusBar()\n-\n-menubar = win.menuBar()\n-fileMenu = menubar.addMenu('&File')\n-fileMenu.addAction(exitAction)\n-optionMenu = menubar.addMenu('&Display')\n-optionMenu.addAction(refreshAction)\n-optionMenu.addAction(switchEbEsAction)\n-\n-# -----------------------------------------------------------------------------\n-\n-win.show()\n-\n-# Start Qt event loop unless running in interactive mode or using pyside.\n-if __name__ == '__main__':\n- import sys\n- if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):\n- QtGui.QApplication.instance().exec_()\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/pyber.desktop",
"new_path": null,
"diff": "-# This file is an example of how to create a gnome icon for the PyBER application.\n-# Think to change the paths to your PyBER location in your the system.\n-# Place this file in the \"~/.local/share/applications/\" directory.\n-[Desktop Entry]\n-Encoding=UTF-8\n-Name=PyBER Plotter\n-# Firt arg is the location of the PyBER python script, second arg is the location of\n-# the data to browse in PyBER (if nothing is specified, PyBER will try to open the\n-# \"data/\" folder).\n-Exec=[full_path_to_PyBER]/pyBER.py [full_path_to_PyBER]/data/\n-Icon=[full_path_to_PyBER]/woody.png\n-Type=Application\n-Categories=Development;\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/reader.py",
"new_path": null,
"diff": "-# The MIT License (MIT)\n-#\n-# Copyright (c) 2016 PyBER\n-#\n-# Permission is hereby granted, free of charge, to any person obtaining a copy\n-# of this software and associated documentation files (the \"Software\"), to deal\n-# in the Software without restriction, including without limitation the rights\n-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n-# copies of the Software, and to permit persons to whom the Software is\n-# furnished to do so, subject to the following conditions:\n-#\n-# The above copyright notice and this permission notice shall be included in all\n-# copies or substantial portions of the Software.\n-#\n-# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n-# SOFTWARE.\n-\n-import os\n-\n-def getVal(line, idColumn, EsEb):\n- # there are two different file formats, classic (lines begni with SNR) and new (lines begin with SNR value directly)\n- # indices of the different parameter change, and the following array is used to convert classic indices to new\n- convert_to_v1 = [0, 4, 5, 12, 0, 3, 2]\n- convert_to_v2 = [0, 4, 5, 9 , 0, 3, 2]\n- convert_to_v3 = [0, 4, 5, 6 , 0, 3, 2]\n-\n- if (EsEb == \"Es\"):\n- convert_to_v4 = [0, 5, 6, 10, 1, 4, 3]\n- convert_to_v5 = [0, 5, 6, 7 , 1, 4, 3]\n- else:\n- convert_to_v4 = [1, 5, 6, 10, 1, 4, 3]\n- convert_to_v5 = [1, 5, 6, 7 , 1, 4, 3]\n-\n- # classic\n- if line.startswith(\"SNR = \"):\n- line = line.replace(\"#\", \"\")\n- line = line.replace(\"=\", \"\")\n- line = line.replace(\"SNR\", \"\")\n- line = line.replace(\"BER\", \"\")\n- line = line.replace(\"FER\", \"\")\n- line = line.replace(\"BE/FE\", \"\")\n- line = line.replace(\"BPS\", \"\")\n- line = line.replace(\"BPS\", \"\")\n- line = line.replace(\"MATRICES\", \"\")\n- line = line.replace(\"BE\", \"\")\n- line = line.replace(\"FE\", \"\")\n- line = line.replace(\"RUNTIME\", \"\")\n- line = line.replace(\"ERR\", \"\")\n- line = line.replace(\" \", \"\")\n- line = line.split('|')\n-\n- val = float(line[idColumn])\n- # new\n- else:\n- line = line.replace(\"||\", \"|\")\n- line = line.split('|')\n-\n- try:\n- float(line[0]) # in cases where the first item of the line is neither \"SNR = \" nor a float\n- except ValueError:\n- return float(-999.0)\n-\n- if(len(line) == 14):\n- val = float(line[convert_to_v1[idColumn]])\n- elif(len(line) == 11):\n- val = float(line[convert_to_v2[idColumn]])\n- elif(len(line) == 8):\n- val = float(line[convert_to_v3[idColumn]])\n- elif(len(line) == 12):\n- val = float(line[convert_to_v4[idColumn]])\n- elif(len(line) == 9):\n- val = float(line[convert_to_v5[idColumn]])\n-\n- if \"inf\" in str(val):\n- val = float(0.0)\n-\n- return val\n-\n-def dataReader(filename, EsEb):\n- # read all the lines from the current file\n- aFile = open(filename, \"r\")\n- lines = []\n- for line in aFile:\n- lines.append(line)\n- aFile.close()\n-\n- dataSNR = []\n- dataBER = []\n- dataFER = []\n- dataBEFE = []\n- dataThr = []\n- dataDeta = []\n- dataName = []\n-\n- for line in lines:\n- if line.startswith(\"#\"):\n- if len(line) > 3 and line[0] == '#' and line[2] == '*':\n- entry = line.replace(\"# * \", \"\").replace(\"\\n\", \"\").split(\" = \")\n- if len(entry) == 1:\n- entry[0] = entry[0].replace(\"-\", \"\")\n- dataDeta.append(entry)\n- elif len(line) > 7 and line[0] == '#' and line[5] == '*' and line[6] == '*':\n- entry = line.replace(\"# ** \", \"\").replace(\"\\n\", \"\").split(\" = \")\n- dataDeta.append(entry)\n- else:\n- snr = getVal(line, 0, EsEb)\n- if snr == -999.0:\n- continue # line is ignored\n-\n- dataSNR.append(snr)\n- dataBER.append(getVal(line, 1, EsEb))\n- dataFER.append(getVal(line, 2, EsEb))\n- dataThr.append(getVal(line, 3, EsEb))\n-\n- be = getVal(line, 6, EsEb)\n- fe = getVal(line, 5, EsEb)\n-\n- if fe == 0:\n- dataBEFE.append(0.0)\n- else :\n- dataBEFE.append(be/fe)\n-\n- dataDeta.append([\"Other\"])\n- dataDeta.append([\"File name\", os.path.basename(filename)])\n-\n- # get the command to to run to reproduce this trace\n- if lines and \"Run command:\" in lines[0]:\n- dataDeta.append([\"Run command\", str(lines[1].strip())])\n- else:\n- dataDeta.append([\"Run command\", \"\"])\n- if lines and \"Run command:\" in lines[2]:\n- dataDeta.append([\"Run command\", str(lines[3].strip())])\n- else:\n- dataDeta.append([\"Run command\", \"\"])\n-\n- # get the curve name (is there is one)\n- if lines and \"Curve name:\" in lines[0]:\n- dataName = str(lines[1].strip())\n- if lines and \"Curve name:\" in lines[2]:\n- dataName = str(lines[3].strip())\n-\n- return dataSNR, dataBER, dataFER, dataBEFE, dataThr, dataDeta, dataName\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/woody.png",
"new_path": "plotter/PyBER/woody.png",
"diff": "Binary files a/plotter/PyBER/woody.png and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "plotter/PyBER/woody_ico.png",
"new_path": "plotter/PyBER/woody_ico.png",
"diff": "Binary files a/plotter/PyBER/woody_ico.png and /dev/null differ\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove PyBER from AFF3CT.
|
8,490 |
26.06.2017 12:17:44
| -7,200 |
7a516a0c8909439c1421630cd975e83e0ec880ca
|
Update the README for the submodules.
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -15,6 +15,12 @@ Download and install `cmake`: [https://cmake.org/files/v3.7/cmake-3.7.1-win64-x6\nMake sure to add the `cmake` program to the `PATH`.\n+## Get the Git submodules\n+\n+AFF3CT depends on some other Git repositories (or submodules). It is highly recommended to get those submodules before trying to do anything else. Here is the command to get all the required submodules:\n+\n+ $ git submodule update --init --recursive\n+\n## Exemple of a Makefile project generation (with the C++ GNU compiler)\nOpen a shell and type (from the `AFF3CT` root folder):\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the README for the submodules.
|
8,490 |
26.06.2017 12:28:08
| -7,200 |
bcbed41467d737655df4fe6804451c23498239a3
|
Improve a little bit the error msg when the cmake can't found MIPP.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -74,7 +74,7 @@ if (EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/lib/MIPP/src/mipp.h\")\nmessage(STATUS \"MIPP found\")\nelse ()\nmessage(FATAL_ERROR \"MIPP can't be found, try to init the submodules with the following cmd:\\n\"\n- \"$ git submodule update --init --recursive\")\n+ \"$ git submodule update --init -- ../lib/MIPP/\")\nendif ()\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve a little bit the error msg when the cmake can't found MIPP.
|
8,490 |
26.06.2017 15:03:26
| -7,200 |
7d520f9b5cf79c6ed64bfcc3e19c7edb6c912410
|
Fix a format issue.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -299,7 +299,7 @@ void Simulation_BFER<B,R,Q>\nmax_chars = std::max(max_chars, (int)duration.first.second.length());\nstream << \"#\" << std::endl;\n- stream << \"# \" << format(\"Time report\", Style::BOLD || Style::UNDERLINED) << \" (the time of the threads is cumulated)\" << std::endl;\n+ stream << \"# \" << format(\"Time report\", Style::BOLD | Style::UNDERLINED) << \" (the time of the threads is cumulated)\" << std::endl;\nauto prev_sec = 0.f;\nfor (auto& duration : durations_sum)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a format issue.
|
8,490 |
27.06.2017 11:04:50
| -7,200 |
7ec67c19376507dbdb59efe4b2465b4a766bbdba
|
Update MIPP version.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -70,6 +70,7 @@ endif()\n# MIPP wrapper includes\nif (EXISTS \"${CMAKE_CURRENT_SOURCE_DIR}/lib/MIPP/src/mipp.h\")\n+ add_definitions (-DMIPP_ENABLE_BACKTRACE)\ninclude_directories (\"${CMAKE_CURRENT_SOURCE_DIR}/lib/MIPP/src/\")\nmessage(STATUS \"MIPP found\")\nelse ()\n"
},
{
"change_type": "MODIFY",
"old_path": "lib/MIPP",
"new_path": "lib/MIPP",
"diff": "-Subproject commit 6297c46ceda56f832f119e30d7461a68cee7e794\n+Subproject commit f7ae80596cf5ef592709c3498d71171892a1f87b\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_AVX.hxx",
"new_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_AVX.hxx",
"diff": "@@ -97,7 +97,7 @@ void Decoder_RSC_BCJR_inter_intra_fast_x2_AVX<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_deinter[8] = {0, 1, 4, 5, 2, 3, 6, 7};\n+ constexpr unsigned cmask_deinter[8] = {0, 1, 4, 5, 2, 3, 6, 7};\nconst auto r_cmask_deinter = mipp::Reg<R>::cmask2(cmask_deinter);\n// compute gamma values\n@@ -130,13 +130,13 @@ void Decoder_RSC_BCJR_inter_intra_fast_x2_AVX<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_a0 [8] = {0, 3, 4, 7, 1, 2, 5, 6}; // alpha trellis transitions 0.\n- constexpr int cmask_a1 [8] = {1, 2, 5, 6, 0, 3, 4, 7}; // alpha trellis transitions 1.\n- constexpr int cmask_ga0 [8] = {0, 1, 1, 0, 0, 1, 1, 0}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_ga1 [8] = {2, 3, 3, 2, 2, 3, 3, 2}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_ga2 [8] = {4, 5, 5, 4, 4, 5, 5, 4}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_ga3 [8] = {6, 7, 7, 6, 6, 7, 7, 6}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_a0 [8] = {0, 3, 4, 7, 1, 2, 5, 6}; // alpha trellis transitions 0.\n+ constexpr unsigned cmask_a1 [8] = {1, 2, 5, 6, 0, 3, 4, 7}; // alpha trellis transitions 1.\n+ constexpr unsigned cmask_ga0 [8] = {0, 1, 1, 0, 0, 1, 1, 0}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga1 [8] = {2, 3, 3, 2, 2, 3, 3, 2}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga2 [8] = {4, 5, 5, 4, 4, 5, 5, 4}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga3 [8] = {6, 7, 7, 6, 6, 7, 7, 6}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_a0 = mipp::Reg<R>::cmask2(cmask_a0 );\nconst auto r_cmask_a1 = mipp::Reg<R>::cmask2(cmask_a1 );\n@@ -194,13 +194,13 @@ void Decoder_RSC_BCJR_inter_intra_fast_x2_AVX<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_b0 [8] = {0, 4, 5, 1, 2, 6, 7, 3}; // beta trellis transitions 0.\n- constexpr int cmask_b1 [8] = {4, 0, 1, 5, 6, 2, 3, 7}; // beta trellis transitions 1.\n- constexpr int cmask_g0 [8] = {0, 0, 1, 1, 1, 1, 0, 0}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_g1 [8] = {2, 2, 3, 3, 3, 3, 2, 2}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_g2 [8] = {4, 4, 5, 5, 5, 5, 4, 4}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_g3 [8] = {6, 6, 7, 7, 7, 7, 6, 6}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_b0 [8] = {0, 4, 5, 1, 2, 6, 7, 3}; // beta trellis transitions 0.\n+ constexpr unsigned cmask_b1 [8] = {4, 0, 1, 5, 6, 2, 3, 7}; // beta trellis transitions 1.\n+ constexpr unsigned cmask_g0 [8] = {0, 0, 1, 1, 1, 1, 0, 0}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g1 [8] = {2, 2, 3, 3, 3, 3, 2, 2}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g2 [8] = {4, 4, 5, 5, 5, 5, 4, 4}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g3 [8] = {6, 6, 7, 7, 7, 7, 6, 6}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_b0 = mipp::Reg<R>::cmask2(cmask_b0 );\nconst auto r_cmask_b1 = mipp::Reg<R>::cmask2(cmask_b1 );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_SSE.hxx",
"new_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_SSE.hxx",
"diff": "@@ -115,13 +115,13 @@ void Decoder_RSC_BCJR_inter_intra_fast_x2_SSE<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_a0 [16] = { 0, 1, 6, 7, 8, 9,14,15, 2, 3, 4, 5,10,11,12,13}; // alpha trellis transitions 0.\n- constexpr int cmask_a1 [16] = { 2, 3, 4, 5,10,11,12,13, 0, 1, 6, 7, 8, 9,14,15}; // alpha trellis transitions 1.\n- constexpr int cmask_ga0 [16] = { 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 1, 3, 0, 2}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_ga1 [16] = { 4, 6, 5, 7, 5, 7, 4, 6, 4, 6, 5, 7, 5, 7, 4, 6}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_ga2 [16] = { 8,10, 9,11, 9,11, 8,10, 8,10, 9,11, 9,11, 8,10}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_ga3 [16] = {12,14,13,15,13,15,12,14,12,14,13,15,13,15,12,14}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_a0 [16] = { 0, 1, 6, 7, 8, 9,14,15, 2, 3, 4, 5,10,11,12,13}; // alpha trellis transitions 0.\n+ constexpr unsigned cmask_a1 [16] = { 2, 3, 4, 5,10,11,12,13, 0, 1, 6, 7, 8, 9,14,15}; // alpha trellis transitions 1.\n+ constexpr unsigned cmask_ga0 [16] = { 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 1, 3, 0, 2}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga1 [16] = { 4, 6, 5, 7, 5, 7, 4, 6, 4, 6, 5, 7, 5, 7, 4, 6}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga2 [16] = { 8,10, 9,11, 9,11, 8,10, 8,10, 9,11, 9,11, 8,10}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga3 [16] = {12,14,13,15,13,15,12,14,12,14,13,15,13,15,12,14}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_a0 = mipp::Reg<R>::cmask(cmask_a0 );\nconst auto r_cmask_a1 = mipp::Reg<R>::cmask(cmask_a1 );\n@@ -179,13 +179,13 @@ void Decoder_RSC_BCJR_inter_intra_fast_x2_SSE<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_b0 [16] = { 0, 1, 8, 9,10,11, 2, 3, 4, 5,12,13,14,15, 6, 7}; // beta trellis transitions 0.\n- constexpr int cmask_b1 [16] = { 8, 9, 0, 1, 2, 3,10,11,12,13, 4, 5, 6, 7,14,15}; // beta trellis transitions 1.\n- constexpr int cmask_g0 [16] = { 0, 2, 0, 2, 1, 3, 1, 3, 1, 3, 1, 3, 0, 2, 0, 2}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_g1 [16] = { 4, 6, 4, 6, 5, 7, 5, 7, 5, 7, 5, 7, 4, 6, 4, 6}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_g2 [16] = { 8,10, 8,10, 9,11, 9,11, 9,11, 9,11, 8,10, 8,10}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_g3 [16] = {12,14,12,14,13,15,13,15,13,15,13,15,12,14,12,14}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_b0 [16] = { 0, 1, 8, 9,10,11, 2, 3, 4, 5,12,13,14,15, 6, 7}; // beta trellis transitions 0.\n+ constexpr unsigned cmask_b1 [16] = { 8, 9, 0, 1, 2, 3,10,11,12,13, 4, 5, 6, 7,14,15}; // beta trellis transitions 1.\n+ constexpr unsigned cmask_g0 [16] = { 0, 2, 0, 2, 1, 3, 1, 3, 1, 3, 1, 3, 0, 2, 0, 2}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g1 [16] = { 4, 6, 4, 6, 5, 7, 5, 7, 5, 7, 5, 7, 4, 6, 4, 6}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g2 [16] = { 8,10, 8,10, 9,11, 9,11, 9,11, 9,11, 8,10, 8,10}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g3 [16] = {12,14,12,14,13,15,13,15,13,15,13,15,12,14,12,14}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_b0 = mipp::Reg<R>::cmask(cmask_b0 );\nconst auto r_cmask_b1 = mipp::Reg<R>::cmask(cmask_b1 );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x4_AVX.hxx",
"new_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x4_AVX.hxx",
"diff": "@@ -121,7 +121,7 @@ void Decoder_RSC_BCJR_inter_intra_fast_x4_AVX<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_deinter[16] = {0, 1, 2, 3, 8, 9, 10, 11, 4, 5, 6, 7, 12, 13, 14, 15};\n+ constexpr unsigned cmask_deinter[16] = {0, 1, 2, 3, 8, 9, 10, 11, 4, 5, 6, 7, 12, 13, 14, 15};\nconst auto r_cmask_deinter = mipp::Reg<R>::cmask2(cmask_deinter);\n// compute gamma values\n@@ -154,13 +154,13 @@ void Decoder_RSC_BCJR_inter_intra_fast_x4_AVX<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_a0 [16] = { 0, 1, 6, 7, 8, 9,14,15, 2, 3, 4, 5,10,11,12,13}; // alpha trellis transitions 0.\n- constexpr int cmask_a1 [16] = { 2, 3, 4, 5,10,11,12,13, 0, 1, 6, 7, 8, 9,14,15}; // alpha trellis transitions 1.\n- constexpr int cmask_ga0 [16] = { 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 1, 3, 0, 2}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_ga1 [16] = { 4, 6, 5, 7, 5, 7, 4, 6, 4, 6, 5, 7, 5, 7, 4, 6}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_ga2 [16] = { 8,10, 9,11, 9,11, 8,10, 8,10, 9,11, 9,11, 8,10}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_ga3 [16] = {12,14,13,15,13,15,12,14,12,14,13,15,13,15,12,14}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_a0 [16] = { 0, 1, 6, 7, 8, 9,14,15, 2, 3, 4, 5,10,11,12,13}; // alpha trellis transitions 0.\n+ constexpr unsigned cmask_a1 [16] = { 2, 3, 4, 5,10,11,12,13, 0, 1, 6, 7, 8, 9,14,15}; // alpha trellis transitions 1.\n+ constexpr unsigned cmask_ga0 [16] = { 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 1, 3, 0, 2}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga1 [16] = { 4, 6, 5, 7, 5, 7, 4, 6, 4, 6, 5, 7, 5, 7, 4, 6}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga2 [16] = { 8,10, 9,11, 9,11, 8,10, 8,10, 9,11, 9,11, 8,10}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga3 [16] = {12,14,13,15,13,15,12,14,12,14,13,15,13,15,12,14}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_a0 = mipp::Reg<R>::cmask2(cmask_a0 );\nconst auto r_cmask_a1 = mipp::Reg<R>::cmask2(cmask_a1 );\n@@ -218,13 +218,13 @@ void Decoder_RSC_BCJR_inter_intra_fast_x4_AVX<B,R,MAX>\n{\nconstexpr auto n_frames = mipp::nElReg<R>() / 8;\n- constexpr int cmask_b0 [16] = { 0, 1, 8, 9,10,11, 2, 3, 4, 5,12,13,14,15, 6, 7}; // beta trellis transitions 0.\n- constexpr int cmask_b1 [16] = { 8, 9, 0, 1, 2, 3,10,11,12,13, 4, 5, 6, 7,14,15}; // beta trellis transitions 1.\n- constexpr int cmask_g0 [16] = { 0, 2, 0, 2, 1, 3, 1, 3, 1, 3, 1, 3, 0, 2, 0, 2}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_g1 [16] = { 4, 6, 4, 6, 5, 7, 5, 7, 5, 7, 5, 7, 4, 6, 4, 6}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_g2 [16] = { 8,10, 8,10, 9,11, 9,11, 9,11, 9,11, 8,10, 8,10}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_g3 [16] = {12,14,12,14,13,15,13,15,13,15,13,15,12,14,12,14}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_b0 [16] = { 0, 1, 8, 9,10,11, 2, 3, 4, 5,12,13,14,15, 6, 7}; // beta trellis transitions 0.\n+ constexpr unsigned cmask_b1 [16] = { 8, 9, 0, 1, 2, 3,10,11,12,13, 4, 5, 6, 7,14,15}; // beta trellis transitions 1.\n+ constexpr unsigned cmask_g0 [16] = { 0, 2, 0, 2, 1, 3, 1, 3, 1, 3, 1, 3, 0, 2, 0, 2}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g1 [16] = { 4, 6, 4, 6, 5, 7, 5, 7, 5, 7, 5, 7, 4, 6, 4, 6}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g2 [16] = { 8,10, 8,10, 9,11, 9,11, 9,11, 9,11, 8,10, 8,10}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g3 [16] = {12,14,12,14,13,15,13,15,13,15,13,15,12,14,12,14}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[16] = { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_b0 = mipp::Reg<R>::cmask2(cmask_b0 );\nconst auto r_cmask_b1 = mipp::Reg<R>::cmask2(cmask_b1 );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_fast.hxx",
"new_path": "src/Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_fast.hxx",
"diff": "@@ -64,13 +64,13 @@ template <typename B, typename R, tools::proto_max_i<R> MAX>\nvoid Decoder_RSC_BCJR_intra_fast<B,R,MAX>\n::compute_alpha()\n{\n- constexpr int cmask_a0 [8] = {0, 3, 4, 7, 1, 2, 5, 6}; // alpha trellis transitions 0.\n- constexpr int cmask_a1 [8] = {1, 2, 5, 6, 0, 3, 4, 7}; // alpha trellis transitions 1.\n- constexpr int cmask_ga0 [8] = {0, 1, 1, 0, 0, 1, 1, 0}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_ga1 [8] = {2, 3, 3, 2, 2, 3, 3, 2}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_ga2 [8] = {4, 5, 5, 4, 4, 5, 5, 4}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_ga3 [8] = {6, 7, 7, 6, 6, 7, 7, 6}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_a0 [8] = {0, 3, 4, 7, 1, 2, 5, 6}; // alpha trellis transitions 0.\n+ constexpr unsigned cmask_a1 [8] = {1, 2, 5, 6, 0, 3, 4, 7}; // alpha trellis transitions 1.\n+ constexpr unsigned cmask_ga0 [8] = {0, 1, 1, 0, 0, 1, 1, 0}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga1 [8] = {2, 3, 3, 2, 2, 3, 3, 2}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga2 [8] = {4, 5, 5, 4, 4, 5, 5, 4}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga3 [8] = {6, 7, 7, 6, 6, 7, 7, 6}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_a0 = mipp::Reg<R>::cmask(cmask_a0 );\nconst auto r_cmask_a1 = mipp::Reg<R>::cmask(cmask_a1 );\n@@ -126,13 +126,13 @@ template <typename B, typename R, tools::proto_max_i<R> MAX>\nvoid Decoder_RSC_BCJR_intra_fast<B,R,MAX>\n::compute_beta_ext(const R *sys, R *ext)\n{\n- constexpr int cmask_b0 [8] = {0, 4, 5, 1, 2, 6, 7, 3}; // beta trellis transitions 0.\n- constexpr int cmask_b1 [8] = {4, 0, 1, 5, 6, 2, 3, 7}; // beta trellis transitions 1.\n- constexpr int cmask_g0 [8] = {0, 0, 1, 1, 1, 1, 0, 0}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_g1 [8] = {2, 2, 3, 3, 3, 3, 2, 2}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_g2 [8] = {4, 4, 5, 5, 5, 5, 4, 4}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_g3 [8] = {6, 6, 7, 7, 7, 7, 6, 6}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_b0 [8] = {0, 4, 5, 1, 2, 6, 7, 3}; // beta trellis transitions 0.\n+ constexpr unsigned cmask_b1 [8] = {4, 0, 1, 5, 6, 2, 3, 7}; // beta trellis transitions 1.\n+ constexpr unsigned cmask_g0 [8] = {0, 0, 1, 1, 1, 1, 0, 0}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g1 [8] = {2, 2, 3, 3, 3, 3, 2, 2}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g2 [8] = {4, 4, 5, 5, 5, 5, 4, 4}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_g3 [8] = {6, 6, 7, 7, 7, 7, 6, 6}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_b0 = mipp::Reg<R>::cmask(cmask_b0 );\nconst auto r_cmask_b1 = mipp::Reg<R>::cmask(cmask_b1 );\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": "@@ -64,13 +64,13 @@ template <typename B, typename R, tools::proto_max_i<R> MAX>\nvoid Decoder_RSC_BCJR_intra_std<B,R,MAX>\n::compute_alpha()\n{\n- constexpr int cmask_a0 [8] = {0, 3, 4, 7, 1, 2, 5, 6}; // alpha trellis transitions 0.\n- constexpr int cmask_a1 [8] = {1, 2, 5, 6, 0, 3, 4, 7}; // alpha trellis transitions 1.\n- constexpr int cmask_ga0 [8] = {0, 1, 1, 0, 0, 1, 1, 0}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_ga1 [8] = {2, 3, 3, 2, 2, 3, 3, 2}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_ga2 [8] = {4, 5, 5, 4, 4, 5, 5, 4}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_ga3 [8] = {6, 7, 7, 6, 6, 7, 7, 6}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_a0 [8] = {0, 3, 4, 7, 1, 2, 5, 6}; // alpha trellis transitions 0.\n+ constexpr unsigned cmask_a1 [8] = {1, 2, 5, 6, 0, 3, 4, 7}; // alpha trellis transitions 1.\n+ constexpr unsigned cmask_ga0 [8] = {0, 1, 1, 0, 0, 1, 1, 0}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga1 [8] = {2, 3, 3, 2, 2, 3, 3, 2}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga2 [8] = {4, 5, 5, 4, 4, 5, 5, 4}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_ga3 [8] = {6, 7, 7, 6, 6, 7, 7, 6}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_a0 = mipp::Reg<R>::cmask(cmask_a0 );\nconst auto r_cmask_a1 = mipp::Reg<R>::cmask(cmask_a1 );\n@@ -106,13 +106,13 @@ template <typename B, typename R, tools::proto_max_i<R> MAX>\nvoid Decoder_RSC_BCJR_intra_std<B,R,MAX>\n::compute_beta_ext(const R *sys, R *ext)\n{\n- constexpr int cmask_b0 [8] = {0, 4, 5, 1, 2, 6, 7, 3}; // beta trellis transitions 0.\n- constexpr int cmask_b1 [8] = {4, 0, 1, 5, 6, 2, 3, 7}; // beta trellis transitions 1.\n- constexpr int cmask_gb0 [8] = {0, 0, 1, 1, 1, 1, 0, 0}; // mask0 to construct the gamma0/1 vector.\n- constexpr int cmask_gb1 [8] = {2, 2, 3, 3, 3, 3, 2, 2}; // mask1 to construct the gamma0/1 vector.\n- constexpr int cmask_gb2 [8] = {4, 4, 5, 5, 5, 5, 4, 4}; // mask2 to construct the gamma0/1 vector.\n- constexpr int cmask_gb3 [8] = {6, 6, 7, 7, 7, 7, 6, 6}; // mask3 to construct the gamma0/1 vector.\n- constexpr int cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n+ constexpr unsigned cmask_b0 [8] = {0, 4, 5, 1, 2, 6, 7, 3}; // beta trellis transitions 0.\n+ constexpr unsigned cmask_b1 [8] = {4, 0, 1, 5, 6, 2, 3, 7}; // beta trellis transitions 1.\n+ constexpr unsigned cmask_gb0 [8] = {0, 0, 1, 1, 1, 1, 0, 0}; // mask0 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_gb1 [8] = {2, 2, 3, 3, 3, 3, 2, 2}; // mask1 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_gb2 [8] = {4, 4, 5, 5, 5, 5, 4, 4}; // mask2 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_gb3 [8] = {6, 6, 7, 7, 7, 7, 6, 6}; // mask3 to construct the gamma0/1 vector.\n+ constexpr unsigned cmask_norm[8] = {0, 0, 0, 0, 0, 0, 0, 0}; // mask to broadcast the first alpha value in the\n// normalization process.\nconst auto r_cmask_b0 = mipp::Reg<R>::cmask(cmask_b0 );\nconst auto r_cmask_b1 = mipp::Reg<R>::cmask(cmask_b1 );\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update MIPP version.
|
8,486 |
27.06.2017 15:40:18
| -7,200 |
72f367b66861dabc7280d5529498c092b9623ce5
|
Bug correction for iterative decoding.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/User/Modem_user.hxx",
"new_path": "src/Module/Modem/User/Modem_user.hxx",
"diff": "@@ -245,7 +245,7 @@ void Modem_user<B,R,Q,MAX>\nL1 = MAX(L1, -tempL);\n}\n- Y_N3[n] = (L0 - L1) + Y_N2[n];\n+ Y_N3[n] = (L0 - L1);\n}\n}\n@@ -290,7 +290,7 @@ void Modem_user<B,R,Q,MAX>\nL1 = MAX(L1, -tempL);\n}\n- Y_N3[n] = (L0 - L1) + Y_N2[n];\n+ Y_N3[n] = (L0 - L1);\n}\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Bug correction for iterative decoding.
|
8,486 |
27.06.2017 17:34:05
| -7,200 |
e2edb905620287c63ddfa4366b98cd89c25cdb02
|
Bug correction in BPSK demod with a priori.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/BPSK/Modem_BPSK.cpp",
"new_path": "src/Module/Modem/BPSK/Modem_BPSK.cpp",
"diff": "@@ -95,38 +95,14 @@ template <typename B, typename R, typename Q>\nvoid Modem_BPSK<B,R,Q>\n::demodulate(const Q *Y_N1, const Q *Y_N2, Q *Y_N3)\n{\n- if (typeid(R) != typeid(Q))\n- throw invalid_argument(__FILE__, __LINE__, __func__, \"Type 'R' and 'Q' have to be the same.\");\n-\n- if (typeid(Q) != typeid(float) && typeid(Q) != typeid(double))\n- throw invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\n-\n- auto size = (unsigned int)(this->N_fil * this->n_frames);\n- if (disable_sig2)\n- for (unsigned i = 0; i < size; i++)\n- Y_N3[i] = Y_N1[i] + Y_N2[i];\n- else\n- for (unsigned i = 0; i < size; i++)\n- Y_N3[i] = (Y_N1[i] * (Q)two_on_square_sigma) + Y_N2[i];\n+ this->demodulate(Y_N1,Y_N3);\n}\ntemplate <typename B, typename R, typename Q>\nvoid Modem_BPSK<B,R,Q>\n::demodulate_with_gains(const Q *Y_N1, const R *H_N, const Q *Y_N2, Q *Y_N3)\n{\n- if (typeid(R) != typeid(Q))\n- throw invalid_argument(__FILE__, __LINE__, __func__, \"Type 'R' and 'Q' have to be the same.\");\n-\n- if (typeid(Q) != typeid(float) && typeid(Q) != typeid(double))\n- throw invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\n-\n- auto size = (unsigned int)(this->N_fil * this->n_frames);\n- if (disable_sig2)\n- for (unsigned i = 0; i < size; i++)\n- Y_N3[i] = Y_N1[i] * (Q)H_N[i] + Y_N2[i];\n- else\n- for (unsigned i = 0; i < size; i++)\n- Y_N3[i] = (Y_N1[i] * (Q)H_N[i] * (Q)two_on_square_sigma) + Y_N2[i];\n+ this->demodulate_with_gains(Y_N1, H_N, Y_N3);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.cpp",
"new_path": "src/Module/Modem/BPSK/Modem_BPSK_fast.cpp",
"diff": "@@ -179,36 +179,7 @@ template <typename B, typename R, typename Q>\nvoid Modem_BPSK_fast<B,R,Q>\n::demodulate(const Q *Y_N1, const Q *Y_N2, Q *Y_N3)\n{\n- if (typeid(R) != typeid(Q))\n- throw invalid_argument(__FILE__, __LINE__, __func__, \"Type 'R' and 'Q' have to be the same.\");\n-\n- if (typeid(Q) != typeid(float) && typeid(Q) != typeid(double))\n- throw invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\n-\n- auto size = (unsigned int)(this->N * this->n_frames);\n- if (disable_sig2)\n- {\n- auto vec_loop_size = (size / mipp::nElReg<Q>()) * mipp::nElReg<Q>();\n- for (unsigned i = 0; i < vec_loop_size; i += mipp::nElReg<Q>())\n- {\n- auto y = mipp::add(mipp::Reg<Q>(&Y_N1[i]), mipp::Reg<Q>(&Y_N2[i]));\n- y.store(&Y_N3[i]);\n- }\n- for (unsigned i = vec_loop_size; i < size; i++)\n- Y_N3[i] = Y_N1[i] + Y_N2[i];\n- }\n- else\n- {\n- auto vec_loop_size = (size / mipp::nElReg<Q>()) * mipp::nElReg<Q>();\n- for (unsigned i = 0; i < vec_loop_size; i += mipp::nElReg<Q>())\n- {\n- // mipp::fmadd(a, b, c) = a * b + c\n- auto y = mipp::fmadd(mipp::Reg<Q>(&Y_N1[i]), mipp::Reg<Q>((Q)two_on_square_sigma), mipp::Reg<Q>(&Y_N2[i]));\n- y.store(&Y_N3[i]);\n- }\n- for (unsigned i = vec_loop_size; i < size; i++)\n- Y_N3[i] = (Y_N1[i] * (Q)two_on_square_sigma) + Y_N2[i];\n- }\n+ this->demodulate(Y_N1,Y_N3);\n}\n// ==================================================================================== explicit template instantiation\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Bug correction in BPSK demod with a priori.
|
8,486 |
27.06.2017 18:13:21
| -7,200 |
45c8a23f06ae3ce522d47f043702d208eee664c8
|
Enabling nonsystematic encoding of Polar codes for BFERI.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.cpp",
"new_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.cpp",
"diff": "@@ -63,6 +63,9 @@ void Launcher_BFERI_polar<B,R,Q>\n// ------------------------------------------------------------------------------------------------------- encoder\nthis->opt_args[{\"enc-type\"}][2] += \", POLAR\";\n+ this->opt_args[{\"enc-no-sys\"}] =\n+ {\"\",\n+ \"disable the systematic encoding.\"};\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"SCAN\");\n@@ -89,6 +92,9 @@ void Launcher_BFERI_polar<B,R,Q>\nif(this->ar.exist_arg({\"cde-awgn-fb-path\" })) this->params.code.awgn_fb_path = this->ar.get_arg ({\"cde-awgn-fb-path\" });\nif(this->ar.exist_arg({\"cde-fb-gen-method\"})) this->params.code.fb_gen_method = this->ar.get_arg ({\"cde-fb-gen-method\"});\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ if(this->ar.exist_arg({\"enc-no-sys\"} )) this->params.encoder.systematic = false;\n+\n// ------------------------------------------------------------------------------------------------------- decoder\nif(this->ar.exist_arg({\"dec-ite\", \"i\"})) this->params.decoder.n_ite = this->ar.get_arg_int ({\"dec-ite\", \"i\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"diff": "@@ -52,7 +52,13 @@ Decoder_SISO<B,R>* Factory_decoder_polar<B,R>\nconst int n_frames)\n{\nif (type == \"SCAN\" && sys_encoding)\n+ {\nif (implem == \"NAIVE\") return new Decoder_polar_SCAN_naive_sys<B, R, init_LLR<R>, f_LLR<R>, v_LLR<R>, h_LLR<B,R>>(K, N, n_ite, frozen_bits, n_frames);\n+ }\n+ else if(type == \"SCAN\" && !sys_encoding)\n+ {\n+ if (implem == \"NAIVE\") return new Decoder_polar_SCAN_naive <B, R, init_LLR<R>, f_LLR<R>, v_LLR<R>, h_LLR<B,R>>(K, N, n_ite, frozen_bits, n_frames);\n+ }\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Enabling nonsystematic encoding of Polar codes for BFERI.
|
8,486 |
28.06.2017 10:28:49
| -7,200 |
025c29fc729c4f0271bbf53a9d2297b5ac0df556
|
Small corrections for enabling iterative non-systematic polar.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"diff": "@@ -27,6 +27,7 @@ protected:\nstd::vector<mipp::vector<R>> feedback_graph;\nstd::vector<mipp::vector<R>> soft_graph;\n+ bool is_init;\npublic:\nDecoder_polar_SCAN_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCAN_naive\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"diff": "@@ -27,7 +27,8 @@ Decoder_polar_SCAN_naive<B,R,I,F,V,H>\nlayers_count (this->m +1 ),\nfrozen_bits (frozen_bits ),\nfeedback_graph(layers_count ),\n- soft_graph (layers_count )\n+ soft_graph (layers_count ),\n+ is_init (false )\n{\nif (!tools::is_power_of_2(this->N))\n{\n@@ -92,6 +93,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\nfor (auto t = 0; t < layers_count -1; t++)\nfor (auto i = 0; i < this->N; i++)\nsoft_graph[t][i] = I();\n+\n+ this->is_init = true;\n}\ntemplate <typename B, typename R,\n@@ -99,6 +102,7 @@ template <typename B, typename R,\nvoid Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n::_load(const R *Y_N)\n{\n+ if (!(this->is_init))\n_load_init();\n// init the softGraph (special case for the right most stage)\n@@ -159,6 +163,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\nthis->d_load_total += d_load;\nthis->d_decod_total += d_decod;\nthis->d_store_total += d_store;\n+\n+ this->is_init = false;\n}\ntemplate <typename B, typename R,\n@@ -174,7 +180,7 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n// ---------------------------------------------------------------------------------------------------------- STORE\nfor (auto i = 0; i < this->N; i++)\n- Y_N2[i] = this->feedback_graph[0][i];\n+ Y_N2[i] = this->feedback_graph[this->layers_count -1][i];\n}\n/********************************************************************/\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Small corrections for enabling iterative non-systematic polar.
|
8,483 |
28.06.2017 16:32:19
| -7,200 |
444258745222cc7857bcf7a6227ce4376cdff26e
|
Change decoder and encoder elements of param chain struct into pointers
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.cpp",
"new_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.cpp",
"diff": "@@ -24,10 +24,25 @@ Launcher_BFER_BCH<B,R,Q>\n::Launcher_BFER_BCH(const int argc, const char **argv, std::ostream &stream)\n: Launcher_BFER<B,R,Q>(argc, argv, stream)\n{\n+ this->m_chain_params->enc = new typename Factory_encoder_BCH<B >::encoder_parameters();\n+ this->m_chain_params->dec = new typename Factory_decoder_BCH<B,Q>::decoder_parameters();\n+\nthis->params.quantizer.n_bits = 7;\nthis->params.quantizer.n_decimals = 2;\n}\n+template <typename B, typename R, typename Q>\n+Launcher_BFER_BCH<B,R,Q>\n+::~Launcher_BFER_BCH()\n+{\n+ if (this->m_chain_params->enc != nullptr)\n+ delete this->m_chain_params->enc;\n+\n+ if (this->m_chain_params->dec != nullptr)\n+ delete this->m_chain_params->dec;\n+}\n+\n+\ntemplate <typename B, typename R, typename Q>\nvoid Launcher_BFER_BCH<B,R,Q>\n::build_args()\n@@ -44,8 +59,8 @@ void Launcher_BFER_BCH<B,R,Q>\n{\nLauncher_BFER<B,R,Q>::store_args();\n- Factory_encoder_BCH<B >::store_args(this->ar, this->m_chain_params->enc);\n- Factory_decoder_BCH<B,Q>::store_args(this->ar, this->m_chain_params->dec);\n+ Factory_encoder_BCH<B >::store_args(this->ar, *this->m_chain_params->enc);\n+ Factory_decoder_BCH<B,Q>::store_args(this->ar, *this->m_chain_params->dec);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.hpp",
"new_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.hpp",
"diff": "@@ -12,7 +12,7 @@ class Launcher_BFER_BCH : public Launcher_BFER<B,R,Q>\n{\npublic:\nLauncher_BFER_BCH(const int argc, const char **argv, std::ostream &stream = std::cout);\n- virtual ~Launcher_BFER_BCH() {};\n+ virtual ~Launcher_BFER_BCH();\nprotected:\nvirtual void build_args();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_std.hpp",
"new_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_std.hpp",
"diff": "@@ -35,8 +35,8 @@ struct Factory_simulation_BFER_std : Factory_simulation_BFER\ntypename Factory_modem <B,R,Q>::modem_parameters modem;\ntypename Factory_channel < R >::channel_parameters chn;\ntypename Factory_quantizer < R,Q>::quantizer_parameters qua;\n- typename Factory_encoder_common<B >::encoder_parameters enc;\n- typename Factory_decoder_common ::decoder_parameters dec;\n+ typename Factory_encoder_common<B >::encoder_parameters *enc;\n+ typename Factory_decoder_common ::decoder_parameters *dec;\n};\nstatic void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/git_sha1.cpp",
"new_path": null,
"diff": "-#include \"Tools/git_sha1.h\"\n-\n-#define GIT_SHA1 \"14debae93d3bf4c019ef3985e5c2007ce795ccc6\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-const char g_GIT_SHA1[] = GIT_SHA1;\n-}\n-}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change decoder and encoder elements of param chain struct into pointers
|
8,483 |
29.06.2017 09:55:58
| -7,200 |
8ec7ac96d2bf24de12e79db5d929146c42f6de15
|
Always display help message when an issue happens in the main function
|
[
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "@@ -127,20 +127,14 @@ void read_arguments(const int argc, const char** argv, std::string &code_type, s\nFactory_simulation_main::store_args(ar, params);\n-\nif (params.display_version)\nprint_version();\n- if (miss_arg)\n+ if (error || miss_arg)\n{\nFactory_simulation_main::group_args(arg_group);\n-\nar.print_usage(arg_group);\n- std::exit(EXIT_FAILURE);\n- }\n- if (error || miss_arg)\n- {\nfor (auto w = 0; w < (int)cmd_error.size(); w++)\nstd::cerr << format_error(cmd_error[w]) << std::endl;\nstd::exit(EXIT_FAILURE);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Always display help message when an issue happens in the main function
|
8,483 |
29.06.2017 14:29:18
| -7,200 |
77b1e459b8e0bcc7bc2a7dff1cda718ea2a270c8
|
Complete Factory interleaver; Add Launcher_RA code.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/RA/Launcher_RA.hpp",
"diff": "+#ifndef LAUNCHER_RA_HPP_\n+#define LAUNCHER_RA_HPP_\n+\n+#include \"Tools/Factory/RA/Factory_decoder_RA.hpp\"\n+#include \"Tools/Factory/RA/Factory_encoder_RA.hpp\"\n+#include \"Tools/Factory/Factory_interleaver.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <class cLauncher, typename B = int, typename R = float, typename Q = R>\n+class Launcher_RA : public cLauncher\n+{\n+public:\n+ Launcher_RA(const int argc, const char **argv, std::ostream &stream = std::cout);\n+ virtual ~Launcher_RA();\n+\n+protected:\n+ virtual void build_args();\n+ virtual void store_args();\n+ virtual void group_args();\n+ virtual void print_header();\n+\n+ virtual void build_codec();\n+\n+ typename tools::Factory_encoder_RA<B >::encoder_parameters *m_enc = nullptr;\n+ typename tools::Factory_decoder_RA<B,Q>::decoder_parameters_RA *m_dec = nullptr;\n+};\n+}\n+}\n+\n+#include \"Launcher_RA.hxx\"\n+\n+#endif /* LAUNCHER_RA_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/RA/Launcher_RA.hxx",
"diff": "+#include <iostream>\n+\n+#include \"Tools/Codec/RA/Codec_RA.hpp\"\n+#include \"Launcher_RA.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <class cLauncher, typename B, typename R, typename Q>\n+Launcher_RA<cLauncher,B,R,Q>\n+::Launcher_RA(const int argc, const char **argv, std::ostream &stream)\n+: cLauncher(argc, argv, stream)\n+{\n+ m_enc = new typename tools::Factory_encoder_RA<B >::encoder_parameters ();\n+ m_dec = new typename tools::Factory_decoder_RA<B,Q>::decoder_parameters_RA();\n+\n+ this->m_chain_params->enc = m_enc;\n+ this->m_chain_params->dec = m_dec;\n+\n+// this->params.quantizer .n_bits = 7;\n+// this->params.quantizer .n_decimals = 2;\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+Launcher_RA<cLauncher,B,R,Q>\n+::~Launcher_RA()\n+{\n+ if (this->m_chain_params->enc != nullptr)\n+ delete this->m_chain_params->enc;\n+\n+ if (this->m_chain_params->dec != nullptr)\n+ delete this->m_chain_params->dec;\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_RA<cLauncher,B,R,Q>\n+::build_args()\n+{\n+ cLauncher::build_args();\n+\n+ tools::Factory_encoder_RA <B >::build_args(this->req_args, this->opt_args);\n+ tools::Factory_decoder_RA <B,Q>::build_args(this->req_args, this->opt_args);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_RA<cLauncher,B,R,Q>\n+::store_args()\n+{\n+ cLauncher::store_args();\n+\n+ tools::Factory_encoder_RA <B >::store_args(this->ar, *m_enc);\n+ tools::Factory_decoder_RA <B,Q>::store_args(this->ar, *m_dec, this->m_chain_params->sim.seed);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_RA<cLauncher,B,R,Q>\n+::group_args()\n+{\n+ cLauncher::group_args();\n+\n+ tools::Factory_encoder_RA <B >::group_args(this->arg_group);\n+ tools::Factory_decoder_RA <B,Q>::group_args(this->arg_group);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_RA<cLauncher,B,R,Q>\n+::print_header()\n+{\n+ tools::Factory_encoder_RA <B >::header(this->pl_enc, *m_enc);\n+ tools::Factory_decoder_RA <B,Q>::header(this->pl_dec, this->pl_itl, *m_dec);\n+\n+ cLauncher::print_header();\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_RA<cLauncher,B,R,Q>\n+::build_codec()\n+{\n+ this->codec = new tools::Codec_RA<B,Q>(this->params);\n+}\n+}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.cpp",
"new_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.cpp",
"diff": "@@ -117,12 +117,12 @@ void Launcher_BFER_std<B,R,Q>\nHeader::compute_max_n_chars(pl_src, max_n_chars);\nHeader::compute_max_n_chars(pl_crc, max_n_chars);\nHeader::compute_max_n_chars(pl_enc, max_n_chars);\n-// Header::compute_max_n_chars(pct, max_n_chars);\n-// Header::compute_max_n_chars(itl, max_n_chars);\n+ Header::compute_max_n_chars(pl_pct, max_n_chars);\n+ Header::compute_max_n_chars(pl_itl, max_n_chars);\nHeader::compute_max_n_chars(pl_mod, max_n_chars);\nHeader::compute_max_n_chars(pl_chn, max_n_chars);\nHeader::compute_max_n_chars(pl_demod, max_n_chars);\n-// Header::compute_max_n_chars(pl_depct, max_n_chars);\n+ Header::compute_max_n_chars(pl_depct, max_n_chars);\nHeader::compute_max_n_chars(pl_qua, max_n_chars);\nHeader::compute_max_n_chars(pl_dec, max_n_chars);\nHeader::compute_max_n_chars(pl_mon, max_n_chars);\n@@ -133,12 +133,12 @@ void Launcher_BFER_std<B,R,Q>\nif (pl_src .size()) Header::print_parameters(\"Source\", pl_src, max_n_chars, this->stream);\nif (pl_crc .size()) Header::print_parameters(\"CRC\", pl_crc, max_n_chars, this->stream);\nif (pl_enc .size()) Header::print_parameters(\"Encoder\", pl_enc, max_n_chars, this->stream);\n-// if (pl_pct.size()) Header::print_parameters(\"Puncturer\", pl_pct, max_n_chars, this->stream);\n-// if (pl_itl.size()) Header::print_parameters(\"Interleaver\", pl_itl, max_n_chars, this->stream);\n+ if (pl_pct .size()) Header::print_parameters(\"Puncturer\", pl_pct, max_n_chars, this->stream);\n+ if (pl_itl .size()) Header::print_parameters(\"Interleaver\", pl_itl, max_n_chars, this->stream);\nif (pl_mod .size()) Header::print_parameters(\"Modulator\", pl_mod, max_n_chars, this->stream);\nif (pl_chn .size()) Header::print_parameters(\"Channel\", pl_chn, max_n_chars, this->stream);\nif (pl_demod.size()) Header::print_parameters(\"Demodulator\", pl_demod, max_n_chars, this->stream);\n-// if (pl_depct.size()) Header::print_parameters(\"Depuncturer\", pl_depct, max_n_chars, this->stream);\n+ if (pl_depct.size()) Header::print_parameters(\"Depuncturer\", pl_depct, max_n_chars, this->stream);\nif (pl_qua .size()) Header::print_parameters(\"Quantizer\", pl_qua, max_n_chars, this->stream);\nif (pl_dec .size()) Header::print_parameters(\"Decoder\", pl_dec, max_n_chars, this->stream);\nif (pl_mon .size()) Header::print_parameters(\"Monitor\", pl_mon, max_n_chars, this->stream);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.hpp",
"new_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.hpp",
"diff": "@@ -26,8 +26,8 @@ protected:\ntools::Factory_simulation_BFER_std::chain_parameters_BFER_std<B,R,Q> * m_chain_params = nullptr;\n- tools::Header::params_list pl_sim, pl_cde, pl_src, pl_crc, pl_mod, pl_demod,\n- pl_chn, pl_qua, pl_enc, pl_dec, pl_mon, pl_ter;\n+ tools::Header::params_list pl_sim, pl_cde, pl_src, pl_crc, pl_itl, pl_mod, pl_demod,\n+ pl_chn, pl_qua, pl_enc, pl_dec, pl_mon, pl_ter, pl_pct, pl_depct;\npublic:\nLauncher_BFER_std(const int argc, const char **argv, std::ostream &stream = std::cout);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_CRC.cpp",
"new_path": "src/Tools/Factory/Factory_CRC.cpp",
"diff": "@@ -51,7 +51,7 @@ void Factory_CRC<B>\ntemplate <typename B>\nvoid Factory_CRC<B>\n-::store_args(const Arguments_reader& ar, CRC_params ¶ms, const int K, const int N)\n+::store_args(const Arguments_reader& ar, CRC_parameters ¶ms, const int K, const int N)\n{\n// ----------------------------------------------------------------------------------------------------------- crc\nif(ar.exist_arg({\"crc-type\"})) params.type = ar.get_arg ({\"crc-type\"});\n@@ -77,10 +77,9 @@ void Factory_CRC<B>\nar.push_back({\"crc\", \"CRC parameter(s)\"});\n}\n-\ntemplate <typename B>\nvoid Factory_CRC<B>\n-::header(Header::params_list& head_crc, const CRC_params& params)\n+::header(Header::params_list& head_crc, const CRC_parameters& params)\n{\n// ----------------------------------------------------------------------------------------------------------- crc\nif (!params.poly.empty())\n@@ -102,6 +101,7 @@ void Factory_CRC<B>\nhead_crc.push_back(std::make_pair(\"Add CRC in the code rate\", crc_inc_rate));\n}\n}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_CRC.hpp",
"new_path": "src/Tools/Factory/Factory_CRC.hpp",
"diff": "@@ -17,7 +17,7 @@ namespace tools\ntemplate <typename B = int>\nstruct Factory_CRC : public Factory\n{\n- struct CRC_params\n+ struct CRC_parameters\n{\nstd::string type = \"FAST\";\nstd::string poly = \"\";\n@@ -34,10 +34,10 @@ struct Factory_CRC : public Factory\nconst int n_frames = 1);\nstatic void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n- static void store_args(const Arguments_reader& ar, CRC_params ¶ms, const int K, const int N);\n+ static void store_args(const Arguments_reader& ar, CRC_parameters ¶ms, const int K, const int N);\nstatic void group_args(Arguments_reader::arg_grp& ar);\n- static void header(Header::params_list& head_crc, const CRC_params& params);\n+ static void header(Header::params_list& head_crc, const CRC_parameters& params);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_interleaver.cpp",
"new_path": "src/Tools/Factory/Factory_interleaver.cpp",
"diff": "@@ -36,6 +36,75 @@ Interleaver<T>* Factory_interleaver<T>\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B>\n+void Factory_interleaver<B>\n+::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ // --------------------------------------------------------------------------------------------------- interleaver\n+ opt_args[{\"itl-type\"}] =\n+ {\"string\",\n+ \"specify the type of the interleaver.\",\n+ \"LTE, CCSDS, RANDOM, GOLDEN, USER, RAND_COL, ROW_COL, NO\"};\n+\n+ opt_args[{\"itl-path\"}] =\n+ {\"string\",\n+ \"specify the path to the interleaver file (to use with \\\"--itl-type USER\\\").\"};\n+\n+ opt_args[{\"itl-cols\"}] =\n+ {\"positive_int\",\n+ \"specify the number of columns used for the RAND_COL or ROW_COL interleaver.\"};\n+\n+ opt_args[{\"itl-uni\"}] =\n+ {\"\",\n+ \"enable the regeneration of the interleaver at each new frame.\"};\n+}\n+\n+template <typename B>\n+void Factory_interleaver<B>\n+::store_args(const Arguments_reader& ar, Interleaver_parameters ¶ms, const int seed)\n+{\n+ // --------------------------------------------------------------------------------------------------- interleaver\n+ params.seed = seed;\n+\n+ if(ar.exist_arg({\"itl-type\"})) params.type = ar.get_arg ({\"itl-type\"});\n+ if(ar.exist_arg({\"itl-path\"})) params.path = ar.get_arg ({\"itl-path\"});\n+ if(ar.exist_arg({\"itl-cols\"})) params.n_cols = ar.get_arg_int({\"itl-cols\"});\n+ if(ar.exist_arg({\"itl-uni\" })) params.uniform = true;\n+\n+// if(params.monitor.err_track_revert)\n+// {\n+// params.monitor.err_track_enable = false;\n+// if (params.interleaver.uniform)\n+// {\n+// params.interleaver.type = \"USER\";\n+// params.interleaver.path = params.monitor.err_track_path + std::string(\"_$snr.itl\");\n+// }\n+// }\n+}\n+\n+template <typename B>\n+void Factory_interleaver<B>\n+::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ ar.push_back({\"crc\", \"interleaver parameter(s)\"});\n+}\n+\n+template <typename B>\n+void Factory_interleaver<B>\n+::header(Header::params_list& head_itl, const Interleaver_parameters& params)\n+{\n+ // --------------------------------------------------------------------------------------------------- interleaver\n+ head_itl.push_back(std::make_pair(\"Type\", params.type));\n+\n+ if (params.type == \"USER\")\n+ head_itl.push_back(std::make_pair(\"Path\", params.path));\n+\n+ if (params.type == \"RAND_COL\" || params.type == \"ROW_COL\")\n+ head_itl.push_back(std::make_pair(\"Number of columns\", std::to_string(params.n_cols)));\n+\n+ head_itl.push_back(std::make_pair(\"Uniform\", (params.uniform ? \"on\" : \"off\")));\n+}\n+\n//==================================================================================== explicit template instantiation\ntemplate struct aff3ct::tools::Factory_interleaver<short>;\ntemplate struct aff3ct::tools::Factory_interleaver<int>;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_interleaver.hpp",
"new_path": "src/Tools/Factory/Factory_interleaver.hpp",
"diff": "#include <string>\n#include \"Module/Interleaver/Interleaver.hpp\"\n+#include \"Tools/Header.hpp\"\n+#include \"Tools/Arguments_reader.hpp\"\n#include \"Factory.hpp\"\n@@ -14,6 +16,15 @@ namespace tools\ntemplate <typename T = int>\nstruct Factory_interleaver : public Factory\n{\n+ struct Interleaver_parameters\n+ {\n+ std::string type = \"RANDOM\";\n+ std::string path = \"\";\n+ int seed;\n+ int n_cols = 4; // number of columns of the columns interleaver\n+ bool uniform = false; // set at true to regenerate the interleaver at each new frame\n+ };\n+\nstatic module::Interleaver<T>* build(const std::string type,\nconst int size,\nconst std::string path = \"\",\n@@ -21,6 +32,12 @@ struct Factory_interleaver : public Factory\nconst int n_cols = 1,\nconst int seed = 0,\nconst int n_frames = 1);\n+\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, Interleaver_parameters ¶ms, const int seed);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_itl, const Interleaver_parameters& params);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RA/Factory_decoder_RA.cpp",
"new_path": "src/Tools/Factory/RA/Factory_decoder_RA.cpp",
"diff": "@@ -25,6 +25,64 @@ Decoder<B,R>* Factory_decoder_RA<B,R>\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B, typename Q>\n+void Factory_decoder_RA<B,Q>\n+::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ Factory_decoder_common::build_args(req_args, opt_args);\n+\n+ // --------------------------------------------------------------------------------------------------- interleaver\n+ Factory_interleaver<int>::build_args(req_args, opt_args);\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ opt_args[{\"dec-ite\", \"i\"}] =\n+ {\"positive_int\",\n+ \"maximal number of iterations in the decoder.\"};\n+\n+ opt_args[{\"dec-type\", \"D\"}].push_back(\"RA\" );\n+\n+ opt_args[{\"dec-implem\" }].push_back(\"STD\");\n+}\n+\n+template <typename B, typename Q>\n+void Factory_decoder_RA<B,Q>\n+::store_args(const Arguments_reader& ar, decoder_parameters_RA ¶ms, const int seed)\n+{\n+ params.type = \"RA\";\n+ params.implem = \"STD\";\n+\n+ Factory_decoder_common::store_args(ar, params);\n+\n+ // --------------------------------------------------------------------------------------------------- interleaver\n+ Factory_interleaver<int>::store_args(ar, params.itl, seed);\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ if(ar.exist_arg({\"dec-ite\", \"i\"})) params.n_ite = ar.get_arg_int({\"dec-ite\", \"i\"});\n+}\n+\n+template <typename B, typename Q>\n+void Factory_decoder_RA<B,Q>\n+::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ Factory_decoder_common::group_args(ar);\n+\n+ // --------------------------------------------------------------------------------------------------- interleaver\n+ Factory_interleaver<int>::group_args(ar);\n+}\n+\n+template <typename B, typename Q>\n+void Factory_decoder_RA<B,Q>\n+::header(Header::params_list& head_dec, Header::params_list& head_itl, const decoder_parameters_RA& params)\n+{\n+ Factory_decoder_common::header(head_dec, params);\n+\n+ // --------------------------------------------------------------------------------------------------- interleaver\n+ Factory_interleaver<int>::header(head_itl, params.itl);\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ head_dec.push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(params.n_ite)));\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RA/Factory_decoder_RA.hpp",
"new_path": "src/Tools/Factory/RA/Factory_decoder_RA.hpp",
"diff": "#include \"Module/Decoder/Decoder.hpp\"\n-#include \"../Factory.hpp\"\n+#include \"../Factory_decoder_common.hpp\"\n+#include \"Tools/Factory/Factory_interleaver.hpp\"\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename B = int, typename R = float>\n-struct Factory_decoder_RA : public Factory\n+struct Factory_decoder_RA : public Factory_decoder_common\n{\n+ struct decoder_parameters_RA : decoder_parameters\n+ {\n+ virtual ~decoder_parameters_RA() {}\n+ // ------- code\n+ typename Factory_interleaver<int>::Interleaver_parameters itl;\n+\n+ // ------- decoder\n+ int n_ite = 10;\n+ };\n+\nstatic module::Decoder<B,R>* build(const std::string type,\nconst std::string implem,\nconst int K,\n@@ -21,6 +32,12 @@ struct Factory_decoder_RA : public Factory\nconst module::Interleaver<int> &itl,\nconst int n_ite,\nconst int n_frames = 1);\n+\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, decoder_parameters_RA ¶ms, const int seed);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_dec, Header::params_list& head_itl, const decoder_parameters_RA& params);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RA/Factory_encoder_RA.cpp",
"new_path": "src/Tools/Factory/RA/Factory_encoder_RA.cpp",
"diff": "@@ -20,6 +20,39 @@ Encoder<B>* Factory_encoder_RA<B>\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B>\n+void Factory_encoder_RA<B>\n+::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ Factory_encoder_common<B>::build_args(req_args, opt_args);\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ opt_args[{\"enc-type\"}][2] += \", RA\";\n+}\n+\n+template <typename B>\n+void Factory_encoder_RA<B>\n+::store_args(const Arguments_reader& ar, typename Factory_encoder_common<B>::encoder_parameters ¶ms)\n+{\n+ params.type = \"RA\";\n+\n+ Factory_encoder_common<B>::store_args(ar, params);\n+}\n+\n+template <typename B>\n+void Factory_encoder_RA<B>\n+::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ Factory_encoder_common<B>::group_args(ar);\n+}\n+\n+template <typename B>\n+void Factory_encoder_RA<B>\n+::header(Header::params_list& head_enc, const typename Factory_encoder_common<B>::encoder_parameters& params)\n+{\n+ Factory_encoder_common<B>::header(head_enc, params);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RA/Factory_encoder_RA.hpp",
"new_path": "src/Tools/Factory/RA/Factory_encoder_RA.hpp",
"diff": "#include \"Module/Encoder/Encoder.hpp\"\n#include \"Module/Interleaver/Interleaver.hpp\"\n-#include \"../Factory.hpp\"\n+#include \"../Factory_encoder_common.hpp\"\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename B = int>\n-struct Factory_encoder_RA : public Factory\n+struct Factory_encoder_RA : public Factory_encoder_common<B>\n{\nstatic module::Encoder<B>* build(const std::string type,\nconst int K,\nconst int N,\nconst module::Interleaver<int> &itl,\nconst int n_frames = 1);\n+\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, typename Factory_encoder_common<B>::encoder_parameters ¶ms);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_enc, const typename Factory_encoder_common<B>::encoder_parameters& params);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/Factory_simulation.cpp",
"new_path": "src/Tools/Factory/Simulation/Factory_simulation.cpp",
"diff": "@@ -74,11 +74,6 @@ void Factory_simulation::store_args(const Arguments_reader& ar, simu_parameters\nFactory_simulation_main::store_args(ar, params);\n- // -------------------------------------------------------------------------------------------- default parameters\n-//\n-// params.interleaver.seed = 0;\n-// params.interleaver.uniform = false;\n-\n// ---------------------------------------------------------------------------------------------------- simulation\nparams.snr_min = ar.get_arg_float({\"sim-snr-min\", \"m\"}); // required\nparams.snr_max = ar.get_arg_float({\"sim-snr-max\", \"M\"}); // required\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_std.hpp",
"new_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_std.hpp",
"diff": "@@ -36,7 +36,7 @@ struct Factory_simulation_BFER_std : Factory_simulation_BFER\nFactory_simulation_BFER_std ::simu_parameters_BFER_std sim;\ntypename Factory_source <B >::source_parameters src;\n- typename Factory_CRC <B >::CRC_params crc;\n+ typename Factory_CRC <B >::CRC_parameters crc;\ntypename Factory_modem <B,R,Q>::modem_parameters modem;\ntypename Factory_channel < R >::channel_parameters chn;\ntypename Factory_quantizer < R,Q>::quantizer_parameters qua;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include \"Launcher/BCH/Launcher_BCH.hpp\"\n#include \"Launcher/LDPC/Launcher_LDPC.hpp\"\n#include \"Launcher/Polar/Launcher_polar.hpp\"\n+#include \"Launcher/RA/Launcher_RA.hpp\"\n//#include \"Launcher/BFER/Polar/Launcher_BFER_polar.hpp\"\n//#include \"Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp\"\n@@ -238,11 +239,11 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\nlauncher = new Launcher_BCH<Launcher_BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n}\n-// if (code_type == \"RA\")\n-// {\n-// if (simu_type == \"BFER\")\n-// launcher = new Launcher_BFER_RA<B,R,Q>(argc, argv);\n-// }\n+ if (code_type == \"RA\")\n+ {\n+ if (simu_type == \"BFER\")\n+ launcher = new Launcher_RA<Launcher_BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n+ }\nif (code_type == \"LDPC\")\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Complete Factory interleaver; Add Launcher_RA code.
|
8,483 |
29.06.2017 15:44:28
| -7,200 |
e4d508c301d8175565c2bb3f58cad30e409c21a6
|
Add Repetition and RSC launchers
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/RSC/Launcher_RSC.hpp",
"diff": "+#ifndef LAUNCHER_RSC_HPP_\n+#define LAUNCHER_RSC_HPP_\n+\n+#include \"Tools/Factory/RSC/Factory_decoder_RSC.hpp\"\n+#include \"Tools/Factory/RSC/Factory_encoder_RSC.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <class cLauncher, typename B = int, typename R = float, typename Q = R, typename QD = Q>\n+class Launcher_RSC : public cLauncher\n+{\n+public:\n+ Launcher_RSC(const int argc, const char **argv, std::ostream &stream = std::cout);\n+ virtual ~Launcher_RSC();\n+\n+protected:\n+ virtual void build_args();\n+ virtual void store_args();\n+ virtual void group_args();\n+ virtual void print_header();\n+\n+ virtual void build_codec();\n+\n+ typename tools::Factory_encoder_RSC<B >::encoder_parameters_RSC *m_enc = nullptr;\n+ typename tools::Factory_decoder_RSC<B,Q,QD>::decoder_parameters_RSC *m_dec = nullptr;\n+};\n+}\n+}\n+\n+#include \"Launcher_RSC.hxx\"\n+\n+#endif /* LAUNCHER_RSC_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/RSC/Launcher_RSC.hxx",
"diff": "+#include <iostream>\n+\n+#include \"Tools/Codec/RSC/Codec_RSC.hpp\"\n+#include \"Launcher_RSC.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <class cLauncher, typename B, typename R, typename Q, typename QD>\n+Launcher_RSC<cLauncher,B,R,Q,QD>\n+::Launcher_RSC(const int argc, const char **argv, std::ostream &stream)\n+: cLauncher(argc, argv, stream)\n+{\n+ m_enc = new typename tools::Factory_encoder_RSC<B >::encoder_parameters_RSC();\n+ m_dec = new typename tools::Factory_decoder_RSC<B,Q,QD>::decoder_parameters_RSC();\n+\n+ this->m_chain_params->enc = m_enc;\n+ this->m_chain_params->dec = m_dec;\n+\n+// this->params.code .tail_length = 2*3;\n+// this->params.quantizer.n_bits = 6;\n+// this->params.quantizer.n_decimals = 3;\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q, typename QD>\n+Launcher_RSC<cLauncher,B,R,Q,QD>\n+::~Launcher_RSC()\n+{\n+ if (this->m_chain_params->enc != nullptr)\n+ delete this->m_chain_params->enc;\n+\n+ if (this->m_chain_params->dec != nullptr)\n+ delete this->m_chain_params->dec;\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q, typename QD>\n+void Launcher_RSC<cLauncher,B,R,Q,QD>\n+::build_args()\n+{\n+ cLauncher::build_args();\n+\n+ tools::Factory_encoder_RSC<B >::build_args(this->req_args, this->opt_args);\n+ tools::Factory_decoder_RSC<B,Q,QD>::build_args(this->req_args, this->opt_args);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q, typename QD>\n+void Launcher_RSC<cLauncher,B,R,Q,QD>\n+::store_args()\n+{\n+ cLauncher::store_args();\n+\n+ tools::Factory_encoder_RSC<B >::store_args(this->ar, *m_enc);\n+ tools::Factory_decoder_RSC<B,Q,QD>::store_args(this->ar, *m_dec);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q, typename QD>\n+void Launcher_RSC<cLauncher,B,R,Q,QD>\n+::group_args()\n+{\n+ cLauncher::group_args();\n+\n+ tools::Factory_encoder_RSC<B >::group_args(this->arg_group);\n+ tools::Factory_decoder_RSC<B,Q,QD>::group_args(this->arg_group);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q, typename QD>\n+void Launcher_RSC<cLauncher,B,R,Q,QD>\n+::print_header()\n+{\n+ tools::Factory_encoder_RSC<B >::header(this->pl_enc, *m_enc);\n+ tools::Factory_decoder_RSC<B,Q,QD>::header(this->pl_dec, this->pl_cde, *m_dec);\n+\n+ cLauncher::print_header();\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q, typename QD>\n+void Launcher_RSC<cLauncher,B,R,Q,QD>\n+::build_codec()\n+{\n+ this->codec = new tools::Codec_RSC<B,Q,QD>(this->params);\n+}\n+}\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/Repetition/Launcher_repetition.hpp",
"diff": "+#ifndef LAUNCHER_REPETITION_HPP_\n+#define LAUNCHER_REPETITION_HPP_\n+\n+#include \"Tools/Factory/Repetition/Factory_decoder_repetition.hpp\"\n+#include \"Tools/Factory/Repetition/Factory_encoder_repetition.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <class cLauncher, typename B = int, typename R = float, typename Q = R>\n+class Launcher_repetition : public cLauncher\n+{\n+public:\n+ Launcher_repetition(const int argc, const char **argv, std::ostream &stream = std::cout);\n+ virtual ~Launcher_repetition();\n+\n+protected:\n+ virtual void build_args();\n+ virtual void store_args();\n+ virtual void group_args();\n+ virtual void print_header();\n+\n+ virtual void build_codec();\n+\n+ typename tools::Factory_encoder_repetition<B >::encoder_parameters_repetition *m_enc = nullptr;\n+ typename tools::Factory_decoder_repetition<B,Q>::decoder_parameters *m_dec = nullptr;\n+};\n+}\n+}\n+\n+#include \"Launcher_repetition.hxx\"\n+\n+#endif /* LAUNCHER_REPETITION_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/Repetition/Launcher_repetition.hxx",
"diff": "+#include <iostream>\n+\n+#include \"Tools/Codec/Repetition/Codec_repetition.hpp\"\n+#include \"Launcher_repetition.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <class cLauncher, typename B, typename R, typename Q>\n+Launcher_repetition<cLauncher,B,R,Q>\n+::Launcher_repetition(const int argc, const char **argv, std::ostream &stream)\n+: cLauncher(argc, argv, stream)\n+{\n+ m_enc = new typename tools::Factory_encoder_repetition<B >::encoder_parameters_repetition();\n+ m_dec = new typename tools::Factory_decoder_repetition<B,Q>::decoder_parameters ();\n+\n+ this->m_chain_params->enc = m_enc;\n+ this->m_chain_params->dec = m_dec;\n+\n+ // this->params.quantizer.n_bits = 6;\n+ // this->params.quantizer.n_decimals = 2;\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+Launcher_repetition<cLauncher,B,R,Q>\n+::~Launcher_repetition()\n+{\n+ if (this->m_chain_params->enc != nullptr)\n+ delete this->m_chain_params->enc;\n+\n+ if (this->m_chain_params->dec != nullptr)\n+ delete this->m_chain_params->dec;\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_repetition<cLauncher,B,R,Q>\n+::build_args()\n+{\n+ cLauncher::build_args();\n+\n+ tools::Factory_encoder_repetition<B >::build_args(this->req_args, this->opt_args);\n+ tools::Factory_decoder_repetition<B,Q>::build_args(this->req_args, this->opt_args);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_repetition<cLauncher,B,R,Q>\n+::store_args()\n+{\n+ cLauncher::store_args();\n+\n+ tools::Factory_encoder_repetition<B >::store_args(this->ar, *m_enc);\n+ tools::Factory_decoder_repetition<B,Q>::store_args(this->ar, *m_dec);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_repetition<cLauncher,B,R,Q>\n+::group_args()\n+{\n+ cLauncher::group_args();\n+\n+ tools::Factory_encoder_repetition<B >::group_args(this->arg_group);\n+ tools::Factory_decoder_repetition<B,Q>::group_args(this->arg_group);\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_repetition<cLauncher,B,R,Q>\n+::print_header()\n+{\n+ tools::Factory_encoder_repetition<B >::header(this->pl_enc, *m_enc);\n+ tools::Factory_decoder_repetition<B,Q>::header(this->pl_dec, *m_dec);\n+\n+ cLauncher::print_header();\n+}\n+\n+template <class cLauncher, typename B, typename R, typename Q>\n+void Launcher_repetition<cLauncher,B,R,Q>\n+::build_codec()\n+{\n+ this->codec = new tools::Codec_repetition<B,Q>(this->params);\n+}\n+}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_encoder_common.hpp",
"new_path": "src/Tools/Factory/Factory_encoder_common.hpp",
"diff": "@@ -23,8 +23,6 @@ struct Factory_encoder_common : public Factory\nstd::string type = \"\";\nstd::string path = \"\";\nbool systematic = true;\n-// bool buffered;\n-// std::vector<int> poly;\n};\nstatic module::Encoder<B>* build(const std::string type,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.cpp",
"new_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.cpp",
"diff": "@@ -132,6 +132,111 @@ Decoder_SISO<B,R>* Factory_decoder_RSC<B,R,RD>\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B, typename Q, typename RD>\n+void Factory_decoder_RSC<B,Q,RD>\n+::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ Factory_decoder_common::build_args(req_args, opt_args);\n+\n+ // ---------------------------------------------------------------------------------------------------------- code\n+ opt_args[{\"dec-type\", \"D\"}].push_back(\"BCJR, LTE, CCSDS\" );\n+\n+ opt_args[{\"dec-implem\" }].push_back(\"GENERIC, STD, FAST, VERY_FAST\");\n+\n+ opt_args[{\"dec-simd\"}] =\n+ {\"string\",\n+ \"the SIMD strategy you want to use.\",\n+ \"INTRA, INTER\"};\n+\n+ opt_args[{\"dec-max\"}] =\n+ {\"string\",\n+ \"the MAX implementation for the nodes.\",\n+ \"MAX, MAXL, MAXS\"};\n+\n+ opt_args[{\"cde-poly\"}] =\n+ {\"string\",\n+ \"the polynomials describing RSC code, should be of the form \\\"{A,B}\\\".\"};\n+}\n+\n+template <typename B, typename Q, typename RD>\n+void Factory_decoder_RSC<B,Q,RD>\n+::store_args(const Arguments_reader& ar, decoder_parameters_RSC ¶ms)\n+{\n+ params.type = \"BCJR\";\n+ params.implem = \"FAST\";\n+\n+ Factory_decoder_common::store_args(ar, params);\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ if(ar.exist_arg({\"dec-simd\" })) params.simd_strategy = ar.get_arg({\"dec-simd\"});\n+ if(ar.exist_arg({\"dec-max\" })) params.max = ar.get_arg({\"dec-max\" });\n+\n+// if (params.simd_strategy == \"INTER\" && !ar.exist_arg({\"sim-inter-lvl\"}))\n+// params.inter_frame_level = mipp::nElReg<Q>();\n+// else if (params.simd_strategy == \"INTRA\" && !ar.exist_arg({\"sim-inter-lvl\"}))\n+// params.inter_frame_level = (int)std::ceil(mipp::nElReg<Q>() / 8.f);\n+\n+ // ---------------------------------------------------------------------------------------------------------- code\n+// params.tail_length = (int)(2 * std::floor(std::log2((float)std::max(params.poly[0], params.poly[1]))));\n+// params.N += params.tail_length;\n+// params.N_code = 2 * params.K + params.tail_length;\n+\n+ if (ar.exist_arg({\"cde-poly\"}))\n+ {\n+ auto poly_str = ar.get_arg({\"cde-poly\"});\n+\n+#ifdef _MSC_VER\n+ sscanf_s (poly_str.c_str(), \"{%o,%o}\", ¶ms.poly[0], ¶ms.poly[1]);\n+#else\n+ std::sscanf(poly_str.c_str(), \"{%o,%o}\", ¶ms.poly[0], ¶ms.poly[1]);\n+#endif\n+ }\n+\n+ if (params.type == \"LTE\")\n+ {\n+ params.type = \"BCJR\";\n+ params.poly = {013, 015};\n+ }\n+\n+ if (params.type == \"CCSDS\")\n+ {\n+ params.type = \"BCJR\";\n+ params.poly = {023, 033};\n+ }\n+\n+ if (!(params.poly[0] == 013 && params.poly[1] == 015)) // if not LTE BCJR\n+ {\n+ params.type = \"BCJR\";\n+ params.implem = \"GENERIC\";\n+ params.simd_strategy = \"\";\n+ }\n+}\n+\n+template <typename B, typename Q, typename RD>\n+void Factory_decoder_RSC<B,Q,RD>\n+::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ Factory_decoder_common::group_args(ar);\n+}\n+\n+template <typename B, typename Q, typename RD>\n+void Factory_decoder_RSC<B,Q,RD>\n+::header(Header::params_list& head_dec, Header::params_list& head_cde, const decoder_parameters_RSC& params)\n+{\n+ Factory_decoder_common::header(head_dec, params);\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ if (!params.simd_strategy.empty())\n+ head_dec.push_back(std::make_pair(std::string(\"SIMD strategy\"), params.simd_strategy));\n+\n+ head_dec.push_back(std::make_pair(std::string(\"Max type\"), params.max));\n+\n+ // ---------------------------------------------------------------------------------------------------------- code\n+ std::stringstream poly;\n+ poly << \"{0\" << std::oct << params.poly[0] << \",0\" << std::oct << params.poly[1] << \"}\";\n+ head_cde.push_back(std::make_pair(std::string(\"Polynomials\"), poly.str()));\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.hpp",
"new_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.hpp",
"diff": "#include <string>\n#include <vector>\n#include <iostream>\n+#include <sstream>\n#include \"Tools/Math/max.h\"\n#include \"Module/Decoder/Decoder_SISO.hpp\"\n-#include \"../Factory.hpp\"\n+#include \"../Factory_decoder_common.hpp\"\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename B = int, typename R = float, typename RD = R>\n-struct Factory_decoder_RSC : public Factory\n+struct Factory_decoder_RSC : public Factory_decoder_common\n{\n+ struct decoder_parameters_RSC : decoder_parameters\n+ {\n+ virtual ~decoder_parameters_RSC() {}\n+\n+ // ------- decoder\n+ std::string max = \"MAX\";;\n+ std::string simd_strategy = \"\";\n+\n+ // ------- code\n+ std::vector<int> poly = {013, 015};\n+ };\n+\nstatic module::Decoder_SISO<B,R>* build(const std::string type,\nconst std::string implem,\nconst int K,\n@@ -29,6 +42,12 @@ struct Factory_decoder_RSC : public Factory\nconst int n_ite = 1,\nconst int n_frames = 1);\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, decoder_parameters_RSC ¶ms);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_dec, Header::params_list& head_cde, const decoder_parameters_RSC& params);\n+\nprivate:\ntemplate <proto_max<R> MAX1, proto_max<RD> MAX2>\nstatic module::Decoder_SISO<B,R>* _build_seq(const std::string type,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RSC/Factory_encoder_RSC.cpp",
"new_path": "src/Tools/Factory/RSC/Factory_encoder_RSC.cpp",
"diff": "@@ -24,6 +24,49 @@ Encoder_RSC_sys<B>* Factory_encoder_RSC<B>\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B>\n+void Factory_encoder_RSC<B>\n+::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ Factory_encoder_common<B>::build_args(req_args, opt_args);\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ opt_args[{\"enc-type\"}][2] += \", RSC\";\n+\n+ opt_args[{\"enc-no-buff\"}] =\n+ {\"\",\n+ \"disable the buffered encoding.\"};\n+}\n+\n+template <typename B>\n+void Factory_encoder_RSC<B>\n+::store_args(const Arguments_reader& ar, encoder_parameters_RSC ¶ms)\n+{\n+ params.type = \"RSC\";\n+\n+ Factory_encoder_common<B>::store_args(ar, params);\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ if(ar.exist_arg({\"enc-no-buff\"})) params.buffered = false;\n+}\n+\n+template <typename B>\n+void Factory_encoder_RSC<B>\n+::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ Factory_encoder_common<B>::group_args(ar);\n+}\n+\n+template <typename B>\n+void Factory_encoder_RSC<B>\n+::header(Header::params_list& head_enc, const encoder_parameters_RSC& params)\n+{\n+ Factory_encoder_common<B>::header(head_enc, params);\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ head_enc.push_back(std::make_pair(\"Buffered\", (params.buffered ? \"on\" : \"off\")));\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RSC/Factory_encoder_RSC.hpp",
"new_path": "src/Tools/Factory/RSC/Factory_encoder_RSC.hpp",
"diff": "#include \"Module/Encoder/RSC/Encoder_RSC_sys.hpp\"\n-#include \"../Factory.hpp\"\n+#include \"../Factory_encoder_common.hpp\"\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename B = int>\n-struct Factory_encoder_RSC : public Factory\n+struct Factory_encoder_RSC : public Factory_encoder_common<B>\n{\n+ struct encoder_parameters_RSC : Factory_encoder_common<B>::encoder_parameters\n+ {\n+ virtual ~encoder_parameters_RSC() {}\n+\n+ bool buffered = true;\n+ };\n+\nstatic module::Encoder_RSC_sys<B>* build(const std::string type,\nconst int K,\nconst int N,\n@@ -23,6 +30,12 @@ struct Factory_encoder_RSC : public Factory\nconst std::vector<int> poly = {5,7},\nstd::ostream &stream = std::cout,\nconst int n_frames = 1);\n+\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, encoder_parameters_RSC ¶ms);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_enc, const encoder_parameters_RSC& params);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Repetition/Factory_decoder_repetition.cpp",
"new_path": "src/Tools/Factory/Repetition/Factory_decoder_repetition.cpp",
"diff": "@@ -26,6 +26,41 @@ Decoder<B,R>* Factory_decoder_repetition<B,R>\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B, typename Q>\n+void Factory_decoder_repetition<B,Q>\n+::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ Factory_decoder_common::build_args(req_args, opt_args);\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ opt_args[{\"dec-type\", \"D\"}].push_back(\"REPETITION\");\n+ opt_args[{\"dec-implem\" }].push_back(\"STD, FAST\");\n+}\n+\n+template <typename B, typename Q>\n+void Factory_decoder_repetition<B,Q>\n+::store_args(const Arguments_reader& ar, typename Factory_decoder_common::decoder_parameters ¶ms)\n+{\n+ params.type = \"REPETITION\";\n+ params.implem = \"STD\";\n+\n+ Factory_decoder_common::store_args(ar, params);\n+}\n+\n+template <typename B, typename Q>\n+void Factory_decoder_repetition<B,Q>\n+::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ Factory_decoder_common::group_args(ar);\n+}\n+\n+template <typename B, typename Q>\n+void Factory_decoder_repetition<B,Q>\n+::header(Header::params_list& head_dec, const typename Factory_decoder_common::decoder_parameters& params)\n+{\n+ Factory_decoder_common::header(head_dec, params);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Repetition/Factory_decoder_repetition.hpp",
"new_path": "src/Tools/Factory/Repetition/Factory_decoder_repetition.hpp",
"diff": "#include \"Module/Decoder/Decoder.hpp\"\n#include \"Module/Decoder/SISO.hpp\"\n-#include \"../Factory.hpp\"\n+#include \"../Factory_decoder_common.hpp\"\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename B = int, typename R = float>\n-struct Factory_decoder_repetition : public Factory\n+struct Factory_decoder_repetition : public Factory_decoder_common\n{\nstatic module::Decoder<B,R>* build(const std::string type,\nconst std::string implem,\n@@ -21,6 +21,13 @@ struct Factory_decoder_repetition : public Factory\nconst int N,\nconst bool buffered = true,\nconst int n_frames = 1);\n+\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, typename Factory_decoder_common::decoder_parameters ¶ms);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_dec, const typename Factory_decoder_common::decoder_parameters& params);\n+\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Repetition/Factory_encoder_repetition.cpp",
"new_path": "src/Tools/Factory/Repetition/Factory_encoder_repetition.cpp",
"diff": "@@ -20,6 +20,49 @@ Encoder_sys<B>* Factory_encoder_repetition<B>\nthrow cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B>\n+void Factory_encoder_repetition<B>\n+::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ Factory_encoder_common<B>::build_args(req_args, opt_args);\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ opt_args[{\"enc-type\"}][2] += \", REPETITION\";\n+\n+ opt_args[{\"enc-no-buff\"}] =\n+ {\"\",\n+ \"disable the buffered encoding.\"};\n+}\n+\n+template <typename B>\n+void Factory_encoder_repetition<B>\n+::store_args(const Arguments_reader& ar, encoder_parameters_repetition ¶ms)\n+{\n+ params.type = \"REPETITION\";\n+\n+ Factory_encoder_common<B>::store_args(ar, params);\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ if(ar.exist_arg({\"enc-no-buff\"})) params.buffered = false;\n+}\n+\n+template <typename B>\n+void Factory_encoder_repetition<B>\n+::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ Factory_encoder_common<B>::group_args(ar);\n+}\n+\n+template <typename B>\n+void Factory_encoder_repetition<B>\n+::header(Header::params_list& head_enc, const encoder_parameters_repetition& params)\n+{\n+ Factory_encoder_common<B>::header(head_enc, params);\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ head_enc.push_back(std::make_pair(\"Buffered\", (params.buffered ? \"on\" : \"off\")));\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Repetition/Factory_encoder_repetition.hpp",
"new_path": "src/Tools/Factory/Repetition/Factory_encoder_repetition.hpp",
"diff": "#include \"Module/Encoder/Encoder_sys.hpp\"\n-#include \"../Factory.hpp\"\n+#include \"../Factory_encoder_common.hpp\"\nnamespace aff3ct\n{\nnamespace tools\n{\ntemplate <typename B = int>\n-struct Factory_encoder_repetition : public Factory\n+struct Factory_encoder_repetition : public Factory_encoder_common<B>\n{\n+ struct encoder_parameters_repetition : Factory_encoder_common<B>::encoder_parameters\n+ {\n+ virtual ~encoder_parameters_repetition() {}\n+\n+ bool buffered = true;\n+ };\n+\nstatic module::Encoder_sys<B>* build(const std::string type,\nconst int K,\nconst int N,\nconst bool buffered = true,\nconst int n_frames = 1);\n+\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, encoder_parameters_repetition ¶ms);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_enc, const encoder_parameters_repetition& params);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include \"Launcher/LDPC/Launcher_LDPC.hpp\"\n#include \"Launcher/Polar/Launcher_polar.hpp\"\n#include \"Launcher/RA/Launcher_RA.hpp\"\n+#include \"Launcher/RSC/Launcher_RSC.hpp\"\n+#include \"Launcher/Repetition/Launcher_repetition.hpp\"\n//#include \"Launcher/BFER/Polar/Launcher_BFER_polar.hpp\"\n//#include \"Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp\"\n@@ -213,25 +215,25 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\n// launcher = new Launcher_GEN_polar<B,R,Q>(argc, argv);\n}\n-// if (code_type == \"RSC\")\n-// {\n-// if (simu_type == \"BFER\")\n-// launcher = new Launcher_BFER_RSC<B,R,Q,QD>(argc, argv);\n+ if (code_type == \"RSC\")\n+ {\n+ if (simu_type == \"BFER\")\n+ launcher = new Launcher_RSC<Launcher_BFER_std<B,R,Q>,B,R,Q,QD>(argc, argv);\n// else if (simu_type == \"BFERI\")\n// launcher = new Launcher_BFERI_RSC<B,R,Q,QD>(argc, argv);\n-// }\n+ }\n//\n// if (code_type == \"TURBO\")\n// {\n// if (simu_type == \"BFER\")\n// launcher = new Launcher_BFER_turbo<B,R,Q,QD>(argc, argv);\n// }\n-//\n-// if (code_type == \"REPETITION\")\n-// {\n-// if (simu_type == \"BFER\")\n-// launcher = new Launcher_BFER_repetition<B,R,Q>(argc, argv);\n-// }\n+\n+ if (code_type == \"REPETITION\")\n+ {\n+ if (simu_type == \"BFER\")\n+ launcher = new Launcher_repetition<Launcher_BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n+ }\nif (code_type == \"BCH\")\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add Repetition and RSC launchers
|
8,483 |
30.06.2017 11:29:39
| -7,200 |
f9e24a1135e7f2a860447557b8c872cb46f9266b
|
Refacto the BFER iterative chain launcher and factories
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/Simulation_chain/Launcher_BFER_ite.cpp",
"diff": "+#include \"Launcher_BFER_ite.hpp\"\n+#include <thread>\n+#include <string>\n+#include <iostream>\n+\n+\n+using namespace aff3ct::tools;\n+using namespace aff3ct::launcher;\n+using namespace aff3ct::simulation;\n+\n+template <typename B, typename R, typename Q>\n+Launcher_BFER_ite<B,R,Q>\n+::Launcher_BFER_ite(const int argc, const char **argv, std::ostream &stream)\n+: Launcher<B,R,Q>(argc, argv, stream), codec(nullptr), m_chain_params(new Factory_simulation_BFER_ite::chain_parameters_BFER_ite<B,R,Q>())\n+{\n+ this->chain_params = m_chain_params;\n+ this->simu_params = &m_chain_params->sim;\n+}\n+\n+template <typename B, typename R, typename Q>\n+Launcher_BFER_ite<B,R,Q>\n+::~Launcher_BFER_ite()\n+{\n+ if (codec != nullptr)\n+ delete codec;\n+\n+ if (m_chain_params != nullptr)\n+ delete m_chain_params;\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Launcher_BFER_ite<B,R,Q>\n+::build_args()\n+{\n+ Launcher<B,R,Q>::build_args();\n+\n+ Factory_simulation_BFER_ite::build_args(this->req_args, this->opt_args);\n+\n+ Factory_source<B> ::build_args(this->req_args, this->opt_args);\n+\n+ Factory_CRC<B> ::build_args(this->req_args, this->opt_args);\n+\n+ Factory_interleaver<int> ::build_args(this->req_args, this->opt_args);\n+\n+ Factory_modem<B,R,Q> ::build_args(this->req_args, this->opt_args);\n+\n+ Factory_channel<R> ::build_args(this->req_args, this->opt_args);\n+\n+ Factory_quantizer<R,Q> ::build_args(this->req_args, this->opt_args);\n+\n+ Factory_monitor<B> ::build_args(this->req_args, this->opt_args);\n+\n+ Factory_terminal_BFER ::build_args(this->req_args, this->opt_args);\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Launcher_BFER_ite<B,R,Q>\n+::store_args()\n+{\n+ Launcher<B,R,Q>::store_args();\n+\n+ Factory_simulation_BFER_ite::store_args(this->ar, m_chain_params->sim);\n+\n+ Factory_source<B> ::store_args(this->ar, m_chain_params->src);\n+\n+ Factory_CRC<B> ::store_args(this->ar, m_chain_params->crc, m_chain_params->sim.K, m_chain_params->sim.N);\n+\n+ Factory_interleaver<int> ::store_args(this->ar, m_chain_params->itl, m_chain_params->sim.seed);\n+\n+ Factory_modem<B,R,Q> ::store_args(this->ar, m_chain_params->modem, m_chain_params->sim.N);\n+\n+ Factory_channel<R> ::store_args(this->ar, m_chain_params->chn);\n+\n+ Factory_quantizer<R,Q> ::store_args(this->ar, m_chain_params->qua);\n+\n+ Factory_monitor<B> ::store_args(this->ar, m_chain_params->mon);\n+\n+ Factory_terminal_BFER ::store_args(this->ar, m_chain_params->ter);\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Launcher_BFER_ite<B,R,Q>\n+::group_args()\n+{\n+ Launcher<B,R,Q>::group_args();\n+\n+ Factory_simulation_BFER_ite::group_args(this->arg_group);\n+\n+ Factory_source<B> ::group_args(this->arg_group);\n+\n+ Factory_CRC<B> ::group_args(this->arg_group);\n+\n+ Factory_interleaver<int> ::group_args(this->arg_group);\n+\n+ Factory_modem<B,R,Q> ::group_args(this->arg_group);\n+\n+ Factory_channel<R> ::group_args(this->arg_group);\n+\n+ Factory_quantizer<R,Q> ::group_args(this->arg_group);\n+\n+ Factory_monitor<B> ::group_args(this->arg_group);\n+\n+ Factory_terminal_BFER ::group_args(this->arg_group);\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Launcher_BFER_ite<B,R,Q>\n+::print_header()\n+{\n+ Launcher<B,R,Q>::print_header();\n+\n+ Factory_simulation_BFER_ite::header(pl_sim, pl_cde, m_chain_params->sim);\n+\n+ Factory_source<B> ::header(pl_src, m_chain_params->src);\n+\n+ Factory_CRC<B> ::header(pl_crc, m_chain_params->crc);\n+\n+ Factory_interleaver<int> ::header(pl_itl, m_chain_params->itl);\n+\n+ Factory_modem<B,R,Q> ::header(pl_mod, pl_demod, m_chain_params->modem);\n+\n+ Factory_channel<R> ::header(pl_chn, m_chain_params->chn);\n+\n+ Factory_quantizer<R,Q> ::header(pl_qua, m_chain_params->qua);\n+\n+ Factory_monitor<B> ::header(pl_mon, m_chain_params->mon);\n+\n+ Factory_terminal_BFER ::header(pl_ter, m_chain_params->ter);\n+\n+ int max_n_chars = 0;\n+ Header::compute_max_n_chars(pl_sim, max_n_chars);\n+ Header::compute_max_n_chars(pl_cde, max_n_chars);\n+ Header::compute_max_n_chars(pl_src, max_n_chars);\n+ Header::compute_max_n_chars(pl_crc, max_n_chars);\n+ Header::compute_max_n_chars(pl_enc, max_n_chars);\n+ Header::compute_max_n_chars(pl_pct, max_n_chars);\n+ Header::compute_max_n_chars(pl_itl, max_n_chars);\n+ Header::compute_max_n_chars(pl_mod, max_n_chars);\n+ Header::compute_max_n_chars(pl_chn, max_n_chars);\n+ Header::compute_max_n_chars(pl_demod, max_n_chars);\n+ Header::compute_max_n_chars(pl_qua, max_n_chars);\n+ Header::compute_max_n_chars(pl_dec, max_n_chars);\n+ Header::compute_max_n_chars(pl_mon, max_n_chars);\n+ Header::compute_max_n_chars(pl_ter, max_n_chars);\n+\n+ if (pl_sim .size()) Header::print_parameters(\"Simulation\", pl_sim, max_n_chars, this->stream);\n+ if (pl_cde .size()) Header::print_parameters(\"Code\", pl_cde, max_n_chars, this->stream);\n+ if (pl_src .size()) Header::print_parameters(\"Source\", pl_src, max_n_chars, this->stream);\n+ if (pl_crc .size()) Header::print_parameters(\"CRC\", pl_crc, max_n_chars, this->stream);\n+ if (pl_enc .size()) Header::print_parameters(\"Encoder\", pl_enc, max_n_chars, this->stream);\n+ if (pl_pct .size()) Header::print_parameters(\"Puncturer\", pl_pct, max_n_chars, this->stream);\n+ if (pl_itl .size()) Header::print_parameters(\"Interleaver\", pl_itl, max_n_chars, this->stream);\n+ if (pl_mod .size()) Header::print_parameters(\"Modulator\", pl_mod, max_n_chars, this->stream);\n+ if (pl_chn .size()) Header::print_parameters(\"Channel\", pl_chn, max_n_chars, this->stream);\n+ if (pl_demod.size()) Header::print_parameters(\"Demodulator\", pl_demod, max_n_chars, this->stream);\n+ if (pl_qua .size()) Header::print_parameters(\"Quantizer\", pl_qua, max_n_chars, this->stream);\n+ if (pl_dec .size()) Header::print_parameters(\"Decoder\", pl_dec, max_n_chars, this->stream);\n+ if (pl_mon .size()) Header::print_parameters(\"Monitor\", pl_mon, max_n_chars, this->stream);\n+ if (pl_ter .size()) Header::print_parameters(\"Terminal\", pl_ter, max_n_chars, this->stream);\n+ this->stream << \"#\" << std::endl;\n+}\n+\n+template <typename B, typename R, typename Q>\n+Simulation* Launcher_BFER_ite<B,R,Q>\n+::build_simu()\n+{\n+ this->build_codec();\n+\n+#if defined(SYSTEMC)\n+ return new SC_Simulation_BFER_ite <B,R,Q>(this->params, *codec);\n+#elif defined(STARPU)\n+ return new SPU_Simulation_BFER_ite <B,R,Q>(this->params, *codec);\n+#else\n+ return new Simulation_BFER_ite_threads<B,R,Q>(this->params, *codec);\n+#endif\n+}\n+\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::launcher::Launcher_BFER_ite<B_8,R_8,Q_8>;\n+template class aff3ct::launcher::Launcher_BFER_ite<B_16,R_16,Q_16>;\n+template class aff3ct::launcher::Launcher_BFER_ite<B_32,R_32,Q_32>;\n+template class aff3ct::launcher::Launcher_BFER_ite<B_64,R_64,Q_64>;\n+#else\n+template class aff3ct::launcher::Launcher_BFER_ite<B,R,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/Simulation_chain/Launcher_BFER_ite.hpp",
"diff": "+#ifndef LAUNCHER_BFER_ITE_HPP_\n+#define LAUNCHER_BFER_ITE_HPP_\n+\n+#include \"Tools/Codec/Codec_SISO.hpp\"\n+#include \"Tools/Factory/Simulation/Factory_simulation_BFER_ite.hpp\"\n+\n+#if defined(SYSTEMC)\n+#include \"Simulation/BFER/Iterative/SystemC/SC_Simulation_BFER_ite.hpp\"\n+#elif defined(STARPU)\n+#include \"Simulation/BFER/Iterative/StarPU/SPU_Simulation_BFER_ite.hpp\"\n+#else\n+#include \"Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.hpp\"\n+#endif\n+\n+#include \"../Launcher.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <typename B = int, typename R = float, typename Q = R>\n+class Launcher_BFER_ite : public Launcher<B,R,Q>\n+{\n+protected:\n+ tools::Codec_SISO<B,Q> *codec = nullptr;\n+\n+ tools::Factory_simulation_BFER_ite::chain_parameters_BFER_ite<B,R,Q> * m_chain_params = nullptr;\n+\n+ tools::Header::params_list pl_sim, pl_cde, pl_src, pl_crc, pl_itl, pl_mod, pl_demod,\n+ pl_chn, pl_qua, pl_enc, pl_dec, pl_mon, pl_ter, pl_pct;\n+\n+public:\n+ Launcher_BFER_ite(const int argc, const char **argv, std::ostream &stream = std::cout);\n+ virtual ~Launcher_BFER_ite();\n+\n+protected:\n+ virtual void build_args();\n+ virtual void store_args();\n+ virtual void group_args();\n+\n+ virtual void build_codec() = 0;\n+\n+ virtual simulation::Simulation* build_simu();\n+\n+ virtual void print_header();\n+};\n+}\n+}\n+\n+#endif /* LAUNCHER_BFER_ITE_HPP_ */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.hpp",
"new_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.hpp",
"diff": "@@ -38,7 +38,7 @@ protected:\nvirtual void store_args();\nvirtual void group_args();\n- virtual void build_codec() {};\n+ virtual void build_codec() = 0;\nvirtual simulation::Simulation* build_simu();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_interleaver.cpp",
"new_path": "src/Tools/Factory/Factory_interleaver.cpp",
"diff": "@@ -61,7 +61,7 @@ void Factory_interleaver<B>\ntemplate <typename B>\nvoid Factory_interleaver<B>\n-::store_args(const Arguments_reader& ar, Interleaver_parameters ¶ms, const int seed)\n+::store_args(const Arguments_reader& ar, interleaver_parameters ¶ms, const int seed)\n{\n// --------------------------------------------------------------------------------------------------- interleaver\nparams.seed = seed;\n@@ -91,7 +91,7 @@ void Factory_interleaver<B>\ntemplate <typename B>\nvoid Factory_interleaver<B>\n-::header(Header::params_list& head_itl, const Interleaver_parameters& params)\n+::header(Header::params_list& head_itl, const interleaver_parameters& params)\n{\n// --------------------------------------------------------------------------------------------------- interleaver\nhead_itl.push_back(std::make_pair(\"Type\", params.type));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_interleaver.hpp",
"new_path": "src/Tools/Factory/Factory_interleaver.hpp",
"diff": "@@ -16,7 +16,7 @@ namespace tools\ntemplate <typename T = int>\nstruct Factory_interleaver : public Factory\n{\n- struct Interleaver_parameters\n+ struct interleaver_parameters\n{\nstd::string type = \"RANDOM\";\nstd::string path = \"\";\n@@ -34,10 +34,10 @@ struct Factory_interleaver : public Factory\nconst int n_frames = 1);\nstatic void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n- static void store_args(const Arguments_reader& ar, Interleaver_parameters ¶ms, const int seed);\n+ static void store_args(const Arguments_reader& ar, interleaver_parameters ¶ms, const int seed);\nstatic void group_args(Arguments_reader::arg_grp& ar);\n- static void header(Header::params_list& head_itl, const Interleaver_parameters& params);\n+ static void header(Header::params_list& head_itl, const interleaver_parameters& params);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RA/Factory_decoder_RA.hpp",
"new_path": "src/Tools/Factory/RA/Factory_decoder_RA.hpp",
"diff": "@@ -19,7 +19,7 @@ struct Factory_decoder_RA : public Factory_decoder_common\n{\nvirtual ~decoder_parameters_RA() {}\n// ------- code\n- typename Factory_interleaver<int>::Interleaver_parameters itl;\n+ typename Factory_interleaver<int>::interleaver_parameters itl;\n// ------- decoder\nint n_ite = 10;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.cpp",
"new_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.cpp",
"diff": "@@ -163,7 +163,7 @@ void Factory_decoder_RSC<B,Q,RD>\n::store_args(const Arguments_reader& ar, decoder_parameters_RSC ¶ms)\n{\nparams.type = \"BCJR\";\n- params.implem = \"FAST\";\n+ params.implem = \"GENERIC\";\nFactory_decoder_common::store_args(ar, params);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.hpp",
"new_path": "src/Tools/Factory/RSC/Factory_decoder_RSC.hpp",
"diff": "@@ -24,7 +24,7 @@ struct Factory_decoder_RSC : public Factory_decoder_common\nvirtual ~decoder_parameters_RSC() {}\n// ------- decoder\n- std::string max = \"MAX\";;\n+ std::string max = \"MAXS\";\nstd::string simd_strategy = \"\";\n// ------- code\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_ite.cpp",
"diff": "+#include \"Factory_simulation_BFER_ite.hpp\"\n+\n+using namespace aff3ct;\n+using namespace tools;\n+\n+void Factory_simulation_BFER_ite::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n+{\n+ Factory_simulation_BFER::build_args(req_args, opt_args);\n+\n+ // ---------------------------------------------------------------------------------------------------- simulation\n+ opt_args[{\"sim-ite\", \"I\"}] =\n+ {\"positive_int\",\n+ \"number of global iterations between the demodulator and the decoder.\"};\n+\n+}\n+\n+void Factory_simulation_BFER_ite::store_args(const Arguments_reader& ar, simu_parameters_BFER_ite ¶ms)\n+{\n+ Factory_simulation_BFER::store_args(ar, params);\n+\n+ // ---------------------------------------------------------------------------------------------------- simulation\n+ if(ar.exist_arg({\"sim-ite\", \"I\"})) params.n_ite = ar.get_arg_int({\"sim-ite\", \"I\"});\n+}\n+\n+void Factory_simulation_BFER_ite::group_args(Arguments_reader::arg_grp& ar)\n+{\n+ Factory_simulation_BFER::group_args(ar);\n+}\n+\n+void Factory_simulation_BFER_ite::header(Header::params_list& head_sim, Header::params_list& head_cde,\n+ const simu_parameters_BFER_ite& params)\n+{\n+ Factory_simulation_BFER::header(head_sim, head_cde, params);\n+\n+ // ---------------------------------------------------------------------------------------------------- simulation\n+ head_sim.push_back(std::make_pair(\"Global iterations (I)\", std::to_string(params.n_ite)));\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_ite.hpp",
"diff": "+#ifndef FACTORY_SIMULATION_BFER_ITE_HPP_\n+#define FACTORY_SIMULATION_BFER_ITE_HPP_\n+\n+#include <string>\n+\n+#include \"Factory_simulation_BFER.hpp\"\n+#include \"Tools/Arguments_reader.hpp\"\n+\n+#include \"Tools/Factory/Factory_source.hpp\"\n+#include \"Tools/Factory/Factory_CRC.hpp\"\n+#include \"Tools/Factory/Factory_modem.hpp\"\n+#include \"Tools/Factory/Factory_channel.hpp\"\n+#include \"Tools/Factory/Factory_quantizer.hpp\"\n+#include \"Tools/Factory/Factory_monitor.hpp\"\n+#include \"Tools/Factory/Factory_terminal.hpp\"\n+#include \"Tools/Factory/Factory_interleaver.hpp\"\n+#include \"Tools/Factory/Factory_encoder_common.hpp\"\n+#include \"Tools/Factory/Factory_decoder_common.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+struct Factory_simulation_BFER_ite : Factory_simulation_BFER\n+{\n+ struct simu_parameters_BFER_ite : simu_parameters_BFER\n+ {\n+ // ---- simulation\n+ int n_ite = 15;\n+ };\n+\n+ template <typename B = int, typename R = float, typename Q = R>\n+ struct chain_parameters_BFER_ite : chain_parameters\n+ {\n+ virtual ~chain_parameters_BFER_ite() {}\n+\n+ Factory_simulation_BFER_ite ::simu_parameters_BFER_ite sim;\n+ typename Factory_source <B >::source_parameters src;\n+ typename Factory_CRC <B >::CRC_parameters crc;\n+ typename Factory_modem <B,R,Q>::modem_parameters modem;\n+ typename Factory_channel < R >::channel_parameters chn;\n+ typename Factory_quantizer < R,Q>::quantizer_parameters qua;\n+ typename Factory_interleaver <int >::interleaver_parameters itl;\n+ typename Factory_encoder_common<B >::encoder_parameters *enc = nullptr;\n+ typename Factory_decoder_common ::decoder_parameters *dec = nullptr;\n+ typename Factory_monitor <B >::monitor_parameters mon;\n+ typename Factory_terminal_BFER ::terminal_parameters_BFER ter;\n+ };\n+\n+ static void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n+ static void store_args(const Arguments_reader& ar, simu_parameters_BFER_ite ¶ms);\n+ static void group_args(Arguments_reader::arg_grp& ar);\n+\n+ static void header(Header::params_list& head_sim, Header::params_list& head_cde, const simu_parameters_BFER_ite& params);\n+};\n+\n+}\n+}\n+\n+#endif /* FACTORY_SIMULATION_BFER_ITE_HPP_ */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_std.hpp",
"new_path": "src/Tools/Factory/Simulation/Factory_simulation_BFER_std.hpp",
"diff": "@@ -41,11 +41,11 @@ struct Factory_simulation_BFER_std : Factory_simulation_BFER\ntypename Factory_modem <B,R,Q>::modem_parameters modem;\ntypename Factory_channel < R >::channel_parameters chn;\ntypename Factory_quantizer < R,Q>::quantizer_parameters qua;\n- typename Factory_monitor <B >::monitor_parameters mon;\n- typename Factory_terminal_BFER ::terminal_parameters_BFER ter;\ntypename Factory_puncturer ::puncturer_parameters *pct = nullptr;\ntypename Factory_encoder_common<B >::encoder_parameters *enc = nullptr;\ntypename Factory_decoder_common ::decoder_parameters *dec = nullptr;\n+ typename Factory_monitor <B >::monitor_parameters mon;\n+ typename Factory_terminal_BFER ::terminal_parameters_BFER ter;\n};\nstatic void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Turbo/Factory_decoder_turbo.hpp",
"new_path": "src/Tools/Factory/Turbo/Factory_decoder_turbo.hpp",
"diff": "@@ -38,7 +38,7 @@ struct Factory_decoder_turbo : public Factory_decoder_common\nstd::vector<int> poly = {013, 015};\n// int tail_length = 4 * 3;\n- typename Factory_interleaver<int>::Interleaver_parameters itl;\n+ typename Factory_interleaver<int>::interleaver_parameters itl;\n};\nstatic module::Decoder_turbo<B,R>* build(const std::string type,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include \"Launcher/Launcher.hpp\"\n#include \"Launcher/Simulation_chain/Launcher_BFER_std.hpp\"\n#include \"Launcher/Simulation_chain/Launcher_BFER_ite.hpp\"\n+\n#include \"Launcher/BCH/Launcher_BCH.hpp\"\n#include \"Launcher/LDPC/Launcher_LDPC.hpp\"\n#include \"Launcher/Polar/Launcher_polar.hpp\"\n@@ -204,8 +205,8 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\n{\nif (simu_type == \"BFER\")\nlauncher = new Launcher_polar<Launcher_BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n-// else if (simu_type == \"BFERI\")\n-// launcher = new Launcher_BFERI_polar<B,R,Q>(argc, argv);\n+ else if (simu_type == \"BFERI\")\n+ launcher = new Launcher_polar<Launcher_BFER_ite<B,R,Q>,B,R,Q>(argc, argv);\n// else if (simu_type == \"GEN\")\n// launcher = new Launcher_GEN_polar<B,R,Q>(argc, argv);\n}\n@@ -214,8 +215,8 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\n{\nif (simu_type == \"BFER\")\nlauncher = new Launcher_RSC<Launcher_BFER_std<B,R,Q>,B,R,Q,QD>(argc, argv);\n-// else if (simu_type == \"BFERI\")\n-// launcher = new Launcher_BFERI_RSC<B,R,Q,QD>(argc, argv);\n+ else if (simu_type == \"BFERI\")\n+ launcher = new Launcher_RSC<Launcher_BFER_ite<B,R,Q>,B,R,Q,QD>(argc, argv);\n}\nif (code_type == \"TURBO\")\n@@ -246,16 +247,16 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\n{\nif (simu_type == \"BFER\")\nlauncher = new Launcher_LDPC<Launcher_BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n-// else if (simu_type == \"BFERI\")\n-// launcher = new Launcher_BFERI_LDPC<B,R,Q>(argc, argv);\n+ else if (simu_type == \"BFERI\")\n+ launcher = new Launcher_LDPC<Launcher_BFER_ite<B,R,Q>,B,R,Q>(argc, argv);\n}\nif (code_type == \"UNCODED\")\n{\nif (simu_type == \"BFER\")\nlauncher = new Launcher_NO<Launcher_BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n-// else if (simu_type == \"BFERI\")\n-// launcher = new Launcher_BFERI_uncoded<B,R,Q>(argc, argv);\n+ else if (simu_type == \"BFERI\")\n+ launcher = new Launcher_NO<Launcher_BFER_ite<B,R,Q>,B,R,Q>(argc, argv);\n}\nif (launcher == nullptr)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Refacto the BFER iterative chain launcher and factories
|
8,483 |
04.07.2017 14:20:08
| -7,200 |
6eb264f29b74acd0533db1c16d5d354a87f279a8
|
Correct n_thread parameter bug
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/BFER/Factory_simulation_BFER.cpp",
"new_path": "src/Tools/Factory/Simulation/BFER/Factory_simulation_BFER.cpp",
"diff": "@@ -36,12 +36,12 @@ void Factory_simulation_BFER::build_args(Arguments_reader::arg_map &req_args, Ar\nvoid Factory_simulation_BFER::store_args(const Arguments_reader& ar, simu_parameters_BFER ¶ms)\n{\n- Factory_simulation::store_args(ar, params);\n-\n#if !defined(STARPU) && !defined(SYSTEMC)\nparams.n_threads = std::thread::hardware_concurrency() ? std::thread::hardware_concurrency() : 1;\n#endif\n+ Factory_simulation::store_args(ar, params);\n+\n// ---------------------------------------------------------------------------------------------------- simulation\nif(ar.exist_arg({\"sim-benchs\", \"b\"})) params.benchs = ar.get_arg_int({\"sim-benchs\", \"b\"});\nif(ar.exist_arg({\"sim-snr-type\", \"E\"})) params.snr_type = ar.get_arg ({\"sim-snr-type\", \"E\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/Factory_simulation.cpp",
"new_path": "src/Tools/Factory/Simulation/Factory_simulation.cpp",
"diff": "@@ -87,8 +87,6 @@ void Factory_simulation::store_args(const Arguments_reader& ar, simu_parameters\nif(ar.exist_arg({\"sim-stop-time\" })) params.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\nif(ar.exist_arg({\"sim-seed\" })) params.seed = ar.get_arg_int ({\"sim-seed\" });\n-// params.interleaver.seed = params.simulation.seed;\n-\n#ifndef STARPU\nif(ar.exist_arg({\"sim-threads\", \"t\"}) && ar.get_arg_int({\"sim-threads\", \"t\"}) > 0)\nif(ar.exist_arg({\"sim-threads\", \"t\"})) params.n_threads = ar.get_arg_int({\"sim-threads\", \"t\"});\n@@ -97,7 +95,6 @@ void Factory_simulation::store_args(const Arguments_reader& ar, simu_parameters\n#endif\n#ifdef ENABLE_MPI\n-\nMPI_Comm_size(MPI_COMM_WORLD, ¶ms.mpi_size);\nMPI_Comm_rank(MPI_COMM_WORLD, ¶ms.mpi_rank);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Correct n_thread parameter bug
|
8,490 |
07.07.2017 18:07:05
| -7,200 |
09387bd8d28768a126e13e96dc6155df64ec6702
|
Enable backtrace for clang.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Exception/exception.cpp",
"new_path": "src/Tools/Exception/exception.cpp",
"diff": "-#if defined(__GNUC__) && (defined(__linux__) || defined(__linux))\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n#include <execinfo.h>\n#include <unistd.h>\n+#include <cstdlib>\n#endif\n#include \"exception.hpp\"\n@@ -58,7 +59,7 @@ std::string exception\n::get_back_trace()\n{\nstd::string bt_str;\n-#if defined(__GNUC__) && (defined(__linux__) || defined(__linux))\n+#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\nconst int bt_max_depth = 32;\nvoid *bt_array[bt_max_depth];\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Enable backtrace for clang.
|
8,486 |
12.07.2017 17:46:38
| -7,200 |
993b85ccf1369a4bd205686befa5d20865b0612e
|
Modification of the SCAN store function.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"diff": "@@ -71,7 +71,7 @@ void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\nfor (auto i = 0; i < this->N; i++)\n{\nif (!this->frozen_bits[i]) // if i is not a frozen bit\n- V_N[k++] = (H(this->feedback_graph[this->layers_count -1][i]) == 0) ? (B)0 : (B)1;\n+ V_N[k++] = (H(this->feedback_graph[this->layers_count -1][i] + this->soft_graph[this->layers_count -1][i]) == 0) ? (B)0 : (B)1;\n}\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Modification of the SCAN store function.
|
8,490 |
13.07.2017 10:02:48
| -7,200 |
6f267e192f562c43429de1e1adf80ea368fd4b2a
|
Folder renaming.
|
[
{
"change_type": "RENAME",
"old_path": "src/Launcher/Simulation_chain/Launcher_BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"diff": "-#include \"Launcher_BFER_ite.hpp\"\n#include <thread>\n#include <string>\n#include <iostream>\n+#include \"Launcher_BFER_ite.hpp\"\nusing namespace aff3ct::tools;\nusing namespace aff3ct::launcher;\n"
},
{
"change_type": "RENAME",
"old_path": "src/Launcher/Simulation_chain/Launcher_BFER_ite.hpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_ite.hpp",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "src/Launcher/Simulation_chain/Launcher_BFER_std.hpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_std.hpp",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "src/Launcher/Simulation_chain/Launcher_EXIT.cpp",
"new_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "src/Launcher/Simulation_chain/Launcher_EXIT.hpp",
"new_path": "src/Launcher/Simulation/Launcher_EXIT.hpp",
"diff": ""
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include \"Tools/Display/bash_tools.h\"\n#include \"Launcher/Launcher.hpp\"\n-#include \"Launcher/Simulation_chain/Launcher_BFER_std.hpp\"\n-#include \"Launcher/Simulation_chain/Launcher_BFER_ite.hpp\"\n-#include \"Launcher/Simulation_chain/Launcher_EXIT.hpp\"\n+#include \"Launcher/Simulation/Launcher_BFER_std.hpp\"\n+#include \"Launcher/Simulation/Launcher_BFER_ite.hpp\"\n+#include \"Launcher/Simulation/Launcher_EXIT.hpp\"\n#include \"Launcher/Code/BCH/Launcher_BCH.hpp\"\n#include \"Launcher/Code/LDPC/Launcher_LDPC.hpp\"\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Folder renaming.
|
8,490 |
13.07.2017 12:09:20
| -7,200 |
5f330cc133eaece3855d0f66e9671977c62cbf81
|
Improve the Factory_source arguments management.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"diff": "@@ -33,7 +33,13 @@ void Launcher_BFER_ite<B,R,Q>\nLauncher::build_args();\nFactory_simulation_BFER_ite::build_args(this->req_args, this->opt_args);\n+\n+ m_chain_params->src.K = m_chain_params->sim->K;\n+ m_chain_params->src.seed = m_chain_params->sim->seed;\n+ m_chain_params->src.n_frames = m_chain_params->sim->inter_frame_level;\n+\nFactory_source::build_args(this->req_args, this->opt_args);\n+\nFactory_CRC ::build_args(this->req_args, this->opt_args);\nFactory_interleaver ::build_args(this->req_args, this->opt_args);\nFactory_modem ::build_args(this->req_args, this->opt_args);\n@@ -49,8 +55,12 @@ void Launcher_BFER_ite<B,R,Q>\n{\nLauncher::store_args();\n+ m_chain_params->src.K = m_chain_params->sim->K;\n+ m_chain_params->src.seed = m_chain_params->sim->seed;\n+ m_chain_params->src.n_frames = m_chain_params->sim->inter_frame_level;\n+\nFactory_simulation_BFER_ite::store_args(this->ar, *m_sim);\n- Factory_source ::store_args(this->ar, m_chain_params->src, m_sim->K, m_sim->inter_frame_level);\n+ Factory_source ::store_args(this->ar, m_chain_params->src);\nFactory_CRC ::store_args(this->ar, m_chain_params->crc, m_sim->K, m_sim->N, m_sim->inter_frame_level);\nFactory_interleaver ::store_args(this->ar, m_chain_params->itl, m_sim->N, m_sim->inter_frame_level);\nFactory_modem ::store_args(this->ar, m_chain_params->mdm, m_sim->N, m_sim->inter_frame_level);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"diff": "@@ -49,7 +49,13 @@ void Launcher_BFER_std<B,R,Q>\nLauncher::store_args();\nFactory_simulation_BFER_std::store_args(this->ar, *m_sim);\n- Factory_source ::store_args(this->ar, m_chain_params->src, m_sim->K, m_sim->inter_frame_level);\n+\n+ m_chain_params->src.K = m_chain_params->sim->K;\n+ m_chain_params->src.seed = m_chain_params->sim->seed;\n+ m_chain_params->src.n_frames = m_chain_params->sim->inter_frame_level;\n+\n+ Factory_source::store_args(this->ar, m_chain_params->src);\n+\nFactory_CRC ::store_args(this->ar, m_chain_params->crc, m_sim->K, m_sim->N, m_sim->inter_frame_level);\nFactory_modem ::store_args(this->ar, m_chain_params->mdm, m_sim->N, m_sim->inter_frame_level);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"new_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"diff": "@@ -44,9 +44,14 @@ void Launcher_EXIT<B,R>\n::store_args()\n{\nLauncher::store_args();\n-\nFactory_simulation_EXIT::store_args(this->ar, *m_sim);\n- Factory_source ::store_args(this->ar, m_chain_params->src, m_sim->K, m_sim->inter_frame_level);\n+\n+ m_chain_params->src.K = m_chain_params->sim->K;\n+ m_chain_params->src.seed = m_chain_params->sim->seed;\n+ m_chain_params->src.n_frames = m_chain_params->sim->inter_frame_level;\n+\n+ Factory_source::store_args(this->ar, m_chain_params->src);\n+\nFactory_modem ::store_args(this->ar, m_chain_params->modem, m_sim->N, m_sim->inter_frame_level);\nbool complex = m_chain_params->modem.complex;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -105,7 +105,9 @@ template <typename B, typename R, typename Q>\nSource<B>* Simulation_BFER_ite<B,R,Q>\n::build_source(const int tid, const int seed)\n{\n- return Factory_source::build<B>(chain_params.src, seed);\n+ auto src_cpy = chain_params.src;\n+ src_cpy.seed = seed;\n+ return Factory_source::build<B>(src_cpy);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -99,7 +99,9 @@ template <typename B, typename R, typename Q>\nSource<B>* Simulation_BFER_std<B,R,Q>\n::build_source(const int tid, const int seed)\n{\n- return Factory_source::build<B>(chain_params.src, seed);\n+ auto src_cpy = chain_params.src;\n+ src_cpy.seed = seed;\n+ return Factory_source::build<B>(chain_params.src);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -410,7 +410,8 @@ template <typename B, typename R>\nSource<B>* Simulation_EXIT<B,R>\n::build_source()\n{\n- return Factory_source::build<B>(params.src, params.sim->seed);\n+\n+ return Factory_source::build<B>(params.src);\n}\ntemplate <typename B, typename R>\n"
},
{
"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 short int n_req_arg = 0;\n+ unsigned n_req_arg = 0;\nthis->clear_arguments();\n@@ -60,10 +60,10 @@ bool Arguments_reader\n{\n// try to find word m_argv[i] inside the arguments list\nbool valid_arg = false;\n- if (this->sub_parse_arguments(this->m_required_args, i))\n+ if (auto n_found = this->sub_parse_arguments(this->m_required_args, i))\n{\n+ n_req_arg += n_found;\nvalid_arg = true;\n- n_req_arg++;\n}\nelse\nvalid_arg = this->sub_parse_arguments(this->m_optional_args, i);\n@@ -84,7 +84,7 @@ bool Arguments_reader\nreturn n_req_arg >= required_args.size();\n}\n-bool Arguments_reader\n+unsigned Arguments_reader\n::sub_parse_arguments(arg_map &args, unsigned short pos_arg)\n{\nif (pos_arg >= this->m_argv.size())\n@@ -95,7 +95,7 @@ bool Arguments_reader\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- auto is_found = false;\n+ auto n_found = 0;\nfor (auto it = args.begin(); it != args.end(); ++it)\n{\nif (it->first.size() <= 0)\n@@ -135,22 +135,22 @@ bool Arguments_reader\nif(pos_arg != (this->m_argv.size() -1))\n{\nthis->m_args[it->first] = this->m_argv[pos_arg +1];\n- is_found = true;\n+ n_found++;\n}\n}\nelse\n{\nthis->m_args[it->first] = \"\";\n- is_found = true;\n+ n_found++;\n}\n}\ni++;\n}\n- while( !is_found && i < (int)it->first.size());\n+ while(i < (int)it->first.size());\n}\n- return is_found;\n+ return n_found;\n}\nbool Arguments_reader\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.hpp",
"new_path": "src/Tools/Arguments_reader.hpp",
"diff": "@@ -168,7 +168,7 @@ private:\n*\n* \\return true if the argument \"m_argv[pos_arg]\" is in args.\n*/\n- bool sub_parse_arguments(arg_map &args, unsigned short pos_arg);\n+ unsigned sub_parse_arguments(arg_map &args, unsigned short pos_arg);\n/*!\n* \\brief Checks if the values from the command line respect the criteria given by required_args and optional_args\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_source.cpp",
"new_path": "src/Tools/Factory/Module/Factory_source.cpp",
"diff": "@@ -12,10 +12,10 @@ using namespace aff3ct::tools;\ntemplate <typename B>\nSource<B>* Factory_source\n-::build(const parameters& params, const int seed)\n+::build(const parameters& params)\n{\n- if (params.type == \"RAND\" ) return new Source_random <B>(params.K, seed, params.n_frames);\n- else if (params.type == \"RAND_FAST\") return new Source_random_fast<B>(params.K, seed, params.n_frames);\n+ if (params.type == \"RAND\" ) return new Source_random <B>(params.K, params.seed, params.n_frames);\n+ else if (params.type == \"RAND_FAST\") return new Source_random_fast<B>(params.K, params.seed, params.n_frames);\nelse if (params.type == \"AZCW\" ) return new Source_AZCW <B>(params.K, params.n_frames);\nelse if (params.type == \"USER\" ) return new Source_user <B>(params.K, params.path, params.n_frames);\n@@ -25,6 +25,10 @@ Source<B>* Factory_source\nvoid Factory_source\n::build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args)\n{\n+ req_args[{\"src-info-bits\", \"K\"}] =\n+ {\"positive_int\",\n+ \"number of generated bits (information bits).\"};\n+\nopt_args[{\"src-type\"}] =\n{\"string\",\n\"method used to generate the codewords.\",\n@@ -33,21 +37,27 @@ void Factory_source\nopt_args[{\"src-path\"}] =\n{\"string\",\n\"path to a file containing one or a set of pre-computed source bits, to use with \\\"--src-type USER\\\".\"};\n+\n+ opt_args[{\"src-fra\", \"F\"}] =\n+ {\"positive_int\",\n+ \"set the number of inter frame level to process.\"};\n+\n+ opt_args[{\"src-seed\", \"S\"}] =\n+ {\"positive_int\",\n+ \"seed used to initialize the pseudo random generators.\"};\n}\nvoid Factory_source\n-::store_args(const Arguments_reader& ar, parameters ¶ms, const int K, const int n_frames)\n+::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.K = K;\n- params.n_frames = n_frames;\n-\n- // -------------------------------------------------------------------------------------------------------- source\n+ params.K = ar.get_arg_int({\"src-info-bits\", \"K\"});\nif(ar.exist_arg({\"src-type\"})) params.type = ar.get_arg({\"src-type\"});\n+ if(ar.exist_arg({\"src-path\"})) params.path = ar.get_arg({\"src-path\"});\n+ if(ar.exist_arg({\"src-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"src-fra\", \"F\"});\n+ if(ar.exist_arg({\"src-seed\", \"S\"})) params.seed = ar.get_arg_int({\"src-seed\", \"S\"});\nif (params.type == \"AZCW\")\nparams.azcw = true;\n-\n- if(ar.exist_arg({\"src-path\"})) params.path = ar.get_arg({\"src-path\"});\n}\nvoid Factory_source\n@@ -59,21 +69,23 @@ void Factory_source\nvoid Factory_source\n::header(params_list& head_src, const parameters& params)\n{\n- // -------------------------------------------------------------------------------------------------------- source\nhead_src.push_back(std::make_pair(\"Type\", params.type));\n-\n+ head_src.push_back(std::make_pair(\"Info. bits (K)\", std::to_string(params.K)));\n+ head_src.push_back(std::make_pair(\"Inter frame level\", std::to_string(params.n_frames)));\nif (params.type == \"USER\")\nhead_src.push_back(std::make_pair(\"Path\", params.path));\n+ if (params.type == \"RAND\" || params.type == \"RAND_FAST\")\n+ head_src.push_back(std::make_pair(\"Seed\", std::to_string(params.seed)));\n}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Source<B_8 >* aff3ct::tools::Factory_source::build<B_8 >(const aff3ct::tools::Factory_source::parameters&, const int);\n-template aff3ct::module::Source<B_16>* aff3ct::tools::Factory_source::build<B_16>(const aff3ct::tools::Factory_source::parameters&, const int);\n-template aff3ct::module::Source<B_32>* aff3ct::tools::Factory_source::build<B_32>(const aff3ct::tools::Factory_source::parameters&, const int);\n-template aff3ct::module::Source<B_64>* aff3ct::tools::Factory_source::build<B_64>(const aff3ct::tools::Factory_source::parameters&, const int);\n+template aff3ct::module::Source<B_8 >* aff3ct::tools::Factory_source::build<B_8 >(const aff3ct::tools::Factory_source::parameters&);\n+template aff3ct::module::Source<B_16>* aff3ct::tools::Factory_source::build<B_16>(const aff3ct::tools::Factory_source::parameters&);\n+template aff3ct::module::Source<B_32>* aff3ct::tools::Factory_source::build<B_32>(const aff3ct::tools::Factory_source::parameters&);\n+template aff3ct::module::Source<B_64>* aff3ct::tools::Factory_source::build<B_64>(const aff3ct::tools::Factory_source::parameters&);\n#else\n-template aff3ct::module::Source<B>* aff3ct::tools::Factory_source::build<B>(const aff3ct::tools::Factory_source::parameters&, const int);\n+template aff3ct::module::Source<B>* aff3ct::tools::Factory_source::build<B>(const aff3ct::tools::Factory_source::parameters&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_source.hpp",
"new_path": "src/Tools/Factory/Module/Factory_source.hpp",
"diff": "@@ -16,18 +16,20 @@ struct Factory_source : public Factory\n{\nstruct parameters\n{\n+ int K;\n+\nstd::string type = \"RAND\";\nstd::string path = \"\";\nbool azcw = false;\n- int K;\n- int n_frames;\n+ int n_frames = 1;\n+ int seed = 0;\n};\ntemplate <typename B = int>\n- static module::Source<B>* build(const parameters& params, const int seed = 0);\n+ static module::Source<B>* build(const parameters& params);\nstatic void build_args(Arguments_reader::arg_map &req_args, Arguments_reader::arg_map &opt_args);\n- static void store_args(const Arguments_reader& ar, parameters ¶ms, const int K, const int n_frames = 1);\n+ static void store_args(const Arguments_reader& ar, parameters ¶ms);\nstatic void group_args(Arguments_reader::arg_grp& ar);\nstatic void header(params_list& head_src, const parameters& params);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/Factory_simulation.cpp",
"new_path": "src/Tools/Factory/Simulation/Factory_simulation.cpp",
"diff": "@@ -42,7 +42,7 @@ void Factory_simulation::build_args(Arguments_reader::arg_map &req_args, Argumen\n{\"positive_int\",\n\"set the number of inter frame level to process in each modules.\"};\n- opt_args[{\"sim-seed\"}] =\n+ opt_args[{\"sim-seed\", \"S\"}] =\n{\"positive_int\",\n\"seed used in the simulation to initialize the pseudo random generators in general.\"};\n@@ -85,7 +85,7 @@ void Factory_simulation::store_args(const Arguments_reader& ar, parameters ¶\nif(ar.exist_arg({\"sim-snr-step\", \"s\"})) params.snr_step = ar.get_arg_float({\"sim-snr-step\", \"s\"});\nif(ar.exist_arg({\"sim-inter-lvl\" })) params.inter_frame_level = ar.get_arg_int ({\"sim-inter-lvl\" });\nif(ar.exist_arg({\"sim-stop-time\" })) params.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\n- if(ar.exist_arg({\"sim-seed\" })) params.seed = ar.get_arg_int ({\"sim-seed\" });\n+ if(ar.exist_arg({\"sim-seed\", \"S\" })) params.seed = ar.get_arg_int ({\"sim-seed\", \"S\" });\n#ifndef STARPU\nif(ar.exist_arg({\"sim-threads\", \"t\"}) && ar.get_arg_int({\"sim-threads\", \"t\"}) > 0)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the Factory_source arguments management.
|
8,490 |
17.07.2017 14:43:01
| -7,200 |
781209a8441354ee9a3eb8cb3678965405c4bf00
|
Clean and cosmetics.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "@@ -227,7 +227,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nthis->durations[tid][std::make_pair(9, \"Deinterlever\")] += steady_clock::now() - t_deint;\n// apply the coset: the decoder will believe to a AZCW\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nauto t_corea = steady_clock::now();\nthis->coset_real[tid]->apply(this->X_N1[tid], this->Y_N5[tid], this->Y_N5[tid]);\n@@ -243,7 +243,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nthis->durations[tid][std::make_pair(11, \"Decoder\")] += steady_clock::now() - t_decod;\n// apply the coset to recover the extrinsic information\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nauto t_corea = steady_clock::now();\nthis->coset_real[tid]->apply(this->X_N1[tid], this->Y_N6[tid], this->Y_N6[tid]);\n@@ -266,7 +266,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\n}\n// apply the coset to recover the real bits\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nauto t_cobit = steady_clock::now();\nthis->coset_bit[tid]->apply(this->U_K2[tid], this->V_K1[tid], this->V_K1[tid]);\n@@ -484,7 +484,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nstd::cout << std::endl;\n// apply the coset: the decoder will believe to a AZCW\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nstd::cout << \"Apply the coset approach on Y_N5...\" << std::endl;\nauto t_corea = steady_clock::now();\n@@ -512,7 +512,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nstd::cout << std::endl;\n// apply the coset to recover the extrinsic information\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nstd::cout << \"Reverse the coset approach on Y_N6...\" << std::endl;\nauto t_corea = steady_clock::now();\n@@ -553,7 +553,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\n}\n// apply the coset to recover the real bits\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nstd::cout << \"Apply the coset approach on V_K1...\" << std::endl;\nauto t_cobit = steady_clock::now();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "@@ -243,7 +243,7 @@ void Simulation_BFER_std_threads<B,R,Q>\nthis->durations[tid][std::make_pair(9, \"Depuncturer\")] += steady_clock::now() - t_depun;\n// apply the coset: the decoder will believe to a AZCW\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nauto t_corea = steady_clock::now();\nthis->coset_real[tid]->apply(this->X_N1[tid], this->Y_N5[tid], this->Y_N5[tid]);\n@@ -259,7 +259,7 @@ void Simulation_BFER_std_threads<B,R,Q>\nthis->durations[tid][std::make_pair(14, \"- store\" )] += this->decoder[tid]->get_store_duration();\n// apply the coset to recover the real bits\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\n{\nauto t_cobit = steady_clock::now();\nthis->coset_bit[tid]->apply(this->U_K2[tid], this->V_K1[tid], this->V_K1[tid]);\n@@ -437,7 +437,7 @@ void Simulation_BFER_std_threads<B,R,Q>\nstd::cout << \"Decode Y_N5 and generate V_K1...\" << std::endl\n<< \"V_K1:\" << std::endl;\n- if (this->chain_params.enc->coset)\n+ if (this->chain_params.enc->type == \"COSET\")\nft.display_bit_vector(this->V_K1[tid]);\nelse\nft.display_bit_vector(this->V_K1[tid], this->U_K2[tid]);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Code/Factory_decoder.cpp",
"new_path": "src/Tools/Factory/Module/Code/Factory_decoder.cpp",
"diff": "@@ -28,13 +28,14 @@ void Factory_decoder::build_args(Arguments_reader::arg_map &req_args, Arguments_\nvoid Factory_decoder::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.K = ar.get_arg_int({\"dec-info-bits\", \"K\"});\n- params.N_cw = ar.get_arg_int({\"dec-cw-size\", \"N\"});\n- params.R = (float)params.K / (float)params.N_cw;\n+ if(ar.exist_arg({\"dec-info-bits\", \"K\"})) params.K = ar.get_arg_int({\"dec-info-bits\", \"K\"});\n+ if(ar.exist_arg({\"dec-cw-size\", \"N\"})) params.N_cw = ar.get_arg_int({\"dec-cw-size\", \"N\"});\nif(ar.exist_arg({\"dec-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"dec-fra\", \"F\"});\nif(ar.exist_arg({\"dec-type\", \"D\"})) params.type = ar.get_arg ({\"dec-type\", \"D\"});\nif(ar.exist_arg({\"dec-implem\" })) params.implem = ar.get_arg ({\"dec-implem\" });\nif(ar.exist_arg({\"enc-no-sys\" })) params.systematic = false;\n+\n+ params.R = (float)params.K / (float)params.N_cw;\n}\nvoid Factory_decoder::group_args(Arguments_reader::arg_grp& ar)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Code/Factory_encoder.cpp",
"new_path": "src/Tools/Factory/Module/Code/Factory_encoder.cpp",
"diff": "@@ -58,18 +58,15 @@ void Factory_encoder\nvoid Factory_encoder\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.K = ar.get_arg_int({\"enc-info-bits\", \"K\"});\n- params.N_cw = ar.get_arg_int({\"enc-cw-size\", \"N\"});\n- params.R = (float)params.K / (float)params.N_cw;\n+ if(ar.exist_arg({\"enc-info-bits\", \"K\"})) params.K = ar.get_arg_int({\"enc-info-bits\", \"K\"});\n+ if(ar.exist_arg({\"enc-cw-size\", \"N\"})) params.N_cw = ar.get_arg_int({\"enc-cw-size\", \"N\"});\nif(ar.exist_arg({\"enc-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"enc-fra\", \"F\"});\n+ if(ar.exist_arg({\"enc-seed\", \"S\"})) params.seed = ar.get_arg_int({\"enc-seed\", \"S\"});\nif(ar.exist_arg({\"enc-type\" })) params.type = ar.get_arg ({\"enc-type\" });\nif(ar.exist_arg({\"enc-path\" })) params.path = ar.get_arg ({\"enc-path\" });\nif(ar.exist_arg({\"enc-no-sys\" })) params.systematic = false;\n- if(ar.exist_arg({\"enc-coset\", \"c\"})) params.coset = true;\n- if(ar.exist_arg({\"enc-seed\", \"S\"})) params.seed = ar.get_arg_int({\"enc-seed\", \"S\"});\n- if (params.type == \"COSET\")\n- params.coset = true;\n+ params.R = (float)params.K / (float)params.N_cw;\n}\nvoid Factory_encoder\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Code/Factory_encoder.hpp",
"new_path": "src/Tools/Factory/Module/Code/Factory_encoder.hpp",
"diff": "@@ -26,7 +26,6 @@ struct Factory_encoder : public Factory\nstd::string path = \"\";\nfloat R = -1.f;\nbool systematic = true;\n- bool coset = false;\nint n_frames = 1;\nint seed = 0;\nint tail_length = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Code/Factory_puncturer.cpp",
"new_path": "src/Tools/Factory/Module/Code/Factory_puncturer.cpp",
"diff": "@@ -39,12 +39,13 @@ void Factory_puncturer\nvoid Factory_puncturer\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.K = ar.get_arg_int({\"pct-info-bits\", \"K\"});\n- params.N = ar.get_arg_int({\"pct-fra-size\", \"N\"});\n- params.N_cw = params.N;\n- params.R = (float)params.K / (float)params.N;\n+ if(ar.exist_arg({\"pct-info-bits\", \"K\"})) params.K = ar.get_arg_int({\"pct-info-bits\", \"K\"});\n+ if(ar.exist_arg({\"pct-fra-size\", \"N\"})) params.N = ar.get_arg_int({\"pct-fra-size\", \"N\"});\nif(ar.exist_arg({\"pct-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"pct-fra\", \"F\"});\nif(ar.exist_arg({\"pct-type\" })) params.type = ar.get_arg ({\"pct-type\" });\n+\n+ params.N_cw = params.N;\n+ params.R = (float)params.K / (float)params.N;\n}\nvoid Factory_puncturer\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Code/Polar/Factory_frozenbits_generator.cpp",
"new_path": "src/Tools/Factory/Module/Code/Polar/Factory_frozenbits_generator.cpp",
"diff": "@@ -29,12 +29,6 @@ void Factory_frozenbits_generator\n{\"positive_int\",\n\"the codeword size.\"};\n-#ifdef ENABLE_POLAR_BOUNDS\n- opt_args[{\"enc-fb-pb-path\"}] =\n- {\"string\",\n- \"path of the polar bounds code generator (generates best channels to use).\"};\n-#endif\n-\nopt_args[{\"enc-fb-sigma\"}] =\n{\"positive_float\",\n\"sigma value for the polar codes generation (adaptative frozen bits if sigma is not set).\"};\n@@ -47,21 +41,26 @@ void Factory_frozenbits_generator\nopt_args[{\"enc-fb-awgn-path\"}] =\n{\"string\",\n\"path to a file or a directory containing the best channels to use for information bits.\"};\n+\n+#ifdef ENABLE_POLAR_BOUNDS\n+ opt_args[{\"enc-fb-pb-path\"}] =\n+ {\"string\",\n+ \"path of the polar bounds code generator (generates best channels to use).\"};\n+#endif\n}\nvoid Factory_frozenbits_generator\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.K = ar.get_arg_int({\"enc-info-bits\", \"K\"});\n- params.N_cw = ar.get_arg_int({\"enc-cw-size\", \"N\"});\n+ if(ar.exist_arg({\"enc-info-bits\", \"K\"})) params.K = ar.get_arg_int ({\"enc-info-bits\", \"K\"});\n+ if(ar.exist_arg({\"enc-cw-size\", \"N\"})) params.N_cw = ar.get_arg_int ({\"enc-cw-size\", \"N\"});\n+ if(ar.exist_arg({\"enc-fb-sigma\" })) params.sigma = ar.get_arg_float({\"enc-fb-sigma\" });\n+ if(ar.exist_arg({\"enc-fb-awgn-path\" })) params.path_fb = ar.get_arg ({\"enc-fb-awgn-path\" });\n+ if(ar.exist_arg({\"enc-fb-gen-method\" })) params.type = ar.get_arg ({\"enc-fb-gen-method\" });\n#ifdef ENABLE_POLAR_BOUNDS\nif(ar.exist_arg({\"enc-fb-pb-path\"})) params.path_pb = ar.get_arg({\"enc-fb-pb-path\"});\n#endif\n-\n- if(ar.exist_arg({\"enc-fb-sigma\"})) params.sigma = ar.get_arg_float({\"enc-fb-sigma\"});\n- if(ar.exist_arg({\"enc-fb-awgn-path\"})) params.path_fb = ar.get_arg({\"enc-fb-awgn-path\"});\n- if(ar.exist_arg({\"enc-fb-gen-method\"})) params.type = ar.get_arg({\"enc-fb-gen-method\"});\n}\nvoid Factory_frozenbits_generator\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_CRC.cpp",
"new_path": "src/Tools/Factory/Module/Factory_CRC.cpp",
"diff": "@@ -54,7 +54,7 @@ void Factory_CRC\nvoid Factory_CRC\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.K = ar.get_arg_int({\"src-info-bits\", \"K\"});\n+ if(ar.exist_arg({\"src-info-bits\", \"K\"})) params.K = ar.get_arg_int({\"src-info-bits\", \"K\"});\nif(ar.exist_arg({\"src-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"src-fra\", \"F\"});\nif(ar.exist_arg({\"crc-type\" })) params.type = ar.get_arg ({\"crc-type\" });\nif(ar.exist_arg({\"crc-poly\" })) params.poly = ar.get_arg ({\"crc-poly\" });\n@@ -66,13 +66,6 @@ void Factory_CRC\nif (params.poly.empty())\nparams.type = \"NO\";\n-\n-// // update the code rate R and K_info\n-// auto real_K = K;\n-// if (!params.poly.empty() && !params.inc_code_rate)\n-// real_K -= params.size;\n-// params.R = real_K / (float)N;\n-// params.K = real_K;\n}\nvoid Factory_CRC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_channel.cpp",
"new_path": "src/Tools/Factory/Module/Factory_channel.cpp",
"diff": "@@ -94,7 +94,7 @@ void Factory_channel\nvoid Factory_channel\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.N = ar.get_arg_int({\"chn-fra-size\", \"N\"});\n+ if(ar.exist_arg({\"chn-fra-size\", \"N\"})) params.N = ar.get_arg_int ({\"chn-fra-size\", \"N\"});\nif(ar.exist_arg({\"chn-fra\", \"F\"})) params.n_frames = ar.get_arg_int ({\"chn-fra\", \"F\"});\nif(ar.exist_arg({\"chn-type\" })) params.type = ar.get_arg ({\"chn-type\" });\nif(ar.exist_arg({\"chn-path\" })) params.path = ar.get_arg ({\"chn-path\" });\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_interleaver.cpp",
"new_path": "src/Tools/Factory/Module/Factory_interleaver.cpp",
"diff": "@@ -66,23 +66,13 @@ void Factory_interleaver\nvoid Factory_interleaver\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.size = ar.get_arg_int({\"itl-size\", \"N\"});\n+ if(ar.exist_arg({\"itl-size\", \"N\"})) params.size = ar.get_arg_int({\"itl-size\", \"N\"});\nif(ar.exist_arg({\"itl-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"itl-fra\", \"F\"});\nif(ar.exist_arg({\"itl-type\" })) params.type = ar.get_arg ({\"itl-type\" });\nif(ar.exist_arg({\"itl-path\" })) params.path = ar.get_arg ({\"itl-path\" });\nif(ar.exist_arg({\"itl-cols\" })) params.n_cols = ar.get_arg_int({\"itl-cols\" });\nif(ar.exist_arg({\"itl-seed\", \"S\"})) params.seed = ar.get_arg_int({\"itl-seed\", \"S\"});\nif(ar.exist_arg({\"itl-uni\" })) params.uniform = true;\n-\n-// if(params.monitor.err_track_revert)\n-// {\n-// params.monitor.err_track_enable = false;\n-// if (params.interleaver.uniform)\n-// {\n-// params.interleaver.type = \"USER\";\n-// params.interleaver.path = params.monitor.err_track_path + std::string(\"_$snr.itl\");\n-// }\n-// }\n}\nvoid Factory_interleaver\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_modem.cpp",
"new_path": "src/Tools/Factory/Module/Factory_modem.cpp",
"diff": "@@ -184,15 +184,22 @@ void Factory_modem\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n// ----------------------------------------------------------------------------------------------------- modulator\n- params.N = ar.get_arg_int({\"mod-fra-size\", \"N\"});\n+ if(ar.exist_arg({\"mod-fra-size\", \"N\"})) params.N = ar.get_arg_int({\"mod-fra-size\", \"N\"});\nif(ar.exist_arg({\"mod-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"mod-fra\", \"F\"});\nif(ar.exist_arg({\"mod-type\" })) params.type = ar.get_arg ({\"mod-type\" });\n+ if(ar.exist_arg({\"mod-cpm-std\" })) params.cpm_std = ar.get_arg ({\"mod-cpm-std\" });\n+ if(ar.exist_arg({\"mod-bps\" })) params.bps = ar.get_arg_int({\"mod-bps\" });\n+ if(ar.exist_arg({\"mod-ups\" })) params.upf = ar.get_arg_int({\"mod-ups\" });\n+ if(ar.exist_arg({\"mod-const-path\" })) params.const_path = ar.get_arg ({\"mod-const-path\" });\n+ if(ar.exist_arg({\"mod-cpm-L\" })) params.cpm_L = ar.get_arg_int({\"mod-cpm-L\" });\n+ if(ar.exist_arg({\"mod-cpm-p\" })) params.cpm_p = ar.get_arg_int({\"mod-cpm-p\" });\n+ if(ar.exist_arg({\"mod-cpm-k\" })) params.cpm_k = ar.get_arg_int({\"mod-cpm-k\" });\n+ if(ar.exist_arg({\"mod-cpm-map\" })) params.mapping = ar.get_arg ({\"mod-cpm-map\" });\n+ if(ar.exist_arg({\"mod-cpm-ws\" })) params.wave_shape = ar.get_arg ({\"mod-cpm-ws\" });\nif (params.type.find(\"BPSK\") != std::string::npos || params.type == \"PAM\")\nparams.complex = false;\n-\n- if(ar.exist_arg({\"mod-cpm-std\"})) params.cpm_std = ar.get_arg({\"mod-cpm-std\"});\nif (params.type == \"CPM\")\n{\nif (!params.cpm_std.empty())\n@@ -216,16 +223,6 @@ void Factory_modem\n}\n}\n- if(ar.exist_arg({\"mod-bps\"})) params.bps = ar.get_arg_int({\"mod-bps\"});\n- if(ar.exist_arg({\"mod-ups\"})) params.upf = ar.get_arg_int({\"mod-ups\"});\n- if(ar.exist_arg({\"mod-const-path\"})) params.const_path = ar.get_arg({\"mod-const-path\"});\n-\n- if(ar.exist_arg({\"mod-cpm-L\"})) params.cpm_L = ar.get_arg_int({\"mod-cpm-L\"});\n- if(ar.exist_arg({\"mod-cpm-p\"})) params.cpm_p = ar.get_arg_int({\"mod-cpm-p\"});\n- if(ar.exist_arg({\"mod-cpm-k\"})) params.cpm_k = ar.get_arg_int({\"mod-cpm-k\"});\n- if(ar.exist_arg({\"mod-cpm-map\"})) params.mapping = ar.get_arg({\"mod-cpm-map\"});\n- if(ar.exist_arg({\"mod-cpm-ws\"})) params.wave_shape = ar.get_arg({\"mod-cpm-ws\"});\n-\n// force the number of bits per symbol to 1 when BPSK mod\nif (params.type == \"BPSK\" || params.type == \"BPSK_FAST\")\nparams.bps = 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_monitor.cpp",
"new_path": "src/Tools/Factory/Module/Factory_monitor.cpp",
"diff": "@@ -47,28 +47,15 @@ void Factory_monitor\nvoid Factory_monitor\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.size = ar.get_arg_int({\"mnt-size\", \"K\"});\n+ if(ar.exist_arg({\"mnt-size\", \"K\"})) params.size = ar.get_arg_int({\"mnt-size\", \"K\"});\nif(ar.exist_arg({\"mnt-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"mnt-fra\", \"F\"});\nif(ar.exist_arg({\"mnt-max-fe\", \"e\"})) params.n_frame_errors = ar.get_arg_int({\"mnt-max-fe\", \"e\"});\n-\n+ if(ar.exist_arg({\"mnt-err-trk-path\"})) params.err_track_path = ar.get_arg ({\"mnt-err-trk-path\"});\nif(ar.exist_arg({\"mnt-err-trk-rev\" })) params.err_track_revert = true;\nif(ar.exist_arg({\"mnt-err-trk\" })) params.err_track_enable = true;\n- if(ar.exist_arg({\"mnt-err-trk-path\"})) params.err_track_path = ar.get_arg({\"mnt-err-trk-path\"});\nif(params.err_track_revert)\n- {\nparams.err_track_enable = false;\n-// params.source. type = \"USER\";\n-// params.encoder.type = \"USER\";\n-// params.channel.type = \"USER\";\n-// params.source. path = params.err_track_path + std::string(\"_$snr.src\");\n-// params.encoder.path = params.err_track_path + std::string(\"_$snr.enc\");\n-// params.channel.path = params.err_track_path + std::string(\"_$snr.chn\");\n- // the paths are set in the Simulation class\n- }\n-\n-// if (params.err_track_revert && !(ar.exist_arg({\"sim-threads\", \"t\"}) && ar.get_arg_int({\"sim-threads\", \"t\"}) > 0))\n-// params.simulation.n_threads = 1;\n}\nvoid Factory_monitor\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_quantizer.cpp",
"new_path": "src/Tools/Factory/Module/Factory_quantizer.cpp",
"diff": "@@ -60,7 +60,7 @@ void Factory_quantizer\nvoid Factory_quantizer\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.size = ar.get_arg_int({\"qnt-size\", \"N\"});\n+ if(ar.exist_arg({\"qnt-size\", \"N\"})) params.size = ar.get_arg_int ({\"qnt-size\", \"N\"});\nif(ar.exist_arg({\"qnt-fra\", \"F\"})) params.n_frames = ar.get_arg_int ({\"qnt-fra\", \"F\"});\nif(ar.exist_arg({\"qnt-type\" })) params.type = ar.get_arg ({\"qnt-type\" });\nif(ar.exist_arg({\"qnt-dec\" })) params.n_decimals = ar.get_arg_int ({\"qnt-dec\" });\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_quantizer.hpp",
"new_path": "src/Tools/Factory/Module/Factory_quantizer.hpp",
"diff": "@@ -21,10 +21,10 @@ struct Factory_quantizer : public Factory\nstd::string type = \"STD\";\nfloat range = 0.f;\n+ float sigma = -1.f;\nint n_bits = 8;\nint n_decimals = 3;\nint n_frames = 1;\n- float sigma = -1.f;\n};\ntemplate <typename R = float, typename Q = R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_source.cpp",
"new_path": "src/Tools/Factory/Module/Factory_source.cpp",
"diff": "@@ -50,14 +50,11 @@ void Factory_source\nvoid Factory_source\n::store_args(const Arguments_reader& ar, parameters ¶ms)\n{\n- params.K = ar.get_arg_int({\"src-info-bits\", \"K\"});\n+ if(ar.exist_arg({\"src-info-bits\", \"K\"})) params.K = ar.get_arg_int({\"src-info-bits\", \"K\"});\nif(ar.exist_arg({\"src-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"src-fra\", \"F\"});\nif(ar.exist_arg({\"src-type\" })) params.type = ar.get_arg ({\"src-type\" });\nif(ar.exist_arg({\"src-path\" })) params.path = ar.get_arg ({\"src-path\" });\nif(ar.exist_arg({\"src-seed\", \"S\"})) params.seed = ar.get_arg_int({\"src-seed\", \"S\"});\n-\n- if (params.type == \"AZCW\")\n- params.azcw = true;\n}\nvoid Factory_source\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Module/Factory_source.hpp",
"new_path": "src/Tools/Factory/Module/Factory_source.hpp",
"diff": "@@ -20,7 +20,6 @@ struct Factory_source : public Factory\nstd::string type = \"RAND\";\nstd::string path = \"\";\n- bool azcw = false;\nint n_frames = 1;\nint seed = 0;\n};\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Clean and cosmetics.
|
8,490 |
18.07.2017 15:40:35
| -7,200 |
bdfd897578468e64c40787b750e95902deaf34eb
|
Rename Launcher_NO in Launcher_uncoded.
|
[
{
"change_type": "RENAME",
"old_path": "src/Launcher/Code/Uncoded/Launcher_NO.hpp",
"new_path": "src/Launcher/Code/Uncoded/Launcher_uncoded.hpp",
"diff": "@@ -30,6 +30,6 @@ protected:\n}\n}\n-#include \"Launcher_NO.hxx\"\n+#include \"Launcher_uncoded.hxx\"\n#endif /* LAUNCHER_NO_HPP_ */\n"
},
{
"change_type": "RENAME",
"old_path": "src/Launcher/Code/Uncoded/Launcher_NO.hxx",
"new_path": "src/Launcher/Code/Uncoded/Launcher_uncoded.hxx",
"diff": "#include <iostream>\n#include \"Tools/Codec/Uncoded/Codec_uncoded.hpp\"\n-#include \"Launcher_NO.hpp\"\n+\n+#include \"Launcher_uncoded.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -203,5 +203,8 @@ void Launcher::launch()\nstream << \"# End of the simulation.\" << std::endl;\nif (simu != nullptr)\n+ {\ndelete simu;\n+ simu = nullptr;\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include \"Launcher/Code/RSC/Launcher_RSC.hpp\"\n#include \"Launcher/Code/Turbo/Launcher_turbo.hpp\"\n#include \"Launcher/Code/Repetition/Launcher_repetition.hpp\"\n-#include \"Launcher/Code/Uncoded/Launcher_NO.hpp\"\n+#include \"Launcher/Code/Uncoded/Launcher_uncoded.hpp\"\n#include \"Tools/Factory/Simulation/Factory_simulation_main.hpp\"\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rename Launcher_NO in Launcher_uncoded.
|
8,490 |
19.07.2017 15:11:58
| -7,200 |
1086166ea02601863e59d642be9aa5b31c507619
|
Fix launcher BFERI and coset approach.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"diff": "@@ -36,9 +36,34 @@ void Launcher_BFER_ite<B,R,Q>\nFactory_interleaver ::build_args(this->req_args, this->opt_args);\nFactory_modem ::build_args(this->req_args, this->opt_args);\nFactory_channel ::build_args(this->req_args, this->opt_args);\n+ if (std::is_integral<Q>())\nFactory_quantizer ::build_args(this->req_args, this->opt_args);\nFactory_monitor ::build_args(this->req_args, this->opt_args);\nFactory_terminal_BFER ::build_args(this->req_args, this->opt_args);\n+\n+ if (this->req_args.find({\"enc-info-bits\", \"K\"}) != this->req_args.end() ||\n+ this->req_args.find({\"pct-info-bits\", \"K\"}) != this->req_args.end())\n+ this->req_args.erase({\"src-info-bits\", \"K\"});\n+ this->opt_args.erase({\"src-seed\", \"S\"});\n+ this->req_args.erase({\"crc-info-bits\", \"K\"});\n+ this->opt_args.erase({\"crc-fra\", \"F\"});\n+ this->req_args.erase({\"itl-size\" });\n+ this->opt_args.erase({\"itl-fra\", \"F\"});\n+ this->opt_args.erase({\"itl-seed\", \"S\"});\n+ this->req_args.erase({\"mod-fra-size\", \"N\"});\n+ this->opt_args.erase({\"mod-fra\", \"F\"});\n+ this->opt_args.erase({\"dmod-sigma\" });\n+ this->req_args.erase({\"chn-fra-size\", \"N\"});\n+ this->opt_args.erase({\"chn-fra\", \"F\"});\n+ this->opt_args.erase({\"chn-sigma\" });\n+ this->opt_args.erase({\"chn-seed\", \"S\"});\n+ this->opt_args.erase({\"chn-add-users\" });\n+ this->opt_args.erase({\"chn-complex\" });\n+ this->req_args.erase({\"qnt-size\", \"N\"});\n+ this->opt_args.erase({\"qnt-fra\", \"F\"});\n+ this->opt_args.erase({\"qnt-sigma\" });\n+ this->req_args.erase({\"mnt-size\", \"K\"});\n+ this->opt_args.erase({\"mnt-fra\", \"F\"});\n}\ntemplate <typename B, typename R, typename Q>\n@@ -48,20 +73,63 @@ void Launcher_BFER_ite<B,R,Q>\nLauncher::store_args();\nFactory_simulation_BFER_ite::store_args(this->ar, *params);\n+\nFactory_source::store_args(this->ar, *params->src);\n+\n+ auto K = this->req_args.find({\"src-info-bits\", \"K\"}) != this->req_args.end() ? params->src->K : params->enc->K;\n+ auto N = this->req_args.find({\"src-info-bits\", \"K\"}) != this->req_args.end() ? params->src->K : params->pct->N;\n+\nFactory_CRC::store_args(this->ar, *params->crc);\n+\n+ params->crc->K = K - params->crc->size;\n+ params->src->K = params->src->K == 0 ? params->crc->K : params->src->K;\n+\n+ params->itl->size = N;\n+\nFactory_interleaver::store_args(this->ar, *params->itl);\n+\n+ params->mdm->N = N;\n+\nFactory_modem::store_args(this->ar, *params->mdm);\n+\n+ params->chn->N = params->mdm->N_mod;\n+ params->chn->complex = params->mdm->complex;\n+ params->chn->add_users = params->mdm->type == \"SCMA\";\n+\nFactory_channel::store_args(this->ar, *params->chn);\n+\n+ params->qnt->size = params->mdm->N_fil;\n+\n+ if (std::is_integral<Q>())\nFactory_quantizer::store_args(this->ar, *params->qnt);\n+\n+ params->mnt->size = params->src->K;\n+\nFactory_monitor::store_args(this->ar, *params->mnt);\n- Factory_terminal_BFER ::store_args(this->ar, *params->ter);\n- params->chn->complex = params->mdm->complex;\n- params->chn->add_users = params->mdm->type == \"SCMA\";\n+ Factory_terminal_BFER::store_args(this->ar, *params->ter);\nif (!std::is_integral<Q>())\nparams->qnt->type = \"NO\";\n+\n+ if (params->coset)\n+ params->enc->type = \"COSET\";\n+\n+ if (params->src->type == \"AZCW\" || params->enc->type == \"AZCW\")\n+ {\n+ params->src->type = \"AZCW\";\n+ params->enc->type = \"AZCW\";\n+ }\n+\n+ params->crc->n_frames = params->src->n_frames;\n+ params->enc->n_frames = params->src->n_frames;\n+ params->itl->n_frames = params->src->n_frames;\n+ params->pct->n_frames = params->src->n_frames;\n+ params->mdm->n_frames = params->src->n_frames;\n+ params->chn->n_frames = params->src->n_frames;\n+ params->qnt->n_frames = params->src->n_frames;\n+ params->dec->n_frames = params->src->n_frames;\n+ params->mnt->n_frames = params->src->n_frames;\n}\ntemplate <typename B, typename R, typename Q>\n@@ -76,6 +144,7 @@ void Launcher_BFER_ite<B,R,Q>\nFactory_interleaver ::group_args(this->arg_group);\nFactory_modem ::group_args(this->arg_group);\nFactory_channel ::group_args(this->arg_group);\n+ if (std::is_integral<Q>())\nFactory_quantizer ::group_args(this->arg_group);\nFactory_monitor ::group_args(this->arg_group);\nFactory_terminal_BFER ::group_args(this->arg_group);\n@@ -91,6 +160,7 @@ void Launcher_BFER_ite<B,R,Q>\nFactory_interleaver ::header(this->pl_itl, *params->itl);\nFactory_modem ::header(this->pl_mod, this->pl_demod, *params->mdm);\nFactory_channel ::header(this->pl_chn, *params->chn);\n+ if (std::is_integral<Q>())\nFactory_quantizer ::header(this->pl_qnt, *params->qnt);\nFactory_monitor ::header(this->pl_mnt, *params->mnt);\nFactory_terminal_BFER ::header(this->pl_ter, *params->ter);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"diff": "@@ -103,6 +103,9 @@ void Launcher_BFER_std<B,R,Q>\nif (!std::is_integral<Q>())\nparams->qnt->type = \"NO\";\n+ if (params->coset)\n+ params->enc->type = \"COSET\";\n+\nif (params->src->type == \"AZCW\" || params->enc->type == \"AZCW\")\n{\nparams->src->type = \"AZCW\";\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -138,7 +138,9 @@ template <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFER_ite<B,R,Q>\n::build_interleaver(const int tid, const int seed)\n{\n- return this->codec.build_interleaver(tid, seed);\n+ auto itl_cpy = *params.itl;\n+ itl_cpy.seed = seed;\n+ return Factory_interleaver::build<int>(itl_cpy);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "@@ -226,7 +226,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nthis->durations[tid][std::make_pair(9, \"Deinterlever\")] += steady_clock::now() - t_deint;\n// apply the coset: the decoder will believe to a AZCW\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nauto t_corea = steady_clock::now();\nthis->coset_real[tid]->apply(this->X_N1[tid], this->Y_N5[tid], this->Y_N5[tid]);\n@@ -242,7 +242,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nthis->durations[tid][std::make_pair(11, \"Decoder\")] += steady_clock::now() - t_decod;\n// apply the coset to recover the extrinsic information\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nauto t_corea = steady_clock::now();\nthis->coset_real[tid]->apply(this->X_N1[tid], this->Y_N6[tid], this->Y_N6[tid]);\n@@ -265,7 +265,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\n}\n// apply the coset to recover the real bits\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nauto t_cobit = steady_clock::now();\nthis->coset_bit[tid]->apply(this->U_K2[tid], this->V_K1[tid], this->V_K1[tid]);\n@@ -483,7 +483,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nstd::cout << std::endl;\n// apply the coset: the decoder will believe to a AZCW\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nstd::cout << \"Apply the coset approach on Y_N5...\" << std::endl;\nauto t_corea = steady_clock::now();\n@@ -511,7 +511,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\nstd::cout << std::endl;\n// apply the coset to recover the extrinsic information\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nstd::cout << \"Reverse the coset approach on Y_N6...\" << std::endl;\nauto t_corea = steady_clock::now();\n@@ -552,7 +552,7 @@ void Simulation_BFER_ite_threads<B,R,Q>\n}\n// apply the coset to recover the real bits\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nstd::cout << \"Apply the coset approach on V_K1...\" << std::endl;\nauto t_cobit = steady_clock::now();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "@@ -242,7 +242,7 @@ void Simulation_BFER_std_threads<B,R,Q>\nthis->durations[tid][std::make_pair(9, \"Depuncturer\")] += steady_clock::now() - t_depun;\n// apply the coset: the decoder will believe to a AZCW\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nauto t_corea = steady_clock::now();\nthis->coset_real[tid]->apply(this->X_N1[tid], this->Y_N5[tid], this->Y_N5[tid]);\n@@ -258,7 +258,7 @@ void Simulation_BFER_std_threads<B,R,Q>\nthis->durations[tid][std::make_pair(14, \"- store\" )] += this->decoder[tid]->get_store_duration();\n// apply the coset to recover the real bits\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\n{\nauto t_cobit = steady_clock::now();\nthis->coset_bit[tid]->apply(this->U_K2[tid], this->V_K1[tid], this->V_K1[tid]);\n@@ -436,7 +436,7 @@ void Simulation_BFER_std_threads<B,R,Q>\nstd::cout << \"Decode Y_N5 and generate V_K1...\" << std::endl\n<< \"V_K1:\" << std::endl;\n- if (this->params.enc->type == \"COSET\")\n+ if (this->params.coset)\nft.display_bit_vector(this->V_K1[tid]);\nelse\nft.display_bit_vector(this->V_K1[tid], this->U_K2[tid]);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/BFER/Factory_simulation_BFER.cpp",
"new_path": "src/Tools/Factory/Simulation/BFER/Factory_simulation_BFER.cpp",
"diff": "@@ -31,6 +31,10 @@ void Factory_simulation_BFER::build_args(Arguments_reader::arg_map &req_args, Ar\n{\"string\",\n\"select the type of SNR: symbol energy or information bit energy.\",\n\"ES, EB\"};\n+\n+ opt_args[{\"sim-coset\", \"c\"}] =\n+ {\"\",\n+ \"enable the coset approach.\"};\n}\nvoid Factory_simulation_BFER::store_args(const Arguments_reader& ar, parameters ¶ms)\n@@ -45,6 +49,7 @@ void Factory_simulation_BFER::store_args(const Arguments_reader& ar, parameters\nif(ar.exist_arg({\"sim-snr-type\", \"E\"})) params.snr_type = ar.get_arg ({\"sim-snr-type\", \"E\"});\nif(ar.exist_arg({\"sim-time-report\" })) params.time_report = true;\nif(ar.exist_arg({\"sim-debug\", \"d\"})) params.debug = true;\n+ if(ar.exist_arg({\"sim-coset\", \"c\"})) params.coset = true;\nif(ar.exist_arg({\"sim-debug-limit\"}))\n{\nparams.debug = true;\n@@ -70,4 +75,17 @@ void Factory_simulation_BFER::group_args(Arguments_reader::arg_grp& ar)\nvoid Factory_simulation_BFER::header(params_list& head_sim, const parameters& params)\n{\nFactory_simulation::header(head_sim, params);\n+\n+ if (params.benchs)\n+ head_sim.push_back(std::make_pair(\"Number of benchs\", std::to_string(params.benchs)));\n+ head_sim.push_back(std::make_pair(\"SNR type\", params.snr_type));\n+ head_sim.push_back(std::make_pair(\"Time report\", params.time_report ? \"on\" : \"off\"));\n+ head_sim.push_back(std::make_pair(\"Debug mode\", params.debug ? \"on\" : \"off\"));\n+ if (params.debug)\n+ {\n+ head_sim.push_back(std::make_pair(\"Debug precision\", std::to_string(params.debug_precision)));\n+ if (params.debug_limit)\n+ head_sim.push_back(std::make_pair(\"Debug limit\", std::to_string(params.debug_limit)));\n+ }\n+ head_sim.push_back(std::make_pair(\"Coset approach (c)\", params.coset ? \"yes\" : \"no\"));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Simulation/BFER/Factory_simulation_BFER.hpp",
"new_path": "src/Tools/Factory/Simulation/BFER/Factory_simulation_BFER.hpp",
"diff": "@@ -61,6 +61,7 @@ struct Factory_simulation_BFER : Factory_simulation\nstd::string snr_type = \"EB\";\nbool time_report = false;\nbool debug = false;\n+ bool coset = false;\nint debug_limit = 0;\nint debug_precision = 5;\nint benchs = 0;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix launcher BFERI and coset approach.
|
8,490 |
19.07.2017 15:41:11
| -7,200 |
2b430ad9aaa57235dc3c8b18b9539a3b78a8cf03
|
Fix EXIT launcher params.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/run_exit_polar_SCAN.sh",
"new_path": "scripts/run_exit_polar_SCAN.sh",
"diff": "@@ -4,7 +4,7 @@ cd ../build\n./bin/aff3ct \\\n--sim-type EXIT \\\n- --cde-type POLAR \\\n+ --sim-cde-type POLAR \\\n-K 1194 \\\n-N 2048 \\\n--sim-snr-min -3 \\\n@@ -15,5 +15,5 @@ cd ../build\n--chn-type AWGN \\\n--dec-type SCAN \\\n--dec-implem NAIVE \\\n- --cde-sigma 0.8 \\\n+ --enc-fb-sigma 0.8 \\\n$*\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/Polar/Launcher_polar.hxx",
"new_path": "src/Launcher/Code/Polar/Launcher_polar.hxx",
"diff": "@@ -46,7 +46,6 @@ void Launcher_polar<C,B,R,Q>\nthis->req_args.erase({\"enc-cw-size\", \"N\"});\nthis->req_args.erase({\"enc-info-bits\", \"K\"});\nthis->opt_args.erase({\"enc-fra\", \"F\"});\n- this->opt_args.erase({\"enc-fb-sigma\" });\nthis->opt_args.erase({\"enc-seed\", \"S\"});\nthis->req_args.erase({\"dec-cw-size\", \"N\"});\nthis->req_args.erase({\"dec-info-bits\", \"K\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"new_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"diff": "@@ -35,6 +35,20 @@ void Launcher_EXIT<B,R>\nFactory_modem ::build_args(this->req_args, this->opt_args);\nFactory_channel ::build_args(this->req_args, this->opt_args);\nFactory_terminal_EXIT ::build_args(this->req_args, this->opt_args);\n+\n+ if (this->req_args.find({\"enc-info-bits\", \"K\"}) != this->req_args.end() ||\n+ this->req_args.find({\"pct-info-bits\", \"K\"}) != this->req_args.end())\n+ this->req_args.erase({\"src-info-bits\", \"K\"});\n+ this->opt_args.erase({\"src-seed\", \"S\"});\n+ this->req_args.erase({\"mod-fra-size\", \"N\"});\n+ this->opt_args.erase({\"mod-fra\", \"F\"});\n+ this->opt_args.erase({\"dmod-sigma\" });\n+ this->req_args.erase({\"chn-fra-size\", \"N\"});\n+ this->opt_args.erase({\"chn-fra\", \"F\"});\n+ this->opt_args.erase({\"chn-sigma\" });\n+ this->opt_args.erase({\"chn-seed\", \"S\"});\n+ this->opt_args.erase({\"chn-add-users\" });\n+ this->opt_args.erase({\"chn-complex\" });\n}\ntemplate <typename B, typename R>\n@@ -44,13 +58,36 @@ void Launcher_EXIT<B,R>\nLauncher::store_args();\nFactory_simulation_EXIT::store_args(this->ar, *params);\n+\nFactory_source::store_args(this->ar, *params->src);\n+\n+ auto K = this->req_args.find({\"src-info-bits\", \"K\"}) != this->req_args.end() ? params->src->K : params->enc->K;\n+ auto N = this->req_args.find({\"src-info-bits\", \"K\"}) != this->req_args.end() ? params->src->K : params->pct->N;\n+\n+ params->src->K = params->src->K == 0 ? K : params->src->K;\n+ params->mdm->N = N;\n+\nFactory_modem::store_args(this->ar, *params->mdm);\n- Factory_channel ::store_args(this->ar, *params->chn);\n- Factory_terminal_EXIT ::store_args(this->ar, *params->ter);\n+ params->chn->N = params->mdm->N_mod;\nparams->chn->complex = params->mdm->complex;\nparams->chn->add_users = params->mdm->type == \"SCMA\";\n+\n+ Factory_channel::store_args(this->ar, *params->chn);\n+\n+ Factory_terminal_EXIT::store_args(this->ar, *params->ter);\n+\n+ if (params->src->type == \"AZCW\" || params->enc->type == \"AZCW\")\n+ {\n+ params->src->type = \"AZCW\";\n+ params->enc->type = \"AZCW\";\n+ }\n+\n+ params->enc->n_frames = params->src->n_frames;\n+ params->pct->n_frames = params->src->n_frames;\n+ params->mdm->n_frames = params->src->n_frames;\n+ params->chn->n_frames = params->src->n_frames;\n+ params->dec->n_frames = params->src->n_frames;\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -445,6 +445,7 @@ Modem<B,R,R>* Simulation_EXIT<B,R>\n{\nauto mdm_cpy = *params.mdm;\nmdm_cpy.sigma = 2.f / sig_a;\n+ mdm_cpy.N = params.enc->K;\nreturn Factory_modem::build<B,R>(mdm_cpy);\n}\n@@ -456,7 +457,6 @@ Channel<R>* Simulation_EXIT<B,R>\nif (params.chn->sigma == -1.f)\nchn_cpy.sigma = this->sigma;\nchn_cpy.seed = params.seed;\n-\nreturn Factory_channel::build<R>(chn_cpy);\n}\n@@ -467,7 +467,11 @@ Channel<R>* Simulation_EXIT<B,R>\nauto chn_cpy = *params.chn;\nchn_cpy.sigma = 2.f / sig_a;\nchn_cpy.seed = params.seed;\n-\n+ chn_cpy.N = Factory_modem::get_buffer_size_after_modulation(params.mdm->type,\n+ params.enc->K,\n+ params.mdm->bps,\n+ params.mdm->upf,\n+ params.mdm->cpm_L);\nreturn Factory_channel::build<R>(chn_cpy);\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix EXIT launcher params.
|
8,490 |
20.07.2017 16:56:19
| -7,200 |
2c36e57f98be6ac3913bb40b0b9b97a7d65653a5
|
Improve the coset factory.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Factory/Module/Coset.cpp",
"diff": "+#include \"Coset.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::factory;\n+\n+template <typename B, typename BR>\n+module::Coset<B,BR>* Coset\n+::build(const parameters ¶ms)\n+{\n+ if (params.type == \"STD\") return new module::Coset<B,BR>(params.size, params.n_frames);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+void Coset\n+::build_args(arg_map &req_args, arg_map &opt_args)\n+{\n+ req_args[{\"cst-size\", \"N\"}] =\n+ {\"positive_int\",\n+ \"coset size.\"};\n+\n+ opt_args[{\"cst-type\"}] =\n+ {\"string\",\n+ \"coset type.\",\n+ \"STD\"};\n+\n+ opt_args[{\"cst-fra\", \"F\"}] =\n+ {\"positive_int\",\n+ \"set the number of inter frame level to process.\"};\n+}\n+\n+void Coset\n+::store_args(const tools::Arguments_reader& ar, parameters ¶ms)\n+{\n+ if(ar.exist_arg({\"cst-size\", \"N\"})) params.size = ar.get_arg_int({\"cst-size\", \"N\"});\n+ if(ar.exist_arg({\"cst-fra\", \"F\"})) params.n_frames = ar.get_arg_int({\"cst-fra\", \"F\"});\n+ if(ar.exist_arg({\"cst-type\" })) params.type = ar.get_arg ({\"cst-type\" });\n+}\n+\n+void Coset\n+::group_args(arg_grp& ar)\n+{\n+ ar.push_back({\"cst\",\"Coset parameter(s)\"});\n+}\n+\n+void Coset\n+::header(params_list& head_pct, const parameters& params)\n+{\n+ head_pct.push_back(std::make_pair(\"Type\", params.type));\n+ head_pct.push_back(std::make_pair(\"Size (N)\", std::to_string(params.size)));\n+ head_pct.push_back(std::make_pair(\"Inter frame level\", std::to_string(params.n_frames)));\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Coset<B_8 ,B_8 >* aff3ct::factory::Coset::build<B_8 ,B_8 >(const aff3ct::factory::Coset::parameters&);\n+template aff3ct::module::Coset<B_16,B_16>* aff3ct::factory::Coset::build<B_16,B_16>(const aff3ct::factory::Coset::parameters&);\n+template aff3ct::module::Coset<B_32,B_32>* aff3ct::factory::Coset::build<B_32,B_32>(const aff3ct::factory::Coset::parameters&);\n+template aff3ct::module::Coset<B_64,B_64>* aff3ct::factory::Coset::build<B_64,B_64>(const aff3ct::factory::Coset::parameters&);\n+#else\n+template aff3ct::module::Coset<B,B>* aff3ct::factory::Coset::build<B,B>(const aff3ct::factory::Coset::parameters&);\n+#endif\n+\n+#ifdef MULTI_PREC\n+template aff3ct::module::Coset<B_32,Q_32>* aff3ct::factory::Coset::build<B_32,Q_32>(const aff3ct::factory::Coset::parameters&);\n+template aff3ct::module::Coset<B_64,Q_64>* aff3ct::factory::Coset::build<B_64,Q_64>(const aff3ct::factory::Coset::parameters&);\n+#elif defined(PREC_8_BIT) || defined(PREC_16_BIT)\n+template aff3ct::module::Coset<B,Q>* aff3ct::factory::Coset::build<B,Q>(const aff3ct::factory::Coset::parameters&);\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Factory/Module/Coset.hpp",
"diff": "+#ifndef FACTORY_COSET_HPP\n+#define FACTORY_COSET_HPP\n+\n+#include <string>\n+\n+#include \"Tools/Arguments_reader.hpp\"\n+\n+#include \"Module/Coset/Coset.hpp\"\n+\n+#include \"../Factory.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace factory\n+{\n+struct Coset : public Factory\n+{\n+ struct parameters\n+ {\n+ virtual ~parameters() {}\n+\n+ int size = 0;\n+\n+ std::string type = \"STD\";\n+ int n_frames = 1;\n+ };\n+\n+ template <typename B = int, typename BR = B>\n+ static module::Coset<B,BR>* build(const parameters ¶ms);\n+\n+ static void build_args(arg_map &req_args, arg_map &opt_args);\n+ static void store_args(const tools::Arguments_reader& ar, parameters ¶ms);\n+ static void group_args(arg_grp& ar);\n+\n+ static void header(params_list& head_dec, const parameters& params);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_COSET_HPP */\n"
},
{
"change_type": "DELETE",
"old_path": "src/Factory/Module/Coset/Coset_bit.cpp",
"new_path": null,
"diff": "-#include \"Tools/Exception/exception.hpp\"\n-\n-#include \"Module/Coset/Bit/Coset_bit.hpp\"\n-\n-#include \"Coset_bit.hpp\"\n-\n-using namespace aff3ct;\n-using namespace aff3ct::factory;\n-\n-template <typename B>\n-module::Coset<B,B>* Coset_bit\n-::build(const std::string type,\n- const int K,\n- const int n_frames)\n-{\n- if (type == \"STD\") return new module::Coset_bit<B,B>(K, n_frames);\n-\n- throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n-}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template aff3ct::module::Coset<B_8 ,B_8 >* aff3ct::factory::Coset_bit::build<B_8 >(const std::string, const int, const int);\n-template aff3ct::module::Coset<B_16,B_16>* aff3ct::factory::Coset_bit::build<B_16>(const std::string, const int, const int);\n-template aff3ct::module::Coset<B_32,B_32>* aff3ct::factory::Coset_bit::build<B_32>(const std::string, const int, const int);\n-template aff3ct::module::Coset<B_64,B_64>* aff3ct::factory::Coset_bit::build<B_64>(const std::string, const int, const int);\n-#else\n-template aff3ct::module::Coset<B,B>* aff3ct::factory::Coset_bit::build<B>(const std::string, const int, const int);\n-#endif\n-// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "DELETE",
"old_path": "src/Factory/Module/Coset/Coset_bit.hpp",
"new_path": null,
"diff": "-#ifndef FACTORY_COSET_BIT_HPP\n-#define FACTORY_COSET_BIT_HPP\n-\n-#include <string>\n-\n-#include \"Module/Coset/Coset.hpp\"\n-\n-#include \"../../Factory.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace factory\n-{\n-struct Coset_bit : public Factory\n-{\n- template <typename B = int>\n- static module::Coset<B,B>* build(const std::string type,\n- const int K,\n- const int n_frames = 1);\n-};\n-}\n-}\n-\n-#endif /* FACTORY_COSET_BIT_HPP */\n"
},
{
"change_type": "DELETE",
"old_path": "src/Factory/Module/Coset/Coset_real.cpp",
"new_path": null,
"diff": "-#include \"Tools/Exception/exception.hpp\"\n-\n-#include \"Module/Coset/Real/Coset_real.hpp\"\n-\n-#include \"Coset_real.hpp\"\n-\n-using namespace aff3ct;\n-using namespace aff3ct::factory;\n-\n-template <typename B, typename Q>\n-module::Coset<B,Q>* Coset_real\n-::build(const std::string type,\n- const int N,\n- const int n_frames)\n-{\n- if (type == \"STD\") return new module::Coset_real<B,Q>(N, n_frames);\n-\n- throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n-}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template aff3ct::module::Coset<B_8 ,Q_8 >* aff3ct::factory::Coset_real::build<B_8 ,Q_8 >(const std::string, const int, const int);\n-template aff3ct::module::Coset<B_16,Q_16>* aff3ct::factory::Coset_real::build<B_16,Q_16>(const std::string, const int, const int);\n-template aff3ct::module::Coset<B_32,Q_32>* aff3ct::factory::Coset_real::build<B_32,Q_32>(const std::string, const int, const int);\n-template aff3ct::module::Coset<B_64,Q_64>* aff3ct::factory::Coset_real::build<B_64,Q_64>(const std::string, const int, const int);\n-#else\n-template aff3ct::module::Coset<B,Q>* aff3ct::factory::Coset_real::build<B,Q>(const std::string, const int, const int);\n-#endif\n-// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "DELETE",
"old_path": "src/Factory/Module/Coset/Coset_real.hpp",
"new_path": null,
"diff": "-#ifndef FACTORY_COSET_REAL_HPP\n-#define FACTORY_COSET_REAL_HPP\n-\n-#include <string>\n-\n-#include \"Module/Coset/Coset.hpp\"\n-\n-#include \"../../Factory.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace factory\n-{\n-struct Coset_real : public Factory\n-{\n- template <typename B = int, typename Q = float>\n- static module::Coset<B,Q>* build(const std::string type,\n- const int N,\n- const int n_frames = 1);\n-};\n-}\n-}\n-\n-#endif /* FACTORY_COSET_REAL_HPP */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "#include \"Factory/Module/Modem.hpp\"\n#include \"Factory/Module/Channel.hpp\"\n#include \"Factory/Module/Quantizer.hpp\"\n-#include \"Factory/Module/Coset/Coset_real.hpp\"\n-#include \"Factory/Module/Coset/Coset_bit.hpp\"\n+#include \"Factory/Module/Coset.hpp\"\n#include \"Factory/Module/Interleaver.hpp\"\n#include \"Simulation_BFER_ite.hpp\"\n@@ -189,7 +188,10 @@ template <typename B, typename R, typename Q>\nCoset<B,Q>* Simulation_BFER_ite<B,R,Q>\n::build_coset_real(const int tid)\n{\n- return factory::Coset_real::build<B,Q>(\"STD\", params.dec->N_cw, params.src->n_frames);\n+ factory::Coset::parameters cst_params;\n+ cst_params.size = params.dec->N_cw;\n+ cst_params.n_frames = params.src->n_frames;\n+ return factory::Coset::build<B,Q>(cst_params);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -203,7 +205,10 @@ template <typename B, typename R, typename Q>\nCoset<B,B>* Simulation_BFER_ite<B,R,Q>\n::build_coset_bit(const int tid)\n{\n- return factory::Coset_bit::build<B>(\"STD\", params.dec->K, params.src->n_frames);\n+ factory::Coset::parameters cst_params;\n+ cst_params.size = params.dec->K;\n+ cst_params.n_frames = params.src->n_frames;\n+ return factory::Coset::build<B>(cst_params);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "#include \"Factory/Module/Channel.hpp\"\n#include \"Factory/Module/Quantizer.hpp\"\n#include \"Factory/Module/Code/Puncturer.hpp\"\n-#include \"Factory/Module/Coset/Coset_real.hpp\"\n-#include \"Factory/Module/Coset/Coset_bit.hpp\"\n+#include \"Factory/Module/Coset.hpp\"\n#include \"Simulation_BFER_std.hpp\"\n@@ -194,7 +193,10 @@ template <typename B, typename R, typename Q>\nCoset<B,Q>* Simulation_BFER_std<B,R,Q>\n::build_coset_real(const int tid)\n{\n- return factory::Coset_real::build<B,Q>(\"STD\", params.dec->N_cw, params.src->n_frames);\n+ factory::Coset::parameters cst_params;\n+ cst_params.size = params.dec->N_cw;\n+ cst_params.n_frames = params.src->n_frames;\n+ return factory::Coset::build<B,Q>(cst_params);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -208,7 +210,10 @@ template <typename B, typename R, typename Q>\nCoset<B,B>* Simulation_BFER_std<B,R,Q>\n::build_coset_bit(const int tid)\n{\n- return factory::Coset_bit::build<B>(\"STD\", params.dec->K, params.src->n_frames);\n+ factory::Coset::parameters cst_params;\n+ cst_params.size = params.dec->K;\n+ cst_params.n_frames = params.src->n_frames;\n+ return factory::Coset::build<B,B>(cst_params);\n}\n// ==================================================================================== explicit template instantiation\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the coset factory.
|
8,490 |
20.07.2017 18:02:59
| -7,200 |
07e7d471dad27761e61408d106f7c2388f66d38f
|
Improve the terminal BFER and EXIT factories.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"new_path": "src/Factory/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"diff": "#include \"Terminal_BFER.hpp\"\n+using namespace aff3ct;\nusing namespace aff3ct::factory;\n+template <typename B>\n+tools::Terminal_BFER<B>* Terminal_BFER\n+::build(const parameters ¶ms, const module::Monitor<B> &monitor, const std::chrono::nanoseconds *d_decod_total)\n+{\n+ if (params.type == \"STD\") return new tools::Terminal_BFER<B>(params.K, params.N ? params.N : params.K, monitor, d_decod_total);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\nvoid Terminal_BFER::build_args(arg_map &req_args, arg_map &opt_args)\n{\nTerminal::build_args(req_args, opt_args);\n+ req_args[{\"term-info-bits\", \"K\"}] =\n+ {\"positive_int\",\n+ \"number of information bits.\"};\n+\nopt_args[{\"term-type\"}] =\n{\"string\",\n\"select the terminal type you want.\",\n\"STD\"};\n+\n+ opt_args[{\"term-cw-size\", \"N\"}] =\n+ {\"positive_int\",\n+ \"number of bits in the codeword.\"};\n}\nvoid Terminal_BFER::store_args(const tools::Arguments_reader& ar, parameters ¶ms)\n{\nTerminal::store_args(ar, params);\n+ if(ar.exist_arg({\"term-info-bits\", \"K\"})) params.K = ar.get_arg_int({\"term-info-bits\", \"K\"});\n+ if(ar.exist_arg({\"term-cw-size\", \"N\"})) params.N = ar.get_arg_int({\"term-cw-size\", \"N\"});\nif(ar.exist_arg({\"term-type\" })) params.type = ar.get_arg ({\"term-type\" });\n}\n@@ -26,5 +46,22 @@ void Terminal_BFER::group_args(arg_grp& ar)\nvoid Terminal_BFER::header(params_list& head_ter, const parameters& params)\n{\n+ head_ter.push_back(std::make_pair(\"Type\", params.type));\n+ head_ter.push_back(std::make_pair(\"Info bits (K)\", std::to_string(params.K)));\n+\n+ if (params.N)\n+ head_ter.push_back(std::make_pair(\"Codeword size (N)\", std::to_string(params.N)));\n+\nTerminal::header(head_ter, params);\n}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::tools::Terminal_BFER<B_8 >* aff3ct::factory::Terminal_BFER::build<B_8 >(const aff3ct::factory::Terminal_BFER::parameters&, const aff3ct::module::Monitor<B_8 >&, const std::chrono::nanoseconds*);\n+template aff3ct::tools::Terminal_BFER<B_16>* aff3ct::factory::Terminal_BFER::build<B_16>(const aff3ct::factory::Terminal_BFER::parameters&, const aff3ct::module::Monitor<B_16>&, const std::chrono::nanoseconds*);\n+template aff3ct::tools::Terminal_BFER<B_32>* aff3ct::factory::Terminal_BFER::build<B_32>(const aff3ct::factory::Terminal_BFER::parameters&, const aff3ct::module::Monitor<B_32>&, const std::chrono::nanoseconds*);\n+template aff3ct::tools::Terminal_BFER<B_64>* aff3ct::factory::Terminal_BFER::build<B_64>(const aff3ct::factory::Terminal_BFER::parameters&, const aff3ct::module::Monitor<B_64>&, const std::chrono::nanoseconds*);\n+#else\n+template aff3ct::tools::Terminal_BFER<B>* aff3ct::factory::Terminal_BFER::build<B>(const aff3ct::factory::Terminal_BFER::parameters&, const aff3ct::module::Monitor<B>&, const std::chrono::nanoseconds*);\n+#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Display/Terminal/BFER/Terminal_BFER.hpp",
"new_path": "src/Factory/Tools/Display/Terminal/BFER/Terminal_BFER.hpp",
"diff": "#include <string>\n#include <chrono>\n+#include \"Module/Monitor/Monitor.hpp\"\n+#include \"Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n+\n#include \"Tools/Arguments_reader.hpp\"\n#include \"../Terminal.hpp\"\n@@ -16,9 +19,16 @@ struct Terminal_BFER : Terminal\n{\nstruct parameters : Terminal::parameters\n{\n+ int K = 0;\n+\nstd::string type = \"STD\";\n+ int N = 0;\n};\n+ template <typename B = int>\n+ static tools::Terminal_BFER<B>* build(const parameters ¶ms, const module::Monitor<B> &monitor,\n+ const std::chrono::nanoseconds *d_decod_total = nullptr);\n+\nstatic void build_args(arg_map &req_args, arg_map &opt_args);\nstatic void store_args(const tools::Arguments_reader& ar, parameters& params);\nstatic void group_args(arg_grp& ar);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"new_path": "src/Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"diff": "+#include \"Tools/Exception/exception.hpp\"\n+\n#include \"Terminal_EXIT.hpp\"\n+using namespace aff3ct;\nusing namespace aff3ct::factory;\n+tools::Terminal_EXIT* Terminal_EXIT\n+::build(const parameters ¶ms, const int &cur_t, const int &trials, const double &I_A, const double &I_E)\n+{\n+ if (params.type == \"STD\") return new tools::Terminal_EXIT(params.N, params.snr, params.sig_a, cur_t, trials, I_A, I_E);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\nvoid Terminal_EXIT::build_args(arg_map &req_args, arg_map &opt_args)\n{\nTerminal::build_args(req_args, opt_args);\n+\n+ req_args[{\"term-cw-size\", \"N\"}] =\n+ {\"positive_int\",\n+ \"number of bits in the codeword.\"};\n+\n+ req_args[{\"term-snr\"}] =\n+ {\"float\",\n+ \"SNR value in dB.\"};\n+\n+ req_args[{\"term-sig-a\"}] =\n+ {\"positive_float\",\n+ \"noise variance.\"};\n+\n+ opt_args[{\"term-type\"}] =\n+ {\"string\",\n+ \"select the terminal type you want.\",\n+ \"STD\"};\n}\nvoid Terminal_EXIT::store_args(const tools::Arguments_reader& ar, parameters ¶ms)\n{\nTerminal::store_args(ar, params);\n+\n+ if(ar.exist_arg({\"term-cw-size\", \"N\"})) params.N = ar.get_arg_int ({\"term-cw-size\", \"N\"});\n+ if(ar.exist_arg({\"term-snr\" })) params.snr = ar.get_arg_float({\"term-snr\" });\n+ if(ar.exist_arg({\"term-sig-a\" })) params.sig_a = ar.get_arg_float({\"term-sig-a\" });\n+ if(ar.exist_arg({\"term-type\" })) params.type = ar.get_arg ({\"term-type\" });\n}\nvoid Terminal_EXIT::group_args(arg_grp& ar)\n@@ -20,4 +53,9 @@ void Terminal_EXIT::group_args(arg_grp& ar)\nvoid Terminal_EXIT::header(params_list& head_ter, const parameters& params)\n{\nTerminal::header(head_ter, params);\n+\n+ head_ter.push_back(std::make_pair(\"Type\", params.type));\n+ head_ter.push_back(std::make_pair(\"Codeword size (N)\", std::to_string(params.N)));\n+ head_ter.push_back(std::make_pair(\"SNR (dB)\", std::to_string(params.snr)));\n+ head_ter.push_back(std::make_pair(\"Sigma A\", std::to_string(params.sig_a)));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp",
"new_path": "src/Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp",
"diff": "#include <chrono>\n#include \"Tools/Arguments_reader.hpp\"\n+#include \"Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp\"\n#include \"../Terminal.hpp\"\n@@ -16,8 +17,16 @@ struct Terminal_EXIT : Terminal\n{\nstruct parameters : Terminal::parameters\n{\n+ int N = 0;\n+ float snr = -1.f;\n+ float sig_a = -1.f;\n+\n+ std::string type = \"STD\";\n};\n+ static tools::Terminal_EXIT* build(const parameters ¶ms, const int &cur_t, const int &trials,\n+ const double &I_A, const double &I_E);\n+\nstatic void build_args(arg_map &req_args, arg_map &opt_args);\nstatic void store_args(const tools::Arguments_reader& ar, parameters& params);\nstatic void group_args(arg_grp& ar);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Display/Terminal/Terminal.cpp",
"new_path": "src/Factory/Tools/Display/Terminal/Terminal.cpp",
"diff": "@@ -26,4 +26,6 @@ void Terminal::group_args(arg_grp& ar)\nvoid Terminal::header(params_list& head_ter, const parameters& params)\n{\n+ head_ter.push_back(std::make_pair(\"Enabled\", params.disabled ? \"no\" : \"yes\"));\n+ head_ter.push_back(std::make_pair(\"Frequency (ms)\", std::to_string(params.frequency.count())));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"diff": "@@ -64,6 +64,8 @@ void Launcher_BFER_ite<B,R,Q>\nthis->opt_args.erase({\"qnt-sigma\" });\nthis->req_args.erase({\"mnt-size\", \"K\"});\nthis->opt_args.erase({\"mnt-fra\", \"F\"});\n+ this->req_args.erase({\"term-info-bits\",\"K\"});\n+ this->opt_args.erase({\"term-cw-size\", \"N\"});\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"diff": "@@ -60,6 +60,8 @@ void Launcher_BFER_std<B,R,Q>\nthis->opt_args.erase({\"qnt-sigma\" });\nthis->req_args.erase({\"mnt-size\", \"K\"});\nthis->opt_args.erase({\"mnt-fra\", \"F\"});\n+ this->req_args.erase({\"term-info-bits\",\"K\"});\n+ this->opt_args.erase({\"term-cw-size\", \"N\"});\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n+#include \"Factory/Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n+\n#include \"Simulation_BFER_ite_threads.hpp\"\nusing namespace aff3ct::module;\n@@ -590,13 +592,14 @@ Terminal_BFER<B>* Simulation_BFER_ite_threads<B,R,Q>\n#ifdef ENABLE_MPI\nreturn Simulation_BFER<B,R,Q>::build_terminal();\n#else\n+ factory::Terminal_BFER::parameters params_term;\n+ params_term.K = this->params.src->K;\n+ params_term.N = this->params.enc->N_cw;\n+\nthis->durations_red[std::make_pair(11, \"Decoder\")] = std::chrono::nanoseconds(0);\nconst auto &d_dec = this->durations_red[std::make_pair(11, \"Decoder\")];\n- return new Terminal_BFER<B>(this->params.src->K,\n- this->params.dec->N_cw,\n- *this->monitor_red,\n- &d_dec);\n+ return factory::Terminal_BFER::build<B>(params_term, *this->monitor_red, &d_dec);\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "#endif\n#include \"Factory/Module/Monitor.hpp\"\n+#include \"Factory/Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n#include \"Simulation_BFER.hpp\"\n@@ -373,9 +374,10 @@ template <typename B, typename R, typename Q>\nTerminal_BFER<B>* Simulation_BFER<B,R,Q>\n::build_terminal()\n{\n- return new Terminal_BFER<B>(params.src->K,\n- params.enc->N_cw,\n- *this->monitor_red);\n+ factory::Terminal_BFER::parameters params_term;\n+ params_term.K = params.src->K;\n+ params_term.N = params.enc->N_cw;\n+ return factory::Terminal_BFER::build<B>(params_term, *this->monitor_red);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n+#include \"Factory/Tools/Display/Terminal/BFER/Terminal_BFER.hpp\"\n+\n#include \"Simulation_BFER_std_threads.hpp\"\nusing namespace aff3ct::module;\n@@ -465,13 +467,14 @@ Terminal_BFER<B>* Simulation_BFER_std_threads<B,R,Q>\n#ifdef ENABLE_MPI\nreturn Simulation_BFER<B,R,Q>::build_terminal();\n#else\n+ factory::Terminal_BFER::parameters params_term;\n+ params_term.K = this->params.src->K;\n+ params_term.N = this->params.enc->N_cw;\n+\nthis->durations_red[std::make_pair(11, \"Decoder\")] = std::chrono::nanoseconds(0);\nconst auto &d_dec = this->durations_red[std::make_pair(11, \"Decoder\")];\n- return new Terminal_BFER<B>(this->params.src->K,\n- this->params.dec->N_cw,\n- *this->monitor_red,\n- &d_dec);\n+ return factory::Terminal_BFER::build<B>(params_term, *this->monitor_red, &d_dec);\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "#include \"Factory/Module/Code/Encoder.hpp\"\n#include \"Factory/Module/Modem.hpp\"\n#include \"Factory/Module/Channel.hpp\"\n+#include \"Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp\"\n#include \"Simulation_EXIT.hpp\"\n@@ -483,10 +484,14 @@ SISO<R>* Simulation_EXIT<B,R>\n// ------------------------------------------------------------------------------------------------- non-virtual method\ntemplate <typename B, typename R>\n-Terminal_EXIT<B,R>* Simulation_EXIT<B,R>\n+Terminal_EXIT* Simulation_EXIT<B,R>\n::build_terminal()\n{\n- return new Terminal_EXIT<B,R>(params.enc->N_cw, snr, sig_a, cur_trial, n_trials, I_A, I_E);\n+ factory::Terminal_EXIT::parameters params_term;\n+ params_term.N = params.enc->N_cw;\n+ params_term.snr = snr;\n+ params_term.sig_a = sig_a;\n+ return factory::Terminal_EXIT::build(params_term, cur_trial, n_trials, I_A, I_E);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.hpp",
"diff": "@@ -62,7 +62,7 @@ protected:\nmodule::Channel<R> *channel;\nmodule::Channel<R> *channel_a;\nmodule::SISO<R> *siso;\n- tools::Terminal_EXIT<B,R> *terminal;\n+ tools::Terminal_EXIT *terminal;\npublic:\nSimulation_EXIT(const factory::Simulation_EXIT::parameters& params, tools::Codec_SISO<B,R> &codec);\n@@ -87,7 +87,7 @@ protected:\nvirtual module::Channel<R>* build_channel (const int size);\nvirtual module::Channel<R>* build_channel_a(const int size);\nvirtual module::SISO<R>* build_siso ( );\n- tools::Terminal_EXIT<B,R>* build_terminal ( );\n+ tools::Terminal_EXIT* build_terminal ( );\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"new_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"diff": "using namespace aff3ct::tools;\n-template <typename B, typename R>\n-Terminal_EXIT<B,R>\n-::Terminal_EXIT(const int& N,\n- const R& snr,\n- const R& sig_a,\n+Terminal_EXIT\n+::Terminal_EXIT(const int N,\n+ const double snr,\n+ const double sig_a,\nconst int &cur_t,\nconst int &trials,\n- double& I_A,\n- double& I_E)\n+ const double &I_A,\n+ const double &I_E)\n: Terminal(),\nN(N),\nsnr(snr),\n@@ -30,8 +29,7 @@ Terminal_EXIT<B,R>\n{\n}\n-template <typename B, typename R>\n-std::string Terminal_EXIT<B,R>\n+std::string Terminal_EXIT\n::get_time_format(float secondes)\n{\nauto ss = (int)secondes % 60;\n@@ -50,8 +48,7 @@ std::string Terminal_EXIT<B,R>\nreturn time_format2;\n}\n-template <typename B, typename R>\n-void Terminal_EXIT<B,R>\n+void Terminal_EXIT\n::legend(std::ostream &stream)\n{\nstream << \"# \" << \"------|-------|-----------|-----------||----------|----------\" << std::endl;\n@@ -60,8 +57,7 @@ void Terminal_EXIT<B,R>\nstream << \"# \" << \"------|-------|-----------|-----------||----------|----------\" << std::endl;\n}\n-template <typename B, typename R>\n-void Terminal_EXIT<B,R>\n+void Terminal_EXIT\n::_report(std::ostream &stream)\n{\nusing namespace std::chrono;\n@@ -81,8 +77,7 @@ void Terminal_EXIT<B,R>\nstream << setprecision(2) << fixed << setw(8) << simu_cthr;\n}\n-template <typename B, typename R>\n-void Terminal_EXIT<B,R>\n+void Terminal_EXIT\n::temp_report(std::ostream &stream)\n{\nusing namespace std::chrono;\n@@ -110,8 +105,7 @@ void Terminal_EXIT<B,R>\nstream.flush();\n}\n-template <typename B, typename R>\n-void Terminal_EXIT<B,R>\n+void Terminal_EXIT\n::final_report(std::ostream &stream)\n{\nusing namespace std::chrono;\n@@ -125,15 +119,3 @@ void Terminal_EXIT<B,R>\nt_snr = std::chrono::steady_clock::now();\n}\n-\n-// ==================================================================================== explicit template instantiation\n-#include \"Tools/types.h\"\n-#ifdef MULTI_PREC\n-template class aff3ct::tools::Terminal_EXIT<B_8,R_8>;\n-template class aff3ct::tools::Terminal_EXIT<B_16,R_16>;\n-template class aff3ct::tools::Terminal_EXIT<B_32,R_32>;\n-template class aff3ct::tools::Terminal_EXIT<B_64,R_64>;\n-#else\n-template class aff3ct::tools::Terminal_EXIT<B,R>;\n-#endif\n-// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp",
"new_path": "src/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp",
"diff": "#include <string>\n#include <chrono>\n+#include <iostream>\n#include \"../Terminal.hpp\"\n@@ -10,28 +11,27 @@ namespace aff3ct\n{\nnamespace tools\n{\n-template <typename B = int, typename R = float>\nclass Terminal_EXIT : public Terminal\n{\nprotected:\nconst int N;\n- const R snr;\n- const R sig_a;\n+ const double snr;\n+ const double sig_a;\nstd::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_snr;\nconst int &cur_t;\nconst int &trials;\n- double &I_A;\n- double &I_E;\n+ const double &I_A;\n+ const double &I_E;\nunsigned short real_time_state;\npublic:\n- Terminal_EXIT(const int& N,\n- const R& snr,\n- const R& sig_a,\n+ Terminal_EXIT(const int N,\n+ const double snr,\n+ const double sig_a,\nconst int &cur_t,\nconst int &trials,\n- double& I_A,\n- double& I_E);\n+ const double &I_A,\n+ const double &I_E);\nvirtual ~Terminal_EXIT() {}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the terminal BFER and EXIT factories.
|
8,490 |
21.07.2017 09:54:41
| -7,200 |
9b2678b7142484daa627eec2400204a947be8a8d
|
Improve the terminal integration.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"new_path": "src/Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.cpp",
"diff": "@@ -56,6 +56,4 @@ void Terminal_EXIT::header(params_list& head_ter, const parameters& params)\nhead_ter.push_back(std::make_pair(\"Type\", params.type));\nhead_ter.push_back(std::make_pair(\"Codeword size (N)\", std::to_string(params.N)));\n- head_ter.push_back(std::make_pair(\"SNR (dB)\", std::to_string(params.snr)));\n- head_ter.push_back(std::make_pair(\"Sigma A\", std::to_string(params.sig_a)));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"diff": "@@ -109,6 +109,9 @@ void Launcher_BFER_ite<B,R,Q>\nfactory::Monitor::store_args(this->ar, *params->mnt);\n+ params->ter->K = params->dec->K;\n+ params->ter->N = params->dec->N_cw;\n+\nfactory::Terminal_BFER::store_args(this->ar, *params->ter);\nif (!std::is_integral<Q>())\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"diff": "@@ -100,6 +100,9 @@ void Launcher_BFER_std<B,R,Q>\nfactory::Monitor::store_args(this->ar, *params->mnt);\n+ params->ter->K = params->dec->K;\n+ params->ter->N = params->dec->N_cw;\n+\nfactory::Terminal_BFER::store_args(this->ar, *params->ter);\nif (!std::is_integral<Q>())\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"new_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"diff": "@@ -49,6 +49,9 @@ void Launcher_EXIT<B,R>\nthis->opt_args.erase({\"chn-seed\", \"S\"});\nthis->opt_args.erase({\"chn-add-users\" });\nthis->opt_args.erase({\"chn-complex\" });\n+ this->req_args.erase({\"term-cw-size\", \"N\"});\n+ this->req_args.erase({\"term-sig-a\" });\n+ this->req_args.erase({\"term-snr\" });\n}\ntemplate <typename B, typename R>\n@@ -75,6 +78,8 @@ void Launcher_EXIT<B,R>\nfactory::Channel::store_args(this->ar, *params->chn);\n+ params->ter->N = params->dec->N_cw;\n+\nfactory::Terminal_EXIT::store_args(this->ar, *params->ter);\nif (params->src->type == \"AZCW\" || params->enc->type == \"AZCW\")\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/Simulation_BFER_ite_threads.cpp",
"diff": "@@ -592,14 +592,10 @@ Terminal_BFER<B>* Simulation_BFER_ite_threads<B,R,Q>\n#ifdef ENABLE_MPI\nreturn Simulation_BFER<B,R,Q>::build_terminal();\n#else\n- factory::Terminal_BFER::parameters params_term;\n- params_term.K = this->params.src->K;\n- params_term.N = this->params.enc->N_cw;\n-\nthis->durations_red[std::make_pair(11, \"Decoder\")] = std::chrono::nanoseconds(0);\nconst auto &d_dec = this->durations_red[std::make_pair(11, \"Decoder\")];\n- return factory::Terminal_BFER::build<B>(params_term, *this->monitor_red, &d_dec);\n+ return factory::Terminal_BFER::build<B>(*this->params.ter, *this->monitor_red, &d_dec);\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Simulation_BFER.cpp",
"diff": "@@ -374,10 +374,7 @@ template <typename B, typename R, typename Q>\nTerminal_BFER<B>* Simulation_BFER<B,R,Q>\n::build_terminal()\n{\n- factory::Terminal_BFER::parameters params_term;\n- params_term.K = params.src->K;\n- params_term.N = params.enc->N_cw;\n- return factory::Terminal_BFER::build<B>(params_term, *this->monitor_red);\n+ return factory::Terminal_BFER::build<B>(*params.ter, *this->monitor_red);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"new_path": "src/Simulation/BFER/Standard/Threads/Simulation_BFER_std_threads.cpp",
"diff": "@@ -467,14 +467,10 @@ Terminal_BFER<B>* Simulation_BFER_std_threads<B,R,Q>\n#ifdef ENABLE_MPI\nreturn Simulation_BFER<B,R,Q>::build_terminal();\n#else\n- factory::Terminal_BFER::parameters params_term;\n- params_term.K = this->params.src->K;\n- params_term.N = this->params.enc->N_cw;\n-\nthis->durations_red[std::make_pair(11, \"Decoder\")] = std::chrono::nanoseconds(0);\nconst auto &d_dec = this->durations_red[std::make_pair(11, \"Decoder\")];\n- return factory::Terminal_BFER::build<B>(params_term, *this->monitor_red, &d_dec);\n+ return factory::Terminal_BFER::build<B>(*this->params.ter, *this->monitor_red, &d_dec);\n#endif\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"new_path": "src/Simulation/EXIT/Simulation_EXIT.cpp",
"diff": "@@ -487,11 +487,10 @@ template <typename B, typename R>\nTerminal_EXIT* Simulation_EXIT<B,R>\n::build_terminal()\n{\n- factory::Terminal_EXIT::parameters params_term;\n- params_term.N = params.enc->N_cw;\n- params_term.snr = snr;\n- params_term.sig_a = sig_a;\n- return factory::Terminal_EXIT::build(params_term, cur_trial, n_trials, I_A, I_E);\n+ auto term_cpy = *params.ter;\n+ term_cpy.snr = snr;\n+ term_cpy.sig_a = sig_a;\n+ return factory::Terminal_EXIT::build(term_cpy, cur_trial, n_trials, I_A, I_E);\n}\n// ==================================================================================== explicit template instantiation\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the terminal integration.
|
8,490 |
21.07.2017 10:16:57
| -7,200 |
c6f2541b6eab1e865f11ea8e1ea5d4b6e0d806eb
|
Use the Decoder_NO factory in the Codec.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/NO/Decoder_NO.cpp",
"new_path": "src/Factory/Module/Code/NO/Decoder_NO.cpp",
"diff": "@@ -10,8 +10,8 @@ using namespace aff3ct;\nusing namespace aff3ct::factory;\ntemplate <typename B, typename Q>\n-module::Decoder<B,Q>* Decoder_NO\n-::build(parameters ¶ms)\n+module::Decoder_SISO<B,Q>* Decoder_NO\n+::build(const parameters ¶ms)\n{\nif (params.type == \"NONE\" && params.implem == \"HARD_DECISION\") return new module::Decoder_NO<B,Q>(params.K, params.n_frames);\n@@ -51,11 +51,11 @@ void Decoder_NO\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder<B_8 ,Q_8 >* aff3ct::factory::Decoder_NO::build<B_8 ,Q_8 >(aff3ct::factory::Decoder::parameters&);\n-template aff3ct::module::Decoder<B_16,Q_16>* aff3ct::factory::Decoder_NO::build<B_16,Q_16>(aff3ct::factory::Decoder::parameters&);\n-template aff3ct::module::Decoder<B_32,Q_32>* aff3ct::factory::Decoder_NO::build<B_32,Q_32>(aff3ct::factory::Decoder::parameters&);\n-template aff3ct::module::Decoder<B_64,Q_64>* aff3ct::factory::Decoder_NO::build<B_64,Q_64>(aff3ct::factory::Decoder::parameters&);\n+template aff3ct::module::Decoder_SISO<B_8 ,Q_8 >* aff3ct::factory::Decoder_NO::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder::parameters&);\n+template aff3ct::module::Decoder_SISO<B_16,Q_16>* aff3ct::factory::Decoder_NO::build<B_16,Q_16>(const aff3ct::factory::Decoder::parameters&);\n+template aff3ct::module::Decoder_SISO<B_32,Q_32>* aff3ct::factory::Decoder_NO::build<B_32,Q_32>(const aff3ct::factory::Decoder::parameters&);\n+template aff3ct::module::Decoder_SISO<B_64,Q_64>* aff3ct::factory::Decoder_NO::build<B_64,Q_64>(const aff3ct::factory::Decoder::parameters&);\n#else\n-template aff3ct::module::Decoder<B,Q>* aff3ct::factory::Decoder_NO::build<B,Q>(aff3ct::factory::Decoder::parameters&);\n+template aff3ct::module::Decoder_SISO<B,Q>* aff3ct::factory::Decoder_NO::build<B,Q>(const aff3ct::factory::Decoder::parameters&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/NO/Decoder_NO.hpp",
"new_path": "src/Factory/Module/Code/NO/Decoder_NO.hpp",
"diff": "#include <string>\n-#include \"Module/Decoder/Decoder.hpp\"\n+#include \"Module/Decoder/Decoder_SISO.hpp\"\n#include \"../Decoder.hpp\"\n@@ -14,7 +14,7 @@ namespace factory\nstruct Decoder_NO : public Decoder\n{\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder<B,Q>* build(parameters ¶ms);\n+ static module::Decoder_SISO<B,Q>* build(const parameters ¶ms);\nstatic void build_args(arg_map &req_args, arg_map &opt_args);\nstatic void store_args(const tools::Arguments_reader& ar, parameters ¶ms);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_ite.cpp",
"diff": "@@ -109,8 +109,8 @@ void Launcher_BFER_ite<B,R,Q>\nfactory::Monitor::store_args(this->ar, *params->mnt);\n- params->ter->K = params->dec->K;\n- params->ter->N = params->dec->N_cw;\n+ params->ter->K = K;\n+ params->ter->N = N;\nfactory::Terminal_BFER::store_args(this->ar, *params->ter);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"new_path": "src/Launcher/Simulation/Launcher_BFER_std.cpp",
"diff": "@@ -100,8 +100,8 @@ void Launcher_BFER_std<B,R,Q>\nfactory::Monitor::store_args(this->ar, *params->mnt);\n- params->ter->K = params->dec->K;\n- params->ter->N = params->dec->N_cw;\n+ params->ter->K = K;\n+ params->ter->N = N;\nfactory::Terminal_BFER::store_args(this->ar, *params->ter);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"new_path": "src/Launcher/Simulation/Launcher_EXIT.cpp",
"diff": "@@ -78,7 +78,7 @@ void Launcher_EXIT<B,R>\nfactory::Channel::store_args(this->ar, *params->chn);\n- params->ter->N = params->dec->N_cw;\n+ params->ter->N = N;\nfactory::Terminal_EXIT::store_args(this->ar, *params->ter);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Uncoded/Codec_uncoded.cpp",
"new_path": "src/Tools/Codec/Uncoded/Codec_uncoded.cpp",
"diff": "#include \"Tools/Exception/exception.hpp\"\n-#include \"Module/Encoder/NO/Encoder_NO.hpp\"\n-#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n-\n#include \"Codec_uncoded.hpp\"\nusing namespace aff3ct::module;\n@@ -13,7 +10,7 @@ using namespace aff3ct::tools;\ntemplate <typename B, typename Q>\nCodec_uncoded<B,Q>\n::Codec_uncoded(const factory::Encoder::parameters &enc_params,\n- const factory::Decoder_NO::parameters &dec_params)\n+ const factory::Decoder::parameters &dec_params)\n: Codec_SISO<B,Q>(enc_params, dec_params)\n{\nif (enc_params.K != enc_params.N_cw)\n@@ -35,21 +32,21 @@ template <typename B, typename Q>\nEncoder<B>* Codec_uncoded<B,Q>\n::build_encoder(const int tid, const Interleaver<int>* itl)\n{\n- return new Encoder_NO<B>(this->enc_params.K, this->enc_params.n_frames);\n+ return factory::Encoder::build<B>(this->enc_params);\n}\ntemplate <typename B, typename Q>\nSISO<Q>* Codec_uncoded<B,Q>\n::build_siso(const int tid, const Interleaver<int>* itl, CRC<B>* crc)\n{\n- return new Decoder_NO<B,Q>(this->dec_params.K, this->dec_params.n_frames);\n+ return factory::Decoder_NO::build<B,Q>(this->dec_params);\n}\ntemplate <typename B, typename Q>\nDecoder<B,Q>* Codec_uncoded<B,Q>\n::build_decoder(const int tid, const Interleaver<int>* itl, CRC<B>* crc)\n{\n- return new Decoder_NO<B,Q>(this->dec_params.K, this->dec_params.n_frames);\n+ return factory::Decoder_NO::build<B,Q>(this->dec_params);\n}\ntemplate <typename B, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/Uncoded/Codec_uncoded.hpp",
"new_path": "src/Tools/Codec/Uncoded/Codec_uncoded.hpp",
"diff": "@@ -15,7 +15,7 @@ class Codec_uncoded : public Codec_SISO<B,Q>\n{\npublic:\nCodec_uncoded(const factory::Encoder::parameters &enc_params,\n- const factory::Decoder_NO::parameters &dec_params);\n+ const factory::Decoder::parameters &dec_params);\nvirtual ~Codec_uncoded();\nmodule::Encoder<B >* build_encoder(const int tid = 0, const module::Interleaver<int>* itl = nullptr);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Use the Decoder_NO factory in the Codec.
|
8,490 |
22.07.2017 11:29:48
| -7,200 |
c65034378f76787b773033e52e51ec7a783de054
|
Update the auto-completion script.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -9,7 +9,9 @@ _aff3ct() {\n# determine code type\nfor ((i = 0 ; i < ${#COMP_WORDS[*]}; ++ i))\ndo\n- if [[ ${COMP_WORDS[$i]} == \"--cde-type\" ]]; then\n+ if [[ ${COMP_WORDS[$i]} == \"--sim-cde-type\" || \\\n+ ${COMP_WORDS[$i]} == \"-C\" ]]\n+ then\ncodetype=${COMP_WORDS[$i+1]}\nfi\ndone\n@@ -24,7 +26,7 @@ _aff3ct() {\ndone\n# add base opts\n- opts=\"--cde-type --sim-type -v --version -h --help\"\n+ opts=\"--sim-cde-type --sim-type -v --version -h --help\"\n# add contents of Launcher.cpp\nif [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n@@ -45,14 +47,15 @@ _aff3ct() {\nthen\nopts=\"$opts --sim-snr-min -m --snr-min-max -M --sim-snr-step -s \\\n--sim-snr-type -E --sim-stop-time --sim-threads -t \\\n- --sim-prec -p --sim-inter-lvl --cde-info-bits -K --cde-size -N \\\n- --src-type --src-path --enc-type --enc-path --mod-type --mod-bps\\\n- --mod-ups --mod-cpm-ws --mod-cpm-map --mod-cpm-L --mod-cpm-p \\\n- --mod-cpm-k --mod-cpm-std --mod-const-path --dmod-max --dmod-psi\\\n- --dmod-ite \\\n- --dmod-no-sig2 --chn-type --chn-path --chn-blk-fad --qnt-type \\\n+ --sim-prec -p --sim-inter-lvl --enc-info-bits -K \\\n+ --enc-cw-size -N \\\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--qnt-dec --qnt-bits --qnt-range --dec-type --dec-implem \\\n- --term-no --term-freq --sim-seed --sim-mpi-comm --sim-pyber \\\n+ --ter-no --ter-freq --sim-seed --sim-mpi-comm --sim-pyber \\\n--sim-no-colors --mnt-err-trk --mnt-err-trk-rev \\\n--mnt-err-trk-path --sim-debug-prec\"\nfi\n@@ -68,8 +71,8 @@ _aff3ct() {\n${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts --sim-benchs -b --sim-debug -d --sim-debug-fe \\\n- --sim-debug-limit --snr-sim-trace-path --sim-time-report --cde-coset \\\n- -c --mnt-max-fe -e --term-type \"\n+ --sim-debug-limit --snr-sim-trace-path --sim-time-report --sim-coset \\\n+ -c --mnt-max-fe -e --ter-type \"\nfi\n# add contents of Launcher_EXIT.cpp\n@@ -87,15 +90,15 @@ _aff3ct() {\nthen\nopts=\"$opts --sim-benchs -b --sim-debug -d --sim-debug-fe \\\n--sim-debug-limit \\\n- --snr-sim-trace-path --sim-time-report --cde-coset -c --itl-type \\\n+ --snr-sim-trace-path --sim-time-report --sim-coset -c --itl-type \\\n--itl-path --itl-cols --itl-uni --sim-ite -I --mnt-max-fe -e \\\n- --term-type\"\n+ --ter-type\"\nfi\n# add contents of Launcher_GEN_polar.cpp\nif [[ ${codetype} == \"POLAR\" && ${simutype} == \"GEN\" ]]\nthen\n- opts=\"$opts --cde-awgn-fb-path --cde-fb-gen-method --dec-snr \\\n+ opts=\"$opts --enc-fb-awgn-path --enc-fb-gen-method --dec-snr \\\n--dec-gen-path --sim-pb-path\"\nfi\n@@ -108,7 +111,7 @@ _aff3ct() {\n# add contents of Launcher_BFER_BCH.cpp\nif [[ ${codetype} == \"BCH\" && ${simutype} == \"BFER\" ]]\nthen\n- opts=\"$opts --cde-corr-pow -T\"\n+ opts=\"$opts --dec-corr-pow -T\"\nfi\n# add contents of Launcher_BFER_RSC.cpp\n@@ -123,8 +126,8 @@ _aff3ct() {\nif [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"POLAR\" && ${simutype} == \"BFERI\" ]]\nthen\n- opts=\"$opts --sim-pb-path --cde-awgn-fb-path --cde-fb-gen-method \\\n- --cde-sigma --dec-type -D --dec-ite -i --dec-implem\"\n+ opts=\"$opts --sim-pb-path --enc-fb-awgn-path --enc-fb-gen-method \\\n+ --enc-fb-sigma --dec-type -D --dec-ite -i --dec-implem\"\nfi\n# add contents of Launcher_BFER_polar.cpp\n@@ -147,8 +150,9 @@ _aff3ct() {\nopts=\"$opts --sim-json-path --crc-type --crc-poly --crc-rate \\\n--enc-no-buff --enc-type --enc-poly --itl-type --itl-path \\\n--itl-cols --itl-uni --dec-type -D --dec-implem --dec-ite -i \\\n- --dec-sf --dec-simd --dec-max --dec-sc --dec-fnc --dec-fnc-q \\\n- --dec-fnc-ite-m --dec-fnc-ite-M --dec-fnc-ite-s --pct-pattern\"\n+ --dec-sf-type --dec-simd --dec-max --dec-sc --dec-fnc \\\n+ --dec-fnc-q --dec-fnc-ite-m --dec-fnc-ite-M --dec-fnc-ite-s \\\n+ --pct-pattern\"\nfi\n# add contents of Launcher_EXIT_RSC.cpp\n@@ -160,8 +164,8 @@ _aff3ct() {\n# add contents of Launcher_EXIT_polar.cpp\nif [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" ]]\nthen\n- opts=\"$opts --sim-pb-path --cde-sigma --cde-awgn-fb-path \\\n- --cde-fb-gen-method --dec-type -D --dec-implem --dec-ite -i \\\n+ opts=\"$opts --sim-pb-path --enc-fb-sigma --enc-fb-awgn-path \\\n+ --enc-fb-gen-method --dec-type -D --dec-implem --dec-ite -i \\\n--dec-lists -L\"\nfi\n@@ -169,7 +173,7 @@ _aff3ct() {\nif [[ ${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" ]]\nthen\n- opts=\"$opts --dec-type -D --dec-implem --dec-ite -i --cde-alist-path \\\n+ opts=\"$opts --dec-type -D --dec-implem --dec-ite -i --dec-h-path \\\n--dec-no-synd --dec-off --dec-norm --dec-synd-depth --dec-simd\"\nfi\n@@ -195,15 +199,15 @@ _aff3ct() {\n# awaiting random number or strings\n--sim-snr-min | -m | --snr-min-max | -M | --sim-snr-min | -m | \\\n--snr-min-max | -M | --sim-snr-step | -s | --sim-stop-time | \\\n- --sim-threads | -t | --sim-inter-lvl | --cde-info-bits | -K | \\\n- --cde-size | -N | --dmod-ite | \\\n- --mod-bps | --mod-ups | --mod-cpm-L | --mod-cpm-p | --mod-cpm-k | \\\n+ --sim-threads | -t | --sim-inter-lvl | --enc-info-bits | -K | \\\n+ --enc-cw-size | -N | --mdm-ite | \\\n+ --mdm-bps | --mdm-ups | --mdm-cpm-L | --mdm-cpm-p | --mdm-cpm-k | \\\n--qnt-dec | --qnt-bits | --qnt-range | --qnt-type | \\\n--sim-benchs | -b | --sim-debug-limit | --sim-debug-prec | \\\n--mnt-max-fe | -e | \\\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | -I | \\\n- --sim-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n- -L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n+ --sim-ite | --enc-fb-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n+ -L | --sim-json-path | --dec-off | --dec-norm | --ter-freq | \\\n--sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n--itl-cols | --dec-synd-depth | --pct-pattern | \\\n--dec-fnc-q | --dec-fnc-ite-m | --dec-fnc-ite-M | --dec-fnc-ite-s )\n@@ -211,9 +215,9 @@ _aff3ct() {\n;;\n# awaiting nothing\n- -v | --version | -h | --help | --dmod-no-sig2 | --term-no | \\\n+ -v | --version | -h | --help | --mdm-no-sig2 | --ter-no | \\\n--sim-debug | -d | --sim-debug-fe | --sim-time-report | \\\n- --cde-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n+ --sim-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n--crc-rate | --mnt-err-trk | --mnt-err-trk-rev | --itl-uni | \\\n--dec-partial-adaptive | --dec-fnc | --dec-sc )\nCOMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n@@ -230,7 +234,7 @@ _aff3ct() {\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --cde-type)\n+ --sim-cde-type)\nlocal params=\"POLAR TURBO LDPC REPETITION RA RSC BCH UNCODED\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n@@ -293,9 +297,9 @@ _aff3ct() {\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --cde-awgn-fb-path | --dec-gen-path | --sim-pb-path | --itl-path | \\\n- --mod-const-path | --src-path | --enc-path | --chn-path | \\\n- --cde-alist-path | --mnt-err-trk-path)\n+ --enc-fb-awgn-path | --dec-gen-path | --sim-pb-path | --itl-path | \\\n+ --mdm-const-path | --src-path | --enc-path | --chn-path | \\\n+ --dec-h-path | --mnt-err-trk-path)\n_filedir\n;;\n@@ -340,37 +344,37 @@ _aff3ct() {\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --dec-sf)\n+ --dec-sf-type)\nlocal params=\"LTE LTE_VEC ARRAY\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --mod-cpm-std)\n+ --mdm-cpm-std)\nlocal params=\"GSM\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --mod-cpm-map)\n+ --mdm-cpm-map)\nlocal params=\"NATURAL GRAY\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --mod-cpm-ws)\n+ --mdm-cpm-ws)\nlocal params=\"GMSK REC RCOS\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --mod-type)\n+ --mdm-type)\nlocal params=\"BPSK BPSK_FAST PSK PAM QAM CPM SCMA USER\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --dmod-max)\n+ --mdm-max)\nlocal params=\"MAX MAXL MAXS MAXSS\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --dmod-psi)\n+ --mdm-psi)\nlocal params=\"PSI0 PSI1 PSI2 PSI3\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n@@ -385,12 +389,12 @@ _aff3ct() {\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --term-type)\n+ --ter-type)\nlocal params=\"STD LEGACY\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n- --cde-fb-gen-method)\n+ --enc-fb-gen-method)\nlocal params=\"GA FILE TV\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the auto-completion script.
|
8,490 |
22.07.2017 11:54:43
| -7,200 |
b55fe1835db3bdd6affd6af84beb80d6acabe8e1
|
Update the scripts.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/GSM_LDPC/gsm_BPF_MAXS_SPA.sh",
"new_path": "scripts/GSM_LDPC/gsm_BPF_MAXS_SPA.sh",
"diff": "#!/bin/bash\n+cd ../../build\n+\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n- --cde-type LDPC \\\n- --cde-coset \\\n+ --sim-cde-type LDPC \\\n+ --sim-coset \\\n-N 4224 \\\n--itl-type RANDOM \\\n- --mod-type CPM \\\n- --dmod-max MAXS \\\n+ --mdm-type CPM \\\n+ --mdm-max MAXS \\\n--chn-type AWGN_FAST \\\n--dec-type BP_FLOODING \\\n--dec-implem SPA \\\n--dec-no-synd \\\n- --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mod-cpm-std GSM \\\n+ --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n+ --mdm-cpm-std GSM \\\n\"$@\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/GSM_LDPC/gsm_BPF_MAX_NMS.sh",
"new_path": "scripts/GSM_LDPC/gsm_BPF_MAX_NMS.sh",
"diff": "#!/bin/bash\n+cd ../../build\n+\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n- --cde-type LDPC \\\n- --cde-coset \\\n+ --sim-cde-type LDPC \\\n+ --sim-coset \\\n-N 4224 \\\n--itl-type RANDOM \\\n- --mod-type CPM \\\n- --dmod-max MAX \\\n+ --mdm-type CPM \\\n+ --mdm-max MAX \\\n--chn-type AWGN_FAST \\\n--dec-type BP_FLOODING \\\n--dec-implem ONMS \\\n--dec-norm 0.825 \\\n--dec-no-synd \\\n- --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mod-cpm-std GSM \\\n+ --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n+ --mdm-cpm-std GSM \\\n\"$@\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/GSM_LDPC/gsm_BPL_MAXS_SPA.sh",
"new_path": "scripts/GSM_LDPC/gsm_BPL_MAXS_SPA.sh",
"diff": "#!/bin/bash\n+cd ../../build\n+\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n- --cde-type LDPC \\\n- --cde-coset \\\n+ --sim-cde-type LDPC \\\n+ --sim-coset \\\n-N 4224 \\\n--itl-type RANDOM \\\n- --mod-type CPM \\\n- --dmod-max MAXS \\\n+ --mdm-type CPM \\\n+ --mdm-max MAXS \\\n--chn-type AWGN_FAST \\\n--dec-type BP_LAYERED \\\n--dec-implem SPA \\\n--dec-no-synd \\\n- --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mod-cpm-std GSM \\\n+ --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n+ --mdm-cpm-std GSM \\\n\"$@\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/GSM_LDPC/gsm_BPL_MAX_NMS.sh",
"new_path": "scripts/GSM_LDPC/gsm_BPL_MAX_NMS.sh",
"diff": "#!/bin/bash\n+cd ../../build\n+\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n- --cde-type LDPC \\\n- --cde-coset \\\n+ --sim-cde-type LDPC \\\n+ --sim-coset \\\n-N 4224 \\\n--itl-type RANDOM \\\n- --mod-type CPM \\\n- --dmod-max MAX \\\n+ --mdm-type CPM \\\n+ --mdm-max MAX \\\n--chn-type AWGN_FAST \\\n--dec-type BP_LAYERED \\\n--dec-implem ONMS \\\n--dec-norm 0.825 \\\n--dec-no-synd \\\n- --cde-alist-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mod-cpm-std GSM \\\n+ --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n+ --mdm-cpm-std GSM \\\n\"$@\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/run_bch.sh",
"new_path": "scripts/run_bch.sh",
"diff": "cd ../build\n./bin/aff3ct \\\n- --simu-type BFER \\\n- --code-type BCH \\\n- --mGF 6 \\\n+ --sim-type BFER \\\n+ --sim-cde-type BCH \\\n-N 63 \\\n-K 57 \\\n-t 1 \\\n- --snr-min 0 \\\n- --snr-max 9 \\\n- --snr-step 0.5 \\\n- --decoding-algo ALGEBRAIC \\\n- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10\n+ --sim-snr-min 0 \\\n+ --sim-snr-max 9 \\\n+ --sim-snr-step 0.5 \\\n+ $*\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/run_bfer_polar_SC.sh",
"new_path": "scripts/run_bfer_polar_SC.sh",
"diff": "@@ -4,7 +4,7 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFER \\\n- --cde-type POLAR \\\n+ --sim-cde-type POLAR \\\n-K 2048 \\\n-N 4096 \\\n--sim-snr-min 2.0 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/run_bfer_polar_SCL.sh",
"new_path": "scripts/run_bfer_polar_SCL.sh",
"diff": "@@ -4,7 +4,7 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFER \\\n- --cde-type POLAR \\\n+ --sim-cde-type POLAR \\\n-K 344 \\\n-N 1024 \\\n--sim-snr-min 1.0 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/run_bfer_polar_SC_debug.sh",
"new_path": "scripts/run_bfer_polar_SC_debug.sh",
"diff": "@@ -4,7 +4,7 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFER \\\n- --cde-type POLAR \\\n+ --sim-cde-type POLAR \\\n-K 4 \\\n-N 8 \\\n--sim-snr-min 0.50 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/run_bfer_polar_SC_small.sh",
"new_path": "scripts/run_bfer_polar_SC_small.sh",
"diff": "@@ -4,7 +4,7 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFER \\\n- --cde-type POLAR \\\n+ --sim-cde-type POLAR \\\n-K 128 \\\n-N 256 \\\n--sim-snr-min 0.50 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/run_bfer_turbo_LTE.sh",
"new_path": "scripts/run_bfer_turbo_LTE.sh",
"diff": "@@ -4,14 +4,14 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFER \\\n- --cde-type TURBO \\\n+ --sim-cde-type TURBO \\\n-K 6144 \\\n- -N 18432 \\\n--sim-snr-min 0.0 \\\n--sim-snr-max 1.01 \\\n--sim-snr-step 0.1 \\\n--mnt-max-fe 100 \\\n+ --enc-std LTE \\\n--dec-ite 6 \\\n- --dec-type LTE \\\n+ --dec-type BCJR \\\n--dec-implem FAST \\\n$*\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the scripts.
|
8,489 |
24.07.2017 14:37:45
| -7,200 |
07847659b82a107d1a526a7c3a5b8c469a7e0d92
|
working on scan integration
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_SC_naive.hpp",
"diff": "+#ifndef DECODER_POLAR_SCAN_SC_NAIVE_H_\n+#define DECODER_POLAR_SCAN_SC_NAIVE_H_\n+\n+#include <vector>\n+#include \"Tools/Perf/MIPP/mipp.h\"\n+#include \"Tools/Math/utils.h\"\n+#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n+\n+#include \"../../Decoder_SISO.hpp\"\n+#include \"../decoder_polar_functions.h\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float,\n+ proto_i< R> I = tools::init_LLR,\n+ proto_l< R> L = tools::l_LLR,\n+ proto_f< R> F = f_LLR,\n+ proto_v< R> V = v_LLR,\n+ proto_h<B,R> H = h_LLR,\n+ proto_s< R> S = tools::sat_val>\n+class Decoder_polar_SCAN_SC_naive : public Decoder_SISO<B,R>\n+{\n+protected:\n+ const int m; // coded bits log-length\n+ const int max_iter;\n+ const int layers_count; // number of layers in the graph = m+1\n+\n+ mipp::vector<int> frozen_bits;\n+\n+\n+public:\n+ Decoder_polar_SCAN_SC_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<int> &frozen_bits,\n+ const int n_frames = 1, const std::string name = \"Decoder_polar_SCAN_SC_naive\");\n+ virtual ~Decoder_polar_SCAN_SC_naive() {}\n+ tools::Frame_trace<> tracer;\n+ std::vector<mipp::vector<R>> feedback_graph;\n+ std::vector<mipp::vector<R>> soft_graph;\n+ std::vector<mipp::vector<R>> L2R_graph;\n+ std::vector<mipp::vector<R>> R2L_graph;\n+\n+ void set_frozen_bits(const mipp::vector<int> &frozen_bits) {this->frozen_bits = frozen_bits;}\n+\n+protected:\n+ void _load (const R *Y_N );\n+ void _hard_decode(const R *Y_N, B *V_K );\n+ virtual void _soft_decode(const R *Y_N1, R *Y_N2);\n+ virtual void _store ( B *V_K ) const;\n+\n+ void _load_init();\n+ void _decode();\n+\n+private:\n+ void set_soft_val_and_propagate(const int l, const int j, const R v);\n+ void fb_compute_soft_output (const int &i);\n+ void display_decoder_graph ();\n+ void display_decoder_graph_de ();\n+ mipp::vector<R> soft_output;\n+};\n+}\n+}\n+\n+#include \"Decoder_polar_SCAN_SC_naive.hxx\"\n+\n+#endif /* DECODER_POLAR_SCAN_SC_NAIVE_H_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_SC_naive.hxx",
"diff": "+#include <chrono>\n+#include <stdexcept>\n+#include <iostream>\n+#include <iomanip>\n+#include <cmath>\n+\n+#include \"Tools/Perf/Reorderer/Reorderer.hpp\"\n+\n+#include \"Decoder_polar_SCAN_SC_naive.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+/********************************************************************/\n+/** CONSTRUCTOR **/\n+/********************************************************************/\n+template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::Decoder_polar_SCAN_SC_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<int> &frozen_bits,\n+ const int n_frames, const std::string name)\n+: Decoder_SISO<B,R>(K, N, n_frames, 1, name),\n+ m (std::log2(N)),\n+ max_iter (max_iter ),\n+ layers_count (this->m +1 ),\n+ frozen_bits (frozen_bits ),\n+ feedback_graph(layers_count),\n+ soft_graph (layers_count),\n+ L2R_graph (layers_count),\n+ R2L_graph (layers_count)\n+\n+{\n+ if (!tools::is_power_of_2(this->N))\n+ throw std::invalid_argument(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: \\\"N\\\" has to be positive a power \"\n+ \"of 2.\");\n+\n+ if (this->N != (int)frozen_bits.size())\n+ throw std::length_error(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: \\\"frozen_bits.size()\\\" has to be equal to \"\n+ \"\\\"N\\\".\");\n+\n+ if (max_iter <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: \\\"max_iter\\\" has to be greater \"\n+ \"than 0.\");\n+\n+ auto k = 0; for (auto i = 0; i < this->N; i++) if (frozen_bits[i] == 0) k++;\n+ if (this->K != k)\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: the number of information bits in the \"\n+ \"\\\"frozen_bits\\\" is invalid.\");\n+\n+ for (auto t = 0; t < layers_count; t++)\n+ {\n+ feedback_graph[t].resize(this->N);\n+ soft_graph[t].resize(this->N);\n+ L2R_graph[t].resize(this->N);\n+ R2L_graph[t].resize(this->N);\n+ }\n+ soft_output.resize(N);\n+}\n+\n+/********************************************************************/\n+/** load **/\n+/********************************************************************/\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::_load_init()\n+{\n+ // init feedback graph (special case for the left most stage)\n+ for (auto i = 0; i < this->N; i++)\n+ if (frozen_bits[i])// if i is a frozen bit\n+ feedback_graph[0][i] = S();\n+ else\n+ feedback_graph[0][i] = I();\n+\n+ // init the rest of the feedback graph\n+ for (auto t = 1; t < layers_count; t++)\n+ for (auto i = 0; i < this->N; i++)\n+ feedback_graph[t][i] = I();\n+\n+ // init the softGraph\n+ // (except for the layer \"layers_count -1\" because it will made by the \"load\" routine from the LLRs)\n+ for (auto t = 0; t < layers_count -1; t++)\n+ for (auto i = 0; i < this->N; i++)\n+ soft_graph[t][i] = I();\n+}\n+\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::_load(const R *Y_N)\n+{\n+ _load_init();\n+\n+ // init the softGraph (special case for the right most stage)\n+ for (auto i = 0; i < this->N; i++)\n+ soft_graph[layers_count - 1][i] = Y_N[i];\n+}\n+\n+/********************************************************************/\n+/** frame_decode **/\n+/********************************************************************/\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::_decode()\n+{\n+ for (auto iter = 0; iter < max_iter; iter++)\n+ {\n+ for (auto i = 0; i < this->N; i++)\n+ {\n+ /**********************/\n+ /* forward (right to left) propagation of soft information in the graph */\n+ fb_compute_soft_output(i);\n+ soft_output[i] = soft_graph[0][i];\n+ //display_graph(soft_graph);\n+ //display_decoder_graph_de();\n+ //tracer.display_real_vector(soft_graph[0]);\n+ /**********************/\n+\n+ if (frozen_bits[i])// if i is a frozen bit\n+ {\n+ feedback_graph[0][i] = S();\n+ soft_graph [0][i] = S();\n+ }\n+ else\n+ //feedback_graph[0][i] = L(soft_graph[0][i]);\n+ feedback_graph[0][i] = S();\n+\n+ /**********************/\n+ /* propagate back (left to right) the soft information in the graph */\n+ set_soft_val_and_propagate(0, i, feedback_graph[0][i]);\n+ /**********************/\n+ }\n+ }\n+}\n+\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::_hard_decode(const R *Y_N, B *V_K)\n+{\n+ auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n+ this->_load(Y_N);\n+ auto d_load = std::chrono::steady_clock::now() - t_load;\n+\n+ auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n+ this->_decode();\n+ auto d_decod = std::chrono::steady_clock::now() - t_decod;\n+\n+ auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n+ this->_store(V_K);\n+ auto d_store = std::chrono::steady_clock::now() - t_store;\n+\n+ this->d_load_total += d_load;\n+ this->d_decod_total += d_decod;\n+ this->d_store_total += d_store;\n+}\n+\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::_soft_decode(const R *Y_N1, R *Y_N2)\n+{\n+ // ----------------------------------------------------------------------------------------------------------- LOAD\n+ this->_load(Y_N1);\n+\n+ // --------------------------------------------------------------------------------------------------------- DECODE\n+ this->_decode();\n+\n+ // ---------------------------------------------------------------------------------------------------------- STORE\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N2[i] = this->soft_output[i];\n+}\n+\n+/********************************************************************/\n+/** frame store **/\n+/********************************************************************/\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::_store(B *V_K) const\n+{\n+ auto k = 0;\n+ for (auto i = 0; i < this->N; i++)\n+ if (!frozen_bits[i]) // if i is not a frozen bit\n+ V_K[k++] = H(soft_graph[0][i]);\n+}\n+\n+/********************************************************************/\n+/** set_and_propagate **/\n+/** set the soft information (l,j) to v and propagate the value in feedbackGraph**/\n+/********************************************************************/\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::set_soft_val_and_propagate(const int l, const int j, const R v)\n+{\n+ const auto up_ix = j - (1 << l);\n+ const auto down_ix = j;\n+\n+ feedback_graph[l][j] = v; // set the bit in the feedback graph\n+\n+ if ((j >> l) & 1) // propagate recursively if the l'th bit of j == 1\n+ {\n+ auto v1 = F(feedback_graph[l][up_ix ], V(feedback_graph[l][down_ix], soft_graph[l + 1][down_ix]));\n+ auto v2 = V(feedback_graph[l][down_ix], F(feedback_graph[l][up_ix ], soft_graph[l + 1][up_ix ]));\n+\n+ set_soft_val_and_propagate(l +1, up_ix, v1); // recursive call\n+ set_soft_val_and_propagate(l +1, down_ix, v2); // recursive call\n+ }\n+}\n+\n+/********************************************************************/\n+/** compute_soft_output **/\n+/********************************************************************/\n+ template <typename B, typename R,\n+ proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n+ void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n+::fb_compute_soft_output(const int &i)\n+{\n+ auto l_start = compute_depth(i, this->m);\n+\n+ for (auto l = l_start; l >= 0; l--) // for each layer\n+ {\n+ auto j_stop = 1 << (l);\n+ for (auto j = i; j < i + j_stop; j++)\n+ {\n+ auto f_up_ix = j;\n+ auto f_down_ix = j + (1 << l);\n+ auto g_up_ix = j - (1 << l);\n+ auto g_down_ix = j;\n+\n+ if ((i & (1 << l)) == 0) // function F\n+ soft_graph[l][j] = F(soft_graph[l + 1][ f_up_ix],\n+ V(soft_graph[l + 1][f_down_ix], feedback_graph[l][f_down_ix]));\n+ else // function G\n+ soft_graph[l][j] = V(soft_graph[l + 1][g_down_ix],\n+ F(feedback_graph[l][ g_up_ix], soft_graph[l + 1][ g_up_ix]));\n+ }\n+ }\n+}\n+\n+}\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"diff": "#include <vector>\n#include <mipp.h>\n+#include \"Tools/Math/utils.h\"\n#include \"Tools/Code/Polar/decoder_polar_functions.h\"\n#include \"../../Decoder_SISO.hpp\"\n@@ -15,7 +16,8 @@ namespace module\ntemplate <typename B = int, typename R = float, tools::proto_i< R> I = tools::init_LLR,\ntools::proto_f< R> F = tools::f_LLR,\ntools::proto_v< R> V = tools::v_LLR,\n- tools::proto_h<B,R> H = tools::h_LLR>\n+ tools::proto_h<B,R> H = tools::h_LLR,\n+ tools::proto_s< R> S = tools::sat_val>\nclass Decoder_polar_SCAN_naive : public Decoder_SISO<B,R>\n{\nprotected:\n@@ -28,6 +30,7 @@ protected:\nstd::vector<mipp::vector<R>> soft_graph;\nbool is_init;\n+\npublic:\nDecoder_polar_SCAN_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCAN_naive\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"diff": "@@ -17,8 +17,8 @@ namespace module\n/** CONSTRUCTOR **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::Decoder_polar_SCAN_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames, const std::string name)\n: Decoder_SISO<B,R>(K, N, n_frames, 1, name),\n@@ -72,14 +72,14 @@ Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n/** load **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::_load_init()\n{\n// init feedback graph (special case for the left most stage)\nfor (auto i = 0; i < this->N; i++)\nif (frozen_bits[i])// if i is a frozen bit\n- feedback_graph[0][i] = tools::sat_vals<R>().second;\n+ feedback_graph[0][i] = S();\nelse\nfeedback_graph[0][i] = I();\n@@ -98,8 +98,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::_load(const R *Y_N)\n{\nif (!(this->is_init))\n@@ -114,8 +114,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n/** frame_decode **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::_decode()\n{\nfor (auto iter = 0; iter < max_iter; iter++)\n@@ -129,8 +129,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\nif (frozen_bits[i])// if i is a frozen bit\n{\n- feedback_graph[0][i] = tools::sat_vals<R>().second;\n- soft_graph [0][i] = tools::sat_vals<R>().second;\n+ feedback_graph[0][i] = S();\n+ soft_graph [0][i] = S();\n}\nelse\nfeedback_graph[0][i] = I();\n@@ -144,8 +144,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::_hard_decode(const R *Y_N, B *V_K, const int frame_id)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n@@ -168,8 +168,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::_soft_decode(const R *Y_N1, R *Y_N2, const int frame_id)\n{\n// ----------------------------------------------------------------------------------------------------------- LOAD\n@@ -187,14 +187,14 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n/** frame store **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::_store(B *V_K) const\n{\nauto k = 0;\nfor (auto i = 0; i < this->N; i++)\nif (!frozen_bits[i]) // if i is not a frozen bit\n- V_K[k++] = (H(soft_graph[0][i]) == 0) ? (B)0 : (B)1;\n+ V_K[k++] = H(soft_graph[0][i]);\n}\n/********************************************************************/\n@@ -202,8 +202,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n/** set the soft information (l,j) to v and propagate the value in feedbackGraph**/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::set_soft_val_and_propagate(const int l, const int j, const R v)\n{\nconst auto up_ix = j - (1 << l);\n@@ -225,8 +225,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n/** compute_soft_output **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n::fb_compute_soft_output(const int &i)\n{\nauto l_start = tools::compute_depth(i, this->m);\n@@ -250,32 +250,5 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n}\n}\n}\n-\n-/********************************************************************/\n-/** Display_decoder_feedbackgraph **/\n-/********************************************************************/\n-template <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n-::display_decoder_graph()\n-{\n- std::cout << \"soft_graph:\" << std::endl;\n- for (auto i = 0; i < this->N; i++)\n- {\n- for (auto j = 0; j <= m; j++)\n- std::cout << \"\\t\\t\" << std::setprecision(4) << std::setw(4) << soft_graph[j][i];\n- std::cout << std::endl;\n- }\n- std::cout << std::endl << std::endl;\n-\n- std::cout << \"feedback_graph:\" << std::endl;\n- for (auto i = 0; i < this->N; i++)\n- {\n- for (auto j = 0; j <= m; j++)\n- std::cout << \"\\t\\t\" << std::setprecision(4) << std::setw(4) << feedback_graph[j][i];\n- std::cout << std::endl;\n- }\n- std::cout << std::endl << std::endl;\n-}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp",
"diff": "@@ -15,7 +15,8 @@ namespace module\ntemplate <typename B = int, typename R = float, tools::proto_i< R> I = tools::init_LLR,\ntools::proto_f< R> F = tools::f_LLR,\ntools::proto_v< R> V = tools::v_LLR,\n- tools::proto_h<B,R> H = tools::h_LLR>\n+ tools::proto_h<B,R> H = tools::h_LLR,\n+ tools::proto_s< R> S = tools::sat_val>\nclass Decoder_polar_SCAN_naive_sys : public Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n{\npublic:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"diff": "@@ -5,24 +5,24 @@ namespace aff3ct\nnamespace module\n{\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n::Decoder_polar_SCAN_naive_sys(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames, const std::string name)\n-: Decoder_polar_SCAN_naive<B,R,I,F,V,H>(K, N, max_iter, frozen_bits, n_frames, name)\n+: Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>(K, N, max_iter, frozen_bits, n_frames, name)\n{\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n::~Decoder_polar_SCAN_naive_sys()\n{\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n::_soft_decode(const R *sys, const R *par, R *ext, const int frame_id)\n{\n// ----------------------------------------------------------------------------------------------------------- LOAD\n@@ -37,7 +37,7 @@ void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\nthis->soft_graph[this->layers_count - 1][i] = par[par_idx++];\n// --------------------------------------------------------------------------------------------------------- DECODE\n- Decoder_polar_SCAN_naive<B,R,I,F,V,H>::_decode();\n+ this->_decode();\n// ---------------------------------------------------------------------------------------------------------- STORE\nsys_idx = 0;\n@@ -47,15 +47,15 @@ void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n::_soft_decode(const R *Y_N1, R *Y_N2, const int frame_id)\n{\n// ----------------------------------------------------------------------------------------------------------- LOAD\nthis->_load(Y_N1);\n// --------------------------------------------------------------------------------------------------------- DECODE\n- Decoder_polar_SCAN_naive<B,R,I,F,V,H>::_decode();\n+ this->_decode();\n// ---------------------------------------------------------------------------------------------------------- STORE\nfor (auto i = 0; i < this->N; i++)\n@@ -63,15 +63,15 @@ void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H>\n-void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n+ tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n::_store(B *V_N) const\n{\nauto k = 0;\nfor (auto i = 0; i < this->N; i++)\n{\nif (!this->frozen_bits[i]) // if i is not a frozen bit\n- V_N[k++] = (H(this->feedback_graph[this->layers_count -1][i] + this->soft_graph[this->layers_count -1][i]) == 0) ? (B)0 : (B)1;\n+ V_N[k++] = H(this->feedback_graph[this->layers_count -1][i] + this->soft_graph[this->layers_count -1][i]);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/decoder_polar_functions.h",
"new_path": "src/Tools/Code/Polar/decoder_polar_functions.h",
"diff": "@@ -58,6 +58,9 @@ using proto_xo_i = mipp::reg (*)(const mipp::reg& u_a, const mipp::reg& u_b);\ntemplate <typename B, typename R>\nusing proto_m = R (*)(const B& u_a, const R& lambda_a);\n+template <typename R>\n+using proto_s = R (*)(); // special proto: return saturate value for a specific domain\n+\n// ------------------------------------------------------------------------------------------- special function headers\ntemplate <typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/utils.h",
"new_path": "src/Tools/Math/utils.h",
"diff": "@@ -36,14 +36,16 @@ constexpr R init_LLR() { return (R)0; }\n// saturate values in function of the domain\ntemplate <typename R>\n-constexpr std::pair<R,R> sat_vals() { return std::make_pair(-std::numeric_limits<R>::infinity(),\n- std::numeric_limits<R>::infinity()); }\n+constexpr R sat_val() { return std::numeric_limits<R>::infinity(); }\ntemplate <>\n-constexpr std::pair<short, short> sat_vals() { return std::make_pair(-16382, 16382); }\n+constexpr short sat_val<short>() { return 16382; }\ntemplate <>\n-constexpr std::pair<signed char, signed char> sat_vals() { return std::make_pair(-63, 63); }\n+constexpr signed char sat_val<signed char>() { return 63; }\n+\n+template <typename R>\n+constexpr std::pair<R, R> sat_vals() { return std::make_pair(-sat_val<R>(), sat_val<R>()); }\n// return the initial value for a bit\ntemplate <typename B>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/git_sha1.cpp",
"diff": "+#include \"Tools/git_sha1.h\"\n+\n+#define GIT_SHA1 \"b8795ceccb240620d403c56e1e110a7bf3dec3b0\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+const char g_GIT_SHA1[] = GIT_SHA1;\n+}\n+}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
working on scan integration
|
8,489 |
24.07.2017 17:03:45
| -7,200 |
fd012befe2a0eed0ebb2475c8cc0de71e4c3b069
|
Remove SCAN SC.
|
[
{
"change_type": "DELETE",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_SC_naive.hpp",
"new_path": null,
"diff": "-#ifndef DECODER_POLAR_SCAN_SC_NAIVE_H_\n-#define DECODER_POLAR_SCAN_SC_NAIVE_H_\n-\n-#include <vector>\n-#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"Tools/Math/utils.h\"\n-#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n-\n-#include \"../../Decoder_SISO.hpp\"\n-#include \"../decoder_polar_functions.h\"\n-\n-namespace aff3ct\n-{\n-namespace module\n-{\n-template <typename B = int, typename R = float,\n- proto_i< R> I = tools::init_LLR,\n- proto_l< R> L = tools::l_LLR,\n- proto_f< R> F = f_LLR,\n- proto_v< R> V = v_LLR,\n- proto_h<B,R> H = h_LLR,\n- proto_s< R> S = tools::sat_val>\n-class Decoder_polar_SCAN_SC_naive : public Decoder_SISO<B,R>\n-{\n-protected:\n- const int m; // coded bits log-length\n- const int max_iter;\n- const int layers_count; // number of layers in the graph = m+1\n-\n- mipp::vector<int> frozen_bits;\n-\n-\n-public:\n- Decoder_polar_SCAN_SC_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<int> &frozen_bits,\n- const int n_frames = 1, const std::string name = \"Decoder_polar_SCAN_SC_naive\");\n- virtual ~Decoder_polar_SCAN_SC_naive() {}\n- tools::Frame_trace<> tracer;\n- std::vector<mipp::vector<R>> feedback_graph;\n- std::vector<mipp::vector<R>> soft_graph;\n- std::vector<mipp::vector<R>> L2R_graph;\n- std::vector<mipp::vector<R>> R2L_graph;\n-\n- void set_frozen_bits(const mipp::vector<int> &frozen_bits) {this->frozen_bits = frozen_bits;}\n-\n-protected:\n- void _load (const R *Y_N );\n- void _hard_decode(const R *Y_N, B *V_K );\n- virtual void _soft_decode(const R *Y_N1, R *Y_N2);\n- virtual void _store ( B *V_K ) const;\n-\n- void _load_init();\n- void _decode();\n-\n-private:\n- void set_soft_val_and_propagate(const int l, const int j, const R v);\n- void fb_compute_soft_output (const int &i);\n- void display_decoder_graph ();\n- void display_decoder_graph_de ();\n- mipp::vector<R> soft_output;\n-};\n-}\n-}\n-\n-#include \"Decoder_polar_SCAN_SC_naive.hxx\"\n-\n-#endif /* DECODER_POLAR_SCAN_SC_NAIVE_H_ */\n"
},
{
"change_type": "DELETE",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_SC_naive.hxx",
"new_path": null,
"diff": "-#include <chrono>\n-#include <stdexcept>\n-#include <iostream>\n-#include <iomanip>\n-#include <cmath>\n-\n-#include \"Tools/Perf/Reorderer/Reorderer.hpp\"\n-\n-#include \"Decoder_polar_SCAN_SC_naive.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace module\n-{\n-/********************************************************************/\n-/** CONSTRUCTOR **/\n-/********************************************************************/\n-template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n-Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::Decoder_polar_SCAN_SC_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<int> &frozen_bits,\n- const int n_frames, const std::string name)\n-: Decoder_SISO<B,R>(K, N, n_frames, 1, name),\n- m (std::log2(N)),\n- max_iter (max_iter ),\n- layers_count (this->m +1 ),\n- frozen_bits (frozen_bits ),\n- feedback_graph(layers_count),\n- soft_graph (layers_count),\n- L2R_graph (layers_count),\n- R2L_graph (layers_count)\n-\n-{\n- if (!tools::is_power_of_2(this->N))\n- throw std::invalid_argument(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: \\\"N\\\" has to be positive a power \"\n- \"of 2.\");\n-\n- if (this->N != (int)frozen_bits.size())\n- throw std::length_error(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: \\\"frozen_bits.size()\\\" has to be equal to \"\n- \"\\\"N\\\".\");\n-\n- if (max_iter <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: \\\"max_iter\\\" has to be greater \"\n- \"than 0.\");\n-\n- auto k = 0; for (auto i = 0; i < this->N; i++) if (frozen_bits[i] == 0) k++;\n- if (this->K != k)\n- throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCAN_SC_naive: the number of information bits in the \"\n- \"\\\"frozen_bits\\\" is invalid.\");\n-\n- for (auto t = 0; t < layers_count; t++)\n- {\n- feedback_graph[t].resize(this->N);\n- soft_graph[t].resize(this->N);\n- L2R_graph[t].resize(this->N);\n- R2L_graph[t].resize(this->N);\n- }\n- soft_output.resize(N);\n-}\n-\n-/********************************************************************/\n-/** load **/\n-/********************************************************************/\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::_load_init()\n-{\n- // init feedback graph (special case for the left most stage)\n- for (auto i = 0; i < this->N; i++)\n- if (frozen_bits[i])// if i is a frozen bit\n- feedback_graph[0][i] = S();\n- else\n- feedback_graph[0][i] = I();\n-\n- // init the rest of the feedback graph\n- for (auto t = 1; t < layers_count; t++)\n- for (auto i = 0; i < this->N; i++)\n- feedback_graph[t][i] = I();\n-\n- // init the softGraph\n- // (except for the layer \"layers_count -1\" because it will made by the \"load\" routine from the LLRs)\n- for (auto t = 0; t < layers_count -1; t++)\n- for (auto i = 0; i < this->N; i++)\n- soft_graph[t][i] = I();\n-}\n-\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::_load(const R *Y_N)\n-{\n- _load_init();\n-\n- // init the softGraph (special case for the right most stage)\n- for (auto i = 0; i < this->N; i++)\n- soft_graph[layers_count - 1][i] = Y_N[i];\n-}\n-\n-/********************************************************************/\n-/** frame_decode **/\n-/********************************************************************/\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::_decode()\n-{\n- for (auto iter = 0; iter < max_iter; iter++)\n- {\n- for (auto i = 0; i < this->N; i++)\n- {\n- /**********************/\n- /* forward (right to left) propagation of soft information in the graph */\n- fb_compute_soft_output(i);\n- soft_output[i] = soft_graph[0][i];\n- //display_graph(soft_graph);\n- //display_decoder_graph_de();\n- //tracer.display_real_vector(soft_graph[0]);\n- /**********************/\n-\n- if (frozen_bits[i])// if i is a frozen bit\n- {\n- feedback_graph[0][i] = S();\n- soft_graph [0][i] = S();\n- }\n- else\n- //feedback_graph[0][i] = L(soft_graph[0][i]);\n- feedback_graph[0][i] = S();\n-\n- /**********************/\n- /* propagate back (left to right) the soft information in the graph */\n- set_soft_val_and_propagate(0, i, feedback_graph[0][i]);\n- /**********************/\n- }\n- }\n-}\n-\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::_hard_decode(const R *Y_N, B *V_K)\n-{\n- auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n- this->_load(Y_N);\n- auto d_load = std::chrono::steady_clock::now() - t_load;\n-\n- auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode();\n- auto d_decod = std::chrono::steady_clock::now() - t_decod;\n-\n- auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- this->_store(V_K);\n- auto d_store = std::chrono::steady_clock::now() - t_store;\n-\n- this->d_load_total += d_load;\n- this->d_decod_total += d_decod;\n- this->d_store_total += d_store;\n-}\n-\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::_soft_decode(const R *Y_N1, R *Y_N2)\n-{\n- // ----------------------------------------------------------------------------------------------------------- LOAD\n- this->_load(Y_N1);\n-\n- // --------------------------------------------------------------------------------------------------------- DECODE\n- this->_decode();\n-\n- // ---------------------------------------------------------------------------------------------------------- STORE\n- for (auto i = 0; i < this->N; i++)\n- Y_N2[i] = this->soft_output[i];\n-}\n-\n-/********************************************************************/\n-/** frame store **/\n-/********************************************************************/\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::_store(B *V_K) const\n-{\n- auto k = 0;\n- for (auto i = 0; i < this->N; i++)\n- if (!frozen_bits[i]) // if i is not a frozen bit\n- V_K[k++] = H(soft_graph[0][i]);\n-}\n-\n-/********************************************************************/\n-/** set_and_propagate **/\n-/** set the soft information (l,j) to v and propagate the value in feedbackGraph**/\n-/********************************************************************/\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::set_soft_val_and_propagate(const int l, const int j, const R v)\n-{\n- const auto up_ix = j - (1 << l);\n- const auto down_ix = j;\n-\n- feedback_graph[l][j] = v; // set the bit in the feedback graph\n-\n- if ((j >> l) & 1) // propagate recursively if the l'th bit of j == 1\n- {\n- auto v1 = F(feedback_graph[l][up_ix ], V(feedback_graph[l][down_ix], soft_graph[l + 1][down_ix]));\n- auto v2 = V(feedback_graph[l][down_ix], F(feedback_graph[l][up_ix ], soft_graph[l + 1][up_ix ]));\n-\n- set_soft_val_and_propagate(l +1, up_ix, v1); // recursive call\n- set_soft_val_and_propagate(l +1, down_ix, v2); // recursive call\n- }\n-}\n-\n-/********************************************************************/\n-/** compute_soft_output **/\n-/********************************************************************/\n- template <typename B, typename R,\n- proto_i<R> I, proto_l<R> L, proto_f<R> F, proto_v<R> V, proto_h<B,R> H, proto_s<R> S>\n- void Decoder_polar_SCAN_SC_naive<B,R,I,L,F,V,H,S>\n-::fb_compute_soft_output(const int &i)\n-{\n- auto l_start = compute_depth(i, this->m);\n-\n- for (auto l = l_start; l >= 0; l--) // for each layer\n- {\n- auto j_stop = 1 << (l);\n- for (auto j = i; j < i + j_stop; j++)\n- {\n- auto f_up_ix = j;\n- auto f_down_ix = j + (1 << l);\n- auto g_up_ix = j - (1 << l);\n- auto g_down_ix = j;\n-\n- if ((i & (1 << l)) == 0) // function F\n- soft_graph[l][j] = F(soft_graph[l + 1][ f_up_ix],\n- V(soft_graph[l + 1][f_down_ix], feedback_graph[l][f_down_ix]));\n- else // function G\n- soft_graph[l][j] = V(soft_graph[l + 1][g_down_ix],\n- F(feedback_graph[l][ g_up_ix], soft_graph[l + 1][ g_up_ix]));\n- }\n- }\n-}\n-\n-}\n-}\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove SCAN SC.
|
8,486 |
25.07.2017 10:01:25
| -7,200 |
c5d42d5d1e50a486e4c70fc0c0bf2fe99224fbc0
|
Stable min star function (f_LLR) for SCAN.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/decoder_polar_functions.h",
"new_path": "src/Tools/Code/Polar/decoder_polar_functions.h",
"diff": "@@ -66,6 +66,9 @@ __forceinline R f_LR(const R& lambda_a, const R& lambda_b);\ntemplate <typename R>\n__forceinline R f_LLR(const R& lambda_a, const R& lambda_b);\n+template <typename R>\n+__forceinline R f_LLR_tanh_safe(const R& lambda_a, const R& lambda_b);\n+\ntemplate <typename R>\n__forceinline mipp::reg f_LLR_i(const mipp::reg& r_lambda_a, const mipp::reg& r_lambda_b);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/decoder_polar_functions.hxx",
"new_path": "src/Tools/Code/Polar/decoder_polar_functions.hxx",
"diff": "@@ -43,12 +43,32 @@ inline R f_LLR_tanh(const R& lambda_a, const R& lambda_b)\nauto abs_lambda_a = (lambda_a >= 0) ? lambda_a : -lambda_a;\nauto abs_lambda_b = (lambda_b >= 0) ? lambda_b : -lambda_b;\n- if(abs(lambda_a) > 17 && abs(lambda_b) > 17)\n- return (R)sign_lambda_a_b * std::min(abs_lambda_a, abs_lambda_b);\n+ R Le = f_LLR(lambda_a, lambda_b);\n+\n+ if(abs_lambda_a > 17 || abs_lambda_b > 17)\n+ return Le;\nelse\nreturn (R)2 * atanh(tanh(lambda_a / 2) * tanh(lambda_b / 2));\n}\n+template <typename R>\n+inline R f_LLR_tanh_safe(const R& lambda_a, const R& lambda_b)\n+{\n+ auto sign_lambda_a_b = sgn<int, R>(lambda_a * lambda_b);\n+ auto abs_lambda_a = (lambda_a >= 0) ? lambda_a : -lambda_a;\n+ auto abs_lambda_b = (lambda_b >= 0) ? lambda_b : -lambda_b;\n+\n+ R le = f_LLR(lambda_a, lambda_b);\n+ if (abs_lambda_a > 17 || abs_lambda_b > 17)\n+ return le;\n+ else\n+ {\n+ auto abs_lambda_a_plus_lambda_b = (lambda_a + lambda_b >= 0) ? lambda_b + lambda_a : -(lambda_b + lambda_a);\n+ auto abs_lambda_a_minus_lambda_b = (lambda_a - lambda_b >= 0) ? lambda_a - lambda_b : -(lambda_a - lambda_b);\n+ return le + log(1 + exp(-abs_lambda_a_plus_lambda_b)) - log(1 + exp(-abs_lambda_a_minus_lambda_b));\n+ }\n+}\n+\ntemplate <>\ninline float f_LLR(const float& lambda_a, const float& lambda_b)\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Stable min star function (f_LLR) for SCAN.
|
8,490 |
25.07.2017 17:38:09
| -7,200 |
10c67aa6593c75738c76418970f320ec837ed855
|
Updte the aff3ct completion script.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -56,8 +56,8 @@ _aff3ct() {\n--mdm-no-sig2 --chn-type --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 --mnt-err-trk --mnt-err-trk-rev \\\n- --mnt-err-trk-path --sim-debug-prec\"\n+ --sim-no-colors --sim-err-trk --sim-err-trk-rev \\\n+ --sim-err-trk-path --sim-debug-prec\"\nfi\n# add contents of Launcher_BFER.cpp\n@@ -147,7 +147,7 @@ _aff3ct() {\n# add contents of Launcher_BFER_turbo.cpp\nif [[ ${codetype} == \"TURBO\" && ${simutype} == \"BFER\" ]]\nthen\n- opts=\"$opts --sim-json-path --crc-type --crc-poly --crc-rate \\\n+ opts=\"$opts --enc-json-path --crc-type --crc-poly --crc-rate \\\n--enc-no-buff --enc-type --enc-poly --itl-type --itl-path \\\n--itl-cols --itl-uni --dec-type -D --dec-implem --dec-ite -i \\\n--dec-sf-type --dec-simd --dec-max --dec-sc --dec-fnc \\\n@@ -207,7 +207,7 @@ _aff3ct() {\n--mnt-max-fe | -e | \\\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | -I | \\\n--sim-ite | --enc-fb-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n- -L | --sim-json-path | --dec-off | --dec-norm | --ter-freq | \\\n+ -L | --enc-json-path | --dec-off | --dec-norm | --ter-freq | \\\n--sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n--itl-cols | --dec-synd-depth | --pct-pattern | \\\n--dec-fnc-q | --dec-fnc-ite-m | --dec-fnc-ite-M | --dec-fnc-ite-s )\n@@ -218,7 +218,7 @@ _aff3ct() {\n-v | --version | -h | --help | --mdm-no-sig2 | --ter-no | \\\n--sim-debug | -d | --sim-debug-fe | --sim-time-report | \\\n--sim-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n- --crc-rate | --mnt-err-trk | --mnt-err-trk-rev | --itl-uni | \\\n+ --crc-rate | --sim-err-trk | --sim-err-trk-rev | --itl-uni | \\\n--dec-partial-adaptive | --dec-fnc | --dec-sc )\nCOMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n;;\n@@ -299,7 +299,7 @@ _aff3ct() {\n--enc-fb-awgn-path | --dec-gen-path | --sim-pb-path | --itl-path | \\\n--mdm-const-path | --src-path | --enc-path | --chn-path | \\\n- --dec-h-path | --mnt-err-trk-path)\n+ --dec-h-path | --sim-err-trk-path)\n_filedir\n;;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Updte the aff3ct completion script.
|
8,490 |
25.07.2017 17:38:37
| -7,200 |
f63db7f775cd7e2a0bb1f3926034e6cdcec6d345
|
Fulfill a missing variable.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Encoder.hpp",
"new_path": "src/Module/Encoder/Encoder.hpp",
"diff": "@@ -108,7 +108,7 @@ public:\nif (this->N * this->n_frames != (int)X_N.size())\n{\nstd::stringstream message;\n- message << \"'X_N.size()' has to be equal to 'N' * 'n_frames' ('X_N.size()' = \"\n+ message << \"'X_N.size()' has to be equal to 'N' * 'n_frames' ('X_N.size()' = \" << X_N.size()\n<< \", 'N' = \" << this->N << \", 'n_frames' = \" << this->n_frames << \").\";\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fulfill a missing variable.
|
8,490 |
25.07.2017 21:20:29
| -7,200 |
b970bd6af0195ed0223ec345b334f7c35572ceaa
|
Fix SystemC simus.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/BFER/BFER_ite.cpp",
"new_path": "src/Factory/Simulation/BFER/BFER_ite.cpp",
"diff": "@@ -14,7 +14,7 @@ simulation::BFER_ite<B,R,Q>* BFER_ite\n::build(const parameters ¶ms, tools::Codec_SISO<B,Q> &codec)\n{\n#if defined(SYSTEMC)\n- return new simulation::SC_Simulation_BFER_ite <B,R,Q>(params, codec);\n+ return new simulation::SC_BFER_ite <B,R,Q>(params, codec);\n#else\nreturn new simulation::BFER_ite_threads<B,R,Q>(params, codec);\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": "@@ -15,9 +15,9 @@ simulation::BFER_std<B,R,Q>* BFER_std\n::build(const parameters ¶ms, tools::Codec<B,Q> &codec)\n{\n#if defined(SYSTEMC)\n- return new simulation::SC_Simulation_BFER_std<B,R,Q>(params, codec);\n+ return new simulation::SC_BFER_std<B,R,Q>(params, codec);\n#elif defined(STARPU)\n- return new simulation::SPU_Simulation_BFER_std<B,R,Q>(params, codec);\n+ return new simulation::SPU_BFER_std<B,R,Q>(params, codec);\n#else\nreturn new simulation::BFER_std_threads<B,R,Q>(params, codec);\n#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp",
"diff": "@@ -138,7 +138,7 @@ Interleaver<int>* BFER_ite<B,R,Q>\n::build_interleaver(const int tid, const int seed)\n{\nauto itl_cpy = *params.itl;\n- itl_cpy.seed = seed;\n+ itl_cpy.seed = itl_cpy.uniform ? seed : itl_cpy.seed;\nif (params.err_track_revert)\nparams.itl->path = this->params.err_track_path + \"_\" + std::to_string(this->snr_b) + \".itl\";\nreturn factory::Interleaver::build<int>(itl_cpy);\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": "#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Algo/Predicate_ite.hpp\"\n-#include \"Tools/Factory/Coset/Factory_coset_real.hpp\"\n-#include \"Tools/Factory/Factory_interleaver.hpp\"\n-\n#include \"SC_BFER_ite.hpp\"\nusing namespace aff3ct::module;\n@@ -14,9 +11,9 @@ using namespace aff3ct::tools;\nusing namespace aff3ct::simulation;\ntemplate <typename B, typename R, typename Q>\n-SC_Simulation_BFER_ite<B,R,Q>\n-::SC_Simulation_BFER_ite(const parameters& params, Codec_SISO<B,Q> &codec)\n-: Simulation_BFER_ite<B,R,Q>(params,codec),\n+SC_BFER_ite<B,R,Q>\n+::SC_BFER_ite(const factory::BFER_ite::parameters ¶ms, Codec_SISO<B,Q> &codec)\n+: BFER_ite<B,R,Q>(params, codec),\ninterleaver_e(nullptr),\ncoset_real_i(nullptr),\n@@ -28,13 +25,13 @@ SC_Simulation_BFER_ite<B,R,Q>\ndbg_R {nullptr, nullptr, nullptr},\ndbg_Q {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}\n{\n- if (params.simulation.n_threads > 1)\n+ if (params.n_threads > 1)\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support multi-threading.\");\n- if (params.simulation.benchs)\n+ if (params.benchs)\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support the bench mode.\");\n- if (params.simulation.time_report)\n+ if (params.time_report)\nstd::clog << format_warning(\"The time report is not available in the SystemC simulation.\") << std::endl;\n#ifdef ENABLE_MPI\n@@ -44,16 +41,16 @@ SC_Simulation_BFER_ite<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-SC_Simulation_BFER_ite<B,R,Q>\n-::~SC_Simulation_BFER_ite()\n+SC_BFER_ite<B,R,Q>\n+::~SC_BFER_ite()\n{\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_ite<B,R,Q>\n+void SC_BFER_ite<B,R,Q>\n::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_ite<B,R,Q>::_build_communication_chain(tid);\n+ BFER_ite<B,R,Q>::_build_communication_chain(tid);\nif (*this->interleaver[tid] != *this->interleaver_e)\nthrow runtime_error(__FILE__, __LINE__, __func__, \"'interleaver[tid]' and 'interleaver_e' have to be equal.\");\n@@ -64,13 +61,13 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->encoder [tid]->create_sc_module ();\nthis->interleaver_e ->create_sc_module_interleaver ();\nthis->modem [tid]->create_sc_module_modulator ();\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\nthis->channel[tid]->create_sc_module_wg ();\nelse\nthis->channel[tid]->create_sc_module ();\nthis->modem [tid]->create_sc_module_filterer ();\nthis->quantizer [tid]->create_sc_module ();\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\nthis->modem [tid]->create_sc_module_tdemodulator_wg();\nelse\nthis->modem [tid]->create_sc_module_tdemodulator();\n@@ -79,7 +76,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->interleaver[tid]->create_sc_module_interleaver ();\nthis->decoder [tid]->create_sc_module ();\nthis->monitor [tid]->create_sc_module ();\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->coset_real[tid]->create_sc_module();\nthis->coset_real_i ->create_sc_module();\n@@ -87,13 +84,13 @@ void SC_Simulation_BFER_ite<B,R,Q>\n}\nthis->crc[tid]->create_sc_module_extract();\n- if (this->params.monitor.err_track_enable)\n+ if (this->params.err_track_enable)\n{\nconst auto &U_K = this->source [tid]->sc_module->get_U_K();\nconst auto &X_N = this->encoder[tid]->sc_module->get_X_N();\nthis->dumper[tid]->register_data(U_K, \"src\", false, {});\n- this->dumper[tid]->register_data(X_N, \"enc\", false, {(unsigned)this->params.code.K});\n+ this->dumper[tid]->register_data(X_N, \"enc\", false, {(unsigned)this->params.enc->K});\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\nif (this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\n@@ -101,24 +98,24 @@ void SC_Simulation_BFER_ite<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_ite<B,R,Q>\n+void SC_BFER_ite<B,R,Q>\n::release_objects()\n{\nif (interleaver_e != nullptr) { delete interleaver_e; interleaver_e = nullptr; }\nif (coset_real_i != nullptr) { delete coset_real_i; coset_real_i = nullptr; }\n- Simulation_BFER_ite<B,R,Q>::release_objects();\n+ BFER_ite<B,R,Q>::release_objects();\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_ite<B,R,Q>\n+void SC_BFER_ite<B,R,Q>\n::_launch()\n{\n- Predicate_ite p(this->params.simulation.n_ite);\n+ Predicate_ite p(this->params.n_ite);\nthis->duplicator[0] = new SC_Duplicator( \"Duplicator0\");\nthis->duplicator[1] = new SC_Duplicator( \"Duplicator1\");\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->duplicator[2] = new SC_Duplicator(\"Duplicator2\");\nthis->duplicator[3] = new SC_Duplicator(\"Duplicator3\");\n@@ -127,9 +124,9 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->router = new SC_Router (p, \"Router\" );\nthis->predicate = new SC_Predicate (p, \"Predicate\" );\n- if (this->params.simulation.n_threads == 1 && this->params.simulation.debug)\n+ if (this->params.n_threads == 1 && this->params.debug)\n{\n- const auto dl = this->params.simulation.debug_limit;\n+ const auto dl = this->params.debug_limit;\nthis->dbg_B[0] = new SC_Debug<B>(\"Generate random bits U_K... \\nU_K: \\n\", dl, \"Debug_B0\");\nthis->dbg_B[1] = new SC_Debug<B>(\"Add the CRC to U_K... \\nU_K: \\n\", dl, \"Debug_B1\");\n@@ -146,13 +143,13 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->dbg_B[4] = new SC_Debug<B>(\"Hard decode Y_N5 and generate V_K1... \\nV_K1:\\n\", dl, \"Debug_B4\");\nthis->dbg_B[6] = new SC_Debug<B>(\"Extract CRC bits from V_K1 into V_K2... \\nV_K2:\\n\", dl, \"Debug_B6\");\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->dbg_Q[5] = new SC_Debug<Q>(\"Apply the coset approach on Y_N5... \\nY_N5:\\n\", dl, \"Debug_Q5\");\nthis->dbg_Q[6] = new SC_Debug<Q>(\"Reverse the coset on Y_N6... \\nY_N6:\\n\", dl, \"Debug_Q6\");\nthis->dbg_B[5] = new SC_Debug<B>(\"Apply the coset approach on V_K... \\nV_K: \\n\", dl, \"Debug_B5\");\n}\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n+ if (this->params.chn->type.find(\"RAYLEIGHApply\") != std::string::npos)\nthis->dbg_R[3] = new SC_Debug<R>(\"Channel gains... \\nH_N: \\n\", dl, \"Debug_R3\");\nthis->bind_sockets_debug();\n@@ -205,10 +202,10 @@ void SC_Simulation_BFER_ite<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_ite<B,R,Q>\n+void SC_BFER_ite<B,R,Q>\n::bind_sockets()\n{\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->source [0]->sc_module ->s_out (this->duplicator [0] ->s_in );\nthis->duplicator [0] ->s_out1(this->monitor [0]->sc_module ->s_in1);\n@@ -222,7 +219,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->duplicator [4] ->s_out2(this->coset_real_i ->sc_module ->s_in1);\nthis->duplicator [3] ->s_out2(this->interleaver_e ->sc_module_inter ->s_in );\nthis->interleaver_e ->sc_module_inter ->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->modem [0]->sc_module_mod ->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->modem [0]->sc_module_tdemod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->modem [0]->sc_module_filt ->s_in );\n@@ -242,7 +239,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->router ->s_out2(this->decoder [0]->sc_module ->s_in );\nthis->siso [0]->sc_module_siso ->s_out (this->coset_real_i ->sc_module ->s_in2);\nthis->coset_real_i ->sc_module ->s_out (this->interleaver[0]->sc_module_inter ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->interleaver[0]->sc_module_inter ->s_out (this->modem [0]->sc_module_tdemod_wg->s_in3);\n} else {\nthis->interleaver[0]->sc_module_inter ->s_out (this->modem [0]->sc_module_tdemod ->s_in2);\n@@ -261,7 +258,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->crc [0]->sc_module_build ->s_out (this->encoder [0]->sc_module ->s_in );\nthis->encoder [0]->sc_module ->s_out (this->interleaver_e ->sc_module_inter ->s_in );\nthis->interleaver_e ->sc_module_inter ->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->modem [0]->sc_module_mod ->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->modem [0]->sc_module_tdemod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->modem [0]->sc_module_filt ->s_in );\n@@ -279,7 +276,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->router ->s_out1(this->siso [0]->sc_module_siso ->s_in );\nthis->router ->s_out2(this->decoder [0]->sc_module ->s_in );\nthis->siso [0]->sc_module_siso ->s_out (this->interleaver[0]->sc_module_inter ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->interleaver[0]->sc_module_inter ->s_out (this->modem [0]->sc_module_tdemod_wg->s_in3);\n} else {\nthis->interleaver[0]->sc_module_inter ->s_out (this->modem [0]->sc_module_tdemod ->s_in2);\n@@ -292,10 +289,10 @@ void SC_Simulation_BFER_ite<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_ite<B,R,Q>\n+void SC_BFER_ite<B,R,Q>\n::bind_sockets_debug()\n{\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->source [0]->sc_module ->s_out (this->dbg_B[0]->s_in); this->dbg_B[0]->s_out (this->duplicator [0] ->s_in );\nthis->duplicator [0] ->s_out1(this->monitor [0]->sc_module ->s_in1);\n@@ -309,7 +306,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->duplicator [4] ->s_out2(this->coset_real_i ->sc_module ->s_in1);\nthis->duplicator [3] ->s_out2(this->interleaver_e ->sc_module_inter ->s_in );\nthis->interleaver_e ->sc_module_inter ->s_out (this->dbg_B[3]->s_in); this->dbg_B[3]->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->modem [0]->sc_module_mod ->s_out (this->dbg_R[0]->s_in); this->dbg_R[0]->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->dbg_R[3]->s_in); this->dbg_R[3]->s_out (this->modem [0]->sc_module_tdemod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->dbg_R[1]->s_in); this->dbg_R[1]->s_out (this->modem [0]->sc_module_filt ->s_in );\n@@ -329,7 +326,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->router ->s_out2(this->decoder [0]->sc_module ->s_in );\nthis->siso [0]->sc_module_siso ->s_out (this->dbg_Q[3]->s_in); this->dbg_Q[3]->s_out (this->coset_real_i ->sc_module ->s_in2);\nthis->coset_real_i ->sc_module ->s_out (this->dbg_Q[6]->s_in); this->dbg_Q[6]->s_out (this->interleaver[0]->sc_module_inter ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->interleaver[0]->sc_module_inter ->s_out (this->dbg_Q[4]->s_in); this->dbg_Q[4]->s_out (this->modem [0]->sc_module_tdemod_wg->s_in3);\n} else {\nthis->interleaver[0]->sc_module_inter ->s_out (this->dbg_Q[4]->s_in); this->dbg_Q[4]->s_out (this->modem [0]->sc_module_tdemod ->s_in2);\n@@ -348,7 +345,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->crc [0]->sc_module_build ->s_out (this->dbg_B[1]->s_in); this->dbg_B[1]->s_out (this->encoder [0]->sc_module ->s_in );\nthis->encoder [0]->sc_module ->s_out (this->dbg_B[2]->s_in); this->dbg_B[2]->s_out (this->interleaver_e ->sc_module_inter ->s_in );\nthis->interleaver_e ->sc_module_inter ->s_out (this->dbg_B[3]->s_in); this->dbg_B[3]->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->modem [0]->sc_module_mod ->s_out (this->dbg_R[0]->s_in); this->dbg_R[0]->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->dbg_R[3]->s_in); this->dbg_R[3]->s_out (this->modem [0]->sc_module_tdemod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->dbg_R[1]->s_in); this->dbg_R[1]->s_out (this->modem [0]->sc_module_filt ->s_in );\n@@ -366,7 +363,7 @@ void SC_Simulation_BFER_ite<B,R,Q>\nthis->router ->s_out1(this->siso [0]->sc_module_siso ->s_in );\nthis->router ->s_out2(this->decoder [0]->sc_module ->s_in );\nthis->siso [0]->sc_module_siso ->s_out (this->dbg_Q[3]->s_in); this->dbg_Q[3]->s_out (this->interleaver[0]->sc_module_inter ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) {\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) {\nthis->interleaver[0]->sc_module_inter ->s_out (this->dbg_Q[4]->s_in); this->dbg_Q[4]->s_out (this->modem [0]->sc_module_tdemod_wg->s_in3);\n} else {\nthis->interleaver[0]->sc_module_inter ->s_out (this->dbg_Q[4]->s_in); this->dbg_Q[4]->s_out (this->modem [0]->sc_module_tdemod ->s_in2);\n@@ -379,38 +376,38 @@ void SC_Simulation_BFER_ite<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-Interleaver<int>* SC_Simulation_BFER_ite<B,R,Q>\n+Interleaver<int>* SC_BFER_ite<B,R,Q>\n::build_interleaver(const int tid, const int seed)\n{\n// build the objects\n- this->interleaver_e = Simulation_BFER_ite<B,R,Q>::build_interleaver(tid, seed);\n+ this->interleaver_e = BFER_ite<B,R,Q>::build_interleaver(tid, seed);\nthis->interleaver_e->init();\nthis->interleaver_e->rename(\"Interleaver_e\");\nif (this->interleaver_e->is_uniform())\nthis->monitor[tid]->add_handler_check(std::bind(&Interleaver<int>::refresh, this->interleaver_e));\n- return Simulation_BFER_ite<B,R,Q>::build_interleaver(tid, seed);\n+ return BFER_ite<B,R,Q>::build_interleaver(tid, seed);\n}\ntemplate <typename B, typename R, typename Q>\n-Coset<B,Q>* SC_Simulation_BFER_ite<B,R,Q>\n+Coset<B,Q>* SC_BFER_ite<B,R,Q>\n::build_coset_real(const int tid)\n{\n- this->coset_real_i = Simulation_BFER_ite<B,R,Q>::build_coset_real(tid);\n+ this->coset_real_i = BFER_ite<B,R,Q>::build_coset_real(tid);\nthis->coset_real_i->rename(\"Coset_real_i\");\n- return Simulation_BFER_ite<B,R,Q>::build_coset_real(tid);\n+ return BFER_ite<B,R,Q>::build_coset_real(tid);\n}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class aff3ct::simulation::SC_Simulation_BFER_ite<B_8,R_8,Q_8>;\n-template class aff3ct::simulation::SC_Simulation_BFER_ite<B_16,R_16,Q_16>;\n-template class aff3ct::simulation::SC_Simulation_BFER_ite<B_32,R_32,Q_32>;\n-template class aff3ct::simulation::SC_Simulation_BFER_ite<B_64,R_64,Q_64>;\n+template class aff3ct::simulation::SC_BFER_ite<B_8,R_8,Q_8>;\n+template class aff3ct::simulation::SC_BFER_ite<B_16,R_16,Q_16>;\n+template class aff3ct::simulation::SC_BFER_ite<B_32,R_32,Q_32>;\n+template class aff3ct::simulation::SC_BFER_ite<B_64,R_64,Q_64>;\n#else\n-template class aff3ct::simulation::SC_Simulation_BFER_ite<B,R,Q>;\n+template class aff3ct::simulation::SC_BFER_ite<B,R,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\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": "@@ -16,7 +16,7 @@ namespace aff3ct\nnamespace simulation\n{\ntemplate <typename B = int, typename R = float, typename Q = R>\n-class SC_Simulation_BFER_ite : public Simulation_BFER_ite<B,R,Q>\n+class SC_BFER_ite : public BFER_ite<B,R,Q>\n{\nprotected:\nmodule::Interleaver<int> *interleaver_e;\n@@ -31,8 +31,8 @@ protected:\ntools::SC_Debug<Q> *dbg_Q[7];\npublic:\n- SC_Simulation_BFER_ite(const tools::parameters& params, tools::Codec_SISO<B,Q> &codec);\n- virtual ~SC_Simulation_BFER_ite();\n+ SC_BFER_ite(const factory::BFER_ite::parameters ¶ms, tools::Codec_SISO<B,Q> &codec);\n+ virtual ~SC_BFER_ite();\nprotected:\nvirtual void _build_communication_chain(const int tid = 0);\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": "@@ -12,21 +12,21 @@ using namespace aff3ct::tools;\nusing namespace aff3ct::simulation;\ntemplate <typename B, typename R, typename Q>\n-SC_Simulation_BFER_std<B,R,Q>\n-::SC_Simulation_BFER_std(const parameters& params, Codec<B,Q> &codec)\n-: Simulation_BFER_std<B,R,Q>(params, codec),\n+SC_BFER_std<B,R,Q>\n+::SC_BFER_std(const factory::BFER_std::parameters ¶ms, Codec<B,Q> &codec)\n+: BFER_std<B,R,Q>(params, codec),\nduplicator{nullptr, nullptr, nullptr},\ndbg_B {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},\ndbg_R {nullptr, nullptr, nullptr},\ndbg_Q {nullptr, nullptr, nullptr}\n{\n- if (this->params.simulation.n_threads > 1)\n+ if (this->params.n_threads > 1)\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support multi-threading.\");\n- if (params.simulation.benchs)\n+ if (params.benchs)\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"SystemC simulation does not support the bench mode.\");\n- if (params.simulation.time_report)\n+ if (params.time_report)\nstd::clog << format_warning(\"The time report is not available in the SystemC simulation.\") << std::endl;\n#ifdef ENABLE_MPI\n@@ -36,16 +36,16 @@ SC_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-SC_Simulation_BFER_std<B,R,Q>\n-::~SC_Simulation_BFER_std()\n+SC_BFER_std<B,R,Q>\n+::~SC_BFER_std()\n{\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_std<B,R,Q>\n+void SC_BFER_std<B,R,Q>\n::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_std<B,R,Q>::_build_communication_chain(tid);\n+ BFER_std<B,R,Q>::_build_communication_chain(tid);\n// create the sc_module inside the objects of the communication chain\nthis->source [tid]->create_sc_module ();\n@@ -55,7 +55,7 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->puncturer[tid]->create_sc_module_depuncturer();\nthis->modem [tid]->create_sc_module_modulator ();\nthis->modem [tid]->create_sc_module_filterer ();\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\nthis->channel[tid]->create_sc_module_wg ();\nthis->modem [tid]->create_sc_module_demodulator_wg();\n@@ -68,20 +68,20 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->quantizer[tid]->create_sc_module();\nthis->decoder [tid]->create_sc_module();\nthis->monitor [tid]->create_sc_module();\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->coset_real[tid]->create_sc_module();\nthis->coset_bit [tid]->create_sc_module();\n}\nthis->crc[tid]->create_sc_module_extract();\n- if (this->params.monitor.err_track_enable)\n+ if (this->params.err_track_enable)\n{\nconst auto &U_K = this->source [tid]->sc_module->get_U_K();\nconst auto &X_N = this->encoder[tid]->sc_module->get_X_N();\nthis->dumper[tid]->register_data(U_K, \"src\", false, {});\n- this->dumper[tid]->register_data(X_N, \"enc\", false, {(unsigned)this->params.code.K});\n+ this->dumper[tid]->register_data(X_N, \"enc\", false, {(unsigned)this->params.enc->K});\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\nif (this->interleaver[tid] != nullptr && this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\n@@ -89,19 +89,19 @@ void SC_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_std<B,R,Q>\n+void SC_BFER_std<B,R,Q>\n::_launch()\n{\nthis->duplicator[0] = new SC_Duplicator(\"Duplicator0\");\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->duplicator[1] = new SC_Duplicator(\"Duplicator1\");\nthis->duplicator[2] = new SC_Duplicator(\"Duplicator2\");\n}\n- if (this->params.simulation.n_threads == 1 && this->params.simulation.debug)\n+ if (this->params.n_threads == 1 && this->params.debug)\n{\n- const auto dl = this->params.simulation.debug_limit;\n+ const auto dl = this->params.debug_limit;\nthis->dbg_B[0] = new SC_Debug<B>(\"Generate random bits U_K1... \\nU_K1:\\n\", dl, \"Debug_B0\");\nthis->dbg_B[1] = new SC_Debug<B>(\"Build the CRC from U_K1 into U_K2... \\nU_K2:\\n\", dl, \"Debug_B1\");\n@@ -116,12 +116,12 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->dbg_B[4] = new SC_Debug<B>(\"Decode Y_N5 and generate V_K1... \\nV_K1:\\n\", dl, \"Debug_B4\");\nthis->dbg_B[6] = new SC_Debug<B>(\"Extract CRC bits from V_K1 into V_K2... \\nV_K2:\\n\", dl, \"Debug_B6\");\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->dbg_Q[2] = new SC_Debug<Q>(\"Apply the coset approach on Y_N5... \\nY_N5:\\n\", dl, \"Debug_Q2\");\nthis->dbg_B[5] = new SC_Debug<B>(\"Apply the coset approach on V_K... \\nV_K: \\n\", dl, \"Debug_B5\");\n}\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\nthis->dbg_R[4] = new SC_Debug<R>(\"Channel gains... \\nH_N: \\n\", dl, \"Debug_R4\");\nthis->bind_sockets_debug();\n@@ -170,10 +170,10 @@ void SC_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_std<B,R,Q>\n+void SC_BFER_std<B,R,Q>\n::bind_sockets()\n{\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->source [0]->sc_module ->s_out (this->duplicator[0] ->s_in );\nthis->duplicator [0] ->s_out1(this->monitor [0]->sc_module ->s_in1);\n@@ -185,7 +185,7 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->duplicator [2] ->s_out1(this->coset_real[0]->sc_module ->s_in1);\nthis->duplicator [2] ->s_out2(this->puncturer [0]->sc_module_punct ->s_in );\nthis->puncturer [0]->sc_module_punct ->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\nthis->modem [0]->sc_module_mod ->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->modem [0]->sc_module_demod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->modem [0]->sc_module_filt ->s_in );\n@@ -212,7 +212,7 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->crc [0]->sc_module_build ->s_out (this->encoder [0]->sc_module ->s_in );\nthis->encoder [0]->sc_module ->s_out (this->puncturer [0]->sc_module_punct ->s_in );\nthis->puncturer [0]->sc_module_punct ->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\nthis->modem [0]->sc_module_mod ->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->modem [0]->sc_module_demod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->modem [0]->sc_module_filt ->s_in );\n@@ -232,10 +232,10 @@ void SC_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SC_Simulation_BFER_std<B,R,Q>\n+void SC_BFER_std<B,R,Q>\n::bind_sockets_debug()\n{\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nthis->source [0]->sc_module ->s_out (this->dbg_B[0]->s_in); this->dbg_B[0]->s_out (this->duplicator[0] ->s_in );\nthis->duplicator [0] ->s_out1(this->monitor [0]->sc_module ->s_in1);\n@@ -247,7 +247,7 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->duplicator [2] ->s_out1(this->coset_real[0]->sc_module ->s_in1);\nthis->duplicator [2] ->s_out2(this->puncturer [0]->sc_module_punct ->s_in );\nthis->puncturer [0]->sc_module_punct ->s_out (this->dbg_B[3]->s_in); this->dbg_B[3]->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\nthis->modem [0]->sc_module_mod ->s_out (this->dbg_R[0]->s_in); this->dbg_R[0]->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->dbg_R[4]->s_in); this->dbg_R[4]->s_out (this->modem [0]->sc_module_demod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->dbg_R[1]->s_in); this->dbg_R[1]->s_out (this->modem [0]->sc_module_filt ->s_in );\n@@ -274,7 +274,7 @@ void SC_Simulation_BFER_std<B,R,Q>\nthis->crc [0]->sc_module_build ->s_out (this->dbg_B[1]->s_in); this->dbg_B[1]->s_out (this->encoder [0]->sc_module ->s_in );\nthis->encoder [0]->sc_module ->s_out (this->dbg_B[2]->s_in); this->dbg_B[2]->s_out (this->puncturer [0]->sc_module_punct ->s_in );\nthis->puncturer [0]->sc_module_punct ->s_out (this->dbg_B[3]->s_in); this->dbg_B[3]->s_out (this->modem [0]->sc_module_mod ->s_in );\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos) { // Rayleigh channel\nthis->modem [0]->sc_module_mod ->s_out (this->dbg_R[0]->s_in); this->dbg_R[0]->s_out (this->channel [0]->sc_module_wg ->s_in );\nthis->channel [0]->sc_module_wg ->s_out1(this->dbg_R[4]->s_in); this->dbg_R[4]->s_out (this->modem [0]->sc_module_demod_wg->s_in1);\nthis->channel [0]->sc_module_wg ->s_out2(this->dbg_R[1]->s_in); this->dbg_R[1]->s_out (this->modem [0]->sc_module_filt ->s_in );\n@@ -296,12 +296,12 @@ void SC_Simulation_BFER_std<B,R,Q>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class aff3ct::simulation::SC_Simulation_BFER_std<B_8,R_8,Q_8>;\n-template class aff3ct::simulation::SC_Simulation_BFER_std<B_16,R_16,Q_16>;\n-template class aff3ct::simulation::SC_Simulation_BFER_std<B_32,R_32,Q_32>;\n-template class aff3ct::simulation::SC_Simulation_BFER_std<B_64,R_64,Q_64>;\n+template class aff3ct::simulation::SC_BFER_std<B_8,R_8,Q_8>;\n+template class aff3ct::simulation::SC_BFER_std<B_16,R_16,Q_16>;\n+template class aff3ct::simulation::SC_BFER_std<B_32,R_32,Q_32>;\n+template class aff3ct::simulation::SC_BFER_std<B_64,R_64,Q_64>;\n#else\n-template class aff3ct::simulation::SC_Simulation_BFER_std<B,R,Q>;\n+template class aff3ct::simulation::SC_BFER_std<B,R,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\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": "@@ -16,7 +16,7 @@ namespace aff3ct\nnamespace simulation\n{\ntemplate <typename B = int, typename R = float, typename Q = R>\n-class SC_Simulation_BFER_std : public Simulation_BFER_std<B,R,Q>\n+class SC_BFER_std : public BFER_std<B,R,Q>\n{\nprotected:\ntools::SC_Duplicator *duplicator[3];\n@@ -25,8 +25,8 @@ protected:\ntools::SC_Debug<Q> *dbg_Q [3];\npublic:\n- SC_Simulation_BFER_std(const tools::parameters& params, tools::Codec<B,Q> &codec);\n- virtual ~SC_Simulation_BFER_std();\n+ SC_BFER_std(const factory::BFER_std::parameters &chain_params, tools::Codec<B,Q> &codec);\n+ virtual ~SC_BFER_std();\nprotected:\nvirtual void _build_communication_chain(const int tid = 0);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix SystemC simus.
|
8,490 |
25.07.2017 21:40:11
| -7,200 |
f2c0af32f29f4458323e5d29a6f476fe18b862bc
|
Fix StarPU simulation.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.cpp",
"diff": "@@ -12,47 +12,47 @@ using namespace aff3ct::tools;\nusing namespace aff3ct::simulation;\ntemplate <typename B, typename R, typename Q>\n-SPU_Simulation_BFER_std<B,R,Q>\n-::SPU_Simulation_BFER_std(const parameters& params, Codec<B,Q> &codec)\n-: Simulation_BFER_std<B,R,Q>(params, codec),\n+SPU_BFER_std<B,R,Q>\n+::SPU_BFER_std(const factory::BFER_std::parameters ¶ms, Codec<B,Q> &codec)\n+: BFER_std<B,R,Q>(params, codec),\n- task_names(this->params.simulation.n_threads, std::vector<std::string>(15)),\n+ task_names(this->params.n_threads, std::vector<std::string>(15)),\nframe_id(0),\n- U_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\n- U_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\n- X_N1(this->params.simulation.n_threads, mipp::vector<B>(params.code.N_code * params.simulation.inter_frame_level)),\n- X_N2(this->params.simulation.n_threads, mipp::vector<B>(params.code.N * params.simulation.inter_frame_level)),\n- X_N3(this->params.simulation.n_threads, mipp::vector<R>(params.code.N_mod * params.simulation.inter_frame_level)),\n- H_N (this->params.simulation.n_threads, mipp::vector<R>(params.code.N_mod * params.simulation.inter_frame_level)),\n- Y_N1(this->params.simulation.n_threads, mipp::vector<R>(params.code.N_mod * params.simulation.inter_frame_level)),\n- Y_N2(this->params.simulation.n_threads, mipp::vector<R>(params.code.N_fil * params.simulation.inter_frame_level)),\n- Y_N3(this->params.simulation.n_threads, mipp::vector<R>(params.code.N * params.simulation.inter_frame_level)),\n- Y_N4(this->params.simulation.n_threads, mipp::vector<Q>(params.code.N * params.simulation.inter_frame_level)),\n- Y_N5(this->params.simulation.n_threads, mipp::vector<Q>(params.code.N_code * params.simulation.inter_frame_level)),\n- V_K1(this->params.simulation.n_threads, mipp::vector<B>(params.code.K * params.simulation.inter_frame_level)),\n- V_K2(this->params.simulation.n_threads, mipp::vector<B>(params.code.K_info * params.simulation.inter_frame_level)),\n-\n- spu_U_K1(this->params.simulation.n_threads),\n- spu_U_K2(this->params.simulation.n_threads),\n- spu_X_N1(this->params.simulation.n_threads),\n- spu_X_N2(this->params.simulation.n_threads),\n- spu_X_N3(this->params.simulation.n_threads),\n- spu_H_N (this->params.simulation.n_threads),\n- spu_Y_N1(this->params.simulation.n_threads),\n- spu_Y_N2(this->params.simulation.n_threads),\n- spu_Y_N3(this->params.simulation.n_threads),\n- spu_Y_N4(this->params.simulation.n_threads),\n- spu_Y_N5(this->params.simulation.n_threads),\n- spu_V_K1(this->params.simulation.n_threads),\n- spu_V_K2(this->params.simulation.n_threads)\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.simulation.debug)\n+ if (params.debug)\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation does not support the debug mode.\");\n- if (params.simulation.benchs)\n+ if (params.benchs)\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"StarPU simulation does not support the bench mode.\");\n- if (params.simulation.time_report)\n+ if (params.time_report)\nstd::clog << format_warning(\"The time report is not available in the StarPU simulation.\") << std::endl;\n// initialize StarPU with default configuration\n@@ -71,7 +71,7 @@ SPU_Simulation_BFER_std<B,R,Q>\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.simulation.n_threads; tid++)\n+ for (auto tid = 0; tid < this->params.n_threads; tid++)\n{\nstarpu_vector_data_register(&spu_U_K1[tid], STARPU_MAIN_RAM, (uintptr_t)U_K1[tid].data(), U_K1[tid].size(), sizeof(B));\nstarpu_vector_data_register(&spu_U_K2[tid], STARPU_MAIN_RAM, (uintptr_t)U_K2[tid].data(), U_K2[tid].size(), sizeof(B));\n@@ -104,11 +104,11 @@ SPU_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-SPU_Simulation_BFER_std<B,R,Q>\n-::~SPU_Simulation_BFER_std()\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.simulation.n_threads; tid++)\n+ for (auto tid = 0; tid < this->params.n_threads; tid++)\n{\nstarpu_data_unregister(spu_U_K1[tid]);\nstarpu_data_unregister(spu_U_K2[tid]);\n@@ -130,12 +130,12 @@ SPU_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SPU_Simulation_BFER_std<B,R,Q>\n+void SPU_BFER_std<B,R,Q>\n::_build_communication_chain(const int tid)\n{\n- Simulation_BFER_std<B,R,Q>::_build_communication_chain(tid);\n+ BFER_std<B,R,Q>::_build_communication_chain(tid);\n- if (this->params.source.type == \"AZCW\")\n+ if (this->params.src->type == \"AZCW\")\n{\nstd::fill(this->U_K1[tid].begin(), this->U_K1[tid].end(), (B)0);\nstd::fill(this->U_K2[tid].begin(), this->U_K2[tid].end(), (B)0);\n@@ -144,10 +144,10 @@ void SPU_Simulation_BFER_std<B,R,Q>\nthis->modem[tid]->modulate(this->X_N2[tid], this->X_N3[tid]);\n}\n- if (this->params.monitor.err_track_enable)\n+ if (this->params.err_track_enable)\n{\nthis->dumper[tid]->register_data(U_K1[tid], \"src\", false, {});\n- this->dumper[tid]->register_data(X_N1[tid], \"enc\", false, {(unsigned)this->params.code.K});\n+ this->dumper[tid]->register_data(X_N1[tid], \"enc\", false, {(unsigned)this->params.enc->K});\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\nif (this->interleaver[tid] != nullptr && this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\n@@ -155,13 +155,13 @@ void SPU_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SPU_Simulation_BFER_std<B,R,Q>\n+void SPU_BFER_std<B,R,Q>\n::_launch()\n{\n// Monte Carlo simulation\nwhile (!this->monitor_red->fe_limit_achieved())\n{\n- for (auto tid = 0; tid < this->params.simulation.n_threads; tid++)\n+ for (auto tid = 0; tid < this->params.n_threads; tid++)\nthis->seq_tasks_submission(tid);\nstarpu_task_wait_for_all();\n@@ -169,12 +169,12 @@ void SPU_Simulation_BFER_std<B,R,Q>\n}\ntemplate <typename B, typename R, typename Q>\n-void SPU_Simulation_BFER_std<B,R,Q>\n+void SPU_BFER_std<B,R,Q>\n::seq_tasks_submission(const int tid)\n{\nconst std::string str_id = std::to_string(frame_id);\n- if (this->params.source.type != \"AZCW\")\n+ if (this->params.src->type != \"AZCW\")\n{\nauto task_gen_source = Source <B >::spu_task_generate(this->source [tid], spu_U_K1[tid] );\nauto task_build_crc = CRC <B >::spu_task_build (this->crc [tid], spu_U_K1[tid], spu_U_K2[tid]);\n@@ -202,7 +202,7 @@ void SPU_Simulation_BFER_std<B,R,Q>\n}\n// Rayleigh channel\n- if (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\n+ if (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\nauto task_add_noise_wg = Channel< R >::spu_task_add_noise_wg (this->channel[tid], spu_X_N3[tid], spu_Y_N1[tid], spu_H_N [tid]);\nauto task_filter = Modem <B,R,R>::spu_task_filter (this->modem [tid], spu_Y_N1[tid], spu_Y_N2[tid] );\n@@ -251,7 +251,7 @@ void SPU_Simulation_BFER_std<B,R,Q>\nSTARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_quantize ), \"task_submit::qnt::process\" );\nSTARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_depuncture), \"task_submit::pct::depuncture\");\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nauto task_coset_real = Coset<B,Q>::spu_task_apply(this->coset_real[tid], spu_X_N1[tid], spu_Y_N5[tid], spu_Y_N5[tid]);\ntask_coset_real->priority = STARPU_MIN_PRIO +10;\n@@ -264,7 +264,7 @@ void SPU_Simulation_BFER_std<B,R,Q>\ntask_names[tid][11] = \"dec::hard_decode_\" + str_id; task_decode->name = task_names[tid][11].c_str();\nSTARPU_CHECK_RETURN_VALUE(starpu_task_submit(task_decode), \"task_submit::dec::hard_decode\");\n- if (this->params.code.coset)\n+ if (this->params.coset)\n{\nauto task_coset_bit = Coset<B,B>::spu_task_apply(this->coset_bit[tid], spu_U_K2[tid], spu_V_K1[tid], spu_V_K1[tid]);\ntask_coset_bit->priority = STARPU_MIN_PRIO +12;\n@@ -288,12 +288,12 @@ void SPU_Simulation_BFER_std<B,R,Q>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class aff3ct::simulation::SPU_Simulation_BFER_std<B_8,R_8,Q_8>;\n-template class aff3ct::simulation::SPU_Simulation_BFER_std<B_16,R_16,Q_16>;\n-template class aff3ct::simulation::SPU_Simulation_BFER_std<B_32,R_32,Q_32>;\n-template class aff3ct::simulation::SPU_Simulation_BFER_std<B_64,R_64,Q_64>;\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_Simulation_BFER_std<B,R,Q>;\n+template class aff3ct::simulation::SPU_BFER_std<B,R,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.hpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.hpp",
"diff": "@@ -14,7 +14,7 @@ namespace aff3ct\nnamespace simulation\n{\ntemplate <typename B = int, typename R = float, typename Q = R>\n-class SPU_Simulation_BFER_std : public Simulation_BFER_std<B,R,Q>\n+class SPU_BFER_std : public BFER_std<B,R,Q>\n{\nprivate:\nstd::condition_variable cond_terminal;\n@@ -53,8 +53,8 @@ protected:\nstd::vector<starpu_data_handle_t> spu_V_K2;\npublic:\n- SPU_Simulation_BFER_std(const tools::parameters& params, tools::Codec<B,Q> &codec);\n- virtual ~SPU_Simulation_BFER_std();\n+ SPU_BFER_std(const factory::BFER_std::parameters ¶ms, tools::Codec<B,Q> &codec);\n+ virtual ~SPU_BFER_std();\nprotected:\nvirtual void _build_communication_chain(const int tid = 0);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix StarPU simulation.
|
8,490 |
26.07.2017 10:54:54
| -7,200 |
e6aeff8b13e97002c8f673a783d8a2076294e666
|
Display warnings just before the simulation.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -66,7 +66,7 @@ int Launcher::read_arguments()\n{\nthis->build_args();\n- std::vector<std::string> cmd_warn, cmd_error;\n+ std::vector<std::string> cmd_error;\nbool miss_arg = !ar.parse_arguments(req_args, opt_args, cmd_warn);\nbool error = !ar.check_arguments(cmd_error);\n@@ -88,13 +88,6 @@ int Launcher::read_arguments()\nif (miss_arg)\nstd::cerr << tools::format_error(\"At least one required argument is missing.\") << std::endl;\n- // print the warnings\n-#ifdef ENABLE_MPI\n- if (simu_params->mpi_rank == 0)\n-#endif\n- for (unsigned w = 0; w < cmd_warn.size(); w++)\n- std::clog << tools::format_warning(cmd_warn[w]) << std::endl;\n-\n// print the help tags\nif ((miss_arg || error) && !params->display_help)\n{\n@@ -161,7 +154,15 @@ void Launcher::launch()\n}\nif (this->read_arguments() == EXIT_FAILURE)\n+ {\n+ // print the warnings\n+#ifdef ENABLE_MPI\n+ if (simu_params->mpi_rank == 0)\n+#endif\n+ for (unsigned w = 0; w < cmd_warn.size(); w++)\n+ std::clog << tools::format_warning(cmd_warn[w]) << std::endl;\nreturn;\n+ }\n// write the command and he curve name in the PyBER format\n#ifdef ENABLE_MPI\n@@ -181,6 +182,13 @@ void Launcher::launch()\n#endif\nthis->print_header();\n+ // print the warnings\n+#ifdef ENABLE_MPI\n+ if (simu_params->mpi_rank == 0)\n+#endif\n+ for (unsigned w = 0; w < cmd_warn.size(); w++)\n+ std::clog << tools::format_warning(cmd_warn[w]) << std::endl;\n+\ntry\n{\nsimu = this->build_simu();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.hpp",
"new_path": "src/Launcher/Launcher.hpp",
"diff": "@@ -33,7 +33,7 @@ class Launcher\nprivate:\nsimulation::Simulation *simu; /*!< A generic simulation pointer to allocate a specific simulation. */\nstd::string cmd_line;\n-\n+ std::vector<std::string> cmd_warn;\nprotected:\ntools::Arguments_reader ar; /*!< An argument reader to manage the parsing and the documentation of the command line parameters. */\ntools::Arguments_reader::arg_map req_args; /*!< List of the required arguments, syntax is the following:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Display warnings just before the simulation.
|
8,490 |
26.07.2017 11:28:10
| -7,200 |
1bd36e7decf445dd55dfd4149f14b6231f6b1e91
|
Fix perf. issue in the AList reader.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"new_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"diff": "@@ -247,37 +247,38 @@ Sparse_matrix AList\n}\n}\n- for (unsigned i = 0; i < n_cols; i++)\n- {\n- for (unsigned j = 0; j < cols_max_degree; j++)\n- {\n- unsigned row_index = 0;\n- stream >> row_index;\n-\n- if ((row_index > 0 && j < cols_degree[i]) ||\n- (row_index <= 0 && j >= cols_degree[i]))\n- {\n- if (row_index)\n- {\n- try\n- {\n- matrix.add_connection(row_index -1, i);\n- throw runtime_error(__FILE__, __LINE__, __func__, \"The input AList is not consistent.\");\n- }\n- catch (std::exception const&)\n- {\n- // everything is normal if the code passes through the catch\n- }\n- }\n- }\n- else\n- {\n- std::stringstream message;\n- message << \"'row_index' is wrong ('row_index' = \" << row_index << \").\";\n- runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- }\n- }\n+ // TODO: this verif. is time consuming\n+// for (unsigned i = 0; i < n_cols; i++)\n+// {\n+// for (unsigned j = 0; j < cols_max_degree; j++)\n+// {\n+// unsigned row_index = 0;\n+// stream >> row_index;\n+//\n+// if ((row_index > 0 && j < cols_degree[i]) ||\n+// (row_index <= 0 && j >= cols_degree[i]))\n+// {\n+// if (row_index)\n+// {\n+// try\n+// {\n+// matrix.add_connection(row_index -1, i);\n+// throw runtime_error(__FILE__, __LINE__, __func__, \"The input AList is not consistent.\");\n+// }\n+// catch (std::exception const&)\n+// {\n+// // everything is normal if the code passes through the catch\n+// }\n+// }\n+// }\n+// else\n+// {\n+// std::stringstream message;\n+// message << \"'row_index' is wrong ('row_index' = \" << row_index << \").\";\n+// throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+// }\n+// }\n+// }\nreturn matrix;\n}\n@@ -422,46 +423,47 @@ Sparse_matrix AList\n}\n}\n- for (unsigned i = 0; i < n_cols; i++)\n- {\n- getline(stream, line);\n- values = split(line);\n-\n- if (values.size() < cols_degree[i])\n- {\n- std::stringstream message;\n- message << \"'values.size()' has to be greater or equal to 'cols_degree[i]' ('values.size()' = \"\n- << values.size() << \", 'i' = \" << i << \", 'cols_degree[i]' = \" << cols_degree[i] << \").\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- for (unsigned j = 0; j < cols_max_degree; j++)\n- {\n- auto row_index = (j < values.size()) ? std::stoi(values[j]) : 0;\n- if ((row_index > 0 && j < cols_degree[i]) ||\n- (row_index <= 0 && j >= cols_degree[i]))\n- {\n- if (row_index)\n- {\n- try\n- {\n- matrix.add_connection(row_index -1, i);\n- throw runtime_error(__FILE__, __LINE__, __func__, \"The input AList file is not consistent.\");\n- }\n- catch (std::exception const&)\n- {\n- // everything is normal if the code passes through the catch\n- }\n- }\n- }\n- else\n- {\n- std::stringstream message;\n- message << \"'row_index' is wrong ('row_index' = \" << row_index << \").\";\n- throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- }\n- }\n+ // TODO: this verif. is time consuming\n+// for (unsigned i = 0; i < n_cols; i++)\n+// {\n+// getline(stream, line);\n+// values = split(line);\n+//\n+// if (values.size() < cols_degree[i])\n+// {\n+// std::stringstream message;\n+// message << \"'values.size()' has to be greater or equal to 'cols_degree[i]' ('values.size()' = \"\n+// << values.size() << \", 'i' = \" << i << \", 'cols_degree[i]' = \" << cols_degree[i] << \").\";\n+// throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+// }\n+//\n+// for (unsigned j = 0; j < cols_max_degree; j++)\n+// {\n+// auto row_index = (j < values.size()) ? std::stoi(values[j]) : 0;\n+// if ((row_index > 0 && j < cols_degree[i]) ||\n+// (row_index <= 0 && j >= cols_degree[i]))\n+// {\n+// if (row_index)\n+// {\n+// try\n+// {\n+// matrix.add_connection(row_index -1, i);\n+// throw runtime_error(__FILE__, __LINE__, __func__, \"The input AList file is not consistent.\");\n+// }\n+// catch (std::exception const&)\n+// {\n+// // everything is normal if the code passes through the catch\n+// }\n+// }\n+// }\n+// else\n+// {\n+// std::stringstream message;\n+// message << \"'row_index' is wrong ('row_index' = \" << row_index << \").\";\n+// throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+// }\n+// }\n+// }\nreturn matrix;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix perf. issue in the AList reader.
|
8,490 |
26.07.2017 12:01:30
| -7,200 |
f156056d18e0c5ee9986ab4703e8f6512b8b64ad
|
Update the AFF3CT reader.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "//find ./src/ -type f -follow -print | grep \"[.]h$\"\n-#include <Tools/general_utils.h>\n#include <Tools/git_sha1.h>\n+#include <Tools/general_utils.h>\n#include <Tools/types.h>\n#include <Tools/Math/matrix.h>\n#include <Tools/Math/utils.h>\n#include <Tools/Math/max.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/Code/Polar/API/functions_polar_intra.h>\n#include <Tools/Perf/Transpose/transpose_NEON.h>\n#include <Tools/Display/bash_tools.h>\n// #include <Tools/MSVC/dirent.h>\n-#include <Tools/params.h>\n//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n-#include <Tools/Exception/exception.hpp>\n#include <Tools/Threads/Barrier.hpp>\n#include <Tools/Math/Galois.hpp>\n-#include <Tools/Factory/Factory_monitor.hpp>\n-#include <Tools/Factory/Polar/Factory_decoder_polar_gen.hpp>\n-#include <Tools/Factory/Polar/Factory_decoder_polar.hpp>\n-#include <Tools/Factory/Polar/Factory_encoder_polar.hpp>\n-#include <Tools/Factory/Polar/Factory_frozenbits_generator.hpp>\n-#include <Tools/Factory/Polar/Factory_puncturer_polar.hpp>\n-#include <Tools/Factory/Factory_quantizer.hpp>\n-#include <Tools/Factory/Factory_channel.hpp>\n-#include <Tools/Factory/Factory.hpp>\n-#include <Tools/Factory/RSC/Factory_decoder_RSC.hpp>\n-#include <Tools/Factory/RSC/Factory_encoder_RSC.hpp>\n-#include <Tools/Factory/Factory_interleaver.hpp>\n-#include <Tools/Factory/Factory_encoder_common.hpp>\n-#include <Tools/Factory/Repetition/Factory_decoder_repetition.hpp>\n-#include <Tools/Factory/Repetition/Factory_encoder_repetition.hpp>\n-#include <Tools/Factory/LDPC/Factory_encoder_LDPC.hpp>\n-#include <Tools/Factory/LDPC/Factory_decoder_LDPC.hpp>\n-#include <Tools/Factory/Coset/Factory_coset_real.hpp>\n-#include <Tools/Factory/Coset/Factory_coset_bit.hpp>\n-#include <Tools/Factory/BCH/Factory_encoder_BCH.hpp>\n-#include <Tools/Factory/BCH/Factory_decoder_BCH.hpp>\n-#include <Tools/Factory/Factory_CRC.hpp>\n-#include <Tools/Factory/Factory_source.hpp>\n-#include <Tools/Factory/Factory_modem.hpp>\n-#include <Tools/Factory/RA/Factory_encoder_RA.hpp>\n-#include <Tools/Factory/RA/Factory_decoder_RA.hpp>\n-#include <Tools/Factory/Turbo/Factory_encoder_turbo.hpp>\n-#include <Tools/Factory/Turbo/Factory_scaling_factor.hpp>\n-#include <Tools/Factory/Turbo/Factory_puncturer_turbo.hpp>\n-#include <Tools/Factory/Turbo/Factory_decoder_turbo.hpp>\n#include <Tools/Algo/Sort/LC_sorter.hpp>\n#include <Tools/Algo/Sort/LC_sorter_simd.hpp>\n#include <Tools/Algo/PRNG/PRNG_MT19937_simd.hpp>\n#include <Tools/Algo/PRNG/PRNG_MT19937.hpp>\n#include <Tools/Algo/Predicate.hpp>\n+#include <Tools/Algo/Sparse_matrix/Sparse_matrix.hpp>\n#include <Tools/Algo/Tree/Binary_node.hpp>\n#include <Tools/Algo/Tree/Binary_tree.hpp>\n#include <Tools/Algo/Tree/Binary_tree_metric.hpp>\n#include <Tools/Codec/BCH/Codec_BCH.hpp>\n#include <Tools/Codec/RA/Codec_RA.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/runtime_error/runtime_error.hpp>\n+#include <Tools/Exception/underflow_error/underflow_error.hpp>\n+#include <Tools/Exception/unimplemented_error/unimplemented_error.hpp>\n+#include <Tools/Exception/invalid_argument/invalid_argument.hpp>\n+#include <Tools/Exception/length_error/length_error.hpp>\n+#include <Tools/Exception/overflow_error/overflow_error.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/NO/Interleaver_NO.hpp>\n#include <Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp>\n#include <Module/Interleaver/LTE/Interleaver_LTE.hpp>\n-// #include <Module/Modem/SC_Modem.hpp>\n-#include <Module/Modem/BPSK/Modem_BPSK_fast.hpp>\n-#include <Module/Modem/BPSK/Modem_BPSK.hpp>\n-#include <Module/Modem/PSK/Modem_PSK.hpp>\n-#include <Module/Modem/CPM/CPM_parameters.hpp>\n-#include <Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.hpp>\n-#include <Module/Modem/CPM/CPE/Encoder_CPE.hpp>\n-#include <Module/Modem/CPM/BCJR/CPM_BCJR.hpp>\n-#include <Module/Modem/CPM/Modem_CPM.hpp>\n-#include <Module/Modem/User/Modem_user.hpp>\n-#include <Module/Modem/QAM/Modem_QAM.hpp>\n-#include <Module/Modem/PAM/Modem_PAM.hpp>\n-// #include <Module/Modem/SPU_Modem.hpp>\n-#include <Module/Modem/SCMA/Modem_SCMA.hpp>\n-#include <Module/Modem/Modem.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/Decoder/Polar/SC/Decoder_polar_SC_naive.hpp>\n#include <Module/Decoder/Polar/SC/Decoder_polar_SC_naive_sys.hpp>\n#include <Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR15.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K873813_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K54613_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K524288_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K9830_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29491_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K19661_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K64_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K32_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K27_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K2_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K4_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29492_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K614_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K3413_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K13107_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K19661_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K7_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K109227_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1229_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K614_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K107_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K4096_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1638_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1024_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K3413_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR18.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K512_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29491_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K13_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K218453_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K13_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K53_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K436907_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K109227_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K873813_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K427_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K4_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K13653_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K14746_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1638_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K3_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K3277_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K3_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K2_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K14746_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K427_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K32_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K6827_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K13107_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K27_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K16_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K205_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K853_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K524288_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K819_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K131072_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K256_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K22938_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27307_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K22938_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K65536_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27568_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K128_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1434_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K6554_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27568_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K512_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K262144_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K26214_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K54613_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR33.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K6827_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K8192_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K65536_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K26214_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K8_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K128_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K213_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K436907_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR15.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K213_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K262144_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K13653_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K7_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K6554_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K205_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K53_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K218453_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR18.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1024_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K256_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K64_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1707_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K4096_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29492_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1229_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K16_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27307_SNR40.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K410_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1434_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1707_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K819_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K410_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K107_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K3277_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K8_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR33.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K9830_SNR25.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K853_SNR40.short.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K131072_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K8192_SNR25.short.hpp>\n#include <Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp>\n#include <Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp>\n#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive_sys.hpp>\n#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.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/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N4_K2_SNR25.hpp>\n-// #include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N256_K64_SNR30.hpp>\n-// #include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N2048_K1755_SNR35.hpp>\n#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp>\n// #include <Module/Decoder/SPU_Decoder.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std_json.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/PSK/Modem_PSK.hpp>\n+#include <Module/Modem/CPM/Modem_CPM.hpp>\n+#include <Module/Modem/CPM/CPM_parameters.hpp>\n+#include <Module/Modem/CPM/CPE/Encoder_CPE_Rimoldi.hpp>\n+#include <Module/Modem/CPM/CPE/Encoder_CPE.hpp>\n+#include <Module/Modem/CPM/BCJR/CPM_BCJR.hpp>\n+#include <Module/Modem/User/Modem_user.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/Module.hpp>\n-#include <Launcher/EXIT/Polar/Launcher_EXIT_polar.hpp>\n-#include <Launcher/EXIT/RSC/Launcher_EXIT_RSC.hpp>\n-#include <Launcher/EXIT/Launcher_EXIT.hpp>\n-#include <Launcher/GEN/Polar/Launcher_GEN_polar.hpp>\n-#include <Launcher/GEN/Launcher_GEN.hpp>\n-#include <Launcher/BFER/Launcher_BFER.hpp>\n-#include <Launcher/BFER/Polar/Launcher_BFER_polar.hpp>\n-#include <Launcher/BFER/RSC/Launcher_BFER_RSC.hpp>\n-#include <Launcher/BFER/Repetition/Launcher_BFER_repetition.hpp>\n-#include <Launcher/BFER/LDPC/Launcher_BFER_LDPC.hpp>\n-#include <Launcher/BFER/Uncoded/Launcher_BFER_uncoded.hpp>\n-#include <Launcher/BFER/BCH/Launcher_BFER_BCH.hpp>\n-#include <Launcher/BFER/RA/Launcher_BFER_RA.hpp>\n-#include <Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp>\n-#include <Launcher/BFERI/Launcher_BFERI.hpp>\n-#include <Launcher/BFERI/Polar/Launcher_BFERI_polar.hpp>\n-#include <Launcher/BFERI/RSC/Launcher_BFERI_RSC.hpp>\n-#include <Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.hpp>\n-#include <Launcher/BFERI/Uncoded/Launcher_BFERI_uncoded.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/Terminal.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/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/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/Launcher/Launcher.hpp>\n+#include <Factory/Simulation/Simulation.hpp>\n+#include <Factory/Simulation/EXIT/EXIT.hpp>\n+#include <Factory/Simulation/BFER/BFER_std.hpp>\n+#include <Factory/Simulation/BFER/BFER.hpp>\n+#include <Factory/Simulation/BFER/BFER_ite.hpp>\n+#include <Launcher/Code/Polar/Polar.hpp>\n+#include <Launcher/Code/RSC/RSC.hpp>\n+#include <Launcher/Code/Repetition/Repetition.hpp>\n+#include <Launcher/Code/LDPC/LDPC.hpp>\n+#include <Launcher/Code/Uncoded/Uncoded.hpp>\n+#include <Launcher/Code/BCH/BCH.hpp>\n+#include <Launcher/Code/RA/RA.hpp>\n+#include <Launcher/Code/Turbo/Turbo.hpp>\n+#include <Launcher/Simulation/BFER_std.hpp>\n+#include <Launcher/Simulation/EXIT.hpp>\n+#include <Launcher/Simulation/BFER_ite.hpp>\n#include <Launcher/Launcher.hpp>\n#include <Simulation/Simulation.hpp>\n-#include <Simulation/GEN/Code/Polar/Generation_polar.hpp>\n-#include <Generator/Polar/SC/Generator_polar_SC_sys.hpp>\n-#include <Generator/Polar/Generator_polar.hpp>\n-#include <Generator/Polar/SCL/Generator_polar_SCL_sys.hpp>\n-#include <Generator/Generator.hpp>\n-\n-#include \"Simulation/BFER/BFER.hpp\"\n-#include \"Simulation/BFER/Iterative/BFER_ite.hpp\"\n-#include \"Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp\"\n-#include \"Simulation/BFER/Iterative/Threads/BFER_ite_threads.hpp\"\n-#include \"Simulation/BFER/Standard/BFER_std.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/Standard/Threads/BFER_std_threads.hpp\"\n-#include \"Simulation/EXIT/EXIT.hpp\"\n+#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+#include <Simulation/BFER/Iterative/BFER_ite.hpp>\n+#include <Simulation/BFER/BFER.hpp>\n+// #include <aff3ct.hpp>\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the AFF3CT reader.
|
8,490 |
26.07.2017 12:14:21
| -7,200 |
01ce30a15f2ec58aa0e9d635fef00851fc6c0984
|
Fix the cmake MKL module for MacOS.
|
[
{
"change_type": "MODIFY",
"old_path": "cmake/Modules/FindMKL.cmake",
"new_path": "cmake/Modules/FindMKL.cmake",
"diff": "@@ -43,6 +43,13 @@ if(WIN32)\nelse()\nset(CMAKE_FIND_LIBRARY_SUFFIXES _dll.lib)\nendif()\n+else()\n+ if(APPLE)\n+ if(MKL_STATAIC)\n+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a)\n+ else()\n+ set(CMAKE_FIND_LIBRARY_SUFFIXES .dylib)\n+ endif()\nelse()\nif(MKL_STATAIC)\nset(CMAKE_FIND_LIBRARY_SUFFIXES .a)\n@@ -50,11 +57,18 @@ else()\nset(CMAKE_FIND_LIBRARY_SUFFIXES .so)\nendif()\nendif()\n+endif()\n# MKL is composed by four layers: Interface, Threading, Computational and RTL\n+if(APPLE)\n+ set(MKL_LIBRARIES_PATH\n+ # ${MKL_ROOT}/lib/ia32/\n+ ${MKL_ROOT}/lib/)\n+else()\nset(MKL_LIBRARIES_PATH\n# ${MKL_ROOT}/lib/ia32/\n${MKL_ROOT}/lib/intel64/)\n+endif()\nset(INTEL_LIBRARIES_PATH\n# ${INTEL_ROOT}/lib/ia32/\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the cmake MKL module for MacOS.
|
8,490 |
26.07.2017 16:51:10
| -7,200 |
663eb906f992a029fe628004d38fa13da00489b2
|
Improve the genericity of the polar node parser function.
|
[
{
"change_type": "DELETE",
"old_path": "src/Tools/Code/Polar/nodes_parser.cpp",
"new_path": null,
"diff": "-#include <string>\n-#include <sstream>\n-#include <vector>\n-#include <cmath>\n-\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n-\n-#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r1.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_spc.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_std.hpp\"\n-\n-#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r1.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep_left.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_spc.hpp\"\n-#include \"Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_std.hpp\"\n-\n-#include \"Tools/Display/bash_tools.h\"\n-\n-#include \"Tools/general_utils.h\"\n-\n-#include \"nodes_parser.h\"\n-\n-using namespace aff3ct::tools;\n-\n-std::vector<aff3ct::tools::Pattern_polar_i*> aff3ct::tools::nodes_parser(const std::string &str_polar,\n- int &idx_r0,\n- int &idx_r1,\n- const std::string type)\n-{\n- idx_r0 = -1;\n- idx_r1 = -1;\n-\n- auto str_polar_bis = str_polar;\n-\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ' '), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '{'), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '}'), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '('), str_polar_bis.end());\n- str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ')'), str_polar_bis.end());\n-\n- std::vector<aff3ct::tools::Pattern_polar_i*> polar_patterns;\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_std );\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_std);\n- else polar_patterns.push_back(new Pattern_polar_std );\n-\n- auto v_polar = string_split(str_polar_bis, ',');\n- for (auto i = 0; i < (int)v_polar.size(); i++)\n- {\n- auto v_str1 = string_split(v_polar[i], '_');\n-\n- if (v_str1.size() >= 1)\n- {\n- if (v_str1[0] == \"R0L\")\n- {\n- if (v_str1.size() == 1)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left );\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left);\n- else polar_patterns.push_back(new Pattern_polar_r0_left );\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left (min, max));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left(min, max));\n- else polar_patterns.push_back(new Pattern_polar_r0_left (min, max));\n-\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left (min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left(min));\n- else polar_patterns.push_back(new Pattern_polar_r0_left (min));\n- }\n- else\n- {\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0_left (min, min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0_left(min, min));\n- else polar_patterns.push_back(new Pattern_polar_r0_left (min, min));\n- }\n- }\n- }\n- }\n- else if (v_str1[0] == \"R0\")\n- {\n- idx_r0 = (int)polar_patterns.size();\n-\n- if (v_str1.size() == 1)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 );\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0);\n- else polar_patterns.push_back(new Pattern_polar_r0 );\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (min, max));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(min, max));\n- else polar_patterns.push_back(new Pattern_polar_r0 (min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(min));\n- else polar_patterns.push_back(new Pattern_polar_r0 (min));\n- }\n- else\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (min, min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(min, min));\n- else polar_patterns.push_back(new Pattern_polar_r0 (min, min));\n- }\n- }\n- }\n- }\n- else if (v_str1[0] == \"R1\")\n- {\n- idx_r1 = (int)polar_patterns.size();\n-\n- if (v_str1.size() == 1)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 );\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1);\n- else polar_patterns.push_back(new Pattern_polar_r1 );\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (min, max));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(min, max));\n- else polar_patterns.push_back(new Pattern_polar_r1 (min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(min));\n- else polar_patterns.push_back(new Pattern_polar_r1 (min));\n- }\n- else\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (min, min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(min, min));\n- else polar_patterns.push_back(new Pattern_polar_r1 (min, min));\n- }\n- }\n- }\n- }\n- else if (v_str1[0] == \"REPL\")\n- {\n- if (v_str1.size() == 1)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left );\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left);\n- else polar_patterns.push_back(new Pattern_polar_rep_left );\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left (min, max));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left(min, max));\n- else polar_patterns.push_back(new Pattern_polar_rep_left (min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left (min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left(min));\n- else polar_patterns.push_back(new Pattern_polar_rep_left (min));\n- }\n- else\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep_left (min, min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep_left(min, min));\n- else polar_patterns.push_back(new Pattern_polar_rep_left (min, min));\n- }\n- }\n- }\n- }\n- else if (v_str1[0] == \"REP\")\n- {\n- if (v_str1.size() == 1)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep );\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep);\n- else polar_patterns.push_back(new Pattern_polar_rep );\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep (min, max));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep(min, max));\n- else polar_patterns.push_back(new Pattern_polar_rep (min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep (min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep(min));\n- else polar_patterns.push_back(new Pattern_polar_rep (min));\n- }\n- else\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_rep (min, min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_rep(min, min));\n- else polar_patterns.push_back(new Pattern_polar_rep (min, min));\n- }\n- }\n- }\n- }\n- else if (v_str1[0] == \"SPC\")\n- {\n- if (v_str1.size() == 1)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc );\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc);\n- else polar_patterns.push_back(new Pattern_polar_spc );\n- }\n- else\n- {\n- auto v_str2 = string_split(v_str1[1], '-');\n-\n- if (v_str2.size() > 1)\n- {\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n- auto max = (int)std::log2(std::stoi(v_str2[1]));\n-\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc (min, max));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc(min, max));\n- else polar_patterns.push_back(new Pattern_polar_spc (min, max));\n- }\n- else\n- {\n- bool plus = v_str2[0].find(\"+\") != std::string::npos;\n-\n- auto min = (int)std::log2(std::stoi(v_str2[0]));\n-\n- if (plus)\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc (min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc(min));\n- else polar_patterns.push_back(new Pattern_polar_spc (min));\n- }\n- else\n- {\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_spc (min, min));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_spc(min, min));\n- else polar_patterns.push_back(new Pattern_polar_spc (min, min));\n- }\n- }\n- }\n- }\n- else\n- {\n- std::clog << format_warning(\"Unrecognized Polar node type (\" + v_polar[i] + \").\") << std::endl;\n- }\n- }\n- }\n-\n- if (idx_r0 == -1)\n- {\n- idx_r0 = (int)polar_patterns.size();\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r0 (0,0));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r0(0,0));\n- else polar_patterns.push_back(new Pattern_polar_r0 (0,0));\n- }\n-\n- if (idx_r1 == -1)\n- {\n- idx_r1 = (int)polar_patterns.size();\n- if (type == \"SC\" ) polar_patterns.push_back(new Pattern_polar_SC_r1 (0,0));\n- else if (type == \"SCL\") polar_patterns.push_back(new Pattern_polar_SCL_r1(0,0));\n- else polar_patterns.push_back(new Pattern_polar_r1 (0,0));\n- }\n-\n- return polar_patterns;\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/nodes_parser.h",
"new_path": "src/Tools/Code/Polar/nodes_parser.h",
"diff": "#include <vector>\n#include \"Tools/Code/Polar/Patterns/Pattern_polar_i.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp\"\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\nnamespace aff3ct\n{\nnamespace tools\n{\n-std::vector<Pattern_polar_i*> nodes_parser(const std::string &str_polar,\n- int &idx_r0,\n- int &idx_r1,\n- const std::string type = \"STD\");\n+template <class R0 = Pattern_polar_r0,\n+ class R0L = Pattern_polar_r0_left,\n+ class R1 = Pattern_polar_r1,\n+ class REP = Pattern_polar_rep,\n+ class REPL = Pattern_polar_rep_left,\n+ class SPC = Pattern_polar_spc,\n+ class STD = Pattern_polar_std>\n+std::vector<Pattern_polar_i*> nodes_parser(const std::string &str_polar, int &idx_r0, int &idx_r1);\n}\n}\n+#include \"nodes_parser.hxx\"\n+\n#endif /* NODES_PARSER_HPP */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Code/Polar/nodes_parser.hxx",
"diff": "+#include <string>\n+#include <sstream>\n+#include <vector>\n+#include <cmath>\n+\n+#include \"Tools/Display/bash_tools.h\"\n+\n+#include \"Tools/general_utils.h\"\n+\n+#include \"nodes_parser.h\"\n+\n+template <class R0, class R0L, class R1, class REP, class REPL, class SPC, class STD>\n+std::vector<aff3ct::tools::Pattern_polar_i*> aff3ct::tools\n+::nodes_parser(const std::string &str_polar, int &idx_r0, int &idx_r1)\n+{\n+ idx_r0 = -1;\n+ idx_r1 = -1;\n+\n+ auto str_polar_bis = str_polar;\n+\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ' '), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '{'), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '}'), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), '('), str_polar_bis.end());\n+ str_polar_bis.erase(std::remove(str_polar_bis.begin(), str_polar_bis.end(), ')'), str_polar_bis.end());\n+\n+ std::vector<aff3ct::tools::Pattern_polar_i*> polar_patterns;\n+\n+ polar_patterns.push_back(new STD);\n+\n+ auto v_polar = string_split(str_polar_bis, ',');\n+ for (auto i = 0; i < (int)v_polar.size(); i++)\n+ {\n+ auto v_str1 = string_split(v_polar[i], '_');\n+\n+ if (v_str1.size() >= 1)\n+ {\n+ if (v_str1[0] == \"R0L\")\n+ {\n+ if (v_str1.size() == 1)\n+ polar_patterns.push_back(new R0L);\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ polar_patterns.push_back(new R0L(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus) polar_patterns.push_back(new R0L(min ));\n+ else polar_patterns.push_back(new R0L(min, min));\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"R0\")\n+ {\n+ idx_r0 = (int)polar_patterns.size();\n+\n+ if (v_str1.size() == 1)\n+ polar_patterns.push_back(new R0);\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ polar_patterns.push_back(new R0(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus) polar_patterns.push_back(new R0(min ));\n+ else polar_patterns.push_back(new R0(min, min));\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"R1\")\n+ {\n+ idx_r1 = (int)polar_patterns.size();\n+\n+ if (v_str1.size() == 1)\n+ polar_patterns.push_back(new R1);\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ polar_patterns.push_back(new R1(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus) polar_patterns.push_back(new R1(min ));\n+ else polar_patterns.push_back(new R1(min, min));\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"REPL\")\n+ {\n+ if (v_str1.size() == 1)\n+ polar_patterns.push_back(new REPL);\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ polar_patterns.push_back(new REPL(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus) polar_patterns.push_back(new REPL(min ));\n+ else polar_patterns.push_back(new REPL(min, min));\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"REP\")\n+ {\n+ if (v_str1.size() == 1)\n+ polar_patterns.push_back(new REP);\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ polar_patterns.push_back(new REP(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus) polar_patterns.push_back(new REP(min ));\n+ else polar_patterns.push_back(new REP(min, min));\n+ }\n+ }\n+ }\n+ else if (v_str1[0] == \"SPC\")\n+ {\n+ if (v_str1.size() == 1)\n+ polar_patterns.push_back(new SPC);\n+ else\n+ {\n+ auto v_str2 = string_split(v_str1[1], '-');\n+\n+ if (v_str2.size() > 1)\n+ {\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+ auto max = (int)std::log2(std::stoi(v_str2[1]));\n+\n+ polar_patterns.push_back(new SPC(min, max));\n+ }\n+ else\n+ {\n+ bool plus = v_str2[0].find(\"+\") != std::string::npos;\n+\n+ auto min = (int)std::log2(std::stoi(v_str2[0]));\n+\n+ if (plus) polar_patterns.push_back(new SPC(min ));\n+ else polar_patterns.push_back(new SPC(min, min));\n+ }\n+ }\n+ }\n+ else\n+ {\n+ std::clog << format_warning(\"Unrecognized Polar node type (\" + v_polar[i] + \").\") << std::endl;\n+ }\n+ }\n+ }\n+\n+ if (idx_r0 == -1)\n+ {\n+ idx_r0 = (int)polar_patterns.size();\n+ polar_patterns.push_back(new R0(0,0));\n+ }\n+\n+ if (idx_r1 == -1)\n+ {\n+ idx_r1 = (int)polar_patterns.size();\n+ polar_patterns.push_back(new R1(0,0));\n+ }\n+\n+ return polar_patterns;\n+}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the genericity of the polar node parser function.
|
8,490 |
26.07.2017 16:53:50
| -7,200 |
aec194addd0d7990b5956a85ea0bac5bd6c3734a
|
Update the AFF3CT header.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Code/Polar/Patterns/Pattern_polar_i.hpp>\n#include <Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp>\n#include <Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0_left.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r1.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep_left.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_spc.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_rep.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_r0.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SC/Pattern_polar_SC_std.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_spc.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r1.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_rep_left.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_r0_left.hpp>\n-#include <Tools/Code/Polar/Patterns/Gen/SCL/Pattern_polar_SCL_std.hpp>\n#include <Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp>\n#include <Tools/Code/Polar/Pattern_polar_parser.hpp>\n#include <Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the AFF3CT header.
|
8,490 |
27.07.2017 15:04:28
| -7,200 |
a292ab7833911aa54756869a1bc1f8bc2f899363
|
Fix broken interleaver selection with the turbo when a standard was selected.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hxx",
"new_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hxx",
"diff": "@@ -94,14 +94,10 @@ void Decoder_turbo\nif(exist(vals, {p+\"-sc\" })) params.self_corrected = true;\nif(exist(vals, {p+\"-json\" })) params.enable_json = true;\n- std::string standard = \"\";\n- if (exist(vals, {p+\"-sub-std\"}) || exist(vals, {p+\"-sub1-std\"}))\n- standard = std::is_same<D1,D2>() ? vals.at({p+\"-sub-std\"}) : vals.at({p+\"-sub1-std\"});\n-\n- if (standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\n+ if (params.sub1.standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\nparams.itl.type = \"LTE\";\n- if (standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\n+ if (params.sub1.standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\nparams.itl.type = \"CCSDS\";\nparams.sub1.K = params.K;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo/Encoder_turbo.hxx",
"new_path": "src/Factory/Module/Code/Turbo/Encoder_turbo.hxx",
"diff": "@@ -84,14 +84,10 @@ void Encoder_turbo\nif(exist(vals, {p+\"-json-path\"})) params.json_path = vals.at({p+\"-json-path\"});\n- std::string standard = \"\";\n- if (exist(vals, {p+\"-sub-std\"}) || exist(vals, {p+\"-sub1-std\"}))\n- standard = std::is_same<E1,E2>() ? vals.at({p+\"-sub-std\"}) : vals.at({p+\"-sub1-std\"});\n-\n- if (standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\n+ if (params.sub1.standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\nparams.itl.type = \"LTE\";\n- if (standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\n+ if (params.sub1.standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\nparams.itl.type = \"CCSDS\";\nparams.sub1.K = params.K;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/Turbo/Turbo.hxx",
"new_path": "src/Launcher/Code/Turbo/Turbo.hxx",
"diff": "@@ -32,7 +32,7 @@ template <class C, typename B, typename R, typename Q, typename QD>\nvoid Turbo<C,B,R,Q,QD>\n::build_args()\n{\n- factory::Encoder_turbo ::build_args<>(this->req_args, this->opt_args);\n+ factory::Encoder_turbo ::build_args(this->req_args, this->opt_args);\nfactory::Puncturer_turbo::build_args(this->req_args, this->opt_args);\nfactory::Decoder_turbo ::build_args(this->req_args, this->opt_args);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix broken interleaver selection with the turbo when a standard was selected.
|
8,490 |
28.07.2017 10:01:51
| -7,200 |
645cb648a72f0bacc8b977c1c30d097cdf5b96ca
|
Rename Decoder_turbo_naive in Decoder_turbo_std.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hxx",
"new_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hxx",
"diff": "#include \"Tools/Exception/exception.hpp\"\n-#include \"Module/Decoder/Turbo/Decoder_turbo_naive.hpp\"\n+#include \"Module/Decoder/Turbo/Decoder_turbo_std.hpp\"\n#include \"Module/Decoder/Turbo/Decoder_turbo_fast.hpp\"\n#include \"Decoder_turbo.hpp\"\n@@ -18,7 +18,7 @@ module::Decoder_turbo<B,Q>* Decoder_turbo\n{\nif (params.type == \"TURBO\")\n{\n- if (params.implem == \"STD\" ) return new module::Decoder_turbo_naive<B,Q>(params.K, params.N_cw, params.n_ite, itl, siso_n, siso_i, params.sub1.buffered);\n+ if (params.implem == \"STD\" ) return new module::Decoder_turbo_std <B,Q>(params.K, params.N_cw, params.n_ite, itl, siso_n, siso_i, params.sub1.buffered);\nelse if (params.implem == \"FAST\") return new module::Decoder_turbo_fast<B,Q>(params.K, params.N_cw, params.n_ite, itl, siso_n, siso_i, params.sub1.buffered);\n}\n"
},
{
"change_type": "DELETE",
"old_path": "src/Module/Decoder/Turbo/Decoder_turbo_naive.hpp",
"new_path": null,
"diff": "-#ifndef DECODER_TURBO_NAIVE_HPP\n-#define DECODER_TURBO_NAIVE_HPP\n-\n-#include <vector>\n-#include <mipp.h>\n-\n-#include \"Module/Interleaver/Interleaver.hpp\"\n-\n-#include \"Decoder_turbo.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace module\n-{\n-template <typename B = int, typename R = float>\n-class Decoder_turbo_naive : public Decoder_turbo<B,R>\n-{\n-public:\n- Decoder_turbo_naive(const int& K,\n- const int& N,\n- const int& n_ite,\n- const Interleaver<int> &pi,\n- SISO<R> &siso_n,\n- SISO<R> &siso_i,\n- const bool buffered_encoding = true,\n- const std::string name = \"Decoder_turbo_naive\");\n- virtual ~Decoder_turbo_naive();\n-\n-protected:\n- virtual void _hard_decode(const R *Y_N, B *V_K, const int frame_id);\n-};\n-}\n-}\n-\n-#endif /* DECODER_TURBO_NAIVE_HPP */\n"
},
{
"change_type": "RENAME",
"old_path": "src/Module/Decoder/Turbo/Decoder_turbo_naive.cpp",
"new_path": "src/Module/Decoder/Turbo/Decoder_turbo_std.cpp",
"diff": "#include <iostream>\n#include <algorithm>\n-#include \"Decoder_turbo_naive.hpp\"\n+#include \"Decoder_turbo_std.hpp\"\nusing namespace aff3ct::module;\ntemplate <typename B, typename R>\n-Decoder_turbo_naive<B,R>\n-::Decoder_turbo_naive(const int& K,\n+Decoder_turbo_std<B,R>\n+::Decoder_turbo_std(const int& K,\nconst int& N,\nconst int& n_ite,\nconst Interleaver<int> &pi,\n@@ -23,13 +23,13 @@ Decoder_turbo_naive<B,R>\n}\ntemplate <typename B, typename R>\n-Decoder_turbo_naive<B,R>\n-::~Decoder_turbo_naive()\n+Decoder_turbo_std<B,R>\n+::~Decoder_turbo_std()\n{\n}\ntemplate <typename B, typename R>\n-void Decoder_turbo_naive<B,R>\n+void Decoder_turbo_std<B,R>\n::_hard_decode(const R *Y_N, B *V_K, const int frame_id)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n@@ -117,11 +117,11 @@ void Decoder_turbo_naive<B,R>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class aff3ct::module::Decoder_turbo_naive<B_8,Q_8>;\n-template class aff3ct::module::Decoder_turbo_naive<B_16,Q_16>;\n-template class aff3ct::module::Decoder_turbo_naive<B_32,Q_32>;\n-template class aff3ct::module::Decoder_turbo_naive<B_64,Q_64>;\n+template class aff3ct::module::Decoder_turbo_std<B_8,Q_8>;\n+template class aff3ct::module::Decoder_turbo_std<B_16,Q_16>;\n+template class aff3ct::module::Decoder_turbo_std<B_32,Q_32>;\n+template class aff3ct::module::Decoder_turbo_std<B_64,Q_64>;\n#else\n-template class aff3ct::module::Decoder_turbo_naive<B,Q>;\n+template class aff3ct::module::Decoder_turbo_std<B,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/Turbo/Decoder_turbo_std.hpp",
"diff": "+#ifndef DECODER_TURBO_NAIVE_HPP\n+#define DECODER_TURBO_NAIVE_HPP\n+\n+#include <vector>\n+#include <mipp.h>\n+\n+#include \"Module/Interleaver/Interleaver.hpp\"\n+\n+#include \"Decoder_turbo.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_turbo_std : public Decoder_turbo<B,R>\n+{\n+public:\n+ Decoder_turbo_std(const int& K,\n+ const int& N,\n+ const int& n_ite,\n+ const Interleaver<int> &pi,\n+ SISO<R> &siso_n,\n+ SISO<R> &siso_i,\n+ const bool buffered_encoding = true,\n+ const std::string name = \"Decoder_turbo_std\");\n+ virtual ~Decoder_turbo_std();\n+\n+protected:\n+ virtual void _hard_decode(const R *Y_N, B *V_K, const int frame_id);\n+};\n+}\n+}\n+\n+#endif /* DECODER_TURBO_NAIVE_HPP */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#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/Turbo/Decoder_turbo_naive.hpp>\n+#include <Module/Decoder/Turbo/Decoder_turbo_std.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo_fast.hpp>\n#include <Module/Decoder/Turbo/Decoder_turbo.hpp>\n// #include <Module/Coset/SPU_Coset.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rename Decoder_turbo_naive in Decoder_turbo_std.
|
8,490 |
28.07.2017 16:09:25
| -7,200 |
41fa4cb485a3af22a5f7be1f900f70590db9f740
|
Fix bad info bits pos in LDPC.
|
[
{
"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": "@@ -77,15 +77,15 @@ void LDPC_matrix_handler\nstd::swap(mat[swapped_cols[l*2-2]], mat[swapped_cols[l*2-1]]);\n// return info bits positions\n- info_bits_pos.resize(n_row);\n+ info_bits_pos.resize(n_col - n_row);\nmipp::vector<unsigned> bits_pos(n_col);\n- std::iota(bits_pos.begin(), bits_pos.begin() + n_col, 0);\n+ std::iota(bits_pos.begin(), bits_pos.end(), 0);\nfor (unsigned l = 1; l <= (swapped_cols.size() / 2); l++)\nstd::swap(bits_pos[swapped_cols[l*2-2]], bits_pos[swapped_cols[l*2-1]]);\n- std::copy(bits_pos.begin() + (n_col-n_row), bits_pos.end(), info_bits_pos.begin());\n+ std::copy(bits_pos.begin() + n_row, bits_pos.end(), info_bits_pos.begin());\n}\nvoid LDPC_matrix_handler\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad info bits pos in LDPC.
|
8,490 |
28.07.2017 16:47:12
| -7,200 |
b19de30f05d8f4b08141e475b02dcc4cf59352c6
|
Do not force USER encoder when reversing err. tracker if the encoder is not COSET.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/BFER/BFER.cpp",
"new_path": "src/Factory/Simulation/BFER/BFER.cpp",
"diff": "@@ -94,6 +94,7 @@ void BFER::store_args(const arg_val_map &vals, parameters ¶ms, const std::st\n{\nparams.err_track_enable = false;\nparams.src->type = \"USER\";\n+ if (params.coset)\nparams.enc->type = \"USER\";\nparams.chn->type = \"USER\";\nparams.src->path = params.err_track_path + std::string(\"_$snr.src\");\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Do not force USER encoder when reversing err. tracker if the encoder is not COSET.
|
8,490 |
28.07.2017 17:43:28
| -7,200 |
4880c777aee30e4872127f2c96617b6d56ab0b5d
|
Allow the channel USER to read float or double even if this is not the corresponding type.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/User/Channel_user.cpp",
"new_path": "src/Module/Channel/User/Channel_user.cpp",
"diff": "using namespace aff3ct::module;\nusing namespace aff3ct::tools;\n+\n+\ntemplate <typename R>\nChannel_user<R>\n::Channel_user(const int N, const std::string filename, const bool add_users, const int n_frames,\n@@ -18,6 +20,7 @@ Channel_user<R>\nthrow invalid_argument(__FILE__, __LINE__, __func__, \"'filename' should not be empty.\");\nstd::ifstream file(filename.c_str(), std::ios::binary);\n+\nif (file.is_open())\n{\nunsigned n_fra = 0;\n@@ -26,6 +29,13 @@ Channel_user<R>\nfile.read((char*)&n_fra, sizeof(n_fra));\nfile.read((char*)&fra_size, sizeof(fra_size));\n+ file.ignore(std::numeric_limits<std::streamsize>::max());\n+ std::streamsize length = file.gcount();\n+ file.clear(); // since ignore will have set eof.\n+ file.seekg(8, std::ios_base::beg);\n+\n+ const unsigned sizeof_float = length / (n_fra * fra_size);\n+\nif (n_fra <= 0 || fra_size <= 0)\n{\nstd::stringstream message;\n@@ -40,10 +50,44 @@ Channel_user<R>\nif (fra_size == this->N)\n{\n- for (unsigned i = 0; i < (unsigned)n_fra; i++)\n+ if (sizeof_float == sizeof(R))\n+ {\n+ for (unsigned i = 0; i < n_fra; i++)\nfile.read(reinterpret_cast<char*>(&this->noise_buff[i][0]), fra_size * sizeof(R));\n}\nelse\n+ {\n+ if (sizeof_float == sizeof(double))\n+ {\n+ std::vector<double> tmp(fra_size);\n+ for (unsigned i = 0; i < n_fra; i++)\n+ {\n+ file.read(reinterpret_cast<char*>(tmp.data()), fra_size * sizeof(double));\n+ for (auto j = 0; j < fra_size; j++)\n+ this->noise_buff[i][j] = (R)tmp[j];\n+ }\n+ }\n+ else if (sizeof_float == sizeof(float))\n+ {\n+ std::vector<float> tmp(fra_size);\n+ for (unsigned i = 0; i < n_fra; i++)\n+ {\n+ file.read(reinterpret_cast<char*>(tmp.data()), fra_size * sizeof(float));\n+ for (auto j = 0; j < fra_size; j++)\n+ this->noise_buff[i][j] = (R)tmp[j];\n+ }\n+ }\n+ else\n+ {\n+ file.close();\n+\n+ std::stringstream message;\n+ message << \"Something went wrong ('sizeof_float' = \" << sizeof_float << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+ }\n+ else\n{\nfile.close();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Allow the channel USER to read float or double even if this is not the corresponding type.
|
8,490 |
28.07.2017 18:41:31
| -7,200 |
6768345aa0f1dc621b67de4977073642ac1bc1a0
|
Improve the error tracker feature.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/BFER.cpp",
"new_path": "src/Simulation/BFER/BFER.cpp",
"diff": "@@ -42,6 +42,8 @@ BFER<B,R,Q>\nsnr_b(0.f),\nsigma(0.f),\n+ max_fra(0),\n+\nmonitor (params.n_threads, nullptr),\nmonitor_red( nullptr),\ndumper (params.n_threads, nullptr),\n@@ -168,16 +170,31 @@ void BFER<B,R,Q>\nthis->terminal->set_esn0(snr_s);\nthis->terminal->set_ebn0(snr_b);\n- // dirty hack to override simulation params\nif (params.err_track_revert)\n{\n+ // dirty hack to override simulation params\nauto *params_writable = const_cast<factory::BFER::parameters*>(¶ms);\n- const auto base_path = params.err_track_path;\n- params_writable->src->path = base_path + \"_\" + std::to_string(snr_b) + \".src\";\n- params_writable->enc->path = base_path + \"_\" + std::to_string(snr_b) + \".enc\";\n- params_writable->chn->path = base_path + \"_\" + std::to_string(snr_b) + \".chn\";\n-// if (params.itl.uniform)\n-// params_writable->itl.path = base_path + \"_\" + std::to_string(snr_b) + \".itl\";\n+\n+ if (this->params.src->type != \"AZCW\")\n+ params_writable->src->path = params.err_track_path + \"_\" + std::to_string(snr_b) + \".src\";\n+\n+ if (this->params.coset)\n+ params_writable->enc->path = params.err_track_path + \"_\" + std::to_string(snr_b) + \".enc\";\n+\n+ params_writable->chn->path = params.err_track_path + \"_\" + std::to_string(snr_b) + \".chn\";\n+\n+ std::ifstream file(params_writable->chn->path, std::ios::binary);\n+ if (file.is_open())\n+ {\n+ file.read((char*)&max_fra, sizeof(max_fra));\n+ file.close();\n+ }\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"Impossible to read the 'chn' file ('chn' = \" << params_writable->chn->path << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ncodec.snr_precompute(this->sigma);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/BFER.hpp",
"new_path": "src/Simulation/BFER/BFER.hpp",
"diff": "@@ -50,6 +50,8 @@ protected:\nfloat snr_b;\nfloat sigma;\n+ unsigned max_fra;\n+\n// the monitors of the the BFER simulation\nstd::vector<module::Monitor <B>*> monitor;\nmodule::Monitor_reduction<B>* monitor_red;\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": "@@ -89,9 +89,14 @@ void SC_BFER_ite<B,R,Q>\nconst auto &U_K = this->source [tid]->sc_module->get_U_K();\nconst auto &X_N = this->encoder[tid]->sc_module->get_X_N();\n+ if (this->params.src->type != \"AZCW\")\nthis->dumper[tid]->register_data(U_K, \"src\", false, {});\n+\n+ if (this->params.coset)\nthis->dumper[tid]->register_data(X_N, \"enc\", false, {(unsigned)this->params.enc->K});\n+\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\n+\nif (this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\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": "@@ -81,9 +81,14 @@ void BFER_ite_threads<B,R,Q>\nif (this->params.err_track_enable)\n{\n+ if (this->params.src->type != \"AZCW\")\nthis->dumper[tid]->register_data(U_K1[tid], \"src\", false, {});\n+\n+ if (this->params.coset)\nthis->dumper[tid]->register_data(X_N1[tid], \"enc\", false, {(unsigned)this->params.enc->K});\n+\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\n+\nif (this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\n}\n@@ -297,8 +302,8 @@ void BFER_ite_threads<B,R,Q>\n// simulation loop\nwhile (!this->monitor_red->fe_limit_achieved() && // while max frame error count has not been reached\n- (this->params.stop_time == seconds(0) ||\n- (steady_clock::now() - t_snr) < this->params.stop_time))\n+ (this->params.stop_time == seconds(0) || (steady_clock::now() - t_snr) < this->params.stop_time) &&\n+ (this->monitor_red->get_n_analyzed_fra() < this->max_fra || this->max_fra == 0))\n{\nstd::cout << \"-------------------------------\" << std::endl;\nstd::cout << \"New encoding/decoding session !\" << std::endl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/StarPU/SPU_BFER_std.cpp",
"diff": "@@ -146,9 +146,14 @@ void SPU_BFER_std<B,R,Q>\nif (this->params.err_track_enable)\n{\n+ if (this->params.src->type != \"AZCW\")\nthis->dumper[tid]->register_data(U_K1[tid], \"src\", false, {});\n+\n+ if (this->params.coset)\nthis->dumper[tid]->register_data(X_N1[tid], \"enc\", false, {(unsigned)this->params.enc->K});\n+\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\n+\nif (this->interleaver[tid] != nullptr && this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\n}\n@@ -159,7 +164,8 @@ void SPU_BFER_std<B,R,Q>\n::_launch()\n{\n// Monte Carlo simulation\n- while (!this->monitor_red->fe_limit_achieved())\n+ while (!this->monitor_red->fe_limit_achieved() &&\n+ (this->monitor_red->get_n_analyzed_fra() < this->max_fra || this->max_fra == 0))\n{\nfor (auto tid = 0; tid < this->params.n_threads; tid++)\nthis->seq_tasks_submission(tid);\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": "@@ -80,9 +80,14 @@ void SC_BFER_std<B,R,Q>\nconst auto &U_K = this->source [tid]->sc_module->get_U_K();\nconst auto &X_N = this->encoder[tid]->sc_module->get_X_N();\n+ if (this->params.src->type != \"AZCW\")\nthis->dumper[tid]->register_data(U_K, \"src\", false, {});\n+\n+ if (this->params.coset)\nthis->dumper[tid]->register_data(X_N, \"enc\", false, {(unsigned)this->params.enc->K});\n+\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\n+\nif (this->interleaver[tid] != nullptr && this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\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": "@@ -86,9 +86,14 @@ void BFER_std_threads<B,R,Q>\nif (this->params.err_track_enable)\n{\n+ if (this->params.src->type != \"AZCW\")\nthis->dumper[tid]->register_data(U_K1[tid], \"src\", false, {});\n+\n+ if (this->params.coset)\nthis->dumper[tid]->register_data(X_N1[tid], \"enc\", false, {(unsigned)this->params.enc->K});\n+\nthis->dumper[tid]->register_data(this->channel[tid]->get_noise(), \"chn\", true, {});\n+\nif (this->interleaver[tid] != nullptr && this->interleaver[tid]->is_uniform())\nthis->dumper[tid]->register_data(this->interleaver[tid]->get_lut(), \"itl\", false, {});\n}\n@@ -160,8 +165,9 @@ void BFER_std_threads<B,R,Q>\nauto t_snr = steady_clock::now();\n// simulation loop\n- while ((!this->monitor_red->fe_limit_achieved()) && // while max frame error count has not been reached\n- (this->params.stop_time == seconds(0) || (steady_clock::now() - t_snr) < this->params.stop_time))\n+ while (!this->monitor_red->fe_limit_achieved() && // while max frame error count has not been reached\n+ (this->params.stop_time == seconds(0) || (steady_clock::now() - t_snr) < this->params.stop_time) &&\n+ (this->monitor_red->get_n_analyzed_fra() < this->max_fra || this->max_fra == 0))\n{\nif (this->params.src->type != \"AZCW\")\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the error tracker feature.
|
8,490 |
28.07.2017 22:45:42
| -7,200 |
d93795c1ecacf19d314eb41ad94e4f17b54cfd38
|
Fix the LDPC DVB-S2 encoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "@@ -14,7 +14,7 @@ using namespace aff3ct::tools;\ntemplate <typename B>\nEncoder_LDPC<B>\n::Encoder_LDPC(const int K, const int N, const int n_frames, const std::string name)\n-: Encoder<B>(K, N, n_frames, name), tG(N * K, 0)\n+: Encoder<B>(K, N, n_frames, name)\n{\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the LDPC DVB-S2 encoder.
|
8,490 |
28.07.2017 23:05:33
| -7,200 |
3151acc9657f4796ab98f38b367ac93d5fa6ab25
|
Does not display quantizer info. in floating point.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/BFER_ite.cpp",
"diff": "@@ -176,6 +176,7 @@ void BFER_ite<B,R,Q>\nfactory::Interleaver ::make_header(this->pl_itl, *params->itl, false);\nfactory::Modem ::make_header(this->pl_mdm, *params->mdm, false);\nfactory::Channel ::make_header(this->pl_chn, *params->chn, false);\n+ if (std::is_integral<Q>())\nfactory::Quantizer::make_header(this->pl_qnt, *params->qnt, false);\nfactory::Monitor ::make_header(this->pl_mnt, *params->mnt, false);\nfactory::Terminal_BFER::make_header(this->pl_ter, *params->ter, false);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/BFER_std.cpp",
"new_path": "src/Launcher/Simulation/BFER_std.cpp",
"diff": "@@ -166,6 +166,7 @@ void BFER_std<B,R,Q>\nfactory::CRC ::make_header(this->pl_crc, *params->crc, false);\nfactory::Modem ::make_header(this->pl_mdm, *params->mdm, false);\nfactory::Channel ::make_header(this->pl_chn, *params->chn, false);\n+ if (std::is_integral<Q>())\nfactory::Quantizer::make_header(this->pl_qnt, *params->qnt, false);\nfactory::Monitor ::make_header(this->pl_mnt, *params->mnt, false);\nfactory::Terminal_BFER::make_header(this->pl_ter, *params->ter, false);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Does not display quantizer info. in floating point.
|
8,490 |
30.07.2017 15:31:17
| -7,200 |
b3ddd99fb6e693c163771f6a1f7fec4096e0cad7
|
Fix a potential bug in the Launcher factory.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Launcher/Launcher.cpp",
"new_path": "src/Factory/Launcher/Launcher.cpp",
"diff": "@@ -181,7 +181,7 @@ void Launcher::store_args(const arg_val_map &vals, parameters ¶ms, const std\nif(exist(vals, {\"version\", \"v\"})) params.display_version = true;\n#ifdef MULTI_PREC\n- if(exist(vals, {\"sim-prec\", \"p\"})) params.sim_prec = std::stoi(vals.at({\"sim-prec\", \"p\"}));\n+ if(exist(vals, {p+\"-prec\", \"p\"})) params.sim_prec = std::stoi(vals.at({p+\"-prec\", \"p\"}));\n#endif\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a potential bug in the Launcher factory.
|
8,490 |
31.07.2017 13:50:25
| -7,200 |
a4c3f923138a7a160c4191f66dcc702dc279da9f
|
Add exceptions.
|
[
{
"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": "@@ -36,7 +36,6 @@ Decoder_RSC_BCJR<B,R>\nmessage << \"'n_states' has to be a power of 2 ('n_states' = \" << n_states << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n-\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/Decoder_turbo.cpp",
"new_path": "src/Module/Decoder/Turbo/Decoder_turbo.cpp",
"diff": "@@ -41,6 +41,22 @@ Decoder_turbo<B,R>\nl_e2i((K ) * siso_i.get_simd_inter_frame_level() + mipp::nElReg<R>()),\ns ((K ) * siso_n.get_simd_inter_frame_level())\n{\n+ if (siso_n.get_K() != K)\n+ {\n+ std::stringstream message;\n+ message << \"'siso_n.get_K()' has to be equal to 'K' ('siso_n.get_K()' = \" << siso_n.get_K()\n+ << \", 'K' = \" << K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (siso_i.get_K() != K)\n+ {\n+ std::stringstream message;\n+ message << \"'siso_i.get_K()' has to be equal to 'K' ('siso_i.get_K()' = \" << siso_i.get_K()\n+ << \", 'K' = \" << K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N - (siso_n.tail_length() + siso_i.tail_length()) != K * 3)\n{\nstd::stringstream message;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add exceptions.
|
8,490 |
01.08.2017 10:19:25
| -7,200 |
346d94c03a9039e13c2947aeb9e2d818c48b067b
|
Move std iterleaver automatic selection after parsing the itl params.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hpp",
"new_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hpp",
"diff": "@@ -52,7 +52,6 @@ struct Decoder_turbo : public Decoder\nstatic void store_args(const arg_val_map &vals, parameters<D1,D2> ¶ms, const std::string p = prefix);\ntemplate <class D1 = Decoder_RSC, class D2 = D1>\nstatic void make_header(params_list& head_dec, params_list& head_itl, const parameters<D1,D2>& params, const bool full = true);\n-\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hxx",
"new_path": "src/Factory/Module/Code/Turbo/Decoder_turbo.hxx",
"diff": "@@ -94,12 +94,6 @@ void Decoder_turbo\nif(exist(vals, {p+\"-sc\" })) params.self_corrected = true;\nif(exist(vals, {p+\"-json\" })) params.enable_json = true;\n- if (params.sub1.standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"LTE\";\n-\n- if (params.sub1.standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"CCSDS\";\n-\nparams.sub1.K = params.K;\nparams.sub2.K = params.K;\nparams.sub1.n_frames = params.n_frames;\n@@ -132,6 +126,12 @@ void Decoder_turbo\nparams.itl.n_frames = params.n_frames;\nInterleaver::store_args(vals, params.itl, \"itl\");\n+ if (params.sub1.standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"LTE\";\n+\n+ if (params.sub1.standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"CCSDS\";\n+\nparams.sf.n_ite = params.n_ite;\nScaling_factor::store_args(vals, params.sf, p+\"-sf\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo/Encoder_turbo.hxx",
"new_path": "src/Factory/Module/Code/Turbo/Encoder_turbo.hxx",
"diff": "@@ -84,12 +84,6 @@ void Encoder_turbo\nif(exist(vals, {p+\"-json-path\"})) params.json_path = vals.at({p+\"-json-path\"});\n- if (params.sub1.standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"LTE\";\n-\n- if (params.sub1.standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"CCSDS\";\n-\nparams.sub1.K = params.K;\nparams.sub2.K = params.K;\nparams.sub1.n_frames = params.n_frames;\n@@ -121,6 +115,12 @@ void Encoder_turbo\nparams.itl.size = params.K;\nparams.itl.n_frames = params.n_frames;\nInterleaver::store_args(vals, params.itl, \"itl\");\n+\n+ if (params.sub1.standard == \"LTE\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"LTE\";\n+\n+ if (params.sub1.standard == \"CCSDS\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"CCSDS\";\n}\ntemplate <class E1, class E2>\n"
},
{
"change_type": "RENAME",
"old_path": "src/Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR.hxx",
"new_path": "src/Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR.cpp",
"diff": ""
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move std iterleaver automatic selection after parsing the itl params.
|
8,490 |
01.08.2017 10:21:47
| -7,200 |
51298e40f21181712de06e7ca856e10f4699ea54
|
Fix issue when debugging.
|
[
{
"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": "@@ -461,7 +461,7 @@ void BFER_std_threads<B,R,Q>\nstd::cout << \"Extract the CRC bits from V_K1 and keep only the info. bits in V_K2...\" << std::endl\n<< \"V_K2:\" << std::endl;\n- ft.display_real_vector(this->V_K2[tid], this->U_K1[tid]);\n+ ft.display_bit_vector(this->V_K2[tid], this->U_K1[tid]);\nstd::cout << std::endl;\nthis->mutex_debug.unlock();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix issue when debugging.
|
8,490 |
01.08.2017 11:36:49
| -7,200 |
aea00f202532458f47fe232006714dc8893f9dfd
|
Improve the genericity of the Turbo DB: now it is possible to use all the available interleavers.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo_DB/Decoder_turbo_DB.cpp",
"new_path": "src/Factory/Module/Code/Turbo_DB/Decoder_turbo_DB.cpp",
"diff": "@@ -81,7 +81,7 @@ void Decoder_turbo_DB\nparams.N_cw = 2 * params.sub.N_cw - params.K;\nparams.R = (float)params.K / (float)params.N_cw;\n- params.itl.size = params.K;\n+ params.itl.size = params.K >> 1;\nparams.itl.n_frames = params.n_frames;\nInterleaver::store_args(vals, params.itl, \"itl\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo_DB/Encoder_turbo_DB.cpp",
"new_path": "src/Factory/Module/Code/Turbo_DB/Encoder_turbo_DB.cpp",
"diff": "@@ -68,7 +68,7 @@ void Encoder_turbo_DB\nparams.N_cw = 2 * params.sub.N_cw - params.K;\nparams.R = (float)params.K / (float)params.N_cw;\n- params.itl.size = params.K;\n+ params.itl.size = params.K >> 1;\nparams.itl.n_frames = params.n_frames;\nInterleaver::store_args(vals, params.itl, \"itl\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp",
"new_path": "src/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp",
"diff": "@@ -24,8 +24,6 @@ Decoder_turbo_DB<B,R>\npi (pi),\nsiso_n (siso_n),\nsiso_i (siso_i),\n- lut (pi.get_lut()),\n- lut_inv (pi.get_lut_inv()),\nl_cpy (2 * K),\nl_sn (2 * K),\nl_si (2 * K),\n@@ -39,6 +37,13 @@ Decoder_turbo_DB<B,R>\nl_e2i (2 * K),\ns ( K)\n{\n+ if (K % 2)\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be a divisible by 2 ('K' = \" << K << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (siso_n.get_K() != K)\n{\nstd::stringstream message;\n@@ -62,10 +67,10 @@ Decoder_turbo_DB<B,R>\nthrow invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if ((int)pi.get_size() != K)\n+ if ((int)pi.get_size() * 2 != K)\n{\nstd::stringstream message;\n- message << \"'pi.get_size()' has to be equal to 'K' ('pi.get_size()' = \" << pi.get_size()\n+ message << \"'pi.get_size()' * 2 has to be equal to 'K' ('pi.get_size()' = \" << pi.get_size()\n<< \", 'K' = \" << K << \").\";\nthrow length_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -160,10 +165,11 @@ void Decoder_turbo_DB<B,R>\nl_cpy = this->l_sn;\nfor (auto i = 0; i < 2 * this->K; i += 8)\nstd::swap(l_cpy[i+1], l_cpy[i+2]);\n- for (auto i = 0; i < 2 * this->K; i += 2)\n+ for (auto i = 0; i < this->K; i += 2)\n{\n- this->l_si[2 * lut[i/2] ] = l_cpy[i ];\n- this->l_si[2 * lut[i/2] +1] = l_cpy[i+1];\n+ const auto l = pi.get_lut_inv()[i >> 1];\n+ for (auto bps = 0; bps < 2; bps++) this->l_si[2 * (i +0) + bps] = l_cpy[(4 * l + 0) + bps];\n+ for (auto bps = 0; bps < 2; bps++) this->l_si[2 * (i +1) + bps] = l_cpy[(4 * l + 2) + bps];\n}\nstd::fill(this->l_e1n.begin(), this->l_e1n.end(), (R)0);\n@@ -177,14 +183,6 @@ void Decoder_turbo_DB<B,R>\nthis->_load(Y_N);\nauto d_load = std::chrono::steady_clock::now() - t_load;\n-// for (auto i = 0; i < this->K; i += 2)\n-// {\n-// this->s[i ] = (std::max(this->l_sn[2*i+2], this->l_sn[2*i+3]) -\n-// std::max(this->l_sn[2*i+0], this->l_sn[2*i+1])) > 0;\n-// this->s[i+1] = (std::max(this->l_sn[2*i+1], this->l_sn[2*i+3]) -\n-// std::max(this->l_sn[2*i+0], this->l_sn[2*i+2])) > 0;\n-// }\n-\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nconst auto n_frames = this->get_simd_inter_frame_level();\n@@ -212,10 +210,11 @@ void Decoder_turbo_DB<B,R>\nl_cpy = this->l_e2n;\nfor (auto i = 0; i < 2 * this->K; i += 8)\nstd::swap(l_cpy[i+1], l_cpy[i+2]);\n- for (auto i = 0; i < 2 * this->K; i += 2)\n+ for (auto i = 0; i < this->K; i += 2)\n{\n- this->l_e1i[2 * lut[i/2] ] = l_cpy[i ];\n- this->l_e1i[2 * lut[i/2] +1] = l_cpy[i+1];\n+ const auto l = pi.get_lut_inv()[i >> 1];\n+ for (auto bps = 0; bps < 2; bps++) this->l_e1i[2 * (i +0) + bps] = l_cpy[(4 * l + 0) + bps];\n+ for (auto bps = 0; bps < 2; bps++) this->l_e1i[2 * (i +1) + bps] = l_cpy[(4 * l + 2) + bps];\n}\n// sys + ext\n@@ -237,10 +236,11 @@ void Decoder_turbo_DB<B,R>\nthis->l_e2i[i] += this->l_sei[i];\n// make the deinterleaving\n- for (auto i = 0; i < 2 * this->K; i += 2)\n+ for (auto i = 0; i < this->K; i += 2)\n{\n- this->l_e1n[i ] = this->l_e2i[2 * lut[i/2] ];\n- this->l_e1n[i+1] = this->l_e2i[2 * lut[i/2] +1];\n+ const auto l = pi.get_lut()[i >> 1];\n+ for (auto bps = 0; bps < 2; bps++) this->l_e1n[2 * (i +0) + bps] = l_e2i[(4 * l + 0) + bps];\n+ for (auto bps = 0; bps < 2; bps++) this->l_e1n[2 * (i +1) + bps] = l_e2i[(4 * l + 2) + bps];\n}\nfor (auto i = 0; i < 2 * this->K; i += 8)\nstd::swap(this->l_e1n[i+1], this->l_e1n[i+2]);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp",
"new_path": "src/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp",
"diff": "@@ -24,10 +24,7 @@ protected:\nDecoder_RSC_DB_BCJR<B,R> &siso_n;\nDecoder_RSC_DB_BCJR<B,R> &siso_i;\n- const mipp::vector<int> &lut;\n- const mipp::vector<int> &lut_inv;\nmipp::vector<R> l_cpy;\n-\nmipp::vector<R> l_sn; // systematic LLRs in the natural domain\nmipp::vector<R> l_si; // systematic LLRs in the interleaved domain\nmipp::vector<R> l_sen; // systematic LLRs + extrinsic LLRs in the natural domain\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp",
"new_path": "src/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp",
"diff": "@@ -21,6 +21,13 @@ Encoder_turbo_DB<B>\npar_n(K * n_frames),\npar_i(K * n_frames)\n{\n+ if (K % 2)\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be a divisible by 2 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (N != 3 * K)\n{\nstd::stringstream message;\n@@ -28,10 +35,10 @@ Encoder_turbo_DB<B>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if ((int)pi.get_size() != K)\n+ if ((int)pi.get_size() * 2 != K)\n{\nstd::stringstream message;\n- message << \"'pi.get_size()' has to be equal to 'K' ('pi.get_size()' = \" << pi.get_size()\n+ message << \"'pi.get_size()' * 2 has to be equal to 'K' ('pi.get_size()' = \" << pi.get_size()\n<< \", 'K' = \" << K << \").\";\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -42,18 +49,18 @@ template <typename B>\nvoid Encoder_turbo_DB<B>\n::encode(const B *U_K, B *X_N)\n{\n- //pi.interleave(U_K, U_K_i.data(), 0, this->n_frames);\n-\n- mipp::vector<int> lut = pi.get_lut();\nmipp::vector<B> U_K_cpy (this->K);\n- //std::copy(U_K, U_K + this->K, U_K_cpy);\nfor (auto i = 0; i < this->K; i++)\nU_K_cpy[i] = U_K[i];\nfor (auto i = 0; i < this->K; i+=4)\nstd::swap(U_K_cpy[i], U_K_cpy[i+1]);\n- for (auto i = 0; i < this->K; i++)\n- U_K_i[ lut[i] ] = U_K_cpy[i];\n+ for (auto i = 0; i < this->K; i += 2)\n+ {\n+ const auto l = pi.get_lut_inv()[i >> 1];\n+ U_K_i[i +0] = U_K_cpy[l * 2 +0];\n+ U_K_i[i +1] = U_K_cpy[l * 2 +1];\n+ }\nenco_n.encode_sys(U_K, par_n.data());\nenco_i.encode_sys(U_K_i.data(), par_i.data());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/ARP/Interleaver_ARP_DVB1.hpp",
"new_path": "src/Module/Interleaver/ARP/Interleaver_ARP_DVB1.hpp",
"diff": "@@ -34,7 +34,7 @@ public:\nInterleaver_ARP_DVB1(const int size, const int n_frames = 1, const std::string name = \"Interleaver_ARP_DVB1\")\n: Interleaver<T>(size, false, n_frames, name)\n{\n- switch (size / 2)\n+ switch (size)\n{\ncase 48:\np0 = parameters[0][0];\n@@ -121,10 +121,8 @@ protected:\nvoid gen_lut(T *lut, const int frame_id)\n{\nint p;\n- int size_d2 = this->get_size()/2;\n- std::vector<int> symbols_lut(size_d2);\n-\n- for (auto i = 0; i < size_d2; i++)\n+ int size = this->get_size();\n+ for (auto i = 0; i < size; i++)\n{\nswitch(i%4)\n{\n@@ -132,25 +130,16 @@ protected:\np = 0;\nbreak;\ncase 1:\n- p = size_d2/2 + p1;\n+ p = size/2 + p1;\nbreak;\ncase 2:\np = p2;\nbreak;\ncase 3:\n- p = size_d2/2 + p3;\n+ p = size/2 + p3;\nbreak;\n}\n- symbols_lut[i] = (p0*i + p + 1) % size_d2;\n- }\n-\n- std::vector<int> io(this->get_size());\n- std::iota(io.begin(), io.end(), 0);\n-\n- for (auto i = 0; i < this->get_size(); i+=2)\n- {\n- lut[i ] = io[2*symbols_lut[i/2] ];\n- lut[i+1] = io[2*symbols_lut[i/2]+1];\n+ lut[i] = (p0*i + p + 1) % size;\n}\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/ARP/Interleaver_ARP_DVB2.hpp",
"new_path": "src/Module/Interleaver/ARP/Interleaver_ARP_DVB2.hpp",
"diff": "@@ -22,7 +22,7 @@ public:\nInterleaver_ARP_DVB2(const int size, const int n_frames = 1, const std::string name = \"Interleaver_ARP_DVB2\")\n: Interleaver<T>(size, false, n_frames, name)\n{\n- switch (size / 2)\n+ switch (size)\n{\ncase 56:\np = 9;\n@@ -163,10 +163,8 @@ protected:\nvoid gen_lut(T *lut, const int frame_id)\n{\nint q;\n- int size_d2 = this->get_size()/2;\n- std::vector<int> symbols_lut(size_d2);\n-\n- for (auto i = 0; i < size_d2; i++)\n+ int size = this->get_size();\n+ for (auto i = 0; i < size; i++)\n{\nswitch(i%4)\n{\n@@ -183,16 +181,7 @@ protected:\nq = 4*q0*p + 4*q3;\nbreak;\n}\n- symbols_lut[i] = (p*i + q + 3) % size_d2;\n- }\n-\n- std::vector<int> io(this->get_size());\n- std::iota(io.begin(), io.end(), 0);\n-\n- for (auto i = 0; i < this->get_size(); i+=2)\n- {\n- lut[i ] = io[2*symbols_lut[i/2] ];\n- lut[i+1] = io[2*symbols_lut[i/2]+1];\n+ lut[i] = (p*i + q + 3) % size;\n}\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check_DB.cpp",
"new_path": "src/Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check_DB.cpp",
"diff": "#include <cmath>\n+#include <sstream>\n#include <algorithm>\n+#include \"Tools/Exception/exception.hpp\"\n+\n#include \"Flip_and_check_DB.hpp\"\nusing namespace aff3ct::tools;\n@@ -19,6 +22,14 @@ Flip_and_check_DB<B,R>\ntab_flips ((1 << q) -1, mipp::vector<B>(q, (B)0) ),\nsymb_sorted (2 * K )\n{\n+ if (simd_inter_frame_level != 1)\n+ {\n+ std::stringstream message;\n+ message << \"The FNC double binary does not support an inter frame level > 1 \"\n+ << \"('simd_inter_frame_level' = \" << simd_inter_frame_level << \").\";\n+ throw invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n// generation of the array that will be used to flip the bits\n// it contains: 1000, 0100, 1100, 0010, ...\nfor (auto i = 1; i <= (int)tab_flips.size(); i++)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the genericity of the Turbo DB: now it is possible to use all the available interleavers.
|
8,490 |
01.08.2017 11:50:10
| -7,200 |
1593f9218af64c5f6ace40951c95e40ee7da047c
|
Fix the inter frame mode in the Turbo DB chain.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/RSC_DB/Encoder_RSC_DB.cpp",
"new_path": "src/Module/Encoder/RSC_DB/Encoder_RSC_DB.cpp",
"diff": "@@ -243,7 +243,6 @@ template <typename B>\nvoid Encoder_RSC_DB<B>\n::_encode_sys(const B *U_K, B *par, const int frame_id)\n{\n-\nint circ_state, end_state;\n__pre_encode(U_K, circ_state);\nint init_state = circ_states[( (this->K/2) % (n_states-1) ) -1][circ_state];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp",
"new_path": "src/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp",
"diff": "#include \"../Encoder_sys.hpp\"\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B>\n+class Encoder_turbo_DB;\n+}\n+}\n+\nnamespace aff3ct\n{\nnamespace module\n@@ -13,6 +22,8 @@ namespace module\ntemplate <typename B = int>\nclass Encoder_RSC_DB: public Encoder_sys<B>\n{\n+ friend Encoder_turbo_DB<B>;\n+\nprivate:\nconst int n_ff; // number of D flip-flop\nconst int n_states; // number of states in the trellis\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp",
"new_path": "src/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp",
"diff": "@@ -47,7 +47,7 @@ Encoder_turbo_DB<B>\n// [ AB ][ WnWi ][ YnYi ]\ntemplate <typename B>\nvoid Encoder_turbo_DB<B>\n-::encode(const B *U_K, B *X_N)\n+::_encode(const B *U_K, B *X_N, const int frame_id)\n{\nmipp::vector<B> U_K_cpy (this->K);\nfor (auto i = 0; i < this->K; i++)\n@@ -62,8 +62,8 @@ void Encoder_turbo_DB<B>\nU_K_i[i +1] = U_K_cpy[l * 2 +1];\n}\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_sys(U_K, par_n.data(), frame_id);\n+ enco_i._encode_sys(U_K_i.data(), par_i.data(), frame_id);\nstd::copy(U_K, U_K + this->K, X_N);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp",
"new_path": "src/Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp",
"diff": "@@ -32,7 +32,7 @@ public:\nconst std::string name = \"Encoder_turbo_DB\");\nvirtual ~Encoder_turbo_DB() {}\n- virtual void encode(const B *U_K, B *X_N); using Encoder<B>::encode;\n+ virtual void _encode(const B *U_K, B *X_N, const int frame_id);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the inter frame mode in the Turbo DB chain.
|
8,490 |
01.08.2017 12:08:38
| -7,200 |
9539a65649726f1d91770a8a8e94a817346db547
|
Fix the generic RSC DB decoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_generic.hxx",
"new_path": "src/Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_generic.hxx",
"diff": "@@ -59,7 +59,12 @@ void Decoder_RSC_DB_BCJR_generic<B,R,MAX>\nthis->alpha[k][s1] + this->gamma[k][4*s1 + 1]),\nMAX(this->alpha[k][s2] + this->gamma[k][4*s2 + 2],\nthis->alpha[k][s3] + this->gamma[k][4*s3 + 3]));\n+\n}\n+\n+ R norm = this->alpha[k+1][0];\n+ for (auto s = 0; s < this->n_states; s++)\n+ this->alpha[k+1][s] -= norm;\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the generic RSC DB decoder.
|
8,490 |
01.08.2017 12:09:58
| -7,200 |
e6c238af6788479f131f12f454bcbd664c55f988
|
Add the possibility to override the decoder implem even if a std is selected (double binary chains).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo_DB/Decoder_turbo_DB.cpp",
"new_path": "src/Factory/Module/Code/Turbo_DB/Decoder_turbo_DB.cpp",
"diff": "@@ -67,12 +67,6 @@ void Decoder_turbo_DB\nif(exist(vals, {p+\"-ite\", \"i\"})) params.n_ite = std::stoi(vals.at({p+\"-ite\", \"i\"}));\n- if (params.sub.implem == \"DVB-RCS1\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"ARP_DVBS1\";\n-\n- if (params.sub.implem == \"DVB-RCS2\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"ARP_DVBS2\";\n-\nparams.sub.K = params.K;\nparams.sub.n_frames = params.n_frames;\n@@ -85,6 +79,12 @@ void Decoder_turbo_DB\nparams.itl.n_frames = params.n_frames;\nInterleaver::store_args(vals, params.itl, \"itl\");\n+ if (params.sub.implem == \"DVB-RCS1\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"ARP_DVBS1\";\n+\n+ if (params.sub.implem == \"DVB-RCS2\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"ARP_DVBS2\";\n+\nparams.sf.n_ite = params.n_ite;\nScaling_factor::store_args(vals, params.sf, p+\"-sf\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Turbo_DB/Encoder_turbo_DB.cpp",
"new_path": "src/Factory/Module/Code/Turbo_DB/Encoder_turbo_DB.cpp",
"diff": "@@ -59,18 +59,18 @@ void Encoder_turbo_DB\nEncoder_RSC_DB::store_args(vals, params.sub, p+\"-sub\");\n- if (params.sub.standard == \"DVB-RCS1\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"ARP_DVBS1\";\n-\n- if (params.sub.standard == \"DVB-RCS2\" && !exist(vals, {\"itl-type\"}))\n- params.itl.type = \"ARP_DVBS2\";\n-\nparams.N_cw = 2 * params.sub.N_cw - params.K;\nparams.R = (float)params.K / (float)params.N_cw;\nparams.itl.size = params.K >> 1;\nparams.itl.n_frames = params.n_frames;\nInterleaver::store_args(vals, params.itl, \"itl\");\n+\n+ if (params.sub.standard == \"DVB-RCS1\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"ARP_DVBS1\";\n+\n+ if (params.sub.standard == \"DVB-RCS2\" && !exist(vals, {\"itl-type\"}))\n+ params.itl.type = \"ARP_DVBS2\";\n}\nvoid Encoder_turbo_DB\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/RSC_DB/RSC_DB.hxx",
"new_path": "src/Launcher/Code/RSC_DB/RSC_DB.hxx",
"diff": "@@ -55,7 +55,7 @@ void RSC_DB<C,B,R,Q>\nfactory::Decoder_RSC_DB::store_args(this->ar.get_args(), *params_dec);\n- if (!params_enc->standard.empty())\n+ if (!params_enc->standard.empty() && !this->ar.exist_arg({\"dec-implem\"}))\nparams_dec->implem = params_enc->standard;\nthis->params->pct->type = \"NO\";\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/Turbo_DB/Turbo_DB.hxx",
"new_path": "src/Launcher/Code/Turbo_DB/Turbo_DB.hxx",
"diff": "@@ -74,7 +74,7 @@ void Turbo_DB<C,B,R,Q>\nfactory::Decoder_turbo_DB::store_args(this->ar.get_args(), *params_dec);\n- if (!params_enc->sub.standard.empty())\n+ if (!params_enc->sub.standard.empty() && !this->ar.exist_arg({\"dec-sub-implem\"}))\nparams_dec->sub.implem = params_enc->sub.standard;\nif (std::is_same<Q,int8_t>())\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the possibility to override the decoder implem even if a std is selected (double binary chains).
|
8,490 |
01.08.2017 12:51:15
| -7,200 |
03d22adecfcae43a50c62fd35a0343080d3f1e17
|
Fix code and bit rates.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/BFER/BFER.cpp",
"new_path": "src/Factory/Simulation/BFER/BFER.cpp",
"diff": "@@ -133,7 +133,7 @@ void BFER::make_header(params_list& head_sim, const parameters& params, const bo\nhead_sim.push_back(std::make_pair(\"Bad frames base path\", path));\n}\n- const auto bit_rate = (float)params.src->K / (float)params.enc->N_cw;\n+ const auto bit_rate = (float)params.src->K / (float)params.pct->N;\nhead_sim.push_back(std::make_pair(\"Bit rate\", std::to_string(bit_rate)));\nhead_sim.push_back(std::make_pair(\"Inter frame level\", std::to_string(params.src->n_frames)));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/BFER_ite.cpp",
"new_path": "src/Launcher/Simulation/BFER_ite.cpp",
"diff": "@@ -181,11 +181,13 @@ void BFER_ite<B,R,Q>\nfactory::Monitor ::make_header(this->pl_mnt, *params->mnt, false);\nfactory::Terminal_BFER::make_header(this->pl_ter, *params->ter, false);\n+ const auto code_rate = (float)params->enc->K / (float)params->pct->N;\n+\nthis->pl_cde.push_back(std::make_pair(\"Type\", params->cde_type ));\nthis->pl_cde.push_back(std::make_pair(\"Info. bits (K)\", std::to_string(params->enc->K )));\nthis->pl_cde.push_back(std::make_pair(\"Codeword size (N_cw)\", std::to_string(params->enc->N_cw)));\nthis->pl_cde.push_back(std::make_pair(\"Frame size (N)\", std::to_string(params->pct->N )));\n- this->pl_cde.push_back(std::make_pair(\"Code rate\", std::to_string(params->enc->R )));\n+ this->pl_cde.push_back(std::make_pair(\"Code rate\", std::to_string(code_rate )));\nLauncher::print_header();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/BFER_std.cpp",
"new_path": "src/Launcher/Simulation/BFER_std.cpp",
"diff": "@@ -171,11 +171,13 @@ void BFER_std<B,R,Q>\nfactory::Monitor ::make_header(this->pl_mnt, *params->mnt, false);\nfactory::Terminal_BFER::make_header(this->pl_ter, *params->ter, false);\n+ const auto code_rate = (float)params->enc->K / (float)params->pct->N;\n+\nthis->pl_cde.push_back(std::make_pair(\"Type\", params->cde_type ));\nthis->pl_cde.push_back(std::make_pair(\"Info. bits (K)\", std::to_string(params->enc->K )));\nthis->pl_cde.push_back(std::make_pair(\"Codeword size (N_cw)\", std::to_string(params->enc->N_cw)));\nthis->pl_cde.push_back(std::make_pair(\"Frame size (N)\", std::to_string(params->pct->N )));\n- this->pl_cde.push_back(std::make_pair(\"Code rate\", std::to_string(params->enc->R )));\n+ this->pl_cde.push_back(std::make_pair(\"Code rate\", std::to_string(code_rate )));\nLauncher::print_header();\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix code and bit rates.
|
8,490 |
01.08.2017 17:10:36
| -7,200 |
750c0dc80a3fe2b79e0fc929f662d1f3c468e3d4
|
Update the AFF3CT includes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor_array.hpp>\n#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor.hpp>\n#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor_seq.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor_adaptive.hpp>\n#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor_vec.hpp>\n#include <Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/Flip_and_check/Flip_and_check_DB.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker_DB.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/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 <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_DVB2.hpp>\n+#include <Module/Interleaver/ARP/Interleaver_ARP_DVB1.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/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/Encoder.hpp>\n#include <Module/Encoder/NO/Encoder_NO.hpp>\n#include <Module/Encoder/RA/Encoder_RA.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/Channel/Channel.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_AVX.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_SSE.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hpp>\n+#include <Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp>\n// #include <Module/Decoder/SPU_SISO.hpp>\n#include <Module/Decoder/SISO.hpp>\n#include <Module/Decoder/Repetition/Decoder_repetition_fast.hpp>\n#include <Module/Decoder/NO/Decoder_NO.hpp>\n#include <Module/Decoder/RA/Decoder_RA.hpp>\n// #include <Module/Decoder/SC_Decoder.hpp>\n-#include <Module/Decoder/Turbo/Decoder_turbo_std.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.hpp>\n+#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB1.hpp>\n+#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB2.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/Coset/Real/Coset_real.hpp>\n#include <Module/Coset/Coset.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/Code/Turbo/Flip_and_check_DB.hpp>\n#include <Factory/Tools/Display/Terminal/Terminal.hpp>\n#include <Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n#include <Factory/Tools/Display/Terminal/BFER/Terminal_BFER.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/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/Simulation/BFER/BFER_ite.hpp>\n#include <Launcher/Code/Polar/Polar.hpp>\n#include <Launcher/Code/RSC/RSC.hpp>\n+#include <Launcher/Code/Turbo_DB/Turbo_DB.hpp>\n#include <Launcher/Code/Repetition/Repetition.hpp>\n#include <Launcher/Code/LDPC/LDPC.hpp>\n#include <Launcher/Code/Uncoded/Uncoded.hpp>\n#include <Launcher/Code/BCH/BCH.hpp>\n#include <Launcher/Code/RA/RA.hpp>\n+#include <Launcher/Code/RSC_DB/RSC_DB.hpp>\n#include <Launcher/Code/Turbo/Turbo.hpp>\n#include <Launcher/Simulation/BFER_std.hpp>\n#include <Launcher/Simulation/EXIT.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the AFF3CT includes.
|
8,490 |
02.08.2017 13:17:35
| -7,200 |
66f978bd5942ab569528f53a2f70bad8465dbf0e
|
Use Decoder_NO fast hard decision whenever possible.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "@@ -12,7 +12,7 @@ template <typename B, typename R>\nDecoder_BCH<B, R>\n::Decoder_BCH(const int& K, const int& N, const int&t, const Galois &GF, const int n_frames,\nconst std::string name)\n-: Decoder_SIHO<B,R>(K, N, n_frames, 1, name),\n+: Decoder_SIHO<B,R>(K, N, n_frames, 1, name), hard_decision(N),\nelp(N+2), discrepancy(N+2), l(N+2), u_lu(N+2), s(N+1), loc(200), reg(201), m(GF.get_m()), t(t), d(2*t+1), alpha_to(N+1),\nindex_of(N+1), YH_N(N), V_K(K)\n{\n@@ -42,8 +42,7 @@ void Decoder_BCH<B, R>\n::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n- for (int j = 0; j < this->N; j++)\n- this->YH_N[j] = (Y_N[j] > 0)? 0 : 1; // hard decision on the input\n+ hard_decision.decode_siho(Y_N, YH_N.data());\nauto d_load = std::chrono::steady_clock::now() - t_load;\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"diff": "#include \"Tools/Math/Galois.hpp\"\n+#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n+\n#include \"../Decoder_SIHO.hpp\"\nnamespace aff3ct\n@@ -16,6 +18,8 @@ template <typename B = int, typename R = float>\nclass Decoder_BCH : public Decoder_SIHO<B,R>\n{\nprivate:\n+ Decoder_NO<B,R> hard_decision;\n+\nstd::vector<mipp::vector<int>> elp;\nmipp::vector<int> discrepancy;\nmipp::vector<int> l;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.hpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.hpp",
"diff": "@@ -7,6 +7,7 @@ namespace aff3ct\n{\nnamespace module\n{\n+\ntemplate <typename B = int, typename R = float>\nclass Decoder_NO : public Decoder_SISO_SIHO<B,R>\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RA/Decoder_RA.cpp",
"new_path": "src/Module/Decoder/RA/Decoder_RA.cpp",
"diff": "@@ -14,7 +14,7 @@ template <typename B, typename R>\nDecoder_RA<B, R>\n::Decoder_RA(const int& K, const int& N, const Interleaver<int>& interleaver, int max_iter, const int n_frames,\nconst std::string name)\n-: Decoder_SIHO<B,R>(K, N, n_frames, 1, name),\n+: Decoder_SIHO<B,R>(K, N, n_frames, 1, name), hard_decision(K),\nrep_count(N/K),\nmax_iter(max_iter),\nFw(N),\n@@ -121,8 +121,7 @@ void Decoder_RA<B, R>\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- for (auto i = 0; i < this->K; i++)\n- V_K[i] = (U[i] > 0) ? 0 : 1;\n+ hard_decision.decode_siho(U.data(), V_K);\nauto d_store = std::chrono::steady_clock::now() - t_store;\nthis->d_load_total += d_load;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RA/Decoder_RA.hpp",
"new_path": "src/Module/Decoder/RA/Decoder_RA.hpp",
"diff": "#include <vector>\n#include <mipp.h>\n+#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n+\n#include \"../Decoder_SIHO.hpp\"\n#include \"../../Interleaver/Interleaver.hpp\"\n@@ -14,6 +16,9 @@ namespace module\ntemplate <typename B = int, typename R = float>\nclass Decoder_RA : public Decoder_SIHO<B,R>\n{\n+private:\n+ Decoder_NO<B,R> hard_decision;\n+\nprotected:\nconst int rep_count; // number of repetitions\nint max_iter; // max number of iterations\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Repetition/Decoder_repetition.cpp",
"new_path": "src/Module/Decoder/Repetition/Decoder_repetition.cpp",
"diff": "@@ -13,7 +13,7 @@ template <typename B, typename R>\nDecoder_repetition<B,R>\n::Decoder_repetition(const int& K, const int& N, const bool buffered_encoding, const int n_frames,\nconst std::string name)\n-: Decoder_SISO_SIHO<B,R>(K, N, n_frames, 1, name),\n+: Decoder_SISO_SIHO<B,R>(K, N, n_frames, 1, name), hard_decision(K),\nrep_count((N/K) -1), buffered_encoding(buffered_encoding), sys(K), par(K * rep_count), ext(K)\n{\nif (N % K)\n@@ -67,17 +67,7 @@ void Decoder_repetition<B,R>\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- // take the hard decision\n- auto vec_loop_size = (this->K / mipp::nElReg<R>()) * mipp::nElReg<R>();\n- for (auto i = 0; i < vec_loop_size; i += mipp::nElReg<R>())\n- {\n- const auto r_ext = mipp::Reg<R>(&ext[i]);\n- const auto r_s = mipp::cast<R,B>(r_ext) >> (sizeof(B) * 8 - 1);\n-\n- r_s.store(&V_K[i]);\n- }\n- for (auto i = vec_loop_size; i < this->K; i++)\n- V_K[i] = ext[i] < 0;\n+ hard_decision.decode_siho(ext.data(), V_K);\nauto d_store = std::chrono::steady_clock::now() - t_store;\nthis->d_load_total += d_load;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Repetition/Decoder_repetition.hpp",
"new_path": "src/Module/Decoder/Repetition/Decoder_repetition.hpp",
"diff": "#include <vector>\n#include <mipp.h>\n+#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n+\n#include \"../Decoder_SISO_SIHO.hpp\"\nnamespace aff3ct\n@@ -13,6 +15,9 @@ namespace module\ntemplate <typename B = int, typename R = float>\nclass Decoder_repetition : public Decoder_SISO_SIHO<B,R>\n{\n+private:\n+ Decoder_NO<B,R> hard_decision;\n+\nprotected:\nconst int rep_count; // number of repetitions\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": "@@ -21,7 +21,8 @@ Decoder_turbo_fast<B,R>\nDecoder_SISO<R> &siso_i,\nconst bool buffered_encoding,\nconst std::string name)\n-: Decoder_turbo<B,R>(K, N, n_ite, pi, siso_n, siso_i, buffered_encoding, name)\n+: Decoder_turbo<B,R>(K, N, n_ite, pi, siso_n, siso_i, buffered_encoding, name),\n+ hard_decision(K * siso_n.get_simd_inter_frame_level())\n{\n}\n@@ -198,18 +199,7 @@ void Decoder_turbo_fast<B,R>\n// compute the hard decision only if we are in the last iteration\nif (ite == this->n_ite || stop)\n- {\n- const auto loop_size1 = (this->K * n_frames) / mipp::nElReg<R>();\n- for (auto i = 0; i < loop_size1; i++)\n- {\n- const auto r_post = mipp::Reg<R>(&this->l_e1n[i * mipp::nElReg<R>()]);\n- const auto r_dec = mipp::cast<R,B>(r_post) >> (sizeof(B) * 8 - 1); // s[i] = (l_e1n[i] < 0);\n- r_dec.store(&this->s[i * mipp::nElReg<R>()]);\n- }\n- const auto loop_size2 = this->K * n_frames;\n- for (auto i = loop_size1 * mipp::nElReg<R>(); i < loop_size2; i++)\n- this->s[i] = (this->l_e1n[i] < 0);\n- }\n+ hard_decision.decode_siho(this->l_e1n.data(), this->s.data());\n}\nite++; // increment the number of iteration\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/Decoder_turbo_fast.hpp",
"new_path": "src/Module/Decoder/Turbo/Decoder_turbo_fast.hpp",
"diff": "#include <vector>\n#include <mipp.h>\n-#include \"Module/Interleaver/Interleaver.hpp\"\n+#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n#include \"Decoder_turbo.hpp\"\n@@ -15,6 +15,9 @@ namespace module\ntemplate <typename B = int, typename R = float>\nclass Decoder_turbo_fast : public Decoder_turbo<B,R>\n{\n+private:\n+ Decoder_NO<B,R> hard_decision;\n+\npublic:\nDecoder_turbo_fast(const int& K,\nconst int& N,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/Decoder_turbo_std.cpp",
"new_path": "src/Module/Decoder/Turbo/Decoder_turbo_std.cpp",
"diff": "@@ -18,7 +18,8 @@ Decoder_turbo_std<B,R>\nDecoder_SISO<R> &siso_i,\nconst bool buffered_encoding,\nconst std::string name)\n-: Decoder_turbo<B,R>(K, N, n_ite, pi, siso_n, siso_i, buffered_encoding, name)\n+: Decoder_turbo<B,R>(K, N, n_ite, pi, siso_n, siso_i, buffered_encoding, name),\n+ hard_decision(K * siso_n.get_simd_inter_frame_level())\n{\n}\n@@ -93,8 +94,7 @@ void Decoder_turbo_std<B,R>\n// compute the hard decision only if we are in the last iteration\nif (ite == this->n_ite || stop)\n- for (auto i = 0; i < this->K * n_frames; i++)\n- this->s[i] = this->l_e1n[i] < 0;\n+ hard_decision.decode_siho(this->l_e1n.data(), this->s.data());\n}\nite++; // increment the number of iteration\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/Decoder_turbo_std.hpp",
"new_path": "src/Module/Decoder/Turbo/Decoder_turbo_std.hpp",
"diff": "#include <vector>\n#include <mipp.h>\n-#include \"Module/Interleaver/Interleaver.hpp\"\n+#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n#include \"Decoder_turbo.hpp\"\n@@ -15,6 +15,9 @@ namespace module\ntemplate <typename B = int, typename R = float>\nclass Decoder_turbo_std : public Decoder_turbo<B,R>\n{\n+private:\n+ Decoder_NO<B,R> hard_decision;\n+\npublic:\nDecoder_turbo_std(const int& K,\nconst int& N,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker.cpp",
"new_path": "src/Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker.cpp",
"diff": "@@ -48,32 +48,6 @@ bool CRC_checker<B,R>\nreturn false;\n}\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-template <>\n-bool CRC_checker<int64_t, double>\n-::siso_n(const int ite,\n- const mipp::vector<double >& sys,\n- mipp::vector<double >& ext,\n- mipp::vector<int64_t>& s)\n-{\n- if (ite >= start_crc_check_ite)\n- {\n- // compute the hard decision (for the CRC)\n- const auto loop_size = (int)s.size();\n- for (auto i = 0; i < loop_size; i++)\n- s[i] = (sys[i] + ext[i]) < 0;\n-\n- return crc.check(s, simd_inter_frame_level);\n- }\n-\n- return false;\n-}\n-}\n-}\n-\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Use Decoder_NO fast hard decision whenever possible.
|
8,490 |
02.08.2017 15:14:56
| -7,200 |
5c1f5fb5bdd0a1b5ebfec191e8330fb4df09ca9c
|
Add a new type of decoder: the Decoder_HIHO (Hard Input Hard Output).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "@@ -12,9 +12,9 @@ template <typename B, typename R>\nDecoder_BCH<B, R>\n::Decoder_BCH(const int& K, const int& N, const int&t, const Galois &GF, const int n_frames,\nconst std::string name)\n-: Decoder_SIHO<B,R>(K, N, n_frames, 1, name), hard_decision(N),\n- elp(N+2), discrepancy(N+2), l(N+2), u_lu(N+2), s(N+1), loc(200), reg(201), m(GF.get_m()), t(t), d(2*t+1), alpha_to(N+1),\n- index_of(N+1), YH_N(N), V_K(K)\n+: Decoder_SIHO_HIHO<B,R>(K, N, n_frames, 1, name), hard_decision(N),\n+ elp(N+2, mipp::vector<int>(N)), discrepancy(N+2), l(N+2), u_lu(N+2), s(N+1), loc(200), reg(201), m(GF.get_m()),\n+ t(t), d(2*t+1), alpha_to(N+1), index_of(N+1), YH_N(N)\n{\nif (K <= 3)\n{\n@@ -25,10 +25,6 @@ Decoder_BCH<B, R>\nalpha_to = GF.alpha_to;\nindex_of = GF.index_of;\n- for (auto i = 0; i < N; i++)\n- {\n- elp[i].resize(N);\n- }\n}\ntemplate <typename B, typename R>\n@@ -39,12 +35,8 @@ Decoder_BCH<B, R>\ntemplate <typename B, typename R>\nvoid Decoder_BCH<B, R>\n-::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+::_decode(B *Y_N, B *V_K)\n{\n- auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n- hard_decision.decode_siho(Y_N, YH_N.data());\n- auto d_load = std::chrono::steady_clock::now() - t_load;\n-\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nint i, j, u, q, t2, count = 0, syn_error = 0;\n@@ -55,7 +47,7 @@ void Decoder_BCH<B, R>\n{\ns[i] = 0;\nfor (j = 0; j < this->N; j++)\n- if (YH_N[j] != 0)\n+ if (Y_N[j] != 0)\ns[i] ^= alpha_to[(i * j) % this->N];\nif (s[i] != 0)\nsyn_error = 1; /* set error flag if non-zero syndrome */\n@@ -163,8 +155,7 @@ void Decoder_BCH<B, R>\ndiscrepancy[u + 1] = 0;\nfor (i = 1; i <= l[u + 1]; i++)\nif ((s[u + 1 - i] != -1) && (elp[u + 1][i] != 0))\n- discrepancy[u + 1] ^= alpha_to[(s[u + 1 - i]\n- + index_of[elp[u + 1][i]]) % this->N];\n+ discrepancy[u + 1] ^= alpha_to[(s[u + 1 - i] + index_of[elp[u + 1][i]]) % this->N];\n/* put d[u+1] into index form */\ndiscrepancy[u + 1] = index_of[discrepancy[u + 1]];\n}\n@@ -202,21 +193,39 @@ void Decoder_BCH<B, R>\nif (count == l[u])\n/* no. roots = degree of elp hence <= t errors */\nfor (i = 0; i < l[u]; i++)\n- YH_N[loc[i]] ^= 1;\n+ Y_N[loc[i]] ^= 1;\n}\n}\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n- for (i = 0; i < this->K; i++)\n- V_K[i] = YH_N[i+this->N-this->K];\n+ std::copy(Y_N + this->N - this->K, Y_N + this->N, V_K);\nauto d_store = std::chrono::steady_clock::now() - t_store;\n- this->d_load_total += d_load;\nthis->d_decod_total += d_decod;\nthis->d_store_total += d_store;\n}\n+template <typename B, typename R>\n+void Decoder_BCH<B, R>\n+::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n+{\n+ std::copy(Y_N, Y_N + this->N, YH_N.begin());\n+ this->_decode(YH_N.data(), V_K);\n+}\n+\n+template <typename B, typename R>\n+void Decoder_BCH<B, R>\n+::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+{\n+ auto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n+ hard_decision.decode_siho(Y_N, YH_N.data());\n+ auto d_load = std::chrono::steady_clock::now() - t_load;\n+ this->d_load_total += d_load;\n+\n+ this->_decode(YH_N.data(), V_K);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"diff": "#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n-#include \"../Decoder_SIHO.hpp\"\n+#include \"../Decoder_SIHO_HIHO.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_BCH : public Decoder_SIHO<B,R>\n+class Decoder_BCH : public Decoder_SIHO_HIHO<B,R>\n{\nprivate:\nDecoder_NO<B,R> hard_decision;\n@@ -37,7 +37,6 @@ protected:\nmipp::vector<int> index_of; // antilog table of GF(2**m)\nmipp::vector<B> YH_N; // hard decision input vector\n- mipp::vector<B> V_K;\npublic:\nDecoder_BCH(const int& K, const int& N, const int&t, const tools::Galois &GF,\n@@ -45,6 +44,8 @@ public:\nvirtual ~Decoder_BCH();\nprotected:\n+ void _decode ( B *Y_N, B *V_K );\n+ void _decode_hiho(const B *Y_N, B *V_K, const int frame_id);\nvoid _decode_siho(const R *Y_N, B *V_K, const int frame_id);\n};\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/Decoder_HIHO.hpp",
"diff": "+/*!\n+ * \\file\n+ * \\brief A Decoder is an algorithm dedicated to find the initial sequence of information bits (before the noise).\n+ *\n+ * \\section LICENSE\n+ * This file is under MIT license (https://opensource.org/licenses/MIT).\n+ */\n+#ifndef DECODER_HIHO_HPP_\n+#define DECODER_HIHO_HPP_\n+\n+#include <chrono>\n+#include <string>\n+#include <vector>\n+#include <sstream>\n+#include <mipp.h>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+\n+#include \"Module/Module.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+/*!\n+ * \\class Decoder_SIHO_i\n+ *\n+ * \\brief A Decoder is an algorithm dedicated to find the initial sequence of information bits (before the noise).\n+ *\n+ * \\tparam B: type of the bits in the Decoder.\n+ * \\tparam R: type of the reals (floating-point or fixed-point representation) in the Decoder.\n+ *\n+ * The Decoder takes a soft input (real numbers) and return a hard output (bits).\n+ * Please use Decoder for inheritance (instead of Decoder_HIHO_i).\n+ */\n+template <typename B = int>\n+class Decoder_HIHO_i : public Module\n+{\n+private:\n+ const int n_inter_frame_rest;\n+\n+ mipp::vector<B> Y_N;\n+ mipp::vector<B> V_K;\n+\n+protected:\n+ const int K_hiho; /*!< Number of information bits in one frame */\n+ const int N_hiho; /*!< Size of one frame (= number of bits in one frame) */\n+ const int simd_inter_frame_level_hiho; /*!< Number of frames absorbed by the SIMD instructions. */\n+ const int n_dec_waves_hiho;\n+\n+public:\n+ /*!\n+ * \\brief Constructor.\n+ *\n+ * \\param K: number of information bits in the frame.\n+ * \\param N: size of one frame.\n+ * \\param n_frames: number of frames to process in the Decoder.\n+ * \\param simd_inter_frame_level: number of frames absorbed by the SIMD instructions.\n+ * \\param name: Decoder's name.\n+ */\n+ Decoder_HIHO_i(const int K, const int N, const int n_frames = 1, const int simd_inter_frame_level = 1,\n+ std::string name = \"Decoder_HIHO_i\")\n+ : Module(n_frames, name),\n+ n_inter_frame_rest(this->n_frames % simd_inter_frame_level),\n+ Y_N(n_inter_frame_rest ? simd_inter_frame_level * N : 0),\n+ V_K(n_inter_frame_rest ? simd_inter_frame_level * K : 0),\n+ K_hiho(K),\n+ N_hiho(N),\n+ simd_inter_frame_level_hiho(simd_inter_frame_level),\n+ n_dec_waves_hiho((int)std::ceil((float)this->n_frames / (float)simd_inter_frame_level))\n+ {\n+ if (K <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be greater than 0 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (N <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be greater than 0 ('N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (simd_inter_frame_level <= 0)\n+ {\n+ std::stringstream message;\n+ message << \"'simd_inter_frame_level' has to be greater than 0 ('simd_inter_frame_level' = \"\n+ << simd_inter_frame_level << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (K > N)\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be smaller or equal to 'N' ('K' = \" << K << \", 'N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+\n+ /*!\n+ * \\brief Destructor.\n+ */\n+ virtual ~Decoder_HIHO_i()\n+ {\n+ }\n+\n+ int get_K() const\n+ {\n+ return this->K_hiho;\n+ }\n+\n+ int get_N() const\n+ {\n+ return this->N_hiho;\n+ }\n+\n+ /*!\n+ * \\brief Gets the number of frames absorbed by the SIMD instructions.\n+ *\n+ * \\return the number of frames absorbed by the SIMD instructions.\n+ */\n+ int get_simd_inter_frame_level() const\n+ {\n+ return this->simd_inter_frame_level_hiho;\n+ }\n+\n+ int get_n_dec_waves() const\n+ {\n+ return this->n_dec_waves_hiho;\n+ }\n+\n+ /*!\n+ * \\brief Decodes the noisy frame.\n+ *\n+ * \\param Y_N: a noisy frame.\n+ * \\param V_K: a decoded codeword (only the information bits).\n+ */\n+ void decode_hiho(const mipp::vector<B>& Y_N, mipp::vector<B>& V_K)\n+ {\n+ if (this->N_hiho * this->n_frames != (int)Y_N.size())\n+ {\n+ std::stringstream message;\n+ message << \"'Y_N.size()' has to be equal to 'N' * 'n_frames' ('Y_N.size()' = \" << Y_N.size()\n+ << \", 'N' = \" << this->N_hiho << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (this->K_hiho * this->n_frames != (int)V_K.size())\n+ {\n+ std::stringstream message;\n+ message << \"'V_K.size()' has to be equal to 'K' * 'n_frames' ('V_K.size()' = \" << V_K.size()\n+ << \", 'K' = \" << this->K_hiho << \", 'n_frames' = \" << this->n_frames << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->decode_hiho(Y_N.data(), V_K.data());\n+ }\n+\n+ virtual void decode_hiho(const B *Y_N, B *V_K)\n+ {\n+ auto w = 0;\n+ for (w = 0; w < this->n_dec_waves_hiho -1; w++)\n+ this->_decode_hiho(Y_N + w * this->N_hiho * this->simd_inter_frame_level_hiho,\n+ V_K + w * this->K_hiho * this->simd_inter_frame_level_hiho,\n+ w * simd_inter_frame_level_hiho);\n+\n+ if (this->n_inter_frame_rest == 0)\n+ this->_decode_hiho(Y_N + w * this->N_hiho * this->simd_inter_frame_level_hiho,\n+ V_K + w * this->K_hiho * this->simd_inter_frame_level_hiho,\n+ w * simd_inter_frame_level_hiho);\n+ else\n+ {\n+ const auto waves_off1 = w * this->simd_inter_frame_level_hiho * this->N_hiho;\n+ std::copy(Y_N + waves_off1,\n+ Y_N + waves_off1 + this->n_inter_frame_rest * this->N_hiho,\n+ this->Y_N.begin());\n+\n+ this->_decode_hiho(this->Y_N.data(), this->V_K.data(), w * simd_inter_frame_level_hiho);\n+\n+ const auto waves_off2 = w * this->simd_inter_frame_level_hiho * this->K_hiho;\n+ std::copy(this->V_K.begin(),\n+ this->V_K.begin() + this->n_inter_frame_rest * this->K_hiho,\n+ V_K + waves_off2);\n+ }\n+ }\n+\n+protected:\n+ virtual void _decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n+ {\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ }\n+};\n+}\n+}\n+\n+#include \"SC_Decoder_HIHO.hpp\"\n+\n+#endif /* DECODER_HIHO_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/Decoder_SIHO_HIHO.hpp",
"diff": "+/*!\n+ * \\file\n+ * \\brief A Decoder_SISO is both a \"Soft Input Hard Output\" decoder and a \"Soft Input Soft Output\" decoder.\n+ *\n+ * \\section LICENSE\n+ * This file is under MIT license (https://opensource.org/licenses/MIT).\n+ */\n+#ifndef DECODER_SIHO_HIHO_HPP_\n+#define DECODER_SIHO_HIHO_HPP_\n+\n+#include \"Decoder_SIHO.hpp\"\n+#include \"Decoder_HIHO.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+/*!\n+ * \\class Decoder_SIHO_HIHO\n+ *\n+ * \\brief A Decoder_SIHO_HIHO is both a \"Soft Input Hard Output\" decoder and a \"Hard Input Hard Output\" decoder.\n+ *\n+ * \\tparam B: type of the bits in the decoder.\n+ * \\tparam R: type of the reals (floating-point or fixed-point representation) in the decoder.\n+ */\n+template <typename B = int, typename R = float>\n+class Decoder_SIHO_HIHO : public Decoder_SIHO<B,R>, public Decoder_HIHO<B>\n+{\n+public:\n+ /*!\n+ * \\brief Constructor.\n+ *\n+ * \\param K: number of information bits in the frame.\n+ * \\param N: size of one frame.\n+ * \\param n_frames: number of frames to process in the decoder.\n+ * \\param simd_inter_frame_level: number of frames absorbed by the SIMD instructions.\n+ * \\param name: decoder name.\n+ */\n+ Decoder_SIHO_HIHO(const int K, const int N, const int n_frames = 1, const int simd_inter_frame_level = 1,\n+ std::string name = \"Decoder_SIHO_HIHO\")\n+ : Decoder_SIHO<B,R>(K, N, n_frames, simd_inter_frame_level, name ),\n+ Decoder_HIHO<B >(K, N, n_frames, simd_inter_frame_level, name + \"_hiho\")\n+ {\n+ }\n+\n+ /*!\n+ * \\brief Destructor.\n+ */\n+ virtual ~Decoder_SIHO_HIHO() {}\n+\n+ /*!\n+ * \\brief Gets the number of frames.\n+ *\n+ * \\return the number of frames to process in the decoder.\n+ */\n+ virtual int get_n_frames() const\n+ {\n+ return Decoder_SIHO<B,R>::n_frames;\n+ }\n+\n+ int get_K() const\n+ {\n+ return Decoder_SIHO<B,R>::K;\n+ }\n+\n+ int get_N() const\n+ {\n+ return Decoder_SIHO<B,R>::N;\n+ }\n+\n+ /*!\n+ * \\brief Gets the number of frames absorbed by the SIMD instructions.\n+ *\n+ * \\return the number of frames absorbed by the SIMD instructions.\n+ */\n+ int get_simd_inter_frame_level() const\n+ {\n+ return Decoder_SIHO<B,R>::simd_inter_frame_level;\n+ }\n+\n+ int get_n_dec_waves() const\n+ {\n+ return Decoder_SIHO<B,R>::n_dec_waves;\n+ }\n+};\n+}\n+}\n+\n+#endif /* DECODER_SIHO_HIHO_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/SC_Decoder_HIHO.hpp",
"diff": "+#ifndef SC_DECODER_HIHO_HPP_\n+#define SC_DECODER_HIHO_HPP_\n+\n+#ifdef SYSTEMC_MODULE\n+#include <vector>\n+#include <string>\n+#include <sstream>\n+#include <systemc>\n+#include <tlm>\n+#include <tlm_utils/simple_target_socket.h>\n+#include <tlm_utils/simple_initiator_socket.h>\n+#include <mipp.h>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B>\n+class SC_Decoder_HIHO;\n+\n+template <typename B = int>\n+class SC_Decoder_HIHO_module : public sc_core::sc_module\n+{\n+public:\n+ tlm_utils::simple_target_socket <SC_Decoder_HIHO_module> s_in;\n+ tlm_utils::simple_initiator_socket<SC_Decoder_HIHO_module> s_out;\n+\n+private:\n+ SC_Decoder_HIHO<B> &decoder;\n+ mipp::vector<B> V_K;\n+\n+public:\n+ SC_Decoder_HIHO_module(SC_Decoder_HIHO<B> &decoder, const sc_core::sc_module_name name = \"SC_Decoder_HIHO_module\")\n+ : sc_module(name), s_in (\"s_in\"), s_out(\"s_out\"),\n+ decoder(decoder),\n+ V_K(decoder.get_K() * decoder.get_n_frames())\n+ {\n+ s_in.register_b_transport(this, &SC_Decoder_HIHO_module::b_transport);\n+ }\n+\n+ const mipp::vector<B>& get_V_K()\n+ {\n+ return V_K;\n+ }\n+\n+private:\n+ void b_transport(tlm::tlm_generic_payload& trans, sc_core::sc_time& t)\n+ {\n+ if (decoder.get_N() * decoder.get_n_frames() != (int)(trans.get_data_length() / sizeof(B)))\n+ {\n+ std::stringstream message;\n+ message << \"'decoder.get_N()' * 'decoder.get_n_frames()' has to be equal to \"\n+ << \"'trans.get_data_length()' / 'sizeof(B)' ('decoder.get_N()' = \" << decoder.get_N()\n+ << \", 'decoder.get_n_frames()' = \" << decoder.get_n_frames()\n+ << \", 'trans.get_data_length()' = \" << trans.get_data_length()\n+ << \", 'sizeof(B)' = \" << sizeof(B) << \").\";\n+ throw tools::length_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ const auto Y_N = (B*)trans.get_data_ptr();\n+\n+ decoder.decode_hiho(Y_N, V_K.data());\n+\n+ tlm::tlm_generic_payload payload;\n+ payload.set_data_ptr((unsigned char*)V_K.data());\n+ payload.set_data_length(V_K.size() * sizeof(B));\n+\n+ sc_core::sc_time zero_time(sc_core::SC_ZERO_TIME);\n+ s_out->b_transport(payload, zero_time);\n+ }\n+};\n+\n+template <typename B>\n+class SC_Decoder_HIHO : public Decoder_HIHO_i<B>\n+{\n+public:\n+ SC_Decoder_HIHO_module<B> *sc_module;\n+\n+public:\n+ SC_Decoder_HIHO(const int K, const int N, const int n_frames = 1, const int simd_inter_frame_level = 1,\n+ const std::string name = \"SC_Decoder_HIHO\")\n+ : Decoder_HIHO_i<B>(K, N, n_frames, simd_inter_frame_level, name), sc_module(nullptr) {}\n+\n+ virtual ~SC_Decoder_HIHO()\n+ {\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\n+ }\n+\n+ void create_sc_module()\n+ {\n+ if (sc_module != nullptr) { delete sc_module; sc_module = nullptr; }\n+ this->sc_module = new SC_Decoder_HIHO_module<B>(*this, this->name.c_str());\n+ }\n+};\n+\n+template <typename B = int>\n+using Decoder_HIHO = SC_Decoder_HIHO<B>;\n+}\n+}\n+#else\n+#include \"SPU_Decoder_HIHO.hpp\"\n+#endif\n+\n+#endif /* SC_DECODER_HIHO_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/SPU_Decoder_HIHO.hpp",
"diff": "+#ifndef SPU_DECODER_HIHO_HPP_\n+#define SPU_DECODER_HIHO_HPP_\n+\n+#ifdef STARPU\n+#include <vector>\n+#include <string>\n+#include <cassert>\n+#include <mipp.h>\n+#include <starpu.h>\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int>\n+class SPU_Decoder_HIHO : public Decoder_HIHO_i<B>\n+{\n+private:\n+ static starpu_codelet spu_cl_decode_hiho;\n+\n+public:\n+ SPU_Decoder_HIHO(const int K, const int N, const int n_frames = 1, const int simd_inter_frame_level = 1,\n+ const std::string name = \"SPU_Decoder_HIHO\")\n+ : Decoder_HIHO_i<B>(K, N, n_frames, simd_inter_frame_level, name) {}\n+\n+ virtual ~SPU_Decoder_HIHO() {}\n+\n+ static inline starpu_task* spu_task_decode_hiho(SPU_Decoder_HIHO<B> *decoder, starpu_data_handle_t &in_data,\n+ starpu_data_handle_t &out_data)\n+ {\n+ auto task = starpu_task_create();\n+\n+ task->name = \"dec::decode_hiho\";\n+ task->cl = &SPU_Decoder_HIHO<B>::spu_cl_decode_hiho;\n+ task->cl_arg = (void*)(decoder);\n+ task->cl_arg_size = sizeof(*decoder);\n+ task->handles[0] = in_data;\n+ task->handles[1] = out_data;\n+\n+ return task;\n+ }\n+\n+private:\n+ static starpu_codelet spu_init_cl_decode_hiho()\n+ {\n+ starpu_codelet cl;\n+\n+ cl.type = STARPU_SEQ;\n+ cl.cpu_funcs [0] = SPU_Decoder_HIHO<B>::spu_kernel_decode_hiho;\n+ cl.cpu_funcs_name[0] = \"dec::decode_hiho::cpu\";\n+ cl.nbuffers = 2;\n+ cl.modes [0] = STARPU_R;\n+ cl.modes [1] = STARPU_W;\n+\n+ return cl;\n+ }\n+\n+ static void spu_kernel_decode_hiho(void *buffers[], void *cl_arg)\n+ {\n+ auto decoder = static_cast<SPU_Decoder_HIHO<B>*>(cl_arg);\n+\n+ auto task = starpu_task_get_current();\n+\n+ auto udata0 = starpu_data_get_user_data(task->handles[0]); assert(udata0);\n+ auto udata1 = starpu_data_get_user_data(task->handles[1]); assert(udata1);\n+\n+ auto Y_N = static_cast<mipp::vector<B>*>(udata0);\n+ auto V_K = static_cast<mipp::vector<B>*>(udata1);\n+\n+ decoder->decode_hiho(*Y_N, *V_K);\n+ }\n+};\n+\n+template <typename B>\n+starpu_codelet SPU_Decoder_HIHO<B>::spu_cl_decode_hiho = SPU_Decoder_HIHO<B>::spu_init_cl_decode_hiho();\n+\n+template <typename B>\n+using Decoder_HIHO = SPU_Decoder_HIHO<B>;\n+}\n+}\n+#else\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int>\n+using Decoder_HIHO = Decoder_HIHO_i<B>;\n+}\n+}\n+#endif\n+\n+#endif /* SPU_DECODER_HIHO_HPP_ */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a new type of decoder: the Decoder_HIHO (Hard Input Hard Output).
|
8,490 |
02.08.2017 15:18:34
| -7,200 |
8c4caed6f5685baad319db2badc04dda9ef87d58
|
Update the AFF3CT header file.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "// #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/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"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the AFF3CT header file.
|
8,490 |
02.08.2017 15:31:04
| -7,200 |
d096b7e7015894fb81c0e8c690df630f9045605a
|
Fix wrong doc.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder_SIHO_HIHO.hpp",
"new_path": "src/Module/Decoder/Decoder_SIHO_HIHO.hpp",
"diff": "/*!\n* \\file\n- * \\brief A Decoder_SISO is both a \"Soft Input Hard Output\" decoder and a \"Soft Input Soft Output\" decoder.\n+ * \\brief A Decoder_SISO is both a \"Soft Input Hard Output\" decoder and a \"Hard Input Hard Output\" decoder.\n*\n* \\section LICENSE\n* This file is under MIT license (https://opensource.org/licenses/MIT).\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix wrong doc.
|
8,490 |
02.08.2017 16:47:05
| -7,200 |
cb98c327cb8beb6c2f6c046b984b29f7930b560d
|
Improving the versionning of AFF3CT.
|
[
{
"change_type": "MODIFY",
"old_path": "CMakeLists.txt",
"new_path": "CMakeLists.txt",
"diff": "@@ -23,8 +23,9 @@ file (GLOB_RECURSE source_files src/*)\n# Auto generate a header containing the last GIT SHA1\ninclude(GetGitRevisionDescription)\nget_git_head_revision(GIT_REFSPEC GIT_SHA1)\n-configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp.in\" \"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp\" @ONLY)\n-list(APPEND source_files \"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/git_sha1.cpp\")\n+git_describe(GIT_VERSION \"--tags\")\n+configure_file(\"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/version.cpp.in\" \"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/version.cpp\" @ONLY)\n+list(APPEND source_files \"${CMAKE_CURRENT_SOURCE_DIR}/src/Tools/version.cpp\")\n# Filters creation for IDEs (tested on Visual Studio and based on the \"source_group\" function)\nfunction(assign_source_group)\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/git_sha1.cpp.in",
"new_path": null,
"diff": "-#include \"Tools/git_sha1.h\"\n-\n-#define GIT_SHA1 \"@GIT_SHA1@\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-const char g_GIT_SHA1[] = GIT_SHA1;\n-}\n-}\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/git_sha1.h",
"new_path": null,
"diff": "-namespace aff3ct\n-{\n-namespace tools\n-{\n-extern const char g_GIT_SHA1[];\n-}\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/version.cpp.in",
"diff": "+#include \"Tools/version.h\"\n+\n+#define GIT_SHA1 \"@GIT_SHA1@\"\n+#define GIT_VERSION \"@GIT_VERSION@\"\n+\n+std::string aff3ct::sha1()\n+{\n+ std::string sha1(GIT_SHA1);\n+ return sha1;\n+}\n+\n+std::string aff3ct::version()\n+{\n+ std::string version(GIT_VERSION);\n+ return version;\n+}\n+\n+int aff3ct::version_major()\n+{\n+ return 0; // TODO\n+}\n+\n+int aff3ct::version_minor()\n+{\n+ return 0; // TODO\n+}\n+\n+int aff3ct::version_release()\n+{\n+ return 0; // TODO\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/version.h",
"diff": "+#ifndef VERSION_H_\n+#define VERSION_H_\n+\n+#include <string>\n+\n+namespace aff3ct\n+{\n+std::string sha1 ();\n+std::string version ();\n+int version_major ();\n+int version_minor ();\n+int version_release();\n+}\n+\n+#endif\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "//find ./src/ -type f -follow -print | grep \"[.]h$\"\n-#include <Tools/git_sha1.h>\n#include <Tools/general_utils.h>\n#include <Tools/types.h>\n#include <Tools/Math/matrix.h>\n#include <Simulation/BFER/Iterative/SystemC/SC_BFER_ite.hpp>\n#include <Simulation/BFER/Iterative/BFER_ite.hpp>\n#include <Simulation/BFER/BFER.hpp>\n+#include \"Tools/version.h\"\n// #include <aff3ct.hpp>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#endif\n#include \"Tools/types.h\"\n-#include \"Tools/git_sha1.h\"\n+#include \"Tools/version.h\"\n#include \"Tools/Arguments_reader.hpp\"\n#include \"Tools/Display/bash_tools.h\"\n@@ -68,14 +68,12 @@ void print_version()\nstd::string compiler = \"Unknown compiler\";\nstd::string compiler_version = \"\";\n#endif\n- std::string affect_version = \"1.1.0\";\n-\n- std::string git_sha1 = tools::g_GIT_SHA1;\n+ std::string affect_version = version() == \"GITDIR-NOTFOUND\" ? \"Unknown version\" : version();\nstd::cout << \"aff3ct (\" << os << prec << \", \" << compiler << \" \" << compiler_version << \", \"\n<< mipp::InstructionFullType << \") \" << affect_version << std::endl;\n- if (git_sha1 != \"GITDIR-NOTFOUND\")\n- std::cout << \"GIT SHA1: \" << git_sha1 << std::endl;\n+ if (sha1() != \"GITDIR-NOTFOUND\")\n+ std::cout << \"GIT SHA1: \" << sha1() << std::endl;\nstd::cout << \"Copyright (c) 2016-2017 - MIT license.\" << std::endl;\nstd::cout << \"This is free software; see the source for copying conditions. There is NO\" << std::endl;\nstd::cout << \"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\" << std::endl;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improving the versionning of AFF3CT.
|
8,490 |
03.08.2017 10:12:49
| -7,200 |
f5a99a5f0ff771093798bc1ebd1c42ff04d4cc65
|
Convert the Gallager A from Decoder_SISO_SIHO to Decoder_SIHO_HIHO + do not display the full git sha1 anymore.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/LDPC/Decoder_LDPC.cpp",
"new_path": "src/Factory/Module/Code/LDPC/Decoder_LDPC.cpp",
"diff": "@@ -19,12 +19,11 @@ const std::string aff3ct::factory::Decoder_LDPC::prefix = \"dec\";\ntemplate <typename B, typename R>\nmodule::Decoder_SISO_SIHO<B,R>* Decoder_LDPC\n-::build(const parameters& params, const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos)\n+::build_siso(const parameters& params, const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos)\n{\nif ((params.type == \"BP\" || params.type == \"BP_FLOODING\") && params.simd_strategy.empty())\n{\nif (params.implem == \"ONMS\") return new module::Decoder_LDPC_BP_flooding_ONMS <B,R>(params.K, params.N_cw, params.n_ite, H, info_bits_pos, params.norm_factor, params.offset, params.enable_syndrome, params.syndrome_depth, params.n_frames);\n- else if (params.implem == \"GALA\") return new module::Decoder_LDPC_BP_flooding_GALA <B,R>(params.K, params.N_cw, params.n_ite, H, info_bits_pos, params.enable_syndrome, params.syndrome_depth, params.n_frames);\nelse if (params.implem == \"SPA\" ) return new module::Decoder_LDPC_BP_flooding_SPA <B,R>(params.K, params.N_cw, params.n_ite, H, info_bits_pos, params.enable_syndrome, params.syndrome_depth, params.n_frames);\nelse if (params.implem == \"LSPA\") return new module::Decoder_LDPC_BP_flooding_LSPA <B,R>(params.K, params.N_cw, params.n_ite, H, info_bits_pos, params.enable_syndrome, params.syndrome_depth, params.n_frames);\n}\n@@ -42,6 +41,20 @@ module::Decoder_SISO_SIHO<B,R>* Decoder_LDPC\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B, typename R>\n+module::Decoder_SIHO<B,R>* Decoder_LDPC\n+::build(const parameters& params, const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos)\n+{\n+ if ((params.type == \"BP\" || params.type == \"BP_FLOODING\") && params.simd_strategy.empty())\n+ {\n+ if (params.implem == \"GALA\") return new module::Decoder_LDPC_BP_flooding_GALA <B,R>(params.K, params.N_cw, params.n_ite, H, info_bits_pos, params.enable_syndrome, params.syndrome_depth, params.n_frames);\n+ }\n+\n+ return build_siso<B,R>(params, H, info_bits_pos);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\nvoid Decoder_LDPC\n::build_args(arg_map &req_args, arg_map &opt_args, const std::string p)\n{\n@@ -126,11 +139,21 @@ void Decoder_LDPC\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_LDPC::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n-template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_LDPC::build<B_16,Q_16>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n-template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_LDPC::build<B_32,Q_32>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n-template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_LDPC::build<B_64,Q_64>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_LDPC::build_siso<B_8 ,Q_8 >(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_LDPC::build_siso<B_16,Q_16>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_LDPC::build_siso<B_32,Q_32>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_LDPC::build_siso<B_64,Q_64>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+#else\n+template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::build_siso<B,Q>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+#endif\n+\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_LDPC::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_LDPC::build<B_16,Q_16>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_LDPC::build<B_32,Q_32>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_LDPC::build<B_64,Q_64>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n#else\n-template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::build<B,Q>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::build<B,Q>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/LDPC/Decoder_LDPC.hpp",
"new_path": "src/Factory/Module/Code/LDPC/Decoder_LDPC.hpp",
"diff": "@@ -34,7 +34,11 @@ struct Decoder_LDPC : public Decoder\n};\ntemplate <typename B = int, typename R = float>\n- static module::Decoder_SISO_SIHO<B,R>* build(const parameters& params, const tools::Sparse_matrix &H,\n+ static module::Decoder_SIHO<B,R>* build(const parameters& params, const tools::Sparse_matrix &H,\n+ const std::vector<unsigned> &info_bits_pos);\n+\n+ template <typename B = int, typename R = float>\n+ static module::Decoder_SISO_SIHO<B,R>* build_siso(const parameters& params, const tools::Sparse_matrix &H,\nconst std::vector<unsigned> &info_bits_pos);\nstatic void build_args(arg_map &req_args, arg_map &opt_args, const std::string p = prefix);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.cpp",
"diff": "@@ -16,7 +16,8 @@ Decoder_LDPC_BP_flooding_Gallager_A<B,R>\nconst std::vector<unsigned> &info_bits_pos, const bool enable_syndrome,\nconst int syndrome_depth, const int n_frames, const std::string name)\n-: Decoder_SISO_SIHO<B,R>(K, N, n_frames, 1, name ),\n+: Decoder_SIHO_HIHO<B,R>(K, N, n_frames, 1, name ),\n+ hard_decision (N ),\nn_ite (n_ite ),\nH (H ),\nenable_syndrome (enable_syndrome ),\n@@ -91,13 +92,8 @@ Decoder_LDPC_BP_flooding_Gallager_A<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n-::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n{\n- auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n- for (auto i = 0; i < this->N; i++)\n- HY_N[i] = Y_N[i] < 0;\n- auto d_load = std::chrono::steady_clock::now() - t_load;\n-\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nauto cur_syndrome_depth = 0;\nfor (auto ite = 0; ite < n_ite; ite++)\n@@ -112,7 +108,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\nfor (auto j = 0; j < node_degree; j++)\n{\n- auto cur_state = HY_N[i];\n+ auto cur_state = Y_N[i];\nif (ite > 0)\n{\nauto count = 0;\n@@ -123,7 +119,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\ncur_state = count == (node_degree -1) ? !cur_state : cur_state;\n}\n- V_to_C_mess_ptr[j] = cur_state;\n+ V_to_C_mess_ptr[j] = (int8_t)cur_state;\n}\nC_to_V_mess_ptr += node_degree; // jump to the next node\n@@ -176,7 +172,7 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\ncount += C_to_V_ptr[j] ? 1 : -1;\nif (node_degree % 2 == 0)\n- count += HY_N[i] ? 1 : -1;\n+ count += Y_N[i] ? 1 : -1;\n// take the hard decision\nthis->V_N[i] = count > 0 ? 1 : 0;\n@@ -185,14 +181,26 @@ void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n}\nfor (auto i = 0; i < this->K; i++)\n- V_K[i] = this->V_N[this->info_bits_pos[i]];\n+ V_K[i] = (B)this->V_N[this->info_bits_pos[i]];\nauto d_store = std::chrono::steady_clock::now() - t_store;\n- this->d_load_total += d_load;\nthis->d_decod_total += d_decod;\nthis->d_store_total += d_store;\n}\n+template <typename B, typename R>\n+void Decoder_LDPC_BP_flooding_Gallager_A<B,R>\n+::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+{\n+ auto t_load = std::chrono::steady_clock::now(); // ---------------------------------------------------------- LOAD\n+ hard_decision.decode_siho(Y_N, HY_N.data());\n+ auto d_load = std::chrono::steady_clock::now() - t_load;\n+\n+ this->d_load_total += d_load;\n+\n+ this->_decode_hiho(HY_N.data(), V_K, frame_id);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp",
"diff": "#ifndef DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n#define DECODER_LDPC_BP_FLOODING_GALLAGER_A_HPP_\n-#include \"Module/Decoder/Decoder_SISO_SIHO.hpp\"\n+#include <cstdint>\n+\n+#include \"Module/Decoder/NO/Decoder_NO.hpp\"\n+#include \"Module/Decoder/Decoder_SIHO_HIHO.hpp\"\n+\n#include \"Tools/Algo/Sparse_matrix/Sparse_matrix.hpp\"\nnamespace aff3ct\n@@ -9,18 +13,21 @@ namespace aff3ct\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_LDPC_BP_flooding_Gallager_A : public Decoder_SISO_SIHO<B,R>\n+class Decoder_LDPC_BP_flooding_Gallager_A : public Decoder_SIHO_HIHO<B,R>\n{\n+private:\n+ Decoder_NO<B,R> hard_decision;\n+\nprotected:\nconst int n_ite; // number of iterations to perform\nconst tools::Sparse_matrix &H; // LDPC H matrix\nconst bool enable_syndrome; // stop criterion\nconst int syndrome_depth;\nconst std::vector<unsigned> &info_bits_pos;\n- mipp::vector<char> HY_N; // input LLRs (transformed in bit)\n- mipp::vector<char> V_N; // decoded bits\n- mipp::vector<char> C_to_V_messages; // check nodes to variable nodes messages\n- mipp::vector<char> V_to_C_messages; // variable nodes to check nodes messages\n+ mipp::vector<B> HY_N; // input LLRs (transformed in bit)\n+ mipp::vector<int8_t> V_N; // decoded bits\n+ mipp::vector<int8_t> C_to_V_messages; // check nodes to variable nodes messages\n+ mipp::vector<int8_t> V_to_C_messages; // variable nodes to check nodes messages\nmipp::vector<unsigned> transpose;\npublic:\n@@ -33,6 +40,7 @@ public:\nvirtual ~Decoder_LDPC_BP_flooding_Gallager_A();\nprotected:\n+ void _decode_hiho(const B *Y_N, B *V_K, const int frame_id);\nvoid _decode_siho(const R *Y_N, B *V_K, const int frame_id);\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Tools/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -82,7 +82,7 @@ template <typename B, typename Q>\nDecoder_SISO_SIHO<B,Q>* Codec_LDPC<B,Q>\n::_build_siso(const int tid, const Interleaver<int>* itl, CRC<B>* crc)\n{\n- decoder_siso[tid] = factory::Decoder_LDPC::build<B,Q>(dec_par, H, info_bits_pos);\n+ decoder_siso[tid] = factory::Decoder_LDPC::build_siso<B,Q>(dec_par, H, info_bits_pos);\nreturn decoder_siso[tid];\n}\n@@ -105,7 +105,7 @@ Decoder_SIHO<B,Q>* Codec_LDPC<B,Q>\n}\nelse\n{\n- auto decoder = this->_build_siso(tid, itl, crc);\n+ auto decoder = factory::Decoder_LDPC::build<B,Q>(dec_par, H, info_bits_pos);\ndecoder_siso[tid] = nullptr;\nreturn decoder;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "@@ -68,12 +68,10 @@ void print_version()\nstd::string compiler = \"Unknown compiler\";\nstd::string compiler_version = \"\";\n#endif\n- std::string affect_version = version() == \"GIT-NOTFOUND\" ? \"Unknown version\" : version();\n+ std::string affect_version = version() == \"GIT-NOTFOUND\" ? \"\" : version();\nstd::cout << \"aff3ct (\" << os << prec << \", \" << compiler << \" \" << compiler_version << \", \"\n<< mipp::InstructionFullType << \") \" << affect_version << std::endl;\n- if (sha1() != \"GITDIR-NOTFOUND\")\n- std::cout << \"GIT SHA1: \" << sha1() << std::endl;\nstd::cout << \"Copyright (c) 2016-2017 - MIT license.\" << std::endl;\nstd::cout << \"This is free software; see the source for copying conditions. There is NO\" << std::endl;\nstd::cout << \"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\" << std::endl;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Convert the Gallager A from Decoder_SISO_SIHO to Decoder_SIHO_HIHO + do not display the full git sha1 anymore.
|
8,490 |
04.08.2017 14:23:39
| -7,200 |
5cf15554f64e2893792c2838f0eeacbec30776f2
|
Move the select_best_path method outside of the _decode method.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"diff": "@@ -235,7 +235,6 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n{\nint first_node_id = 0, off_l = 0, off_s = 0;\nrecursive_decode(Y_N, off_l, off_s, m, first_node_id);\n- select_best_path();\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -248,6 +247,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nthis->_decode(Y_N);\n+ this->select_best_path();\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -269,6 +269,7 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nthis->_decode(Y_N);\n+ this->select_best_path();\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"diff": "@@ -255,7 +255,6 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\nint first_node_id = 0, off_l = 0, off_s = 0;\nrecursive_decode(Y_N, off_l, off_s, m, first_node_id);\n- select_best_path();\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -268,6 +267,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nthis->_decode(Y_N);\n+ this->select_best_path();\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -289,6 +289,7 @@ void Decoder_polar_SCL_fast_sys<B,R,API_polar>\nauto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\nthis->_decode(Y_N);\n+ this->select_best_path();\nauto d_decod = std::chrono::steady_clock::now() - t_decod;\nauto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move the select_best_path method outside of the _decode method.
|
8,490 |
04.08.2017 14:40:00
| -7,200 |
1a3bb50fb14aa705f75a80428ab8ff30feba3f91
|
Add _decode_siho_coded method.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.cpp",
"diff": "@@ -45,6 +45,13 @@ void Decoder_NO<B,R>\nthis->d_store_total += d_store;\n}\n+template <typename B, typename R>\n+void Decoder_NO<B,R>\n+::_decode_siho_coded(const R *Y_K, B *V_K, const int frame_id)\n+{\n+ this->_decode_siho(Y_K, V_K, frame_id);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/NO/Decoder_NO.hpp",
"new_path": "src/Module/Decoder/NO/Decoder_NO.hpp",
"diff": "@@ -7,7 +7,6 @@ namespace aff3ct\n{\nnamespace module\n{\n-\ntemplate <typename B = int, typename R = float>\nclass Decoder_NO : public Decoder_SISO_SIHO<B,R>\n{\n@@ -19,6 +18,7 @@ protected:\nvoid _decode_siso (const R *sys, const R *par, R *ext, const int frame_id);\nvoid _decode_siso (const R *Y_K1, R *Y_K2, const int frame_id);\nvoid _decode_siho (const R *Y_K, B *V_K, const int frame_id);\n+ void _decode_siho_coded(const R *Y_K, B *V_K, const int frame_id);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add _decode_siho_coded method.
|
8,490 |
04.08.2017 14:45:08
| -7,200 |
f621c04f05a5fa22a76e0fa86ddf9ac605ff3c28
|
Rename REPETITION in REP.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -35,7 +35,7 @@ _aff3ct() {\n${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"BCH\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"TURBO\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"REPETITION\" && ${simutype} == \"BFER\" || \\\n+ ${codetype} == \"REP\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"RA\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" || \\\n@@ -65,7 +65,7 @@ _aff3ct() {\n${codetype} == \"RSC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"BCH\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"TURBO\" && ${simutype} == \"BFER\" || \\\n- ${codetype} == \"REPETITION\" && ${simutype} == \"BFER\" || \\\n+ ${codetype} == \"REP\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"RA\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" ]]\n@@ -139,7 +139,7 @@ _aff3ct() {\nfi\n# add contents of Launcher_BFER_repetition.cpp\n- if [[ ${codetype} == \"REPETITION\" && ${simutype} == \"BFER\" ]]\n+ if [[ ${codetype} == \"REP\" && ${simutype} == \"BFER\" ]]\nthen\nopts=\"$opts --enc-no-buff --dec-type -D --dec-implem\"\nfi\n@@ -235,7 +235,7 @@ _aff3ct() {\n;;\n--sim-cde-type)\n- local params=\"POLAR TURBO LDPC REPETITION RA RSC BCH UNCODED\"\n+ local params=\"POLAR TURBO LDPC REP RA RSC BCH UNCODED\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n@@ -245,7 +245,7 @@ _aff3ct() {\nPOLAR) params=\"BFER EXIT\" ;;\nTURBO) params=\"BFER\" ;;\nLDPC) params=\"BFER BFERI\" ;;\n- REPETITION) params=\"BFER\" ;;\n+ REP) params=\"BFER\" ;;\nRA) params=\"BFER\" ;;\nBCH) params=\"BFER\" ;;\nRSC) params=\"BFER BFERI EXIT\" ;;\n@@ -261,7 +261,7 @@ _aff3ct() {\ncase \"${codetype}\" in\nPOLAR) params=\"AZCW COSET USER POLAR\" ;;\nRSC) params=\"AZCW COSET USER RSC\" ;;\n- REPETITION) params=\"AZCW COSET USER REPETITION\" ;;\n+ REP) params=\"AZCW COSET USER REP\" ;;\nRA) params=\"AZCW COSET USER RA\" ;;\nBCH) params=\"AZCW COSET USER BCH\" ;;\nTURBO) params=\"AZCW COSET USER TURBO\" ;;\n@@ -275,7 +275,7 @@ _aff3ct() {\ncase \"${codetype}\" in\nPOLAR) params=\"SC SCL SCAN\" ;;\nRSC) params=\"BCJR BCJR4 LTE CCSDS\" ;;\n- REPETITION) params=\"STD\" ;;\n+ REP) params=\"STD\" ;;\nRA) params=\"STD\" ;;\nBCH) params=\"ALGEBRAIC\" ;;\nTURBO) params=\"LTE CCSDS\" ;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Launcher/Launcher.cpp",
"new_path": "src/Factory/Launcher/Launcher.cpp",
"diff": "@@ -121,7 +121,7 @@ launcher::Launcher* Launcher\nreturn new launcher::Turbo_DB<launcher::BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n}\n- if (params.cde_type == \"REPETITION\")\n+ if (params.cde_type == \"REP\")\n{\nif (params.sim_type == \"BFER\")\nreturn new launcher::Repetition<launcher::BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n@@ -163,7 +163,7 @@ void Launcher::build_args(arg_map &req_args, arg_map &opt_args, const std::strin\nreq_args[{p+\"-cde-type\", \"C\"}] =\n{\"string\",\n\"select the code type you want to use.\",\n- \"POLAR, TURBO, TURBO_DB, LDPC, REPETITION, RA, RSC, RSC_DB, BCH, UNCODED\"};\n+ \"POLAR, TURBO, TURBO_DB, LDPC, REP, RA, RSC, RSC_DB, BCH, UNCODED\"};\nopt_args[{p+\"-type\"}] =\n{\"string\",\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rename REPETITION in REP.
|
8,490 |
07.08.2017 09:42:20
| -7,200 |
c9dbfd21d3a6525debe057883641c6df815535c4
|
Fix compilation error on MSVC v1910.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Code/Polar/Decoder_polar.cpp",
"new_path": "src/Factory/Module/Code/Polar/Decoder_polar.cpp",
"diff": "@@ -49,11 +49,11 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_polar\n{\nif (params.type == \"SCAN\" && params.systematic)\n{\n- if (params.implem == \"NAIVE\") return new module::Decoder_polar_SCAN_naive_sys<B, Q, tools::init_LLR<Q>, tools::f_LLR<Q>, tools::v_LLR<Q>, tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\n+ if (params.implem == \"NAIVE\") return new module::Decoder_polar_SCAN_naive_sys<B, Q, tools::f_LLR<Q>, tools::v_LLR<Q>, tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\n}\nelse if (params.type == \"SCAN\" && !params.systematic)\n{\n- if (params.implem == \"NAIVE\") return new module::Decoder_polar_SCAN_naive <B, Q, tools::init_LLR<Q>, tools::f_LLR<Q>, tools::v_LLR<Q>, tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\n+ if (params.implem == \"NAIVE\") return new module::Decoder_polar_SCAN_naive <B, Q, tools::f_LLR<Q>, tools::v_LLR<Q>, tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n@@ -73,7 +73,7 @@ module::Decoder_SIHO<B,Q>* Decoder_polar\nif (crc == nullptr || crc->get_size() == 0)\n{\nif (params.type == \"SC\" ) return new module::Decoder_polar_SC_naive <B,Q,tools::f_LLR<Q>,tools::g_LLR<B,Q>,tools::h_LLR<B,Q>>(params.K, params.N_cw, frozen_bits, params.n_frames);\n- else if (params.type == \"SCAN\") return new module::Decoder_polar_SCAN_naive <B,Q,tools::init_LLR<Q>,tools::f_LLR<Q>,tools::v_LLR< Q>,tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\n+ else if (params.type == \"SCAN\") return new module::Decoder_polar_SCAN_naive <B,Q,tools::f_LLR<Q>,tools::v_LLR< Q>,tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\nelse if (params.type == \"SCL\" ) return new module::Decoder_polar_SCL_naive <B,Q,tools::f_LLR<Q>,tools::g_LLR<B,Q> >(params.K, params.N_cw, params.L, frozen_bits, params.n_frames);\n}\nelse\n@@ -87,7 +87,7 @@ module::Decoder_SIHO<B,Q>* Decoder_polar\nif (crc == nullptr || crc->get_size() == 0)\n{\nif (params.type == \"SC\" ) return new module::Decoder_polar_SC_naive_sys <B,Q,tools::f_LLR<Q>,tools::g_LLR<B,Q>,tools::h_LLR<B,Q>>(params.K, params.N_cw, frozen_bits, params.n_frames);\n- else if (params.type == \"SCAN\") return new module::Decoder_polar_SCAN_naive_sys <B,Q,tools::init_LLR<Q>,tools::f_LLR<Q>,tools::v_LLR< Q>,tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\n+ else if (params.type == \"SCAN\") return new module::Decoder_polar_SCAN_naive_sys <B,Q,tools::f_LLR<Q>,tools::v_LLR< Q>,tools::h_LLR<B,Q>>(params.K, params.N_cw, params.n_ite, frozen_bits, params.n_frames);\nelse if (params.type == \"SCL\" ) return new module::Decoder_polar_SCL_naive_sys <B,Q,tools::f_LLR<Q>,tools::g_LLR<B,Q> >(params.K, params.N_cw, params.L, frozen_bits, params.n_frames);\n}\nelse\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"diff": "@@ -13,11 +13,11 @@ namespace aff3ct\n{\nnamespace module\n{\n-template <typename B = int, typename R = float, tools::proto_i< R> I = tools::init_LLR,\n- tools::proto_f< R> F = tools::f_LLR,\n- tools::proto_v< R> V = tools::v_LLR,\n- tools::proto_h<B,R> H = tools::h_LLR,\n- tools::proto_s< R> S = tools::sat_val>\n+template <typename B = int, typename R = float, tools::proto_f< R> F = &tools::f_LLR,\n+ tools::proto_v< R> V = &tools::v_LLR,\n+ tools::proto_h<B,R> H = &tools::h_LLR,\n+ tools::proto_i< R> I = &tools::init_LLR,\n+ tools::proto_s< R> S = &tools::sat_val>\nclass Decoder_polar_SCAN_naive : public Decoder_SISO_SIHO<B,R>\n{\nprotected:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"diff": "@@ -17,8 +17,8 @@ namespace module\n/** CONSTRUCTOR **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::Decoder_polar_SCAN_naive(const int &K, const int &N, const int &max_iter, const std::vector<bool> &frozen_bits,\nconst int n_frames, const std::string name)\n: Decoder_SISO_SIHO<B,R>(K, N, n_frames, 1, name),\n@@ -72,8 +72,8 @@ Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n/** load **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::_load_init()\n{\n// init feedback graph (special case for the left most stage)\n@@ -98,8 +98,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::_load(const R *Y_N)\n{\nif (!(this->is_init))\n@@ -114,8 +114,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n/** frame_decode **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::_decode()\n{\nfor (auto iter = 0; iter < max_iter; iter++)\n@@ -144,8 +144,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n@@ -168,8 +168,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::_decode_siho_coded(const R *Y_N, B *V_N, const int frame_id)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\n@@ -192,15 +192,15 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::_decode_siso(const R *Y_N1, R *Y_N2, const int frame_id)\n{\n// ----------------------------------------------------------------------------------------------------------- LOAD\nthis->_load(Y_N1);\n// --------------------------------------------------------------------------------------------------------- DECODE\n- Decoder_polar_SCAN_naive<B,R,I,F,V,H>::_decode();\n+ this->_decode();\n// ---------------------------------------------------------------------------------------------------------- STORE\nstd::copy(this->feedback_graph[this->layers_count -1].begin(),\n@@ -212,8 +212,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n/** frame store **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::_store(B *V_KN, bool coded) const\n{\nif (!coded)\n@@ -234,8 +234,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n/** set the soft information (l,j) to v and propagate the value in feedbackGraph**/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::set_soft_val_and_propagate(const int l, const int j, const R v)\n{\nconst auto up_ix = j - (1 << l);\n@@ -257,8 +257,8 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n/** compute_soft_output **/\n/********************************************************************/\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n::fb_compute_soft_output(const int &i)\n{\nauto l_start = tools::compute_depth(i, this->m);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp",
"diff": "@@ -12,12 +12,12 @@ namespace aff3ct\n{\nnamespace module\n{\n-template <typename B = int, typename R = float, tools::proto_i< R> I = tools::init_LLR,\n- tools::proto_f< R> F = tools::f_LLR,\n- tools::proto_v< R> V = tools::v_LLR,\n- tools::proto_h<B,R> H = tools::h_LLR,\n- tools::proto_s< R> S = tools::sat_val>\n-class Decoder_polar_SCAN_naive_sys : public Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>\n+template <typename B = int, typename R = float, tools::proto_f< R> F = &tools::f_LLR,\n+ tools::proto_v< R> V = &tools::v_LLR,\n+ tools::proto_h<B,R> H = &tools::h_LLR,\n+ tools::proto_i< R> I = &tools::init_LLR,\n+ tools::proto_s< R> S = &tools::sat_val>\n+class Decoder_polar_SCAN_naive_sys : public Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>\n{\npublic:\nDecoder_polar_SCAN_naive_sys(const int &K, const int &N, const int &max_iter, const std::vector<bool> &frozen_bits,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"diff": "@@ -5,24 +5,24 @@ namespace aff3ct\nnamespace module\n{\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+Decoder_polar_SCAN_naive_sys<B,R,F,V,H,I,S>\n::Decoder_polar_SCAN_naive_sys(const int &K, const int &N, const int &max_iter, const std::vector<bool> &frozen_bits,\nconst int n_frames, const std::string name)\n-: Decoder_polar_SCAN_naive<B,R,I,F,V,H,S>(K, N, max_iter, frozen_bits, n_frames, name)\n+: Decoder_polar_SCAN_naive<B,R,F,V,H,I,S>(K, N, max_iter, frozen_bits, n_frames, name)\n{\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+Decoder_polar_SCAN_naive_sys<B,R,F,V,H,I,S>\n::~Decoder_polar_SCAN_naive_sys()\n{\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive_sys<B,R,F,V,H,I,S>\n::_decode_siso(const R *sys, const R *par, R *ext, const int frame_id)\n{\n// ----------------------------------------------------------------------------------------------------------- LOAD\n@@ -47,8 +47,8 @@ void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive_sys<B,R,F,V,H,I,S>\n::_decode_siso(const R *Y_N1, R *Y_N2, const int frame_id)\n{\n// ----------------------------------------------------------------------------------------------------------- LOAD\n@@ -64,8 +64,8 @@ void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n}\ntemplate <typename B, typename R,\n- tools::proto_i<R> I, tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_s<R> S>\n-void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H,S>\n+ tools::proto_f<R> F, tools::proto_v<R> V, tools::proto_h<B,R> H, tools::proto_i<R> I, tools::proto_s<R> S>\n+void Decoder_polar_SCAN_naive_sys<B,R,F,V,H,I,S>\n::_store(B *V_KN, bool coded) const\n{\nif (!coded)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix compilation error on MSVC v1910.
|
8,490 |
16.08.2017 13:57:58
| -7,200 |
9ba50bd6d2c48f5fafc8ef31d1fb6a78670e7960
|
Put a '#' before the lines.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Process.cpp",
"new_path": "src/Module/Process.cpp",
"diff": "@@ -90,6 +90,7 @@ void Process::exec()\nconst auto sty_class = tools::Style::BOLD;\nconst auto sty_method = tools::Style::BOLD | tools::FG::Color::GREEN;\n+ std::cout << \"# \";\nstd::cout << tools::format(module.get_name(), sty_class) << \"::\" << tools::format(get_name(), sty_method)\n<< \"(\";\nfor (auto i = 0; i < (int)in.size(); i++)\n@@ -120,7 +121,7 @@ void Process::exec()\nauto n_elmts = i.get_databytes() / (size_t)i.get_datatype_size();\nauto limit = debug_limit != -1 ? std::min(n_elmts, (size_t)debug_limit) : n_elmts;\nauto p = debug_precision;\n- std::cout << \"{IN} \" << i.get_name() << spaces << \" = [\";\n+ std::cout << \"# {IN} \" << i.get_name() << spaces << \" = [\";\nif (i.get_datatype() == typeid(int8_t )) display_data((int8_t *)i.get_dataptr(), limit, p);\nelse if (i.get_datatype() == typeid(int16_t)) display_data((int16_t*)i.get_dataptr(), limit, p);\nelse if (i.get_datatype() == typeid(int32_t)) display_data((int32_t*)i.get_dataptr(), limit, p);\n@@ -161,7 +162,7 @@ void Process::exec()\nauto n_elmts = o.get_databytes() / (size_t)o.get_datatype_size();\nauto limit = debug_limit != -1 ? std::min(n_elmts, (size_t)debug_limit) : n_elmts;\n- std::cout << \"{OUT} \" << o.get_name() << spaces << \" = [\";\n+ std::cout << \"# {OUT} \" << o.get_name() << spaces << \" = [\";\nauto p = debug_precision;\nif (o.get_datatype() == typeid(int8_t )) display_data((int8_t *)o.get_dataptr(), limit, p);\nelse if (o.get_datatype() == typeid(int16_t)) display_data((int16_t*)o.get_dataptr(), limit, p);\n@@ -171,7 +172,7 @@ void Process::exec()\nelse if (o.get_datatype() == typeid(double )) display_data((double *)o.get_dataptr(), limit, p);\nstd::cout << (limit < n_elmts ? \", ...\" : \"\") << \"]\" << std::endl;\n}\n- std::cout << std::endl;\n+ std::cout << \"#\" << std::endl;\n}\n}\nelse\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Put a '#' before the lines.
|
8,490 |
17.08.2017 09:27:25
| -7,200 |
98b2a7e0474f94a42cfcf630524870cc146d4a06
|
Implement the BFERI simu with the new binding.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -70,9 +70,9 @@ _aff3ct() {\n${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" ]]\nthen\n- opts=\"$opts --sim-benchs -b --sim-debug -d --sim-debug-fe \\\n- --sim-debug-limit --snr-sim-trace-path --sim-stats --sim-coset \\\n- -c --mnt-max-fe -e --ter-type \"\n+ opts=\"$opts --sim-debug -d --sim-debug-fe --sim-debug-limit \\\n+ --snr-sim-trace-path --sim-stats --sim-coset -c --mnt-max-fe -e \\\n+ --ter-type \"\nfi\n# add contents of Launcher_EXIT.cpp\n@@ -88,8 +88,7 @@ _aff3ct() {\n${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" ]]\nthen\n- opts=\"$opts --sim-benchs -b --sim-debug -d --sim-debug-fe \\\n- --sim-debug-limit \\\n+ opts=\"$opts --sim-debug -d --sim-debug-fe --sim-debug-limit \\\n--snr-sim-trace-path --sim-stats --sim-coset -c --itl-type \\\n--itl-path --itl-cols --itl-uni --sim-ite -I --mnt-max-fe -e \\\n--ter-type\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/BFER/BFER.cpp",
"new_path": "src/Factory/Simulation/BFER/BFER.cpp",
"diff": "@@ -11,10 +11,6 @@ void BFER::build_args(arg_map &req_args, arg_map &opt_args, const std::string p)\n{\nSimulation::build_args(req_args, opt_args, p);\n- opt_args[{p+\"-benchs\", \"b\"}] =\n- {\"positive_int\",\n- \"enable special benchmark mode with a loop around the decoder.\"};\n-\nopt_args[{p+\"-debug\", \"d\"}] =\n{\"\",\n\"enable debug mode: print array values after each step.\"};\n@@ -65,7 +61,6 @@ void BFER::store_args(const arg_val_map &vals, parameters ¶ms, const std::st\nSimulation::store_args(vals, params, p);\n- if(exist(vals, {p+\"-benchs\", \"b\"})) params.benchs = std::stoi(vals.at({p+\"-benchs\", \"b\"}));\nif(exist(vals, {p+\"-snr-type\", \"E\"})) params.snr_type = vals.at({p+\"-snr-type\", \"E\"});\nif(exist(vals, {p+\"-err-trk-path\" })) params.err_track_path = vals.at({p+\"-err-trk-path\" });\nif(exist(vals, {p+\"-err-trk-rev\" })) params.err_track_revert = true;\n@@ -113,8 +108,6 @@ void BFER::make_header(params_list& head_sim, const parameters& params, const bo\n{\nSimulation::make_header(head_sim, params, full);\n- if (params.benchs)\n- head_sim.push_back(std::make_pair(\"Number of benchs\", std::to_string(params.benchs)));\nhead_sim.push_back(std::make_pair(\"SNR type\", params.snr_type));\nhead_sim.push_back(std::make_pair(\"Statistics\", params.statistics ? \"on\" : \"off\"));\nhead_sim.push_back(std::make_pair(\"Debug mode\", params.debug ? \"on\" : \"off\"));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/BFER/BFER.hpp",
"new_path": "src/Factory/Simulation/BFER/BFER.hpp",
"diff": "@@ -67,7 +67,6 @@ struct BFER : Simulation\nbool coded_monitoring = false;\nint debug_limit = 0;\nint debug_precision = 2;\n- int benchs = 0;\nSource ::parameters *src;\nCRC ::parameters *crc;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/Modem.hpp",
"new_path": "src/Module/Modem/Modem.hpp",
"diff": "@@ -171,7 +171,7 @@ public:\n});\nauto &p3 = this->create_process(\"demodulate\");\n- this->template create_socket_in <Q>(p3, \"Y_N1\", this->N_mod * this->n_frames);\n+ this->template create_socket_in <Q>(p3, \"Y_N1\", this->N_fil * this->n_frames);\nthis->template create_socket_out<Q>(p3, \"Y_N2\", this->N * this->n_frames);\nthis->create_codelet(p3, [&]()\n{\n@@ -180,7 +180,7 @@ public:\n});\nauto &p4 = this->create_process(\"tdemodulate\");\n- this->template create_socket_in <Q>(p4, \"Y_N1\", this->N_mod * this->n_frames);\n+ this->template create_socket_in <Q>(p4, \"Y_N1\", this->N_fil * this->n_frames);\nthis->template create_socket_in <Q>(p4, \"Y_N2\", this->N * this->n_frames);\nthis->template create_socket_out<Q>(p4, \"Y_N3\", this->N * this->n_frames);\nthis->create_codelet(p4, [&]()\n@@ -191,8 +191,8 @@ public:\n});\nauto &p5 = this->create_process(\"demodulate_wg\");\n- this->template create_socket_in <Q>(p5, \"Y_N1\", this->N_mod * this->n_frames);\n- this->template create_socket_in <R>(p5, \"H_N\", this->N_mod * this->n_frames);\n+ this->template create_socket_in <Q>(p5, \"Y_N1\", this->N_fil * this->n_frames);\n+ this->template create_socket_in <R>(p5, \"H_N\", this->N_fil * this->n_frames);\nthis->template create_socket_out<Q>(p5, \"Y_N2\", this->N * this->n_frames);\nthis->create_codelet(p5, [&]()\n{\n@@ -202,8 +202,8 @@ public:\n});\nauto &p6 = this->create_process(\"tdemodulate_wg\");\n- this->template create_socket_in <Q>(p6, \"Y_N1\", this->N_mod * this->n_frames);\n- this->template create_socket_in <R>(p6, \"H_N\", this->N_mod * this->n_frames);\n+ this->template create_socket_in <Q>(p6, \"Y_N1\", this->N_fil * this->n_frames);\n+ this->template create_socket_in <R>(p6, \"H_N\", this->N_fil * this->n_frames);\nthis->template create_socket_in <Q>(p6, \"Y_N2\", this->N * this->n_frames);\nthis->template create_socket_out<Q>(p6, \"Y_N3\", this->N * this->n_frames);\nthis->create_codelet(p6, [&]()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/BFER.cpp",
"new_path": "src/Simulation/BFER/BFER.cpp",
"diff": "@@ -225,18 +225,17 @@ void BFER<B,R,Q>\n}\n#ifdef ENABLE_MPI\n- if (((!params.ter->disabled && snr == params.snr_min && !params.debug && !params.benchs) ||\n+ if (((!params.ter->disabled && snr == params.snr_min && !params.debug) ||\n(params.statistics && !params.debug)) && params.mpi_rank == 0)\n#else\n- if (((!params.ter->disabled && snr == params.snr_min && !params.debug && !params.benchs) ||\n+ if (((!params.ter->disabled && snr == params.snr_min && !params.debug) ||\n(params.statistics && !params.debug)))\n#endif\nterminal->legend(std::cout);\n// start the terminal to display BER/FER results\nstd::thread term_thread;\n- if (!params.ter->disabled && params.ter->frequency != std::chrono::nanoseconds(0) && !params.benchs &&\n- !params.debug)\n+ if (!params.ter->disabled && params.ter->frequency != std::chrono::nanoseconds(0) && !params.debug)\n// launch a thread dedicated to the terminal display\nterm_thread = std::thread(BFER<B,R,Q>::start_thread_terminal, this);\n@@ -253,8 +252,7 @@ void BFER<B,R,Q>\n}\n// stop the terminal\n- if (!params.ter->disabled && params.ter->frequency != std::chrono::nanoseconds(0) && !params.benchs &&\n- !params.debug)\n+ if (!params.ter->disabled && params.ter->frequency != std::chrono::nanoseconds(0) && !params.debug)\n{\nstop_terminal = true;\ncond_terminal.notify_all();\n@@ -264,9 +262,9 @@ void BFER<B,R,Q>\n}\n#ifdef ENABLE_MPI\n- if (!params.ter->disabled && !params.benchs && terminal != nullptr && !simu_error && params.mpi_rank == 0)\n+ if (!params.ter->disabled && terminal != nullptr && !simu_error && params.mpi_rank == 0)\n#else\n- if (!params.ter->disabled && !params.benchs && terminal != nullptr && !simu_error)\n+ if (!params.ter->disabled && terminal != nullptr && !simu_error)\n#endif\n{\nif (params.debug)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/BFER_ite.cpp",
"diff": "@@ -41,6 +41,19 @@ BFER_ite<B,R,Q>\n{\nfor (auto tid = 0; tid < params.n_threads; tid++)\nrd_engine_seed[tid].seed(params.local_seed + tid);\n+\n+ this->modules[\"source\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"crc\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"encoder\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"modem\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"channel\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"quantizer\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"coset_real\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"siso\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"decoder\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"coset_bit\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"interleaver_bit\"] = std::vector<module::Module*>(params.n_threads, nullptr);\n+ this->modules[\"interleaver_llr\"] = std::vector<module::Module*>(params.n_threads, nullptr);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -59,20 +72,23 @@ void BFER_ite<B,R,Q>\nconst auto seed_itl = rd_engine_seed[tid]();\n// build the objects\n- source [tid] = build_source (tid, seed_src);\n- crc [tid] = build_crc (tid );\n- encoder [tid] = build_encoder (tid, seed_enc);\n- modem [tid] = build_modem (tid );\n- channel [tid] = build_channel (tid, seed_chn);\n- quantizer [tid] = build_quantizer (tid );\n- coset_real [tid] = build_coset_real (tid );\n- siso [tid] = build_siso (tid );\n- decoder [tid] = build_decoder (tid );\n- coset_bit [tid] = build_coset_bit (tid );\n+ source [tid] = build_source (tid, seed_src); this->modules[\"source\" ][tid] = source [tid];\n+ crc [tid] = build_crc (tid ); this->modules[\"crc\" ][tid] = crc [tid];\n+ encoder [tid] = build_encoder (tid, seed_enc); this->modules[\"encoder\" ][tid] = encoder [tid];\n+ modem [tid] = build_modem (tid ); this->modules[\"modem\" ][tid] = modem [tid];\n+ channel [tid] = build_channel (tid, seed_chn); this->modules[\"channel\" ][tid] = channel [tid];\n+ quantizer [tid] = build_quantizer (tid ); this->modules[\"quantizer\" ][tid] = quantizer [tid];\n+ coset_real [tid] = build_coset_real (tid ); this->modules[\"coset_real\"][tid] = coset_real[tid];\n+ siso [tid] = build_siso (tid ); this->modules[\"siso\" ][tid] = siso [tid];\n+ decoder [tid] = build_decoder (tid ); this->modules[\"decoder\" ][tid] = decoder [tid];\n+ coset_bit [tid] = build_coset_bit (tid ); this->modules[\"coset_bit\" ][tid] = coset_bit [tid];\ninterleaver_core[tid] = build_interleaver(tid, seed_itl);\ninterleaver_bit [tid] = factory::Interleaver::build<B>(*interleaver_core[tid]);\ninterleaver_llr [tid] = factory::Interleaver::build<Q>(*interleaver_core[tid]);\n+ this->modules[\"interleaver_bit\"][tid] = interleaver_bit[tid];\n+ this->modules[\"interleaver_llr\"][tid] = interleaver_llr[tid];\n+\ninterleaver_core[tid]->init();\nif (interleaver_core[tid]->is_uniform())\nthis->monitor[tid]->add_handler_check(std::bind(&tools::Interleaver_core<>::refresh,\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": "@@ -17,25 +17,6 @@ namespace simulation\ntemplate <typename B = int, typename R = float, typename Q = R>\nclass BFER_ite_threads : public BFER_ite<B,R,Q>\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; // interleaved 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<Q>> Y_N3; // noisy codeword (after the quatization)\n- std::vector<mipp::vector<Q>> Y_N4; // noisy codeword (after the demodulation)\n- std::vector<mipp::vector<Q>> Y_N5; // noisy codeword (after the deinterleaving process)\n- std::vector<mipp::vector<Q>> Y_N6; // noisy codeword (after the decoding process)\n- std::vector<mipp::vector<Q>> Y_N7; // noisy codeword (after the interleaving process)\n- std::vector<mipp::vector<B>> V_N1; // decoded bits (full codeword)\n- std::vector<mipp::vector<B>> V_K1; // decoded bits + CRC bits\n- std::vector<mipp::vector<B>> V_K2; // decoded bits\n-\npublic:\nBFER_ite_threads(const factory::BFER_ite::parameters ¶ms, tools::Codec_SISO<B,Q> &codec);\nvirtual ~BFER_ite_threads();\n@@ -45,7 +26,6 @@ protected:\nvirtual void _launch();\nprivate:\n- void Monte_Carlo_method(const int tid = 0);\nvoid simulation_loop(const int tid = 0);\nstatic void start_thread(BFER_ite_threads<B,R,Q> *simu, const int tid = 0);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/BFER_std.cpp",
"diff": "@@ -51,7 +51,6 @@ BFER_std<B,R,Q>\nthis->modules[\"coset_real\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\nthis->modules[\"decoder\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\nthis->modules[\"coset_bit\" ] = std::vector<module::Module*>(params.n_threads, nullptr);\n- this->modules[\"interleaver\"] = std::vector<module::Module*>(params.n_threads, nullptr);\n}\ntemplate <typename B, typename R, typename Q>\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": "@@ -148,7 +148,6 @@ void BFER_std_threads<B,R,Q>\nauto &coset_bit = *this->coset_bit [tid];\nauto &monitor = *this->monitor [tid];\n- // simulation loop\nwhile (!this->monitor_red->fe_limit_achieved() && // while max frame error count has not been reached\n(this->params.stop_time == seconds(0) || (steady_clock::now() - t_snr) < this->params.stop_time) &&\n(this->monitor_red->get_n_analyzed_fra() < this->max_fra || this->max_fra == 0))\n@@ -173,7 +172,6 @@ void BFER_std_threads<B,R,Q>\npuncturer[\"puncture\"][\"X_N2\"].bind(modem [\"modulate\"][\"X_N1\"]);\n}\n- // Rayleigh channel\nif (this->params.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\nmodem [\"modulate\" ][\"X_N2\"].bind(channel [\"add_noise_wg\" ][\"X_N\" ]);\n@@ -182,7 +180,7 @@ void BFER_std_threads<B,R,Q>\nchannel[\"add_noise_wg\" ][\"H_N\" ].bind(modem [\"demodulate_wg\"][\"H_N\" ]);\nmodem [\"demodulate_wg\"][\"Y_N2\"].bind(quantizer[\"process\" ][\"Y_N1\"]);\n}\n- else // additive channel (AWGN, USER, NO)\n+ else\n{\nmodem [\"modulate\" ][\"X_N2\"].bind(channel [\"add_noise\" ][\"X_N\" ]);\nchannel[\"add_noise\" ][\"Y_N\" ].bind(modem [\"filter\" ][\"Y_N1\"]);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Implement the BFERI simu with the new binding.
|
8,486 |
17.08.2017 16:45:02
| -7,200 |
acd1cfa78388fbf1cf003e6b581937f15631c245
|
Factor 2 for real modulations.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/PAM/Modem_PAM.hxx",
"new_path": "src/Module/Modem/PAM/Modem_PAM.hxx",
"diff": "@@ -123,7 +123,7 @@ void Modem_PAM<B,R,Q,MAX>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\nauto size = this->N;\n- auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)(1.0 / (this->sigma * this->sigma));\n+ auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)(1.0 / (2 * this->sigma * this->sigma));\nfor (auto n = 0; n < size; n++) // loop upon the LLRs\n{\n@@ -158,7 +158,7 @@ void Modem_PAM<B,R,Q,MAX>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\nauto size = this->N;\n- auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)(1.0 / (this->sigma * this->sigma));\n+ auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)(1.0 / (2 * this->sigma * this->sigma));\nfor (auto n = 0; n < size; n++) // loop upon the LLRs\n{\n@@ -190,7 +190,7 @@ void Modem_PAM<B,R,Q,MAX>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\nauto size = this->N;\n- auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)1.0 / (this->sigma * this->sigma);\n+ auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)1.0 / (2 * this->sigma * this->sigma);\nfor (auto n = 0; n < size; n++) // loop upon the LLRs\n{\n@@ -231,7 +231,7 @@ void Modem_PAM<B,R,Q,MAX>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\nauto size = this->N;\n- auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)1.0 / (this->sigma * this->sigma);\n+ auto inv_sigma2 = disable_sig2 ? (Q)1.0 : (Q)1.0 / (2 * this->sigma * this->sigma);\nfor (auto n = 0; n < size; n++) // boucle sur les LLRs\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Factor 2 for real modulations.
|
8,486 |
17.08.2017 16:52:24
| -7,200 |
28e50d7c5e1497a18f9d91cdc3df902cbf8ac173
|
Modification for handling real/complex modulations.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"new_path": "src/Simulation/BFER/Iterative/Simulation_BFER_ite.cpp",
"diff": "@@ -158,9 +158,11 @@ template <typename B, typename R, typename Q>\nModem<B,R,Q>* Simulation_BFER_ite<B,R,Q>\n::build_modem(const int tid)\n{\n+ auto sigma = this->params.modulator.complex ? this->sigma * std::sqrt(2.f) : this->sigma;\n+ // auto sigma = this->sigma;\nreturn Factory_modem<B,R,Q>::build(this->params.modulator.type,\nthis->params.code.N,\n- this->sigma,\n+ sigma,\nthis->params.demodulator.max,\nthis->params.demodulator.psi,\nthis->params.modulator.bits_per_symbol,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/Simulation_BFER_std.cpp",
"diff": "@@ -170,9 +170,11 @@ template <typename B, typename R, typename Q>\nModem<B,R,R>* Simulation_BFER_std<B,R,Q>\n::build_modem(const int tid)\n{\n+ auto sigma = this->params.modulator.complex ? this->sigma * std::sqrt(2.f) : this->sigma;\n+ //auto sigma = this->sigma;\nreturn Factory_modem<B,R,R>::build(this->params.modulator.type,\nthis->params.code.N,\n- this->sigma,\n+ sigma,\nthis->params.demodulator.max,\nthis->params.demodulator.psi,\nthis->params.modulator.bits_per_symbol,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Modification for handling real/complex modulations.
|
8,483 |
08.09.2017 10:13:36
| -7,200 |
5309e222cbce3f7390232fa5ac31526fc90765d6
|
Add a column_row interleaver (written column by column, read row by row) in opposition to the row_column interleaver (written row by row, read column by column)
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -311,8 +311,8 @@ _aff3ct() {\n--itl-type)\nlocal params\ncase \"${simutype}\" in\n- BFER) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL GOLDEN USER NO\" ;;\n- BFERI) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL GOLDEN USER NO\" ;;\n+ BFER) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL COL_ROW GOLDEN USER NO\" ;;\n+ BFERI) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL COL_ROW GOLDEN USER NO\" ;;\nesac\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Interleaver.cpp",
"new_path": "src/Factory/Module/Interleaver.cpp",
"diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Interleaver/Random_column/Interleaver_random_column.hpp\"\n+#include \"Module/Interleaver/Column_row/Interleaver_column_row.hpp\"\n#include \"Module/Interleaver/Row_column/Interleaver_row_column.hpp\"\n#include \"Module/Interleaver/LTE/Interleaver_LTE.hpp\"\n#include \"Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp\"\n@@ -30,6 +31,7 @@ module::Interleaver<T>* Interleaver\nelse if (params.type == \"RANDOM\" ) return new module::Interleaver_random <T>(params.size, params.seed, params.uniform, params.n_frames);\nelse if (params.type == \"RAND_COL\") return new module::Interleaver_random_column<T>(params.size, params.n_cols, params.seed, params.uniform, params.n_frames);\nelse if (params.type == \"ROW_COL\" ) return new module::Interleaver_row_column <T>(params.size, params.n_cols, params.n_frames);\n+ else if (params.type == \"COL_ROW\" ) return new module::Interleaver_column_row <T>(params.size, params.n_cols, params.n_frames);\nelse if (params.type == \"GOLDEN\" ) return new module::Interleaver_golden <T>(params.size, params.seed, params.uniform, params.n_frames);\nelse if (params.type == \"USER\" ) return new module::Interleaver_user <T>(params.size, params.path, params.n_frames);\nelse if (params.type == \"NO\" ) return new module::Interleaver_NO <T>(params.size, params.n_frames);\n@@ -51,7 +53,7 @@ void Interleaver\nopt_args[{p+\"-type\"}] =\n{\"string\",\n\"specify the type of the interleaver.\",\n- \"LTE, CCSDS, DVB-RCS1, DVB-RCS2, RANDOM, GOLDEN, USER, RAND_COL, ROW_COL, NO\"};\n+ \"LTE, CCSDS, DVB-RCS1, DVB-RCS2, RANDOM, GOLDEN, USER, RAND_COL, ROW_COL, COL_ROW, NO\"};\nopt_args[{p+\"-path\"}] =\n{\"string\",\n@@ -90,7 +92,7 @@ void Interleaver\nif (full) head_itl.push_back(std::make_pair(\"Inter frame level\", std::to_string(params.n_frames)));\nif (params.type == \"USER\")\nhead_itl.push_back(std::make_pair(\"Path\", params.path));\n- if (params.type == \"RAND_COL\" || params.type == \"ROW_COL\")\n+ if (params.type == \"RAND_COL\" || params.type == \"ROW_COL\" || params.type == \"COL_ROW\")\nhead_itl.push_back(std::make_pair(\"Number of columns\", std::to_string(params.n_cols)));\nif (params.type == \"RANDOM\" || params.type == \"GOLDEN\" || params.type == \"RAND_COL\")\n{\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Interleaver/Column_row/Interleaver_column_row.hpp",
"diff": "+#ifndef INTERLEAVER_COLUMN_ROW_HPP\n+#define INTERLEAVER_COLUMN_ROW_HPP\n+\n+#include <sstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Math/matrix.h\"\n+\n+#include \"../Interleaver.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+\n+/*\n+ * This interleaver is such as a table that is written column by column and read row by row\n+ */\n+template <typename T = int>\n+class Interleaver_column_row : public Interleaver<T>\n+{\n+private:\n+ const int n_cols;\n+ const int n_rows;\n+\n+public:\n+ Interleaver_column_row(const int size, const int n_cols, const int n_frames = 1,\n+ const std::string name = \"Interleaver_column_row\")\n+ : Interleaver<T>(size, false, n_frames, name), n_cols(n_cols), n_rows(size / n_cols)\n+ {\n+ if (n_rows * n_cols != size)\n+ {\n+ std::stringstream message;\n+ message << \"'size' has to be equal to 'n_rows' * 'n_cols' ('size' = \" << size\n+ << \", 'n_rows' = \" << n_rows << \", 'n_cols' = \" << n_cols << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+\n+ virtual ~Interleaver_column_row()\n+ {\n+ }\n+\n+protected:\n+ void gen_lut(T *lut, const int frame_id)\n+ {\n+ for (auto i = 0; i < n_cols; i++)\n+ for (auto j = 0; j < n_rows; j++)\n+ lut[j * n_cols +i] = i * n_rows +j;\n+ }\n+};\n+}\n+}\n+\n+#endif /* INTERLEAVER_COLUMN_ROW_HPP */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Row_column/Interleaver_row_column.hpp",
"new_path": "src/Module/Interleaver/Row_column/Interleaver_row_column.hpp",
"diff": "@@ -12,6 +12,10 @@ namespace aff3ct\n{\nnamespace module\n{\n+\n+/*\n+ * This interleaver is such as a table that is written row by row and read column by column\n+ */\ntemplate <typename T = int>\nclass Interleaver_row_column : public Interleaver<T>\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a column_row interleaver (written column by column, read row by row) in opposition to the row_column interleaver (written row by row, read column by column)
|
8,483 |
12.09.2017 14:32:07
| -7,200 |
0b5ae43782977ac65837f2952d1907de569358b1
|
Design the OOK modem
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -365,7 +365,7 @@ _aff3ct() {\n;;\n--mdm-type)\n- local params=\"BPSK BPSK_FAST PSK PAM QAM CPM SCMA USER\"\n+ local params=\"BPSK BPSK_FAST OOK PSK PAM QAM CPM SCMA USER\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Modem.cpp",
"new_path": "src/Factory/Module/Modem.cpp",
"diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Code/SCMA/modem_SCMA_functions.hpp\"\n+#include \"Module/Modem/OOK/Modem_OOK.hpp\"\n#include \"Module/Modem/BPSK/Modem_BPSK.hpp\"\n#include \"Module/Modem/BPSK/Modem_BPSK_fast.hpp\"\n#include \"Module/Modem/PAM/Modem_PAM.hpp\"\n@@ -24,6 +25,7 @@ module::Modem<B,R,Q>* Modem\n{\nif (params.type == \"BPSK\" ) return new module::Modem_BPSK <B,R,Q >(params.N, params.sigma, params.no_sig2, params.n_frames);\nelse if (params.type == \"BPSK_FAST\") return new module::Modem_BPSK_fast<B,R,Q >(params.N, params.sigma, params.no_sig2, params.n_frames);\n+ else if (params.type == \"OOK\" ) return new module::Modem_OOK <B,R,Q >(params.N, params.sigma, params.no_sig2, params.n_frames);\nelse if (params.type == \"PAM\" ) return new module::Modem_PAM <B,R,Q,MAX>(params.N, params.sigma, params.bps, params.no_sig2, params.n_frames);\nelse if (params.type == \"QAM\" ) return new module::Modem_QAM <B,R,Q,MAX>(params.N, params.sigma, params.bps, params.no_sig2, params.n_frames);\nelse if (params.type == \"PSK\" ) return new module::Modem_PSK <B,R,Q,MAX>(params.N, params.sigma, params.bps, params.no_sig2, params.n_frames);\n@@ -73,6 +75,7 @@ int Modem\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+ else if (type == \"OOK\" ) return module::Modem_OOK <>::size_mod(N );\nelse if (type == \"SCMA\" ) return module::Modem_SCMA <>::size_mod(N, bps );\nelse if (type == \"PAM\" ) return module::Modem_PAM <>::size_mod(N, bps );\nelse if (type == \"QAM\" ) return module::Modem_QAM <>::size_mod(N, bps );\n@@ -92,6 +95,7 @@ int Modem\n{\nif (type == \"BPSK\" ) return module::Modem_BPSK <>::size_fil(N );\nelse if (type == \"BPSK_FAST\") return module::Modem_BPSK_fast<>::size_fil(N );\n+ else if (type == \"OOK\" ) return module::Modem_OOK <>::size_fil(N );\nelse if (type == \"SCMA\" ) return module::Modem_SCMA <>::size_fil(N, bps );\nelse if (type == \"PAM\" ) return module::Modem_PAM <>::size_fil(N, bps );\nelse if (type == \"QAM\" ) return module::Modem_QAM <>::size_fil(N, bps );\n@@ -117,7 +121,7 @@ void Modem\nopt_args[{p+\"-type\"}] =\n{\"string\",\n\"type of the modulation to use in the simulation.\",\n- \"BPSK, BPSK_FAST, PSK, PAM, QAM, CPM, USER, SCMA\"};\n+ \"BPSK, BPSK_FAST, OOK, PSK, PAM, QAM, CPM, USER, SCMA\"};\nopt_args[{p+\"-bps\"}] =\n{\"positive_int\",\n@@ -227,8 +231,9 @@ void Modem\n}\n// force the number of bits per symbol to 1 when BPSK mod\n- if (params.type == \"BPSK\" || params.type == \"BPSK_FAST\")\n+ if (params.type == \"BPSK\" || params.type == \"BPSK_FAST\" || params.type == \"OOK\")\nparams.bps = 1;\n+\n// force the number of bits per symbol to 3 when SCMA mod\nif (params.type == \"SCMA\")\nparams.bps = 3;\n@@ -279,6 +284,7 @@ void Modem\nstd::string demod_sig2 = (params.no_sig2) ? \"off\" : \"on\";\nstd::string demod_max = (params.type == \"BPSK\" ) ||\n(params.type == \"BPSK_FAST\") ||\n+ (params.type == \"OOK\") ||\n(params.type == \"SCMA\" ) ?\n\"unused\" : params.max;\nstd::string demod_ite = std::to_string(params.n_ite);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Modem/OOK/Modem_OOK.cpp",
"diff": "+#include <type_traits>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+\n+#include \"Modem_OOK.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B, typename R, typename Q>\n+Modem_OOK<B,R,Q>\n+::Modem_OOK(const int N, const R sigma, const bool disable_sig2, const int n_frames, const std::string name)\n+: Modem<B,R,Q>(N, sigma, n_frames, name),\n+ disable_sig2(disable_sig2)\n+{\n+ this->set_sigma(sigma);\n+}\n+\n+template <typename B, typename R, typename Q>\n+Modem_OOK<B,R,Q>\n+::~Modem_OOK()\n+{\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Modem_OOK<B,R,Q>\n+::set_sigma(const R sigma)\n+{\n+ Modem<B,R,Q>::set_sigma(sigma);\n+\n+ if(disable_sig2)\n+ sigma_factor = (R)0.5;\n+ else\n+ sigma_factor = (R)1.0 / (2 * sigma * sigma);\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Modem_OOK<B,R,Q>\n+::modulate(const B *X_N1, R *X_N2)\n+{\n+ auto size = (unsigned int)(this->N * this->n_frames);\n+ for (unsigned i = 0; i < size; i++)\n+ X_N2[i] = X_N1[i] ? 0 : 1;\n+}\n+\n+template <typename B,typename R, typename Q>\n+void Modem_OOK<B,R,Q>\n+::filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil * this->n_frames, Y_N2);\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Modem_OOK<B,R,Q>\n+::demodulate(const Q *Y_N1, Q *Y_N2)\n+{\n+ if (!std::is_same<R,Q>::value)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'R' and 'Q' have to be the same.\");\n+\n+ if (!std::is_floating_point<Q>::value)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\n+\n+ auto size = (unsigned int)(this->N_fil * this->n_frames);\n+ for (unsigned i = 0; i < size; i++)\n+ {\n+ Y_N2[i] = ((Q)2.0 * Y_N1[i] - (Q)1) * (Q)sigma_factor;\n+ }\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Modem_OOK<B,R,Q>\n+::demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2)\n+{\n+ if (!std::is_same<R,Q>::value)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'R' and 'Q' have to be the same.\");\n+\n+ if (!std::is_floating_point<Q>::value)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Type 'Q' has to be float or double.\");\n+\n+ auto size = (unsigned int)(this->N_fil * this->n_frames);\n+ for (unsigned i = 0; i < size; i++)\n+ {\n+ Y_N2[i] = ((Q)2.0 * Y_N1[i] - (Q)1) * (Q)sigma_factor * (Q)H_N[i];\n+ }\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Modem_OOK<B,R,Q>\n+::demodulate(const Q *Y_N1, const Q *Y_N2, Q *Y_N3)\n+{\n+ this->demodulate(Y_N1,Y_N3);\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Modem_OOK<B,R,Q>\n+::demodulate_with_gains(const Q *Y_N1, const R *H_N, const Q *Y_N2, Q *Y_N3)\n+{\n+ this->demodulate_with_gains(Y_N1, H_N, Y_N3);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Modem_OOK<B_8,R_8,R_8>;\n+template class aff3ct::module::Modem_OOK<B_8,R_8,Q_8>;\n+template class aff3ct::module::Modem_OOK<B_16,R_16,R_16>;\n+template class aff3ct::module::Modem_OOK<B_16,R_16,Q_16>;\n+template class aff3ct::module::Modem_OOK<B_32,R_32,R_32>;\n+template class aff3ct::module::Modem_OOK<B_64,R_64,R_64>;\n+#else\n+template class aff3ct::module::Modem_OOK<B,R,Q>;\n+#if !defined(PREC_32_BIT) && !defined(PREC_64_BIT)\n+template class aff3ct::module::Modem_OOK<B,R,R>;\n+#endif\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Modem/OOK/Modem_OOK.hpp",
"diff": "+#ifndef MODEM_OOK_HPP_\n+#define MODEM_OOK_HPP_\n+\n+#include \"../Modem.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float, typename Q = R>\n+class Modem_OOK : public Modem<B,R,Q>\n+{\n+private:\n+ const bool disable_sig2;\n+ R sigma_factor;\n+\n+public:\n+ Modem_OOK(const int N, const R sigma = (R)1, const bool disable_sig2 = false, const int n_frames = 1,\n+ const std::string name = \"Modem_OOK\");\n+ virtual ~Modem_OOK();\n+\n+ void set_sigma(const R sigma);\n+\n+ void modulate (const B *X_N1, R *X_N2); using Modem<B,R,Q>::modulate;\n+ void 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_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\n+ void demodulate (const Q *Y_N1, const Q *Y_N2, Q *Y_N3); using Modem<B,R,Q>::demodulate;\n+ void demodulate_with_gains(const Q *Y_N1, const R *H_N, const Q *Y_N2, Q *Y_N3); using Modem<B,R,Q>::demodulate_with_gains;\n+\n+ static int size_mod(const int N)\n+ {\n+ return Modem<B,R,Q>::get_buffer_size_after_modulation(N, 1, 0, 1, false);\n+ }\n+\n+ static int size_fil(const int N)\n+ {\n+ return Modem<B,R,Q>::get_buffer_size_after_filtering(N, 1, 0, 1, false);\n+ }\n+};\n+}\n+}\n+\n+#endif /* MODEM_OOK_HPP_ */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Design the OOK modem
|
8,483 |
12.09.2017 16:46:28
| -7,200 |
125cad0d87f5529d81aeed61b1928bc6a665198e
|
Design a Rayleigh channel getting its attenuation gain from a file
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -200,7 +200,7 @@ _aff3ct() {\n--sim-snr-min | -m | --snr-min-max | -M | --sim-snr-min | -m | \\\n--snr-min-max | -M | --sim-snr-step | -s | --sim-stop-time | \\\n--sim-threads | -t | --sim-inter-lvl | --enc-info-bits | -K | \\\n- --enc-cw-size | -N | --mdm-ite | \\\n+ --enc-cw-size | -N | --mdm-ite | --chn-gain-occur \\\n--mdm-bps | --mdm-ups | --mdm-cpm-L | --mdm-cpm-p | --mdm-cpm-k | \\\n--qnt-dec | --qnt-bits | --qnt-range | --qnt-type | \\\n--sim-benchs | -b | --sim-debug-limit | --sim-debug-prec | \\\n@@ -318,7 +318,7 @@ _aff3ct() {\n;;\n--chn-type)\n- local params=\"NO AWGN AWGN_FAST AWGN_GSL AWGN_MKL RAYLEIGH RAYLEIGH_FAST RAYLEIGH_GSL RAYLEIGH_MKL \\\n+ local params=\"NO AWGN AWGN_FAST AWGN_GSL AWGN_MKL RAYLEIGH RAYLEIGH_USER RAYLEIGH_FAST RAYLEIGH_GSL RAYLEIGH_MKL \\\nUSER\"\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Channel.cpp",
"new_path": "src/Factory/Module/Channel.cpp",
"diff": "#include \"Module/Channel/User/Channel_user.hpp\"\n#include \"Module/Channel/AWGN/Channel_AWGN_LLR.hpp\"\n#include \"Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp\"\n+#include \"Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.hpp\"\n#include \"Tools/Algo/Noise/Standard/Noise_std.hpp\"\n#include \"Tools/Algo/Noise/Fast/Noise_fast.hpp\"\n@@ -40,6 +41,7 @@ module::Channel<R>* Channel\nelse if (params.type == \"AWGN_GSL\" ) return new module::Channel_AWGN_LLR <R>(params.N, new tools::Noise_GSL <R>(params.seed), params.add_users, params.sigma, params.n_frames);\nelse if (params.type == \"RAYLEIGH_GSL\" ) return new module::Channel_Rayleigh_LLR<R>(params.N, params.complex, new tools::Noise_GSL <R>(params.seed), params.add_users, params.sigma, params.n_frames);\n#endif\n+ else if (params.type == \"RAYLEIGH_USER\") return new module::Channel_Rayleigh_LLR_user<R>(params.N, params.complex, params.path, params.gain_occur, new tools::Noise_fast<R>(params.seed), params.add_users, params.sigma, params.n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n@@ -55,7 +57,7 @@ void Channel\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\";\n+ std::string chan_avail = \"NO, USER, AWGN, AWGN_FAST, RAYLEIGH, RAYLEIGH_FAST, RAYLEIGH_USER\";\n#ifdef CHANNEL_GSL\nchan_avail += \", AWGN_GSL, RAYLEIGH_GSL\";\n#endif\n@@ -70,7 +72,7 @@ void Channel\nopt_args[{p+\"-path\"}] =\n{\"string\",\n- \"path to a noisy file, to use with \\\"--chn-type USER\\\".\"};\n+ \"path to a noisy file (used with \\\"--chn-type USER\\\") or to a gains file (used with \\\"--chn-type RAYLEIGH_USER\\\").\"};\nopt_args[{p+\"-blk-fad\"}] =\n{\"string\",\n@@ -92,6 +94,10 @@ void Channel\nopt_args[{p+\"-complex\"}] =\n{\"\",\n\"enable complex noise generation.\"};\n+\n+ opt_args[{p+\"-gain-occur\"}] =\n+ {\"positive_int\",\n+ \"the number of times a gain is used on consecutive symbols (used with \\\"--chn-type RAYLEIGH_USER\\\").\"};\n}\nvoid Channel\n@@ -106,6 +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}\nvoid Channel\n@@ -114,14 +121,22 @@ void Channel\nhead_chn.push_back(std::make_pair(\"Type\", params.type));\nif (full) head_chn.push_back(std::make_pair(\"Frame size (N)\", std::to_string(params.N)));\nif (full) head_chn.push_back(std::make_pair(\"Inter frame level\", std::to_string(params.n_frames)));\n+\nif (params.sigma != -1.f)\nhead_chn.push_back(std::make_pair(\"Sigma value\", std::to_string(params.sigma)));\n- if (params.type == \"USER\")\n+\n+ if (params.type == \"USER\" || params.type == \"RAYLEIGH_USER\")\nhead_chn.push_back(std::make_pair(\"Path\", params.path));\n+\n+ if (params.type == \"RAYLEIGH_USER\")\n+ head_chn.push_back(std::make_pair(\"Gain occurrences\", std::to_string(params.gain_occur)));\n+\nif (params.type.find(\"RAYLEIGH\") != std::string::npos)\nhead_chn.push_back(std::make_pair(\"Block fading policy\", params.block_fading));\n+\nif ((params.type != \"NO\" && params.type != \"USER\") && full)\nhead_chn.push_back(std::make_pair(\"Seed\", std::to_string(params.seed)));\n+\nhead_chn.push_back(std::make_pair(\"Complex\", params.complex ? \"on\" : \"off\"));\nhead_chn.push_back(std::make_pair(\"Add users\", params.add_users ? \"on\" : \"off\"));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Channel.hpp",
"new_path": "src/Factory/Module/Channel.hpp",
"diff": "@@ -27,6 +27,7 @@ struct Channel : public Factory\nbool complex = false;\nint n_frames = 1;\nint seed = 0;\n+ int gain_occur = 1;\nfloat sigma = -1.f;\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR.cpp",
"diff": "@@ -54,13 +54,21 @@ 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+\n+\ntemplate <typename R>\nvoid Channel_Rayleigh_LLR<R>\n::add_noise(const R *X_N, R *Y_N, R *H_N)\n{\nif (add_users && this->n_frames > 1)\n{\n- noise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\n+ this->get_gains(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@@ -98,7 +106,7 @@ void Channel_Rayleigh_LLR<R>\n}\nelse\n{\n- noise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\n+ this->get_gains(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": "@@ -30,6 +30,8 @@ public:\nvirtual ~Channel_Rayleigh_LLR();\nvirtual void add_noise(const R *X_N, R *Y_N, R *H_N); using Channel<R>::add_noise;\n+\n+ virtual void get_gains(std::vector<R>& gains, const R sigma);\n};\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.cpp",
"diff": "+#include <cmath>\n+#include <fstream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+\n+#include \"Channel_Rayleigh_LLR_user.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename R>\n+Channel_Rayleigh_LLR_user<R>\n+::Channel_Rayleigh_LLR_user(const int N, const bool complex, const std::string& gains_filename,\n+ const int gain_occurrences, tools::Noise<R> *noise_generator, const bool add_users,\n+ const 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+ gain_occur(gain_occurrences),\n+ current_gain_occur(0),\n+ gain_index(0)\n+{\n+ if (gain_occurrences <= 0)\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Argument 'gain_occurrences' must be strictly positive.\");\n+\n+ read_gains(gains_filename);\n+}\n+\n+template <typename R>\n+Channel_Rayleigh_LLR_user<R>\n+::Channel_Rayleigh_LLR_user(const int N, const bool complex, const int seed, const std::string& gains_filename,\n+ const int gain_occurrences, const bool add_users, const R sigma,\n+ const int n_frames, const std::string name)\n+: Channel_Rayleigh_LLR<R>(N, complex, seed, add_users, sigma, n_frames, name),\n+ gain_occur(gain_occurrences),\n+ current_gain_occur(0),\n+ gain_index(0)\n+{\n+ read_gains(gains_filename);\n+}\n+\n+template <typename R>\n+Channel_Rayleigh_LLR_user<R>\n+::~Channel_Rayleigh_LLR_user()\n+{\n+}\n+\n+template <typename R>\n+void Channel_Rayleigh_LLR_user<R>\n+::read_gains(const std::string& gains_filename)\n+{\n+ if (gains_filename.empty())\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Argument 'gains_filename' should not be empty.\");\n+\n+ std::ifstream file(gains_filename);\n+\n+ if (file.is_open())\n+ {\n+ R val;\n+ while (!file.eof() && !file.bad())\n+ {\n+ file >> val;\n+ gains_stock.push_back(val);\n+ }\n+\n+ file.close();\n+ }\n+ else\n+ {\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Can't open '\" + gains_filename + \"' file.\");\n+ }\n+\n+ if(gains_stock.empty())\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"The file '\" + gains_filename + \"' is empty.\");\n+}\n+\n+template <typename R>\n+void Channel_Rayleigh_LLR_user<R>\n+::get_gains(std::vector<R>& gains, const R sigma)\n+{\n+ for (unsigned i = 0; i < gains.size(); ++i)\n+ {\n+ gains[i] = gains_stock[gain_index];\n+\n+ current_gain_occur++;\n+ if(current_gain_occur >= gain_occur)\n+ {\n+ current_gain_occur = 0;\n+ gain_index++;\n+\n+ if(gain_index >= gains_stock.size())\n+ gain_index = 0;\n+ }\n+ }\n+}\n+\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Channel_Rayleigh_LLR_user<R_32>;\n+template class aff3ct::module::Channel_Rayleigh_LLR_user<R_64>;\n+#else\n+template class aff3ct::module::Channel_Rayleigh_LLR_user<R>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"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+\n+#include \"Channel_Rayleigh_LLR.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename R = float>\n+class Channel_Rayleigh_LLR_user : public Channel_Rayleigh_LLR<R>\n+{\n+protected:\n+ std::vector<R> gains_stock;\n+ const unsigned gain_occur;\n+ unsigned current_gain_occur;\n+ unsigned gain_index;\n+\n+public:\n+ Channel_Rayleigh_LLR_user(const int N, const bool complex, const std::string& gains_filename,\n+ const int gain_occurrences = 1,\n+ tools::Noise<R> *noise_generator = new tools::Noise_std<R>(),\n+ const bool add_users = false, const R sigma = (R)1, const int n_frames = 1,\n+ const std::string name = \"Channel_Rayleigh_LLR_user\");\n+ Channel_Rayleigh_LLR_user(const int N, const bool complex, const int seed, const std::string& gains_filename,\n+ const int gain_occurrences = 1, const bool add_users = false, const R sigma = (R)1,\n+ const int n_frames = 1, const std::string name = \"Channel_Rayleigh_LLR_user\");\n+ virtual ~Channel_Rayleigh_LLR_user();\n+\n+ using Channel_Rayleigh_LLR<R>::add_noise;\n+\n+ virtual void get_gains(std::vector<R>& gains, const R sigma);\n+\n+protected:\n+ void read_gains(const std::string& gains_filename);\n+};\n+}\n+}\n+\n+#endif /* CHANNEL_RAYLEIGH_LLR_HPP_ */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Design a Rayleigh channel getting its attenuation gain from a file
|
8,483 |
13.09.2017 09:58:32
| -7,200 |
1672d51fa8ee8270f4113ffccc519494523a5633
|
Set back the OOK demodulation to inversed LLR arbitrarily set to >0 -> 0 and <0 -> 1
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modem/OOK/Modem_OOK.cpp",
"new_path": "src/Module/Modem/OOK/Modem_OOK.cpp",
"diff": "@@ -40,7 +40,7 @@ void Modem_OOK<B,R,Q>\n{\nauto size = (unsigned int)(this->N * this->n_frames);\nfor (unsigned i = 0; i < size; i++)\n- X_N2[i] = X_N1[i] ? 0 : 1;\n+ X_N2[i] = X_N1[i] ? 1 : 0;\n}\ntemplate <typename B,typename R, typename Q>\n@@ -63,7 +63,7 @@ void Modem_OOK<B,R,Q>\nauto size = (unsigned int)(this->N_fil * this->n_frames);\nfor (unsigned i = 0; i < size; i++)\n{\n- Y_N2[i] = ((Q)2.0 * Y_N1[i] - (Q)1) * (Q)sigma_factor;\n+ Y_N2[i] = -((Q)2.0 * Y_N1[i] - (Q)1) * (Q)sigma_factor;\n}\n}\n@@ -80,7 +80,7 @@ void Modem_OOK<B,R,Q>\nauto size = (unsigned int)(this->N_fil * this->n_frames);\nfor (unsigned i = 0; i < size; i++)\n{\n- Y_N2[i] = ((Q)2.0 * Y_N1[i] - (Q)1) * (Q)sigma_factor * (Q)H_N[i];\n+ Y_N2[i] = -((Q)2.0 * Y_N1[i] - (Q)1) * (Q)sigma_factor * (Q)H_N[i];\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Set back the OOK demodulation to inversed LLR arbitrarily set to >0 -> 0 and <0 -> 1
|
8,490 |
14.09.2017 15:02:01
| -7,200 |
151917cbd5cd60505391d76961271900b7139e05
|
Fix bad group args storage.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/BCH/BCH.cpp",
"new_path": "src/Launcher/Code/BCH/BCH.cpp",
"diff": "@@ -54,7 +54,7 @@ template <class L, typename B, typename R, typename Q>\nvoid BCH<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->dec->get_prefix(), params_cdc->dec->get_short_name() + \" parameter(s)\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/LDPC/LDPC.cpp",
"new_path": "src/Launcher/Code/LDPC/LDPC.cpp",
"diff": "@@ -61,7 +61,7 @@ template <class L, typename B, typename R, typename Q>\nvoid LDPC<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->dec->get_prefix(), params_cdc->dec->get_short_name() + \" parameter(s)\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/Polar/Polar.cpp",
"new_path": "src/Launcher/Code/Polar/Polar.cpp",
"diff": "@@ -63,7 +63,7 @@ template <class L, typename B, typename R, typename Q>\nvoid Polar<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->dec->get_prefix(), params_cdc->dec->get_short_name() + \" parameter(s)\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/RA/RA.cpp",
"new_path": "src/Launcher/Code/RA/RA.cpp",
"diff": "@@ -65,7 +65,7 @@ template <class L, typename B, typename R, typename Q>\nvoid RA<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->itl->get_prefix(), params_cdc->itl->get_short_name() + \" parameter(s)\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/RSC/RSC.cpp",
"new_path": "src/Launcher/Code/RSC/RSC.cpp",
"diff": "@@ -63,7 +63,7 @@ template <class L, typename B, typename R, typename Q>\nvoid RSC<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->dec->get_prefix(), params_cdc->dec->get_short_name() + \" parameter(s)\"});\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": "@@ -57,7 +57,7 @@ template <class L, typename B, typename R, typename Q>\nvoid RSC_DB<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->dec->get_prefix(), params_cdc->dec->get_short_name() + \" parameter(s)\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/Repetition/Repetition.cpp",
"new_path": "src/Launcher/Code/Repetition/Repetition.cpp",
"diff": "@@ -57,7 +57,7 @@ template <class L, typename B, typename R, typename Q>\nvoid Repetition<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->dec->get_prefix(), params_cdc->dec->get_short_name() + \" parameter(s)\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/Turbo/Turbo.cpp",
"new_path": "src/Launcher/Code/Turbo/Turbo.cpp",
"diff": "@@ -84,7 +84,7 @@ template <class L, typename B, typename R, typename Q>\nvoid Turbo<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->pct->get_prefix(), params_cdc->pct->get_short_name() + \" parameter(s)\"});\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": "@@ -76,7 +76,7 @@ template <class L, typename B, typename R, typename Q>\nvoid Turbo_DB<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->pct->get_prefix(), params_cdc->pct->get_short_name() + \" parameter(s)\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/Uncoded/Uncoded.cpp",
"new_path": "src/Launcher/Code/Uncoded/Uncoded.cpp",
"diff": "@@ -53,7 +53,7 @@ template <class L, typename B, typename R, typename Q>\nvoid Uncoded<L,B,R,Q>\n::group_args()\n{\n- L::store_args();\n+ L::group_args();\nthis->arg_group.push_back({params_cdc->enc->get_prefix(), params_cdc->enc->get_short_name() + \" parameter(s)\"});\nthis->arg_group.push_back({params_cdc->dec->get_prefix(), params_cdc->dec->get_short_name() + \" parameter(s)\"});\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad group args storage.
|
8,490 |
14.09.2017 15:02:22
| -7,200 |
ea5e4b7eccfa33500c805e49141a3b82c307fb6c
|
Fix polar parameters.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Codec/Polar/Codec_polar.cpp",
"new_path": "src/Factory/Module/Codec/Polar/Codec_polar.cpp",
"diff": "@@ -68,6 +68,7 @@ void Codec_polar::parameters\nreq_args.erase({pdec+\"-info-bits\", \"K\"});\nopt_args.erase({pdec+\"-fra\", \"F\"});\nopt_args.erase({pdec+\"-no-sys\" });\n+ req_args.erase({pdec+\"-cw-size\", \"N\"});\nreq_args.erase({pfbg+\"-cw-size\", \"N\"});\nreq_args.erase({pfbg+\"-info-bits\", \"K\"});\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix polar parameters.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.