author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
8,490
26.01.2018 20:55:48
-3,600
14889c457369fed65236d3cfac4b24a6d8d1dadf
Add the ML decoder for the RSC DB codes.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.cpp", "new_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.cpp", "diff": "#include \"Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS1.hpp\"\n#include \"Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS2.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n+\n#include \"Decoder_RSC_DB.hpp\"\nusing namespace aff3ct;\n@@ -40,7 +42,7 @@ void Decoder_RSC_DB::parameters\nreq_args.erase({p+\"-cw-size\", \"N\"});\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"BCJR\");\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"BCJR, ML\");\nopt_args[{p+\"-implem\"}].push_back(\"GENERIC, DVB-RCS1, DVB-RCS2\");\n@@ -75,6 +77,8 @@ void Decoder_RSC_DB::parameters\nauto p = this->get_prefix();\n+ if (this->type != \"ML\")\n+ {\nif (this->tail_length && full)\nheaders[p].push_back(std::make_pair(\"Tail length\", std::to_string(this->tail_length)));\n@@ -82,10 +86,11 @@ void Decoder_RSC_DB::parameters\nheaders[p].push_back(std::make_pair(std::string(\"Max type\"), this->max));\n}\n+}\ntemplate <typename B, typename Q, tools::proto_max<Q> MAX>\nmodule::Decoder_RSC_DB_BCJR<B,Q>* Decoder_RSC_DB::parameters\n-::_build(const std::vector<std::vector<int>> &trellis) const\n+::_build_siso(const std::vector<std::vector<int>> &trellis) const\n{\nif (this->type == \"BCJR\")\n{\n@@ -99,35 +104,68 @@ module::Decoder_RSC_DB_BCJR<B,Q>* Decoder_RSC_DB::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_RSC_DB_BCJR<B,Q>* Decoder_RSC_DB::parameters\n-::build(const std::vector<std::vector<int>> &trellis) const\n+::build_siso(const std::vector<std::vector<int>> &trellis) const\n+{\n+ if (this->max == \"MAX\" ) return _build_siso<B,Q,tools::max <Q>>(trellis);\n+ else if (this->max == \"MAXS\") return _build_siso<B,Q,tools::max_star <Q>>(trellis);\n+ else if (this->max == \"MAXL\") return _build_siso<B,Q,tools::max_linear<Q>>(trellis);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_RSC_DB::parameters\n+::build(const std::vector<std::vector<int>> &trellis, module::Encoder_RSC_DB<B> *encoder) const\n{\n- if (this->max == \"MAX\" ) return _build<B,Q,tools::max <Q>>(trellis);\n- else if (this->max == \"MAXS\") return _build<B,Q,tools::max_star <Q>>(trellis);\n- else if (this->max == \"MAXL\") return _build<B,Q,tools::max_linear<Q>>(trellis);\n+ if (this->type == \"ML\" && encoder)\n+ return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n+ else\n+ return build_siso<B,Q>(trellis);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\ntemplate <typename B, typename Q>\nmodule::Decoder_RSC_DB_BCJR<B,Q>* Decoder_RSC_DB\n-::build(const parameters &params, const std::vector<std::vector<int>> &trellis)\n+::build_siso(const parameters &params, const std::vector<std::vector<int>> &trellis)\n{\n- return params.template build<B,Q>(trellis);\n+ return params.template build_siso<B,Q>(trellis);\n+}\n+\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_RSC_DB\n+::build(const parameters &params, const std::vector<std::vector<int>> &trellis, module::Encoder_RSC_DB<B> *encoder)\n+{\n+ return params.template build<B,Q>(trellis, encoder);\n}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_8 ,Q_8 >(const std::vector<std::vector<int>>&) const;\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_16,Q_16>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_16,Q_16>(const std::vector<std::vector<int>>&) const;\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_32,Q_32>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_32,Q_32>(const std::vector<std::vector<int>>&) const;\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_64,Q_64>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_64,Q_64>(const std::vector<std::vector<int>>&) const;\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC_DB::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_16,Q_16>* aff3ct::factory::Decoder_RSC_DB::build<B_16,Q_16>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_32,Q_32>* aff3ct::factory::Decoder_RSC_DB::build<B_32,Q_32>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B_64,Q_64>* aff3ct::factory::Decoder_RSC_DB::build<B_64,Q_64>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC_DB::parameters::build_siso<B_8 ,Q_8 >(const std::vector<std::vector<int>>&) const;\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_16,Q_16>* aff3ct::factory::Decoder_RSC_DB::parameters::build_siso<B_16,Q_16>(const std::vector<std::vector<int>>&) const;\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_32,Q_32>* aff3ct::factory::Decoder_RSC_DB::parameters::build_siso<B_32,Q_32>(const std::vector<std::vector<int>>&) const;\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_64,Q_64>* aff3ct::factory::Decoder_RSC_DB::parameters::build_siso<B_64,Q_64>(const std::vector<std::vector<int>>&) const;\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC_DB::build_siso<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_16,Q_16>* aff3ct::factory::Decoder_RSC_DB::build_siso<B_16,Q_16>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_32,Q_32>* aff3ct::factory::Decoder_RSC_DB::build_siso<B_32,Q_32>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B_64,Q_64>* aff3ct::factory::Decoder_RSC_DB::build_siso<B_64,Q_64>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n+#else\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>* aff3ct::factory::Decoder_RSC_DB::parameters::build_siso<B,Q>(const std::vector<std::vector<int>>&) const;\n+template aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>* aff3ct::factory::Decoder_RSC_DB::build_siso<B,Q>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n+#endif\n+\n+#ifdef MULTI_PREC\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_8 ,Q_8 >(const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_16,Q_16>(const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_32,Q_32>(const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B_64,Q_64>(const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC_DB::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC_DB::build<B_16,Q_16>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC_DB::build<B_32,Q_32>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC_DB::build<B_64,Q_64>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B_64>*);\n#else\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B,Q>(const std::vector<std::vector<int>>&) const;\n-template aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>* aff3ct::factory::Decoder_RSC_DB::build<B,Q>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RSC_DB::parameters::build<B,Q>(const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RSC_DB::build<B,Q>(const aff3ct::factory::Decoder_RSC_DB::parameters&, const std::vector<std::vector<int>>&, module::Encoder_RSC_DB<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.hpp", "new_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.hpp", "diff": "#include \"Tools/Math/max.h\"\n#include \"Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR.hpp\"\n+#include \"Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp\"\n#include \"../Decoder.hpp\"\n@@ -40,15 +41,25 @@ struct Decoder_RSC_DB : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_RSC_DB_BCJR<B,Q>* build(const std::vector<std::vector<int>> &trellis) const;\n+ module::Decoder_RSC_DB_BCJR<B,Q>* build_siso(const std::vector<std::vector<int>> &trellis) const;\n+\n+ template <typename B = int, typename Q = float>\n+ module::Decoder_SIHO<B,Q>* build(const std::vector<std::vector<int>> &trellis,\n+ module::Encoder_RSC_DB<B> *encoder = nullptr) const;\nprivate:\ntemplate <typename B = int, typename Q = float, tools::proto_max<Q> MAX>\n- module::Decoder_RSC_DB_BCJR<B,Q>* _build(const std::vector<std::vector<int>> &trellis) const;\n+ module::Decoder_RSC_DB_BCJR<B,Q>* _build_siso(const std::vector<std::vector<int>> &trellis) const;\n};\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_RSC_DB_BCJR<B,Q>* build(const parameters &params, const std::vector<std::vector<int>> &trellis);\n+ static module::Decoder_RSC_DB_BCJR<B,Q>* build_siso(const parameters &params,\n+ const std::vector<std::vector<int>> &trellis);\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Decoder_SIHO<B,Q>* build(const parameters &params,\n+ const std::vector<std::vector<int>> &trellis,\n+ module::Encoder_RSC_DB<B> *encoder = nullptr);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "new_path": "src/Module/Codec/RSC/Codec_RSC.cpp", "diff": "@@ -80,7 +80,7 @@ Codec_RSC<B,Q>\nthis->set_decoder_siso(decoder_siso_siho);\nthis->set_decoder_siho(decoder_siso_siho);\n}\n- catch (const std::exception&)\n+ catch (tools::cannot_allocate const&)\n{\nthis->set_decoder_siho(factory::Decoder_RSC::build<B,Q>(dec_params, trellis, std::cout, 1, encoder_RSC_bis));\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/RSC_DB/Codec_RSC_DB.cpp", "new_path": "src/Module/Codec/RSC_DB/Codec_RSC_DB.cpp", "diff": "@@ -63,19 +63,28 @@ Codec_RSC_DB<B,Q>\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pct_params));\n+ Encoder_RSC_DB<B> *encoder_RSC_bis = nullptr;\ntry\n{\n- this->set_encoder(factory::Encoder_RSC_DB::build<B>(enc_params));\n+ encoder_RSC_bis = factory::Encoder_RSC_DB::build<B>(enc_params);\n+ this->set_encoder(encoder_RSC_bis);\n}\ncatch (tools::cannot_allocate const&)\n{\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n- auto decoder_siso_siho = factory::Decoder_RSC_DB::build<B,Q>(dec_params, trellis);\n+ try\n+ {\n+ auto decoder_siso_siho = factory::Decoder_RSC_DB::build_siso<B,Q>(dec_params, trellis);\nthis->set_decoder_siso(decoder_siso_siho);\nthis->set_decoder_siho(decoder_siso_siho);\n}\n+ catch (tools::cannot_allocate const&)\n+ {\n+ this->set_decoder_siho(factory::Decoder_RSC_DB::build<B,Q>(dec_params, trellis, encoder_RSC_bis));\n+ }\n+}\ntemplate <typename B, typename Q>\nCodec_RSC_DB<B,Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -98,8 +98,8 @@ Codec_turbo_DB<B,Q>\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n- sub_dec_n = factory::Decoder_RSC_DB::build<B,Q>(*dec_params.sub, trellis);\n- sub_dec_i = factory::Decoder_RSC_DB::build<B,Q>(*dec_params.sub, trellis);\n+ sub_dec_n = factory::Decoder_RSC_DB::build_siso<B,Q>(*dec_params.sub, trellis);\n+ sub_dec_i = factory::Decoder_RSC_DB::build_siso<B,Q>(*dec_params.sub, trellis);\nauto decoder = factory::Decoder_turbo_DB::build<B,Q>(dec_params, this->get_interleaver_llr(), *sub_dec_n, *sub_dec_i);\nthis->set_decoder_siho(decoder);\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the ML decoder for the RSC DB codes.
8,490
26.01.2018 21:18:42
-3,600
d658eb0e323a8a30c33348e36cb34003e3673994
Add the ML decoder for the Turbo DB codes.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n#include \"Decoder_turbo_DB.hpp\"\n@@ -93,7 +94,7 @@ void Decoder_turbo_DB::parameters\nreq_args.erase({pi+\"-size\" });\nopt_args.erase({pi+\"-fra\", \"F\"});\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"TURBO_DB\");\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"TURBO_DB, ML\");\nopt_args[{p+\"-implem\"}].push_back(\"STD\");\n@@ -170,6 +171,8 @@ void Decoder_turbo_DB::parameters\nauto p = this->get_prefix();\n+ if (this->type != \"ML\")\n+ {\nitl->get_headers(headers, full);\nheaders[p].push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->n_ite)));\n@@ -180,6 +183,7 @@ void Decoder_turbo_DB::parameters\nfnc->get_headers(headers, full);\nsub->get_headers(headers, full);\n}\n+}\ntemplate <typename B, typename Q>\nmodule::Decoder_turbo_DB<B,Q>* Decoder_turbo_DB::parameters\n@@ -195,6 +199,16 @@ module::Decoder_turbo_DB<B,Q>* Decoder_turbo_DB::parameters\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_turbo_DB::parameters\n+::build_ml(module::Encoder_turbo_DB<B> *encoder) const\n+{\n+ if (this->type == \"ML\" && encoder)\n+ return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\ntemplate <typename B, typename Q>\nmodule::Decoder_turbo_DB<B,Q>* Decoder_turbo_DB\n::build(const parameters &params,\n@@ -205,6 +219,13 @@ module::Decoder_turbo_DB<B,Q>* Decoder_turbo_DB\nreturn params.template build<B,Q>(itl, siso_n, siso_i);\n}\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_turbo_DB\n+::build_ml(const parameters &params, module::Encoder_turbo_DB<B> *encoder)\n+{\n+ return params.template build_ml<B,Q>(encoder);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n@@ -220,4 +241,18 @@ template aff3ct::module::Decoder_turbo_DB<B_64,Q_64>* aff3ct::factory::Decoder_t\ntemplate aff3ct::module::Decoder_turbo_DB<B,Q>* aff3ct::factory::Decoder_turbo_DB::parameters::build<B,Q>(const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>&, aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>&) const;\ntemplate aff3ct::module::Decoder_turbo_DB<B,Q>* aff3ct::factory::Decoder_turbo_DB::build<B,Q>(const aff3ct::factory::Decoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>&, aff3ct::module::Decoder_RSC_DB_BCJR<B,Q>&);\n#endif\n+\n+#ifdef MULTI_PREC\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_8 ,Q_8 >(module::Encoder_turbo_DB<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_16,Q_16>(module::Encoder_turbo_DB<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_32,Q_32>(module::Encoder_turbo_DB<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_64,Q_64>(module::Encoder_turbo_DB<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_DB::build_ml<B_8 ,Q_8 >(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_DB::build_ml<B_16,Q_16>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_DB::build_ml<B_32,Q_32>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_DB::build_ml<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_64>*);\n+#else\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B,Q>(module::Encoder_turbo_DB<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_DB::build_ml<B,Q>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B>*);\n+#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp", "new_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp", "diff": "#include \"Module/Decoder/RSC_DB/BCJR//Decoder_RSC_DB_BCJR.hpp\"\n#include \"Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp\"\n#include \"Module/Interleaver/Interleaver.hpp\"\n+#include \"Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp\"\n#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n#include \"Factory/Tools/Code/Turbo/Flip_and_check_DB.hpp\"\n@@ -55,6 +56,9 @@ struct Decoder_turbo_DB : public Decoder\nmodule::Decoder_turbo_DB<B,Q>* build(const module::Interleaver<Q> &itl,\nmodule::Decoder_RSC_DB_BCJR<B,Q> &siso_n,\nmodule::Decoder_RSC_DB_BCJR<B,Q> &siso_i) const;\n+\n+ template <typename B = int, typename Q = float>\n+ module::Decoder_SIHO<B,Q>* build_ml(module::Encoder_turbo_DB<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float>\n@@ -62,6 +66,10 @@ struct Decoder_turbo_DB : public Decoder\nconst module::Interleaver<Q> &itl,\nmodule::Decoder_RSC_DB_BCJR<B,Q> &siso_n,\nmodule::Decoder_RSC_DB_BCJR<B,Q> &siso_i);\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Decoder_SIHO<B,Q>* build_ml(const parameters &params,\n+ module::Encoder_turbo_DB<B> *encoder = nullptr);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp", "new_path": "src/Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp", "diff": "@@ -142,7 +142,7 @@ void Encoder_turbo_DB::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_turbo_DB::parameters\n+module::Encoder_turbo_DB<B>* Encoder_turbo_DB::parameters\n::build(const module::Interleaver<B> &itl, module::Encoder_RSC_DB<B> &sub_enc) const\n{\nif (this->type == \"TURBO_DB\") return new module::Encoder_turbo_DB<B>(this->K, this->N_cw, itl, sub_enc, sub_enc, this->n_frames);\n@@ -151,7 +151,7 @@ module::Encoder<B>* Encoder_turbo_DB::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_turbo_DB\n+module::Encoder_turbo_DB<B>* Encoder_turbo_DB\n::build(const parameters &params,\nconst module::Interleaver<B> &itl,\nmodule::Encoder_RSC_DB<B> &sub_enc)\n@@ -162,16 +162,16 @@ module::Encoder<B>* Encoder_turbo_DB\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_8 >(const aff3ct::module::Interleaver<B_8 >&, aff3ct::module::Encoder_RSC_DB<B_8 >&) const;\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_16>(const aff3ct::module::Interleaver<B_16>&, aff3ct::module::Encoder_RSC_DB<B_16>&) const;\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_32>(const aff3ct::module::Interleaver<B_32>&, aff3ct::module::Encoder_RSC_DB<B_32>&) const;\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_64>(const aff3ct::module::Interleaver<B_64>&, aff3ct::module::Encoder_RSC_DB<B_64>&) const;\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_turbo_DB::build<B_8 >(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_8 >&, aff3ct::module::Encoder_RSC_DB<B_8 >&);\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_turbo_DB::build<B_16>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_16>&, aff3ct::module::Encoder_RSC_DB<B_16>&);\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_turbo_DB::build<B_32>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_32>&, aff3ct::module::Encoder_RSC_DB<B_32>&);\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_turbo_DB::build<B_64>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_64>&, aff3ct::module::Encoder_RSC_DB<B_64>&);\n+template aff3ct::module::Encoder_turbo_DB<B_8 >* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_8 >(const aff3ct::module::Interleaver<B_8 >&, aff3ct::module::Encoder_RSC_DB<B_8 >&) const;\n+template aff3ct::module::Encoder_turbo_DB<B_16>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_16>(const aff3ct::module::Interleaver<B_16>&, aff3ct::module::Encoder_RSC_DB<B_16>&) const;\n+template aff3ct::module::Encoder_turbo_DB<B_32>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_32>(const aff3ct::module::Interleaver<B_32>&, aff3ct::module::Encoder_RSC_DB<B_32>&) const;\n+template aff3ct::module::Encoder_turbo_DB<B_64>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B_64>(const aff3ct::module::Interleaver<B_64>&, aff3ct::module::Encoder_RSC_DB<B_64>&) const;\n+template aff3ct::module::Encoder_turbo_DB<B_8 >* aff3ct::factory::Encoder_turbo_DB::build<B_8 >(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_8 >&, aff3ct::module::Encoder_RSC_DB<B_8 >&);\n+template aff3ct::module::Encoder_turbo_DB<B_16>* aff3ct::factory::Encoder_turbo_DB::build<B_16>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_16>&, aff3ct::module::Encoder_RSC_DB<B_16>&);\n+template aff3ct::module::Encoder_turbo_DB<B_32>* aff3ct::factory::Encoder_turbo_DB::build<B_32>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_32>&, aff3ct::module::Encoder_RSC_DB<B_32>&);\n+template aff3ct::module::Encoder_turbo_DB<B_64>* aff3ct::factory::Encoder_turbo_DB::build<B_64>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B_64>&, aff3ct::module::Encoder_RSC_DB<B_64>&);\n#else\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B>(const aff3ct::module::Interleaver<B>&, aff3ct::module::Encoder_RSC_DB<B>&) const;\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_turbo_DB::build<B>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B>&, aff3ct::module::Encoder_RSC_DB<B>&);\n+template aff3ct::module::Encoder_turbo_DB<B>* aff3ct::factory::Encoder_turbo_DB::parameters::build<B>(const aff3ct::module::Interleaver<B>&, aff3ct::module::Encoder_RSC_DB<B>&) const;\n+template aff3ct::module::Encoder_turbo_DB<B>* aff3ct::factory::Encoder_turbo_DB::build<B>(const aff3ct::factory::Encoder_turbo_DB::parameters&, const aff3ct::module::Interleaver<B>&, aff3ct::module::Encoder_RSC_DB<B>&);\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp", "new_path": "src/Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp", "diff": "#include <string>\n#include \"Module/Interleaver/Interleaver.hpp\"\n-#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp\"\n#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n#include \"Factory/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp\"\n@@ -46,11 +46,11 @@ struct Encoder_turbo_DB : public Encoder\n// builder\ntemplate <typename B = int>\n- module::Encoder<B>* build(const module::Interleaver<B> &itl, module::Encoder_RSC_DB<B> &sub_enc) const;\n+ module::Encoder_turbo_DB<B>* build(const module::Interleaver<B> &itl, module::Encoder_RSC_DB<B> &sub_enc) const;\n};\ntemplate <typename B = int>\n- static module::Encoder<B>* build(const parameters &params,\n+ static module::Encoder_turbo_DB<B>* build(const parameters &params,\nconst module::Interleaver<B> &itl,\nmodule::Encoder_RSC_DB<B> &sub_enc);\n};\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -88,22 +88,34 @@ Codec_turbo_DB<B,Q>\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pctno_params));\n}\n+ Encoder_turbo_DB<B> *encoder_turbo = nullptr;\ntry\n{\nsub_enc = factory::Encoder_RSC_DB::build<B>(*enc_params.sub);\n- this->set_encoder(factory::Encoder_turbo_DB::build<B>(enc_params, this->get_interleaver_bit(), *sub_enc));\n+ encoder_turbo = factory::Encoder_turbo_DB::build<B>(enc_params, this->get_interleaver_bit(), *sub_enc);\n+ this->set_encoder(encoder_turbo);\n}\ncatch (tools::cannot_allocate const&)\n{\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n+ Decoder_turbo_DB<B,Q>* decoder_turbo = nullptr;\n+ try\n+ {\n+ this->set_decoder_siho(factory::Decoder_turbo_DB::build_ml<B,Q>(dec_params, encoder_turbo));\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\nsub_dec_n = factory::Decoder_RSC_DB::build_siso<B,Q>(*dec_params.sub, trellis);\nsub_dec_i = factory::Decoder_RSC_DB::build_siso<B,Q>(*dec_params.sub, trellis);\n- auto decoder = factory::Decoder_turbo_DB::build<B,Q>(dec_params, this->get_interleaver_llr(), *sub_dec_n, *sub_dec_i);\n- this->set_decoder_siho(decoder);\n+ decoder_turbo = factory::Decoder_turbo_DB::build<B,Q>(dec_params, this->get_interleaver_llr(), *sub_dec_n, *sub_dec_i);\n+ this->set_decoder_siho(decoder_turbo);\n+ }\n// ------------------------------------------------------------------------------------------------ post processing\n+ if (decoder_turbo)\n+ {\n// then add post processing modules\nif (dec_params.sf->enable)\npost_pros.push_back(factory::Scaling_factor::build<B,Q>(*dec_params.sf));\n@@ -116,7 +128,7 @@ Codec_turbo_DB<B,Q>\npost_pros.push_back(factory::Flip_and_check_DB::build<B,Q>(*dec_params.fnc, *crc));\n}\nelse if (crc != nullptr && crc->get_size() > 0)\n- post_pros.push_back(new tools::CRC_checker_DB<B,Q>(*crc, 2, decoder->get_simd_inter_frame_level()));\n+ post_pros.push_back(new tools::CRC_checker_DB<B,Q>(*crc, 2, decoder_turbo->get_simd_inter_frame_level()));\nfor (auto i = 0; i < (int)post_pros.size(); i++)\n{\n@@ -125,9 +137,10 @@ Codec_turbo_DB<B,Q>\nusing namespace std::placeholders;\nauto pp = post_pros[i];\n- decoder->add_handler_siso_n(std::bind(&tools::Post_processing_SISO<B,Q>::siso_n, pp, _1, _2, _3, _4));\n- decoder->add_handler_siso_i(std::bind(&tools::Post_processing_SISO<B,Q>::siso_i, pp, _1, _2, _3 ));\n- decoder->add_handler_end (std::bind(&tools::Post_processing_SISO<B,Q>::end, pp, _1 ));\n+ decoder_turbo->add_handler_siso_n(std::bind(&tools::Post_processing_SISO<B,Q>::siso_n, pp, _1, _2, _3, _4));\n+ decoder_turbo->add_handler_siso_i(std::bind(&tools::Post_processing_SISO<B,Q>::siso_i, pp, _1, _2, _3 ));\n+ decoder_turbo->add_handler_end (std::bind(&tools::Post_processing_SISO<B,Q>::end, pp, _1 ));\n+ }\n}\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the ML decoder for the Turbo DB codes.
8,490
26.01.2018 22:43:12
-3,600
6441cce28c36dc0a878005461e666f17182f3023
Factorize the code of the ML decoder parameters.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp", "new_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp", "diff": "@@ -39,7 +39,7 @@ void Decoder_BCH::parameters\nauto p = this->get_prefix();\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"ALGEBRAIC, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", ALGEBRAIC\";\nopt_args[{p+\"-implem\"}].push_back(\"STD\");\nopt_args[{p+\"-corr-pow\", \"T\"}] =\n@@ -73,10 +73,10 @@ void Decoder_BCH::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- auto p = this->get_prefix();\n-\nif (this->type != \"ML\")\n{\n+ auto p = this->get_prefix();\n+\nheaders[p].push_back(std::make_pair(\"Galois field order (m)\", std::to_string(this->m)));\nheaders[p].push_back(std::make_pair(\"Correction power (T)\", std::to_string(this->t)));\n}\n@@ -85,14 +85,17 @@ void Decoder_BCH::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_BCH::parameters\n::build(const tools::BCH_polynomial_generator &GF, module::Encoder_BCH<B> *encoder) const\n+{\n+ try\n+ {\n+ return Decoder::parameters::build<B,Q>(encoder);\n+ }\n+ catch (tools::cannot_allocate const&)\n{\nif (this->type == \"ALGEBRAIC\")\n{\nif (this->implem == \"STD\") return new module::Decoder_BCH<B,Q>(this->K, this->N_cw, GF, this->n_frames);\n}\n- else if (this->type == \"ML\" && encoder)\n- {\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Decoder.cpp", "new_path": "src/Factory/Module/Decoder/Decoder.cpp", "diff": "+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n+\n#include \"Decoder.hpp\"\n+using namespace aff3ct;\nusing namespace aff3ct::factory;\nconst std::string aff3ct::factory::Decoder_name = \"Decoder\";\n@@ -41,11 +44,16 @@ void Decoder::parameters\nopt_args[{p+\"-type\", \"D\"}] =\n{\"string\",\n- \"select the algorithm you want to decode the codeword.\"};\n+ \"select the algorithm you want to decode the codeword.\",\n+ \"ML\"};\nopt_args[{p+\"-implem\"}] =\n{\"string\",\n\"select the implementation of the algorithm to decode.\"};\n+\n+ opt_args[{p+\"-ml-hamming\"}] =\n+ {\"\",\n+ \"enable the computation of the Hamming distance instead of the Euclidean distance in the ML decoder.\"};\n}\nvoid Decoder::parameters\n@@ -59,6 +67,7 @@ void Decoder::parameters\nif(exist(vals, {p+\"-type\", \"D\"})) this->type = vals.at({p+\"-type\", \"D\"});\nif(exist(vals, {p+\"-implem\" })) this->implem = vals.at({p+\"-implem\" });\nif(exist(vals, {p+\"-no-sys\" })) this->systematic = false;\n+ if(exist(vals, {p+\"-ml-hamming\" })) this->ml_hamming = true;\nthis->R = (float)this->K / (float)this->N_cw;\n}\n@@ -69,11 +78,35 @@ void Decoder::parameters\nauto p = this->get_prefix();\nheaders[p].push_back(std::make_pair(\"Type (D)\",this->type));\n- if(this->implem.size() && this->type != \"ML\")\n- headers[p].push_back(std::make_pair(\"Implementation\", this->implem));\n+ if(this->implem.size() && this->type != \"ML\") headers[p].push_back(std::make_pair(\"Implementation\", this->implem));\nif (full) headers[p].push_back(std::make_pair(\"Info. bits (K)\", std::to_string(this->K)));\nif (full) headers[p].push_back(std::make_pair(\"Codeword size (N)\", std::to_string(this->N_cw)));\nif (full) headers[p].push_back(std::make_pair(\"Code rate (R)\", std::to_string(this->R)));\nheaders[p].push_back(std::make_pair(\"Systematic\", ((this->systematic) ? \"yes\" : \"no\")));\nif (full) headers[p].push_back(std::make_pair(\"Inter frame level\", std::to_string(this->n_frames)));\n+ if(this->type == \"ML\") headers[p].push_back(std::make_pair(\"Distance\", this->ml_hamming ? \"Hamming\" : \"Euclidean\"));\n}\n+\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder::parameters\n+::build(module::Encoder<B> *encoder) const\n+{\n+ if (encoder)\n+ {\n+ if (this->type == \"ML\") return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, this->ml_hamming, this->n_frames);\n+ }\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::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder::parameters::build<B_8 ,Q_8 >(module::Encoder<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder::parameters::build<B_16,Q_16>(module::Encoder<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder::parameters::build<B_32,Q_32>(module::Encoder<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder::parameters::build<B_64,Q_64>(module::Encoder<B_64>*) const;\n+#else\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder::parameters::build<B,Q>(module::Encoder<B>*) const;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Decoder.hpp", "new_path": "src/Factory/Module/Decoder/Decoder.hpp", "diff": "#include <string>\n+#include \"Module/Decoder/Decoder_SIHO.hpp\"\n+#include \"Module/Encoder/Encoder.hpp\"\n+\n#include \"../../Factory.hpp\"\nnamespace aff3ct\n@@ -25,6 +28,7 @@ struct Decoder : Factory\nstd::string type = \"\";\nstd::string implem = \"\";\nbool systematic = true;\n+ bool ml_hamming = false;\nint n_frames = 1;\nint tail_length = 0;\n@@ -42,6 +46,9 @@ struct Decoder : Factory\nprotected:\nparameters(const std::string &n, const std::string &p);\n+\n+ template <typename B = int, typename Q = float>\n+ module::Decoder_SIHO<B,Q>* build(module::Encoder<B> *encoder = nullptr) const;\n};\n};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "@@ -61,8 +61,7 @@ void Decoder_LDPC::parameters\n\"the MIN implementation for the nodes (AMS decoder).\",\n\"MIN, MINL, MINS\"};\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED, ML\");\n-\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", BP, BP_FLOODING, BP_LAYERED\";\nopt_args[{p+\"-implem\"}].push_back(\"ONMS, SPA, LSPA, GALA, AMS\");\nopt_args[{p+\"-ite\", \"i\"}] =\n@@ -114,10 +113,10 @@ void Decoder_LDPC::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- auto p = this->get_prefix();\n-\nif (this->type != \"ML\")\n{\n+ auto p = this->get_prefix();\n+\nif (!this->H_path.empty())\n{\nheaders[p].push_back(std::make_pair(\"H matrix path\", this->H_path));\n@@ -183,16 +182,19 @@ module::Decoder_SIHO<B,Q>* Decoder_LDPC::parameters\n::build(const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos,\nmodule::Encoder_LDPC<B> *encoder) const\n{\n- if ((this->type == \"BP\" || this->type == \"BP_FLOODING\") && this->simd_strategy.empty())\n+ try\n{\n- if (this->implem == \"GALA\") return new module::Decoder_LDPC_BP_flooding_GALA<B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n+ return Decoder::parameters::build<B,Q>(encoder);\n}\n- else if (this->type == \"ML\" && encoder)\n+ catch (tools::cannot_allocate const&)\n+ {\n+ if ((this->type == \"BP\" || this->type == \"BP_FLOODING\") && this->simd_strategy.empty())\n{\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n+ if (this->implem == \"GALA\") return new module::Decoder_LDPC_BP_flooding_GALA<B,Q>(this->K, this->N_cw, this->n_ite, H, info_bits_pos, this->enable_syndrome, this->syndrome_depth, this->n_frames);\n}\nreturn build_siso<B,Q>(H, info_bits_pos);\n+ }\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/NO/Decoder_NO.cpp", "new_path": "src/Factory/Module/Decoder/NO/Decoder_NO.cpp", "diff": "@@ -38,8 +38,10 @@ void Decoder_NO::parameters\nauto p = this->get_prefix();\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"NONE\");\n+ opt_args[{p+\"-type\", \"D\"}][2] = \"NONE\";\nopt_args[{p+\"-implem\" }].push_back(\"HARD_DECISION\");\n+\n+ opt_args.erase({p+\"-ml-hamming\"});\n}\nvoid Decoder_NO::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "new_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "diff": "@@ -77,7 +77,7 @@ void Decoder_polar::parameters\nauto p = this->get_prefix();\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"SC, SCL, SCL_MEM, ASCL, ASCL_MEM, SCAN, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", SC, SCL, SCL_MEM, ASCL, ASCL_MEM, SCAN\";\nopt_args[{p+\"-ite\", \"i\"}] =\n{\"strictly_positive_int\",\n@@ -127,10 +127,10 @@ void Decoder_polar::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- auto p = this->get_prefix();\n-\nif (this->type != \"ML\")\n{\n+ auto p = this->get_prefix();\n+\nif (!this->simd_strategy.empty())\nheaders[p].push_back(std::make_pair(\"SIMD strategy\", this->simd_strategy));\n@@ -248,11 +248,12 @@ template <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_polar::parameters\n::build(const std::vector<bool> &frozen_bits, module::CRC<B> *crc, module::Encoder_polar<B> *encoder) const\n{\n- if (this->type == \"ML\" && encoder)\n+ try\n{\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n+ return Decoder::parameters::build<B,Q>(encoder);\n}\n-\n+ catch (tools::cannot_allocate const&)\n+ {\nif (this->type.find(\"SCL\") != std::string::npos && this->implem == \"FAST\")\n{\nif (this->simd_strategy == \"INTRA\")\n@@ -344,6 +345,7 @@ module::Decoder_SIHO<B,Q>* Decoder_polar::parameters\n#endif\nreturn _build<B,Q,API_polar>(frozen_bits, crc);\n}\n+ }\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RA/Decoder_RA.cpp", "new_path": "src/Factory/Module/Decoder/RA/Decoder_RA.cpp", "diff": "@@ -73,7 +73,7 @@ void Decoder_RA::parameters\nreq_args.erase({pi+\"-size\" });\nopt_args.erase({pi+\"-fra\", \"F\"});\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"RA, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", RA\";\nopt_args[{p+\"-implem\" }].push_back(\"STD\");\nopt_args[{p+\"-ite\", \"i\"}] =\n@@ -103,23 +103,28 @@ void Decoder_RA::parameters\nitl->get_headers(headers, full);\n+ if (this->type != \"ML\")\n+ {\nauto p = this->get_prefix();\n- if (this->type != \"ML\")\nheaders[p].push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->n_ite)));\n}\n+}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_RA::parameters\n::build(const module::Interleaver<Q> &itl, module::Encoder_RA<B> *encoder) const\n+{\n+ try\n+ {\n+ return Decoder::parameters::build<B,Q>(encoder);\n+ }\n+ catch (tools::cannot_allocate const&)\n{\nif (this->type == \"RA\")\n{\nif (this->implem == \"STD\" ) return new module::Decoder_RA<B,Q>(this->K, this->N_cw, itl, this->n_ite, this->n_frames);\n}\n- else if (this->type == \"ML\" && encoder)\n- {\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp", "new_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp", "diff": "@@ -59,7 +59,7 @@ void Decoder_RSC::parameters\nreq_args.erase({p+\"-cw-size\", \"N\"});\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"BCJR, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", BCJR\";\nopt_args[{p+\"-implem\"}].push_back(\"GENERIC, STD, FAST, VERY_FAST\");\n@@ -129,10 +129,10 @@ void Decoder_RSC::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- auto p = this->get_prefix();\n-\nif (this->type != \"ML\")\n{\n+ auto p = this->get_prefix();\n+\nif (this->tail_length && full)\nheaders[p].push_back(std::make_pair(\"Tail length\", std::to_string(this->tail_length)));\n@@ -250,10 +250,14 @@ module::Decoder_SIHO<B,Q>* Decoder_RSC::parameters\nconst int n_ite,\nmodule::Encoder_RSC_sys<B> *encoder) const\n{\n- if (this->type == \"ML\" && encoder)\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n- else\n+ try\n+ {\n+ return Decoder::parameters::build<B,Q>(encoder);\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\nreturn build_siso<B,Q>(trellis, stream, n_ite);\n+ }\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.cpp", "new_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.cpp", "diff": "@@ -42,7 +42,7 @@ void Decoder_RSC_DB::parameters\nreq_args.erase({p+\"-cw-size\", \"N\"});\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"BCJR, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", BCJR\";\nopt_args[{p+\"-implem\"}].push_back(\"GENERIC, DVB-RCS1, DVB-RCS2\");\n@@ -75,10 +75,10 @@ void Decoder_RSC_DB::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- auto p = this->get_prefix();\n-\nif (this->type != \"ML\")\n{\n+ auto p = this->get_prefix();\n+\nif (this->tail_length && full)\nheaders[p].push_back(std::make_pair(\"Tail length\", std::to_string(this->tail_length)));\n@@ -117,10 +117,14 @@ template <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_RSC_DB::parameters\n::build(const std::vector<std::vector<int>> &trellis, module::Encoder_RSC_DB<B> *encoder) const\n{\n- if (this->type == \"ML\" && encoder)\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n- else\n+ try\n+ {\n+ return Decoder::parameters::build<B,Q>(encoder);\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\nreturn build_siso<B,Q>(trellis);\n+ }\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp", "new_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp", "diff": "@@ -38,7 +38,7 @@ void Decoder_repetition::parameters\nauto p = this->get_prefix();\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"REPETITION, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", REPETITION\";\nopt_args[{p+\"-implem\" }].push_back(\"STD, FAST\");\nopt_args[{p+\"-no-buff\"}] =\n@@ -61,24 +61,29 @@ void Decoder_repetition::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n+ if (this->type != \"ML\")\n+ {\nauto p = this->get_prefix();\n- if (this->type != \"ML\")\nif (full) headers[p].push_back(std::make_pair(\"Buffered\", (this->buffered ? \"on\" : \"off\")));\n}\n+}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_repetition::parameters\n::build(module::Encoder_repetition_sys<B> *encoder) const\n+{\n+ try\n+ {\n+ return Decoder::parameters::build<B,Q>(encoder);\n+ }\n+ catch (tools::cannot_allocate const&)\n{\nif (this->type == \"REPETITION\")\n{\nif (this->implem == \"STD\" ) return new module::Decoder_repetition_std <B,Q>(this->K, this->N_cw, this->buffered, this->n_frames);\nelse if (this->implem == \"FAST\") return new module::Decoder_repetition_fast<B,Q>(this->K, this->N_cw, this->buffered, this->n_frames);\n}\n- else if (this->type == \"ML\" && encoder)\n- {\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hpp", "new_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hpp", "diff": "@@ -62,7 +62,7 @@ struct Decoder_turbo : public Decoder\nmodule::Decoder_SISO<Q> &siso_i) const;\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SIHO<B,Q>* build_ml(module::Encoder_turbo<B> *encoder = nullptr) const;\n+ module::Decoder_SIHO<B,Q>* build(module::Encoder_turbo<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float, class D1 = Decoder_RSC, class D2 = D1>\n@@ -72,7 +72,7 @@ struct Decoder_turbo : public Decoder\nmodule::Decoder_SISO<Q> &siso_i);\ntemplate <typename B = int, typename Q = float, class D1 = Decoder_RSC, class D2 = D1>\n- static module::Decoder_SIHO<B,Q>* build_ml(const parameters<D1,D2> &params,\n+ static module::Decoder_SIHO<B,Q>* build(const parameters<D1,D2> &params,\nmodule::Encoder_turbo<B> *encoder = nullptr);\n};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "new_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "diff": "@@ -106,7 +106,7 @@ void Decoder_turbo::parameters<D1,D2>\nreq_args.erase({pi+\"-size\" });\nopt_args.erase({pi+\"-fra\", \"F\"});\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"TURBO, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", TURBO\";\nopt_args[{p+\"-implem\"}].push_back(\"STD, FAST\");\n@@ -214,12 +214,12 @@ void Decoder_turbo::parameters<D1,D2>\n{\nDecoder::parameters::get_headers(headers, full);\n- auto p = this->get_prefix();\n-\nitl->get_headers(headers, full);\nif (this->type != \"ML\")\n{\n+ auto p = this->get_prefix();\n+\nheaders[p].push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->n_ite)));\nif (this->tail_length && full)\nheaders[p].push_back(std::make_pair(\"Tail length\", std::to_string(this->tail_length)));\n@@ -256,10 +256,9 @@ module::Decoder_turbo<B,Q>* Decoder_turbo::parameters<D1,D2>\ntemplate <class D1, class D2>\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_turbo::parameters<D1,D2>\n-::build_ml(module::Encoder_turbo<B> *encoder) const\n+::build(module::Encoder_turbo<B> *encoder) const\n{\n- if (this->type == \"ML\" && encoder)\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n+ return Decoder::parameters::build<B,Q>(encoder);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n@@ -276,9 +275,9 @@ module::Decoder_turbo<B,Q>* Decoder_turbo\ntemplate <typename B, typename Q, class D1, class D2>\nmodule::Decoder_SIHO<B,Q>* Decoder_turbo\n-::build_ml(const parameters<D1,D2> &params, module::Encoder_turbo<B> *encoder)\n+::build(const parameters<D1,D2> &params, module::Encoder_turbo<B> *encoder)\n{\n- return params.template build_ml<B,Q>(encoder);\n+ return params.template build<B,Q>(encoder);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "diff": "@@ -94,7 +94,7 @@ void Decoder_turbo_DB::parameters\nreq_args.erase({pi+\"-size\" });\nopt_args.erase({pi+\"-fra\", \"F\"});\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"TURBO_DB, ML\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", TURBO_DB\";\nopt_args[{p+\"-implem\"}].push_back(\"STD\");\n@@ -169,10 +169,10 @@ void Decoder_turbo_DB::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- auto p = this->get_prefix();\n-\nif (this->type != \"ML\")\n{\n+ auto p = this->get_prefix();\n+\nitl->get_headers(headers, full);\nheaders[p].push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->n_ite)));\n@@ -201,10 +201,9 @@ module::Decoder_turbo_DB<B,Q>* Decoder_turbo_DB::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_turbo_DB::parameters\n-::build_ml(module::Encoder_turbo_DB<B> *encoder) const\n+::build(module::Encoder_turbo_DB<B> *encoder) const\n{\n- if (this->type == \"ML\" && encoder)\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n+ return Decoder::parameters::build<B,Q>(encoder);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n@@ -221,9 +220,9 @@ module::Decoder_turbo_DB<B,Q>* Decoder_turbo_DB\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_turbo_DB\n-::build_ml(const parameters &params, module::Encoder_turbo_DB<B> *encoder)\n+::build(const parameters &params, module::Encoder_turbo_DB<B> *encoder)\n{\n- return params.template build_ml<B,Q>(encoder);\n+ return params.template build<B,Q>(encoder);\n}\n// ==================================================================================== explicit template instantiation\n@@ -243,16 +242,16 @@ template aff3ct::module::Decoder_turbo_DB<B,Q>* aff3ct::factory::Decoder_turbo_D\n#endif\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_8 ,Q_8 >(module::Encoder_turbo_DB<B_8 >*) const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_16,Q_16>(module::Encoder_turbo_DB<B_16>*) const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_32,Q_32>(module::Encoder_turbo_DB<B_32>*) const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B_64,Q_64>(module::Encoder_turbo_DB<B_64>*) const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_DB::build_ml<B_8 ,Q_8 >(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_8 >*);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_DB::build_ml<B_16,Q_16>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_16>*);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_DB::build_ml<B_32,Q_32>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_32>*);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_DB::build_ml<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_64>*);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_DB::parameters::build<B_8 ,Q_8 >(module::Encoder_turbo_DB<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_DB::parameters::build<B_16,Q_16>(module::Encoder_turbo_DB<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_DB::parameters::build<B_32,Q_32>(module::Encoder_turbo_DB<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_DB::parameters::build<B_64,Q_64>(module::Encoder_turbo_DB<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_DB::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_DB::build<B_16,Q_16>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_DB::build<B_32,Q_32>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_DB::build<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B_64>*);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_DB::parameters::build_ml<B,Q>(module::Encoder_turbo_DB<B>*) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_DB::build_ml<B,Q>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B>*);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_DB::parameters::build<B,Q>(module::Encoder_turbo_DB<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_DB::build<B,Q>(const aff3ct::factory::Decoder_turbo_DB::parameters&, module::Encoder_turbo_DB<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp", "new_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp", "diff": "@@ -58,7 +58,7 @@ struct Decoder_turbo_DB : public Decoder\nmodule::Decoder_RSC_DB_BCJR<B,Q> &siso_i) const;\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SIHO<B,Q>* build_ml(module::Encoder_turbo_DB<B> *encoder = nullptr) const;\n+ module::Decoder_SIHO<B,Q>* build(module::Encoder_turbo_DB<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float>\n@@ -68,7 +68,7 @@ struct Decoder_turbo_DB : public Decoder\nmodule::Decoder_RSC_DB_BCJR<B,Q> &siso_i);\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_SIHO<B,Q>* build_ml(const parameters &params,\n+ static module::Decoder_SIHO<B,Q>* build(const parameters &params,\nmodule::Encoder_turbo_DB<B> *encoder = nullptr);\n};\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo/Codec_turbo.cpp", "new_path": "src/Module/Codec/Turbo/Codec_turbo.cpp", "diff": "@@ -109,7 +109,7 @@ Codec_turbo<B,Q>\nDecoder_turbo<B,Q>* decoder_turbo = nullptr;\ntry\n{\n- this->set_decoder_siho(factory::Decoder_turbo::build_ml<B,Q>(dec_params, encoder_turbo));\n+ this->set_decoder_siho(factory::Decoder_turbo::build<B,Q>(dec_params, encoder_turbo));\n}\ncatch (tools::cannot_allocate const&)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -103,7 +103,7 @@ Codec_turbo_DB<B,Q>\nDecoder_turbo_DB<B,Q>* decoder_turbo = nullptr;\ntry\n{\n- this->set_decoder_siho(factory::Decoder_turbo_DB::build_ml<B,Q>(dec_params, encoder_turbo));\n+ this->set_decoder_siho(factory::Decoder_turbo_DB::build<B,Q>(dec_params, encoder_turbo));\n}\ncatch (tools::cannot_allocate const&)\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Factorize the code of the ML decoder parameters.
8,490
28.01.2018 10:07:01
-3,600
f4264824a8bcbe22a5ba1a36e8a9b0a7ff0326d8
Fix various 'is_codeword()' implementations.
[ { "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": "@@ -81,7 +81,7 @@ bool Encoder_LDPC_from_H<B>\nconst auto n_CN = (int)this->H.get_n_cols();\nauto i = 0;\n- while (!syndrome && i < n_CN)\n+ while (i < n_CN && !syndrome)\n{\nauto sign = 0;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.cpp", "new_path": "src/Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.cpp", "diff": "@@ -83,7 +83,7 @@ bool Encoder_LDPC_from_QC<B>\nconst auto n_CN = (int)this->H.get_n_cols();\nauto i = 0;\n- while (!syndrome && i < n_CN)\n+ while (i < n_CN && !syndrome)\n{\nauto sign = 0;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Polar/Encoder_polar.cpp", "new_path": "src/Module/Encoder/Polar/Encoder_polar.cpp", "diff": "@@ -39,7 +39,11 @@ void Encoder_polar<B>\n::_encode(const B *U_K, B *X_N, const int frame_id)\n{\nthis->convert(U_K, X_N);\n+\nthis->light_encode(X_N);\n+\n+ for (auto i = 0; i < this->N; i++)\n+ X_N[i] = (B)(!this->frozen_bits[i]) && X_N[i];\n}\ntemplate <typename B>\n@@ -78,7 +82,7 @@ bool Encoder_polar<B>\n::is_codeword(const B *X_N)\n{\nauto n = 0;\n- while ((!frozen_bits[n] || (frozen_bits[n] && !X_N[n])) && n < this->N) n++;\n+ while (n < this->N && (!frozen_bits[n] || (frozen_bits[n] && !X_N[n]))) n++;\nreturn n == this->N;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Polar/Encoder_polar_sys.cpp", "new_path": "src/Module/Encoder/Polar/Encoder_polar_sys.cpp", "diff": "@@ -29,6 +29,9 @@ void Encoder_polar_sys<B>\n// second time encode because of systematic encoder\nthis->light_encode(X_N);\n+\n+ for (auto i = 0; i < this->N; i++)\n+ X_N[i] = (B)(!this->frozen_bits[i]) && X_N[i];\n}\n// ==================================================================================== explicit template instantiation\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": "@@ -157,12 +157,16 @@ bool Encoder_RSC_sys<B>\n// standard frame encoding process\nif (par != nullptr)\n+ {\nfor (auto i = 0; i < this->K; i++)\nif (par[i * stride] != inner_encode((int)sys[i * stride], state)) // encoding block\nreturn false;\n+ }\nelse\n+ {\nfor (auto i = 0; i < this->K; i++)\ninner_encode((int)sys[i * stride], state); // encoding block\n+ }\n// tail bits for initialization conditions (state of data \"state\" have to be 0 0 0)\nfor (auto i = 0; i < this->n_ff; i++)\n" }, { "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": "@@ -295,7 +295,7 @@ bool Encoder_RSC_DB<B>\ncirc_state = next_state[X_N[i]*2 + X_N[i+1]][circ_state];\nelse\nfor (auto i = 0; i < this->K; i+=2)\n- circ_state = next_state[X_N[i*4]*2 + X_N[i*4+1]][circ_state];\n+ circ_state = next_state[X_N[i*2]*2 + X_N[i*2+1]][circ_state];\nauto init_state = circ_states[( (this->K/2) % (n_states-1) ) -1][circ_state];\nauto state = init_state;\n@@ -314,11 +314,11 @@ bool Encoder_RSC_DB<B>\n{\nfor (auto i = 0; i < this->K; i+=2)\n{\n- auto in = X_N[i*4+0]*2 + X_N[i*4+1];\n+ auto in = X_N[i*2+0]*2 + X_N[i*2+1];\nauto parity = out_parity[in][state];\nstate = next_state[in][state];\n- if (X_N[i*4+2] != ((parity>>1) &1)) return false;\n- if (X_N[i*4+3] != ((parity ) &1)) return false;\n+ if (X_N[i*2+2] != ((parity>>1) &1)) return false;\n+ if (X_N[i*2+3] != ((parity ) &1)) return false;\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": "@@ -69,7 +69,7 @@ bool Encoder_repetition_sys<B>\nwhile (valid && r < rep_count)\n{\nauto k = 0;\n- while ((X_N[k] == X_N[(r +1) * this->K +k]) && k < this->K) k++;\n+ while (k < this->K && (X_N[k] == X_N[(r +1) * this->K +k])) k++;\nvalid = k == this->K;\nr++;\n}\n@@ -82,7 +82,7 @@ bool Encoder_repetition_sys<B>\nwhile (valid && k < this->K)\n{\nauto r = 0;\n- while ((X_N[k * this->K] == X_N[k * this->K + r +1]) && r < rep_count) r++;\n+ while (r < rep_count && (X_N[k * (rep_count +1)] == X_N[k * (rep_count +1) + r +1])) r++;\nvalid = r == rep_count;\nk++;\n}\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": "@@ -102,13 +102,13 @@ bool Encoder_turbo_DB<B>\nfor (auto i = 0; i < this->K; i += 4)\nstd::swap(U_K_n[i], U_K_n[i+1]);\n- auto &U_K_i = X_N_tmp;\nfor (auto i = 0; i < this->K; i += 2)\n{\nconst auto l = pi.get_core().get_lut_inv()[i >> 1];\nU_K_i[i +0] = U_K_n[l * 2 +0];\nU_K_i[i +1] = U_K_n[l * 2 +1];\n}\n+ std::copy(U_K_i.begin(), U_K_i.end(), X_N_tmp.begin());\nauto *X_N_par_i = X_N_tmp.data() + this->K;\nfor (auto i = 0; i < this->K; i+=2) // parity y for interleaver encoders\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix various 'is_codeword()' implementations.
8,490
29.01.2018 10:00:31
-3,600
c97f8f8ee2753ef3dff0c0c859ce8f1c144cf76a
Fix Puncturer_NO bug.
[ { "change_type": "MODIFY", "old_path": "src/Module/Puncturer/NO/Puncturer_NO.cpp", "new_path": "src/Module/Puncturer/NO/Puncturer_NO.cpp", "diff": "@@ -21,16 +21,16 @@ Puncturer_NO<B,Q>\ntemplate <typename B, typename Q>\nvoid Puncturer_NO<B,Q>\n-::puncture(const B *X_N1, B *X_N2) const\n+::_puncture(const B *X_N1, B *X_N2, const int frame_id) const\n{\n- std::copy(X_N1, X_N1 + this->N * this->n_frames, X_N2);\n+ std::copy(X_N1, X_N1 + this->N, X_N2);\n}\ntemplate <typename B, typename Q>\nvoid Puncturer_NO<B,Q>\n-::depuncture(const Q *Y_N1, Q *Y_N2) const\n+::_depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const;\n{\n- std::copy(Y_N1, Y_N1 + this->N * this->n_frames, Y_N2);\n+ std::copy(Y_N1, Y_N1 + this->N, Y_N2);\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Puncturer/NO/Puncturer_NO.hpp", "new_path": "src/Module/Puncturer/NO/Puncturer_NO.hpp", "diff": "@@ -14,8 +14,9 @@ public:\nPuncturer_NO(const int K, const int N, const int n_frames = 1);\nvirtual ~Puncturer_NO();\n- void puncture(const B *X_N1, B *X_N2) const; using Puncturer<B,Q>::puncture;\n- void depuncture(const Q *Y_N1, Q *Y_N2) const; using Puncturer<B,Q>::depuncture;\n+protected:\n+ void _puncture(const B *X_N1, B *X_N2, const int frame_id) const;\n+ void _depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const;\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix Puncturer_NO bug.
8,490
29.01.2018 11:01:15
-3,600
d2cbd1f303a7f115b133f99cceaf06ed47131963
Add the '-g' option to get the source code lines.
[ { "change_type": "MODIFY", "old_path": "ci/test-build-linux-gcc.sh", "new_path": "ci/test-build-linux-gcc.sh", "diff": "@@ -3,6 +3,6 @@ set -x\nmkdir build\ncd build\n-cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC -DENABLE_COOL_BASH\"\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-g -Wall -funroll-loops -march=native -DMULTI_PREC -DENABLE_COOL_BASH\"\nTHREADS=$(grep -c ^processor /proc/cpuinfo)\nmake -j $THREADS\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the '-g' option to get the source code lines.
8,490
29.01.2018 11:10:19
-3,600
d8923f25c1988cacce82d9f7c66ee9b2fee2bc2d
Fix bugs in turbo code encoders.
[ { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "diff": "@@ -53,8 +53,15 @@ int Encoder_turbo<B>\ntemplate <typename B>\nvoid Encoder_turbo<B>\n-::encode(const B *U_K, B *X_N)\n+::encode(const B *U_K, B *X_N, const int frame_id)\n{\n+ if (frame_id != -1)\n+ {\n+ std::stringstream message;\n+ message << \"'frame_id' has to be equal to -1 ('frame_id' = \" << frame_id << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\npi.interleave(U_K, U_K_i.data(), 0, this->n_frames);\nenco_n.encode(U_K, X_N_tmp.data());\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "diff": "@@ -30,7 +30,7 @@ public:\nint tail_length() const;\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 = -1); using Encoder<B>::encode;\nvirtual bool is_codeword(const B *X_N);\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": "@@ -44,8 +44,15 @@ Encoder_turbo_legacy<B>\ntemplate <typename B>\nvoid Encoder_turbo_legacy<B>\n-::encode(const B *U_K, B *X_N)\n+::encode(const B *U_K, B *X_N, const int frame_id)\n{\n+ if (frame_id != -1)\n+ {\n+ std::stringstream message;\n+ message << \"'frame_id' has to be equal to -1 ('frame_id' = \" << frame_id << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\npi.interleave (U_K, this->U_K_i.data(), 0, this->n_frames);\nsub_enc.encode(U_K, X_N_n.data() );\nsub_enc.encode(this->U_K_i.data(), X_N_i.data() );\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.hpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.hpp", "diff": "@@ -26,7 +26,7 @@ public:\nconst int n_frames = 1);\nvirtual ~Encoder_turbo_legacy() {}\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 = -1); using Encoder<B>::encode;\nbool is_codeword(const B *X_N);\n};\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bugs in turbo code encoders.
8,490
29.01.2018 11:36:31
-3,600
04125e4ac0958ec050484aabd5ffdd40349e17c5
Re-implement Turbo encoders frame by frame.
[ { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "diff": "@@ -53,53 +53,23 @@ int Encoder_turbo<B>\ntemplate <typename B>\nvoid Encoder_turbo<B>\n-::encode(const B *U_K, B *X_N, const int frame_id)\n+::_encode(const B *U_K, B *X_N, const int frame_id)\n{\n- if (frame_id != -1)\n- {\n- std::stringstream message;\n- message << \"'frame_id' has to be equal to -1 ('frame_id' = \" << frame_id << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- pi.interleave(U_K, U_K_i.data(), 0, this->n_frames);\n+ pi.interleave(U_K - frame_id * this->K, U_K_i.data(), frame_id);\n- enco_n.encode(U_K, X_N_tmp.data());\n+ enco_n.encode(U_K - frame_id * this->K, X_N_tmp.data(), frame_id);\n- for (auto f = 0; f < this->n_frames; f++)\n- std::copy(X_N_tmp.data() + f * enco_n.get_N(),\n- X_N_tmp.data() + f * enco_n.get_N() + enco_n.get_N(),\n- X_N + f * this->N);\n+ std::copy(X_N_tmp.data() + frame_id * enco_n.get_N(),\n+ X_N_tmp.data() + frame_id * enco_n.get_N() + enco_n.get_N(),\n+ X_N - frame_id * this->N);\n- enco_i.encode(U_K_i.data(), X_N_tmp.data());\n+ enco_i.encode(U_K_i.data(), X_N_tmp.data(), frame_id);\n- for (auto f = 0; f < this->n_frames; f++)\n- std::copy(X_N_tmp.data() + f * enco_i.get_N() + enco_i.get_K(),\n- X_N_tmp.data() + f * enco_i.get_N() + enco_i.get_N(),\n- X_N + f * this->N + enco_n.get_N());\n+ std::copy(X_N_tmp.data() + frame_id * enco_i.get_N() + enco_i.get_K(),\n+ X_N_tmp.data() + frame_id * enco_i.get_N() + enco_i.get_N(),\n+ X_N - frame_id * this->N + enco_n.get_N());\n}\n-// template <typename B>\n-// void Encoder_turbo<B>\n-// ::_encode(const B *U_K, B *X_N, const int frame_id)\n-// {\n-// pi.interleave(U_K, U_K_i.data(), frame_id, 1);\n-\n-// enco_n.encode(U_K, X_N_tmp.data());\n-\n-// for (auto f = 0; f < this->n_frames; f++)\n-// std::copy(X_N_tmp.data() + f * enco_n.get_N(),\n-// X_N_tmp.data() + f * enco_n.get_N() + enco_n.get_N(),\n-// X_N + f * this->N);\n-\n-// enco_i.encode(U_K_i.data(), X_N_tmp.data());\n-\n-// for (auto f = 0; f < this->n_frames; f++)\n-// std::copy(X_N_tmp.data() + f * enco_i.get_N() + enco_i.get_K(),\n-// X_N_tmp.data() + f * enco_i.get_N() + enco_i.get_N(),\n-// X_N + f * this->N + enco_n.get_N());\n-// }\n-\ntemplate <typename B>\nbool Encoder_turbo<B>\n::is_codeword(const B *X_N)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "diff": "@@ -30,12 +30,10 @@ public:\nint tail_length() const;\n- virtual void encode(const B *U_K, B *X_N, const int frame_id = -1); using Encoder<B>::encode;\n-\nvirtual bool is_codeword(const B *X_N);\n-// protected:\n-// void _encode(const B *U_K, B *X_N, const int frame_id);\n+protected:\n+ virtual void _encode(const B *U_K, B *X_N, const int frame_id);\n};\n}\n}\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": "@@ -44,23 +44,14 @@ Encoder_turbo_legacy<B>\ntemplate <typename B>\nvoid Encoder_turbo_legacy<B>\n-::encode(const B *U_K, B *X_N, const int frame_id)\n+::_encode(const B *U_K, B *X_N, const int frame_id)\n{\n- if (frame_id != -1)\n- {\n- std::stringstream message;\n- message << \"'frame_id' has to be equal to -1 ('frame_id' = \" << frame_id << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n+ pi.interleave (U_K - frame_id * this->K, this->U_K_i.data(), frame_id);\n+ sub_enc.encode(U_K - frame_id * this->K, X_N_n.data(), frame_id);\n+ sub_enc.encode(this->U_K_i.data(), X_N_i.data(), frame_id);\n- pi.interleave (U_K, this->U_K_i.data(), 0, this->n_frames);\n- sub_enc.encode(U_K, X_N_n.data() );\n- sub_enc.encode(this->U_K_i.data(), X_N_i.data() );\n-\n- for (auto f = 0; f < this->n_frames; f++)\n- {\n- const auto off1 = (3*this->K + (2 * sub_enc.tail_length())) * f;\n- const auto off2 = (2*this->K + (1 * sub_enc.tail_length())) * f;\n+ const auto off1 = ((3*this->K + (2 * sub_enc.tail_length())) * frame_id) - (frame_id * this->N);\n+ const auto off2 = (2*this->K + (1 * sub_enc.tail_length())) * frame_id;\nfor (auto i = 0; i < this->K; i++)\n{\nX_N[off1 + 3*i +0] = X_N_n[off2 + 2*i +0];\n@@ -84,7 +75,6 @@ void Encoder_turbo_legacy<B>\nX_N[off1_tails_i + 2*i +1] = X_N_i[off2_tails_i + 2*i +1];\n}\n}\n-}\ntemplate <typename B>\nbool Encoder_turbo_legacy<B>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.hpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.hpp", "diff": "@@ -26,9 +26,10 @@ public:\nconst int n_frames = 1);\nvirtual ~Encoder_turbo_legacy() {}\n- virtual void encode(const B *U_K, B *X_N, const int frame_id = -1); using Encoder<B>::encode;\n-\nbool is_codeword(const B *X_N);\n+\n+protected:\n+ void _encode(const B *U_K, B *X_N, const int frame_id);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Re-implement Turbo encoders frame by frame.
8,490
29.01.2018 12:12:40
-3,600
3f4bce09ce1ace86e32bce86f934ac0891a2ede8
Rm the useless '_encode_sys()' method in the RSC DB encoder.
[ { "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": "@@ -250,25 +250,6 @@ void Encoder_RSC_DB<B>\n}\n}\n-template <typename B>\n-void Encoder_RSC_DB<B>\n-::_encode_sys(const B *U_K, B *par, const int frame_id)\n-{\n- int circ_state, end_state;\n- __pre_encode(U_K, circ_state);\n- int init_state = circ_states[( (this->K/2) % (n_states-1) ) -1][circ_state];\n-\n- __encode_from_state(U_K, par, true, init_state, end_state);\n-\n- if (init_state != end_state)\n- {\n- std::stringstream message;\n- message << \"'end_state' should match 'init_state' ('end_state' = \" << end_state\n- << \", 'init_state' = \" << init_state << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n-}\n-\ntemplate <typename B>\nstd::vector<std::vector<int>> Encoder_RSC_DB<B>\n::get_trellis()\n@@ -335,6 +316,13 @@ bool Encoder_RSC_DB<B>\nreturn true;\n}\n+template <typename B>\n+bool Encoder_RSC_DB<B>\n+::is_buffered() const\n+{\n+ return this->buffered_encoding;\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\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": "@@ -42,10 +42,10 @@ public:\nstd::vector<std::vector<int>> get_trellis();\nbool is_codeword(const B *X_N);\n+ bool is_buffered() const;\nprotected:\nvoid _encode(const B *U_K, B *X_N, const int frame_id);\n- void _encode_sys(const B *U_K, B *par, const int frame_id);\nvoid __encode_from_state(const B* U_K, B* X_N, const bool only_parity, const int init_state, int& end_state);\nvoid __pre_encode(const B* U_K, int& end_state);\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": "@@ -16,11 +16,11 @@ Encoder_turbo_DB<B>\npi(pi),\nenco_n(enco_n),\nenco_i(enco_i),\n- U_K_cpy(K),\n- U_K_i(K),\n+ U_K_cpy(K * this->n_frames),\n+ U_K_i(K * this->n_frames),\n+ X_N_tmp(N * this->n_frames),\npar_n(K),\n- par_i(K),\n- X_N_tmp(N)\n+ par_i(K)\n{\nconst std::string name = \"Encoder_turbo_DB\";\nthis->set_name(name);\n@@ -46,6 +46,14 @@ Encoder_turbo_DB<B>\n<< pi.get_core().get_size() << \", 'K' = \" << K << \").\";\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ if (!enco_n.is_buffered() || !enco_i.is_buffered())\n+ {\n+ std::stringstream message;\n+ message << \"Both 'enco_n.is_buffered()' and 'enco_i.is_buffered()' have to be true ('enco_n.is_buffered()' = \"\n+ << enco_n.is_buffered() << \", 'enco_i.is_buffered()' = \" << enco_i.is_buffered() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n// [ AB ][ WnWi ][ YnYi ]\n@@ -53,18 +61,29 @@ template <typename B>\nvoid Encoder_turbo_DB<B>\n::_encode(const B *U_K, B *X_N, const int frame_id)\n{\n- std::copy(U_K, U_K + this->K, U_K_cpy.begin());\n+ std::copy(U_K, U_K + this->K, U_K_cpy.begin() + frame_id * this->K);\n+\nfor (auto i = 0; i < this->K; i+=4)\n- std::swap(U_K_cpy[i], U_K_cpy[i+1]);\n+ std::swap(U_K_cpy[frame_id * this->K +i], U_K_cpy[frame_id * this->K + i +1]);\n+\nfor (auto i = 0; i < this->K; i += 2)\n{\nconst auto l = pi.get_core().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+ U_K_i[frame_id * this->K + i +0] = U_K_cpy[frame_id * this->K + l * 2 +0];\n+ U_K_i[frame_id * this->K + i +1] = U_K_cpy[frame_id * this->K + l * 2 +1];\n}\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);\n+ enco_n.encode(U_K - frame_id * enco_n.get_K(), X_N_tmp.data(), frame_id);\n+\n+ std::copy(X_N_tmp.begin() + frame_id * enco_n.get_N() + enco_n.get_K(),\n+ X_N_tmp.begin() + frame_id * enco_n.get_N() + enco_n.get_N(),\n+ this->par_n.begin());\n+\n+ enco_i.encode(U_K_i.data() + frame_id * enco_i.get_K(), X_N_tmp.data(), frame_id);\n+\n+ std::copy(X_N_tmp.begin() + frame_id * enco_i.get_N() + enco_i.get_K(),\n+ X_N_tmp.begin() + frame_id * enco_i.get_N() + enco_i.get_N(),\n+ this->par_i.begin());\nstd::copy(U_K, U_K + this->K, X_N);\n@@ -108,7 +127,7 @@ bool Encoder_turbo_DB<B>\nU_K_i[i +0] = U_K_n[l * 2 +0];\nU_K_i[i +1] = U_K_n[l * 2 +1];\n}\n- std::copy(U_K_i.begin(), U_K_i.end(), X_N_tmp.begin());\n+ std::copy(U_K_i.begin(), U_K_i.begin() + this->K, X_N_tmp.begin());\nauto *X_N_par_i = X_N_tmp.data() + this->K;\nfor (auto i = 0; i < this->K; i+=2) // parity y for interleaver encoders\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": "@@ -23,9 +23,9 @@ protected:\nstd::vector<B> U_K_cpy;\nstd::vector<B> U_K_i; // internal buffer for the systematic bits in the interleaved domain\n+ std::vector<B> X_N_tmp;\nstd::vector<B> par_n; // internal buffer for the encoded bits in the natural domain\nstd::vector<B> par_i; // internal buffer for the encoded bits in the interleaved domain\n- std::vector<B> X_N_tmp;\nbool is_codeword(const B *X_N);\n" } ]
C++
MIT License
aff3ct/aff3ct
Rm the useless '_encode_sys()' method in the RSC DB encoder.
8,490
29.01.2018 12:22:57
-3,600
ca214cc46e818c660c6e91b80948f8557d002d63
Allow the ML decoders to operate on inter frames.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hxx", "new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hxx", "diff": "@@ -41,14 +41,6 @@ Decoder_maximum_likelihood<B,R>\n<< \", 'N' = \" << N << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n-\n- if (encoder.get_n_frames() != 1)\n- {\n- std::stringstream message;\n- message << \"'encoder.get_n_frames()' has to be equal to 1 ('encoder.get_n_frames()' = \"\n- << encoder.get_n_frames() << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n}\ntemplate <typename B, typename R>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood_std.cpp", "new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood_std.cpp", "diff": "@@ -73,16 +73,7 @@ void Decoder_maximum_likelihood_std<B,R>\nauto data = (uint64_t*)this->U_K.data();\ndata[0] = u;\ntools::Bit_packer<B>::unpack(this->U_K.data(), this->K);\n- this->encoder.encode(this->U_K.data(), this->X_N.data());\n-\n- // // DEBUG CODE (BEGIN)\n- // if (this->encoder.is_codeword(this->X_N.data()))\n- // std::cout << \"It is a codeword :-)\" << std::endl;\n- // else\n- // std::cout << \"It is not a codeword :-(\" << std::endl;\n- // if (u == 10)\n- // std::exit(-1);\n- // // DEBUG CODE (END)\n+ this->encoder.encode(this->U_K.data(), this->X_N.data(), 0);\n// compute the Euclidean distance between the input LLR and the current codeword\nauto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n@@ -124,7 +115,7 @@ void Decoder_maximum_likelihood_std<B,R>\nauto data = (uint64_t*)this->U_K.data();\ndata[0] = u;\ntools::Bit_packer<B>::unpack(this->U_K.data(), this->K);\n- this->encoder.encode(this->U_K.data(), this->X_N.data());\n+ this->encoder.encode(this->U_K.data(), this->X_N.data(), 0);\n// compute the Hamming distance between the input bits and the current codeword\nauto cur_hamming_dist = this->compute_hamming_dist(this->X_N.data(), Y_N);\n" } ]
C++
MIT License
aff3ct/aff3ct
Allow the ML decoders to operate on inter frames.
8,490
29.01.2018 14:14:39
-3,600
0547b46b3a439f28800f16ab9730f636bf532c80
Fix Turbo and Turbo DB encoders in inter frame.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hxx", "new_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hxx", "diff": "@@ -197,11 +197,11 @@ module::Encoder_turbo<B>* Encoder_turbo::parameters<E1,E2>\nif (this->sub1->buffered)\n{\n- if (this->type == \"TURBO\") return new module::Encoder_turbo <B>(this->K, this->N_cw, itl, *enc_n, *enc_i, this->n_frames);\n+ if (this->type == \"TURBO\") return new module::Encoder_turbo <B>(this->K, this->N_cw, itl, *enc_n, *enc_i);\n}\nelse if (enc_n == enc_i)\n{\n- if (this->type == \"TURBO\") return new module::Encoder_turbo_legacy<B>(this->K, this->N_cw, itl, *enc_n, this->n_frames);\n+ if (this->type == \"TURBO\") return new module::Encoder_turbo_legacy<B>(this->K, this->N_cw, itl, *enc_n);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp", "new_path": "src/Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.cpp", "diff": "@@ -145,7 +145,7 @@ template <typename B>\nmodule::Encoder_turbo_DB<B>* Encoder_turbo_DB::parameters\n::build(const module::Interleaver<B> &itl, module::Encoder_RSC_DB<B> &sub_enc) const\n{\n- if (this->type == \"TURBO_DB\") return new module::Encoder_turbo_DB<B>(this->K, this->N_cw, itl, sub_enc, sub_enc, this->n_frames);\n+ if (this->type == \"TURBO_DB\") return new module::Encoder_turbo_DB<B>(this->K, this->N_cw, itl, sub_enc, sub_enc);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp", "diff": "@@ -14,13 +14,13 @@ using namespace aff3ct::module;\ntemplate <typename B>\nEncoder_turbo<B>\n::Encoder_turbo(const int& K, const int& N, const Interleaver<B> &pi,\n- Encoder<B> &enco_n, Encoder<B> &enco_i, const int n_frames)\n-: Encoder<B>(K, N, n_frames),\n+ Encoder<B> &enco_n, Encoder<B> &enco_i)\n+: Encoder<B>(K, N, enco_n.get_n_frames()),\npi (pi),\nenco_n (enco_n),\nenco_i (enco_i),\n- U_K_i (K * n_frames),\n- X_N_tmp ((enco_n.get_N() >= enco_i.get_N() ? enco_n.get_N() : enco_i.get_N()) * n_frames)\n+ U_K_i (K * enco_n.get_n_frames()),\n+ X_N_tmp ((enco_n.get_N() >= enco_i.get_N() ? enco_n.get_N() : enco_i.get_N()) * enco_n.get_n_frames())\n{\nconst std::string name = \"Encoder_turbo\";\nthis->set_name(name);\n@@ -42,6 +42,14 @@ Encoder_turbo<B>\n<< pi.get_core().get_size() << \", 'K' = \" << K << \").\";\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ if (enco_n.get_n_frames() != enco_i.get_n_frames())\n+ {\n+ std::stringstream message;\n+ message << \"'enco_n.get_n_frames()' has to be equal to 'enco_i.get_n_frames()' ('enco_n.get_n_frames()' = \"\n+ << enco_n.get_n_frames() << \", 'enco_i.get_n_frames()' = \" << enco_i.get_n_frames() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\ntemplate <typename B>\n@@ -61,13 +69,13 @@ void Encoder_turbo<B>\nstd::copy(X_N_tmp.data() + frame_id * enco_n.get_N(),\nX_N_tmp.data() + frame_id * enco_n.get_N() + enco_n.get_N(),\n- X_N - frame_id * this->N);\n+ X_N);\nenco_i.encode(U_K_i.data(), X_N_tmp.data(), frame_id);\nstd::copy(X_N_tmp.data() + frame_id * enco_i.get_N() + enco_i.get_K(),\nX_N_tmp.data() + frame_id * enco_i.get_N() + enco_i.get_N(),\n- X_N - frame_id * this->N + enco_n.get_N());\n+ X_N + enco_n.get_N());\n}\ntemplate <typename B>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo.hpp", "diff": "@@ -24,8 +24,7 @@ protected:\nstd::vector<B> X_N_tmp;\npublic:\n- Encoder_turbo(const int& K, const int& N, const Interleaver<B> &pi, Encoder<B> &enco_n, Encoder<B> &enco_i,\n- const int n_frames = 1);\n+ Encoder_turbo(const int& K, const int& N, const Interleaver<B> &pi, Encoder<B> &enco_n, Encoder<B> &enco_i);\nvirtual ~Encoder_turbo() {}\nint tail_length() const;\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": "@@ -11,13 +11,12 @@ using namespace aff3ct::module;\ntemplate <typename B>\nEncoder_turbo_legacy<B>\n-::Encoder_turbo_legacy(const int& K, const int& N, const Interleaver<B> &pi, Encoder<B> &sub_enc,\n- const int n_frames)\n-: Encoder_turbo<B>(K, N, pi, sub_enc, sub_enc, n_frames),\n+::Encoder_turbo_legacy(const int& K, const int& N, const Interleaver<B> &pi, Encoder<B> &sub_enc)\n+: Encoder_turbo<B>(K, N, pi, sub_enc, sub_enc),\npi(pi),\nsub_enc(sub_enc),\n- X_N_n((2 * (K + sub_enc.tail_length()/2))*n_frames),\n- X_N_i((2 * (K + sub_enc.tail_length()/2))*n_frames)\n+ X_N_n((2 * (K + sub_enc.tail_length()/2))*sub_enc.get_n_frames()),\n+ X_N_i((2 * (K + sub_enc.tail_length()/2))*sub_enc.get_n_frames())\n{\nconst std::string name = \"Encoder_turbo_legacy\";\nthis->set_name(name);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.hpp", "new_path": "src/Module/Encoder/Turbo/Encoder_turbo_legacy.hpp", "diff": "@@ -22,8 +22,7 @@ protected:\nstd::vector<B> X_N_i; // internal buffer for the encoded bits in the interleaved domain\npublic:\n- Encoder_turbo_legacy(const int& K, const int& N, const Interleaver<B> &pi, Encoder<B> &sub_enc,\n- const int n_frames = 1);\n+ Encoder_turbo_legacy(const int& K, const int& N, const Interleaver<B> &pi, Encoder<B> &sub_enc);\nvirtual ~Encoder_turbo_legacy() {}\nbool is_codeword(const B *X_N);\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": "@@ -11,14 +11,14 @@ using namespace aff3ct::module;\ntemplate <typename B>\nEncoder_turbo_DB<B>\n::Encoder_turbo_DB(const int& K, const int& N, const Interleaver<B> &pi,\n- Encoder_RSC_DB<B> &enco_n, Encoder_RSC_DB<B> &enco_i, const int n_frames)\n-: Encoder<B>(K, N, n_frames),\n+ Encoder_RSC_DB<B> &enco_n, Encoder_RSC_DB<B> &enco_i)\n+: Encoder<B>(K, N, enco_n.get_n_frames()),\npi(pi),\nenco_n(enco_n),\nenco_i(enco_i),\n- U_K_cpy(K * this->n_frames),\n- U_K_i(K * this->n_frames),\n- X_N_tmp(N * this->n_frames),\n+ U_K_cpy(K * enco_n.get_n_frames()),\n+ U_K_i (K * enco_n.get_n_frames()),\n+ X_N_tmp(N * enco_n.get_n_frames()),\npar_n(K),\npar_i(K)\n{\n@@ -54,6 +54,14 @@ Encoder_turbo_DB<B>\n<< enco_n.is_buffered() << \", 'enco_i.is_buffered()' = \" << enco_i.is_buffered() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ if (enco_n.get_n_frames() != enco_i.get_n_frames())\n+ {\n+ std::stringstream message;\n+ message << \"'enco_n.get_n_frames()' has to be equal to 'enco_i.get_n_frames()' ('enco_n.get_n_frames()' = \"\n+ << enco_n.get_n_frames() << \", 'enco_i.get_n_frames()' = \" << enco_i.get_n_frames() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n}\n// [ AB ][ WnWi ][ YnYi ]\n@@ -79,7 +87,7 @@ void Encoder_turbo_DB<B>\nX_N_tmp.begin() + frame_id * enco_n.get_N() + enco_n.get_N(),\nthis->par_n.begin());\n- enco_i.encode(U_K_i.data() + frame_id * enco_i.get_K(), X_N_tmp.data(), frame_id);\n+ enco_i.encode(U_K_i.data(), X_N_tmp.data(), frame_id);\nstd::copy(X_N_tmp.begin() + frame_id * enco_i.get_N() + enco_i.get_K(),\nX_N_tmp.begin() + frame_id * enco_i.get_N() + enco_i.get_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": "@@ -31,7 +31,7 @@ protected:\npublic:\nEncoder_turbo_DB(const int& K, const int& N, const Interleaver<B> &pi,\n- Encoder_RSC_DB<B> &enco_n, Encoder_RSC_DB<B> &enco_i, const int n_frames = 1);\n+ Encoder_RSC_DB<B> &enco_n, Encoder_RSC_DB<B> &enco_i);\nvirtual ~Encoder_turbo_DB() {}\nprotected:\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix Turbo and Turbo DB encoders in inter frame.
8,490
29.01.2018 14:43:04
-3,600
07ec126fbaf87c5d776b2f71d621439fe5ed22bc
Improve the 'frame_id' management in the channels.
[ { "change_type": "MODIFY", "old_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp", "new_path": "src/Module/Channel/AWGN/Channel_AWGN_LLR.cpp", "diff": "@@ -43,6 +43,8 @@ Channel_AWGN_LLR<R>\ntemplate <typename R>\nvoid Channel_AWGN_LLR<R>\n::add_noise(const R *X_N, R *Y_N, const int frame_id)\n+{\n+ if (add_users && this->n_frames > 1)\n{\nif (frame_id != -1)\n{\n@@ -51,8 +53,6 @@ void Channel_AWGN_LLR<R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (add_users && this->n_frames > 1)\n- {\nnoise_generator->generate(this->noise.data(), this->N, this->sigma);\nstd::fill(Y_N, Y_N + this->N, (R)0);\n@@ -65,10 +65,17 @@ void Channel_AWGN_LLR<R>\n}\nelse\n{\n+ const auto f_start = (frame_id < 0) ? 0 : frame_id % this->n_frames;\n+ const auto f_stop = (frame_id < 0) ? this->n_frames : f_start +1;\n+\n+ if (frame_id < 0)\nnoise_generator->generate(this->noise, this->sigma);\n+ else\n+ noise_generator->generate(this->noise.data() + f_start * this->N, this->N, this->sigma);\n- for (auto i = 0; i < this->N * this->n_frames; i++)\n- Y_N[i] = X_N[i] + this->noise[i];\n+ for (auto f = f_start; f < f_stop; f++)\n+ for (auto n = 0; n < this->N; n++)\n+ Y_N[f * this->N +n] = X_N[f * this->N +n] + this->noise[f * this->N +n];\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Channel/NO/Channel_NO.cpp", "new_path": "src/Module/Channel/NO/Channel_NO.cpp", "diff": "@@ -20,6 +20,8 @@ Channel_NO<R>\ntemplate <typename R>\nvoid Channel_NO<R>\n::add_noise(const R *X_N, R *Y_N, const int frame_id)\n+{\n+ if (add_users && this->n_frames > 1)\n{\nif (frame_id != -1)\n{\n@@ -28,15 +30,20 @@ void Channel_NO<R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (add_users && this->n_frames > 1)\n- {\nstd::fill(Y_N, Y_N + this->N, (R)0);\nfor (auto f = 0; f < this->n_frames; f++)\nfor (auto i = 0; i < this->N; i++)\nY_N[i] += X_N[f * this->N +i];\n}\nelse\n+ {\n+ if (frame_id < 0)\nstd::copy(X_N, X_N + this->N * this->n_frames, Y_N);\n+ else\n+ std::copy(X_N + (frame_id +0) * this->N,\n+ X_N + (frame_id +1) * this->N,\n+ Y_N + (frame_id +0) * this->N);\n+ }\n}\n// ==================================================================================== explicit template instantiation\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": "@@ -63,6 +63,8 @@ Channel_Rayleigh_LLR<R>\ntemplate <typename R>\nvoid Channel_Rayleigh_LLR<R>\n::add_noise_wg(const R *X_N, R *H_N, R *Y_N, const int frame_id)\n+{\n+ if (add_users && this->n_frames > 1)\n{\nif (frame_id != -1)\n{\n@@ -71,8 +73,6 @@ void Channel_Rayleigh_LLR<R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (add_users && this->n_frames > 1)\n- {\nnoise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\nnoise_generator->generate(this->noise.data(), this->N, this->sigma);\n@@ -110,33 +110,50 @@ void Channel_Rayleigh_LLR<R>\nY_N[i] += this->noise[i];\n}\nelse\n+ {\n+ const auto f_start = (frame_id < 0) ? 0 : frame_id % this->n_frames;\n+ const auto f_stop = (frame_id < 0) ? this->n_frames : f_start +1;\n+\n+ if (frame_id < 0)\n{\nnoise_generator->generate(this->gains, (R)1 / (R)std::sqrt((R)2));\nnoise_generator->generate(this->noise, this->sigma);\n+ }\n+ else\n+ {\n+ noise_generator->generate(this->gains.data() + f_start * this->N, this->N, (R)1 / (R)std::sqrt((R)2));\n+ noise_generator->generate(this->noise.data() + f_start * this->N, this->N, this->sigma);\n+ }\nif (this->complex)\n{\n- for (auto i = 0; i < this->N * this->n_frames; i += 2)\n+ for (auto f = f_start; f < f_stop; f++)\n+ {\n+ for (auto n = 0; n < this->N; n += 2)\n{\n- const auto h_re = H_N[i ] = this->gains[i ];\n- const auto h_im = H_N[i +1] = this->gains[i +1];\n+ const auto h_re = H_N[f * this->N + n ] = this->gains[f * this->N + n ];\n+ const auto h_im = H_N[f * this->N + n +1] = this->gains[f * this->N + n +1];\n- const auto n_re = this->noise[i ];\n- const auto n_im = this->noise[i +1];\n+ const auto n_re = this->noise[f * this->N + n ];\n+ const auto n_im = this->noise[f * this->N + n +1];\n- Y_N[i ] = (X_N[i ] * h_re - X_N[i +1] * h_im) + n_re;\n- Y_N[i +1] = (X_N[i +1] * h_re + X_N[i ] * h_im) + n_im;\n+ Y_N[f * this->N + n ] = (X_N[f * this->N + n ] * h_re - X_N[f * this->N + n +1] * h_im) + n_re;\n+ Y_N[f * this->N + n +1] = (X_N[f * this->N + n +1] * h_re + X_N[f * this->N + n ] * h_im) + n_im;\n+ }\n}\n}\nelse\n{\n- for (auto i = 0; i < this->N * this->n_frames; i++)\n+ for (auto f = f_start; f < f_stop; f++)\n+ {\n+ for (auto n = 0; n < this->N; n++)\n{\n- const auto h_re = this->gains[2*i ];\n- const auto h_im = this->gains[2*i +1];\n+ const auto h_re = this->gains[f * this->N + 2*n ];\n+ const auto h_im = this->gains[f * this->N + 2*n +1];\n- H_N[i] = std::sqrt(h_re * h_re + h_im * h_im);\n- Y_N[i] = X_N[i] * H_N[i] + this->noise[i];\n+ H_N[f * this->N + n] = std::sqrt(h_re * h_re + h_im * h_im);\n+ Y_N[f * this->N + n] = X_N[f * this->N + n] * H_N[f * this->N + n] + this->noise[f * this->N + n];\n+ }\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Channel/User/Channel_user.cpp", "new_path": "src/Module/Channel/User/Channel_user.cpp", "diff": "@@ -113,6 +113,8 @@ Channel_user<R>\ntemplate <typename R>\nvoid Channel_user<R>\n::add_noise(const R *X_N, R *Y_N, const int frame_id)\n+{\n+ if (add_users && this->n_frames > 1)\n{\nif (frame_id != -1)\n{\n@@ -121,8 +123,6 @@ void Channel_user<R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (add_users && this->n_frames > 1)\n- {\nstd::fill(Y_N, Y_N + this->N, (R)0);\nfor (auto f = 0; f < this->n_frames; f++)\nfor (auto i = 0; i < this->N; i++)\n@@ -141,7 +141,11 @@ void Channel_user<R>\nY_N[i] += this->noise[i];\n}\nelse\n- for (auto f = 0; f < this->n_frames; f++)\n+ {\n+ const auto f_start = (frame_id < 0) ? 0 : frame_id % this->n_frames;\n+ const auto f_stop = (frame_id < 0) ? this->n_frames : f_start +1;\n+\n+ for (auto f = f_start; f < f_stop; f++)\n{\nstd::copy(this->noise_buff[this->noise_counter].begin(),\nthis->noise_buff[this->noise_counter].end (),\n@@ -153,6 +157,7 @@ void Channel_user<R>\nthis->noise_counter = (this->noise_counter +1) % (int)this->noise_buff.size();\n}\n}\n+}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the 'frame_id' management in the channels.
8,490
29.01.2018 16:28:45
-3,600
493e422ec126386fb347e5f4d3a396dc1bbddd6c
Add a naive implem of a non-working Chase decoder.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp", "new_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp", "diff": "@@ -71,7 +71,7 @@ void Decoder_BCH::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Decoder.cpp", "new_path": "src/Factory/Module/Decoder/Decoder.cpp", "diff": "#include \"Module/Decoder/ML/Decoder_maximum_likelihood_std.hpp\"\n#include \"Module/Decoder/ML/Decoder_maximum_likelihood_naive.hpp\"\n+#include \"Module/Decoder/ML/Decoder_chase_naive.hpp\"\n#include \"Decoder.hpp\"\n@@ -46,16 +47,20 @@ void Decoder::parameters\nopt_args[{p+\"-type\", \"D\"}] =\n{\"string\",\n\"select the algorithm you want to decode the codeword.\",\n- \"ML\"};\n+ \"ML, CHASE\"};\nopt_args[{p+\"-implem\"}] =\n{\"string\",\n\"select the implementation of the algorithm to decode.\",\n\"STD, NAIVE\"};\n- opt_args[{p+\"-ml-hamming\"}] =\n+ opt_args[{p+\"-hamming\"}] =\n{\"\",\n- \"enable the computation of the Hamming distance instead of the Euclidean distance in the ML decoder.\"};\n+ \"enable the computation of the Hamming distance instead of the Euclidean distance in the ML/CHASE decoders.\"};\n+\n+ opt_args[{p+\"-flips\"}] =\n+ {\"strictly_positive_int\",\n+ \"set the maximum number of flips in the CHASE decoder.\"};\n}\nvoid Decoder::parameters\n@@ -66,10 +71,11 @@ void Decoder::parameters\nif(exist(vals, {p+\"-info-bits\", \"K\"})) this->K = std::stoi(vals.at({p+\"-info-bits\", \"K\"}));\nif(exist(vals, {p+\"-cw-size\", \"N\"})) this->N_cw = std::stoi(vals.at({p+\"-cw-size\", \"N\"}));\nif(exist(vals, {p+\"-fra\", \"F\"})) this->n_frames = std::stoi(vals.at({p+\"-fra\", \"F\"}));\n+ if(exist(vals, {p+\"-flips\" })) this->flips = std::stoi(vals.at({p+\"-flips\" }));\nif(exist(vals, {p+\"-type\", \"D\"})) this->type = vals.at({p+\"-type\", \"D\"});\nif(exist(vals, {p+\"-implem\" })) this->implem = vals.at({p+\"-implem\" });\nif(exist(vals, {p+\"-no-sys\" })) this->systematic = false;\n- if(exist(vals, {p+\"-ml-hamming\" })) this->ml_hamming = true;\n+ if(exist(vals, {p+\"-hamming\" })) this->hamming = true;\nthis->R = (float)this->K / (float)this->N_cw;\n}\n@@ -86,7 +92,10 @@ void Decoder::parameters\nif (full) headers[p].push_back(std::make_pair(\"Code rate (R)\", std::to_string(this->R)));\nheaders[p].push_back(std::make_pair(\"Systematic\", ((this->systematic) ? \"yes\" : \"no\")));\nif (full) headers[p].push_back(std::make_pair(\"Inter frame level\", std::to_string(this->n_frames)));\n- if(this->type == \"ML\") headers[p].push_back(std::make_pair(\"Distance\", this->ml_hamming ? \"Hamming\" : \"Euclidean\"));\n+ if(this->type == \"ML\" || this->type == \"CHASE\")\n+ headers[p].push_back(std::make_pair(\"Distance\", this->hamming ? \"Hamming\" : \"Euclidean\"));\n+ if(this->type == \"CHASE\")\n+ headers[p].push_back(std::make_pair(\"Max flips\", std::to_string(this->flips)));\n}\ntemplate <typename B, typename Q>\n@@ -97,8 +106,12 @@ module::Decoder_SIHO<B,Q>* Decoder::parameters\n{\nif (this->type == \"ML\")\n{\n- if (this->implem == \"STD\" ) return new module::Decoder_ML_std <B,Q>(this->K, this->N_cw, *encoder, this->ml_hamming, this->n_frames);\n- if (this->implem == \"NAIVE\") return new module::Decoder_ML_naive<B,Q>(this->K, this->N_cw, *encoder, this->ml_hamming, this->n_frames);\n+ if (this->implem == \"STD\" ) return new module::Decoder_ML_std <B,Q>(this->K, this->N_cw, *encoder, this->hamming, this->n_frames);\n+ if (this->implem == \"NAIVE\") return new module::Decoder_ML_naive<B,Q>(this->K, this->N_cw, *encoder, this->hamming, this->n_frames);\n+ }\n+ else if (this->type == \"CHASE\")\n+ {\n+ if (this->implem == \"NAIVE\") return new module::Decoder_chase_naive<B,Q>(this->K, this->N_cw, *encoder, this->flips, this->hamming, this->n_frames);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Decoder.hpp", "new_path": "src/Factory/Module/Decoder/Decoder.hpp", "diff": "@@ -28,9 +28,10 @@ struct Decoder : Factory\nstd::string type = \"ML\";\nstd::string implem = \"STD\";\nbool systematic = true;\n- bool ml_hamming = false;\n+ bool hamming = false;\nint n_frames = 1;\nint tail_length = 0;\n+ int flips = 3;\n// deduced parameters\nfloat R = -1.f;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "@@ -112,7 +112,7 @@ void Decoder_LDPC::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "new_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "diff": "@@ -127,7 +127,7 @@ void Decoder_polar::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RA/Decoder_RA.cpp", "new_path": "src/Factory/Module/Decoder/RA/Decoder_RA.cpp", "diff": "@@ -101,7 +101,7 @@ void Decoder_RA::parameters\nitl->get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp", "new_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp", "diff": "@@ -126,7 +126,7 @@ void Decoder_RSC::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.cpp", "new_path": "src/Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.cpp", "diff": "@@ -72,7 +72,7 @@ void Decoder_RSC_DB::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp", "new_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp", "diff": "@@ -60,7 +60,7 @@ void Decoder_repetition::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "new_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hxx", "diff": "@@ -214,7 +214,7 @@ void Decoder_turbo::parameters<D1,D2>\nitl->get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.cpp", "diff": "@@ -166,7 +166,7 @@ void Decoder_turbo_DB::parameters\n{\nDecoder::parameters::get_headers(headers, full);\n- if (this->type != \"ML\")\n+ if (this->type != \"ML\" && this->type != \"CHASE\")\n{\nauto p = this->get_prefix();\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "diff": "+#include <chrono>\n+#include <iostream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Algo/Bit_packer.hpp\"\n+#include \"Tools/Perf/hard_decision.h\"\n+\n+#include \"Decoder_chase_naive.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B, typename R>\n+Decoder_chase_naive<B,R>\n+::Decoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips, const bool hamming,\n+ const int n_frames)\n+: Decoder (K, N, n_frames, 1),\n+ Decoder_maximum_likelihood<B,R>(K, N, encoder, n_frames ),\n+ max_flips(max_flips),\n+ hamming(hamming),\n+ x_max(0),\n+ min_euclidean_dist(std::numeric_limits<float>::max()),\n+ min_hamming_dist(std::numeric_limits<uint32_t>::max())\n+{\n+ const std::string name = \"Decoder_chase_naive\";\n+ this->set_name(name);\n+\n+ if (N > 64)\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be smaller or equal to 64 ('N' = \" << N << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (max_flips == 0)\n+ {\n+ std::stringstream message;\n+ message << \"'max_flips' has to be bigger than 0 ('max_flips' = \" << max_flips << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ // determine the maximum sequence 'x' of codeword bits\n+ if (N == 64)\n+ this->x_max = std::numeric_limits<uint64_t>::max();\n+ else\n+ this->x_max = ((uint64_t)1 << (uint64_t)(N)) -1;\n+}\n+\n+template <typename B, typename R>\n+Decoder_chase_naive<B,R>\n+::~Decoder_chase_naive()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+{\n+ if (!this->encoder.is_sys())\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.is_sys()' has to be true.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->_decode_siho_cw(Y_N, this->best_X_N.data(), frame_id);\n+\n+ const auto &info_bits_pos = this->encoder.get_info_bits_pos();\n+ for (auto k = 0; k < this->K; k++)\n+ V_K[k] = this->best_X_N[info_bits_pos[k]];\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n+{\n+ tools::hard_decide(Y_N, this->hard_Y_N.data(), this->N);\n+\n+ // compute Hamming distance instead of Euclidean distance\n+ if (hamming)\n+ {\n+ this->_decode_hiho_cw(this->hard_Y_N.data(), V_N, frame_id);\n+ }\n+ else\n+ {\n+ this->min_euclidean_dist = std::numeric_limits<float>::max();\n+\n+ for (auto n_flips = 0; n_flips <= (int)this->max_flips; n_flips++)\n+ {\n+ if (n_flips == 0)\n+ {\n+ if (this->encoder.is_codeword(this->hard_Y_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(this->hard_Y_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ else if (n_flips == 1)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ }\n+ else if (n_flips == 2)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n+ this->X_N[flip2_pos] = this->X_N[flip2_pos] ? (B)0 : (B)1;\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ }\n+ else if (n_flips == 3)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n+ this->X_N[flip2_pos] = this->X_N[flip2_pos] ? (B)0 : (B)1;\n+ this->X_N[flip3_pos] = this->X_N[flip3_pos] ? (B)0 : (B)1;\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ }\n+ else if (n_flips == 4)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n+ this->X_N[flip2_pos] = this->X_N[flip2_pos] ? (B)0 : (B)1;\n+ this->X_N[flip3_pos] = this->X_N[flip3_pos] ? (B)0 : (B)1;\n+ this->X_N[flip4_pos] = this->X_N[flip4_pos] ? (B)0 : (B)1;\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ }\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"'max_flips' unsupported size ('max_flips' = \" << max_flips << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_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+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n+{\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_chase_naive<B_8,Q_8>;\n+template class aff3ct::module::Decoder_chase_naive<B_16,Q_16>;\n+template class aff3ct::module::Decoder_chase_naive<B_32,Q_32>;\n+template class aff3ct::module::Decoder_chase_naive<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_chase_naive<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "diff": "+#ifndef DECODER_CHASE_NAIVE_HPP_\n+#define DECODER_CHASE_NAIVE_HPP_\n+\n+#include \"Decoder_maximum_likelihood.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_chase_naive : public Decoder_maximum_likelihood<B,R>\n+{\n+protected:\n+ const uint32_t max_flips;\n+ const bool hamming;\n+ uint64_t x_max;\n+ float min_euclidean_dist;\n+ uint32_t min_hamming_dist;\n+\n+\n+public:\n+ Decoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\n+ const bool hamming = false, const int n_frames = 1);\n+ virtual ~Decoder_chase_naive();\n+\n+protected:\n+ void _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n+ void _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id);\n+ void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n+ void _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n+};\n+}\n+}\n+\n+#endif /* DECODER_CHASE_NAIVE_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hpp", "new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hpp", "diff": "@@ -26,9 +26,9 @@ public:\nprotected:\nDecoder_maximum_likelihood(const int K, const int N, Encoder<B> &encoder, const int n_frames = 1);\n- inline float compute_euclidean_dist (const B *X_N, const R *Y_N);\n- inline uint32_t compute_hamming_dist (const B *X_N, const B *Y_N);\n- inline uint32_t compute_hamming_dist_soft(const B *X_N, const R *Y_N);\n+ inline float compute_euclidean_dist (const B *X_N, const R *Y_N) const;\n+ inline uint32_t compute_hamming_dist (const B *X_N, const B *Y_N) const;\n+ inline uint32_t compute_hamming_dist_soft(const B *X_N, const R *Y_N) const;\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hxx", "new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hxx", "diff": "@@ -51,7 +51,7 @@ Decoder_maximum_likelihood<B,R>\ntemplate <typename B, typename R>\nfloat Decoder_maximum_likelihood<B,R>\n-::compute_euclidean_dist(const B *X_N, const R *Y_N)\n+::compute_euclidean_dist(const B *X_N, const R *Y_N) const\n{\n// compute the Euclidean distance between the LLR (Y_N) and the current codeword (X_N)\nfloat euclidean_dist = 0.f;\n@@ -70,7 +70,7 @@ float Decoder_maximum_likelihood<B,R>\ntemplate <typename B, typename R>\nuint32_t Decoder_maximum_likelihood<B,R>\n-::compute_hamming_dist(const B *X_N, const B *Y_N)\n+::compute_hamming_dist(const B *X_N, const B *Y_N) const\n{\n// compute the Hamming distance between the input bits (Y_N) and the current codeword (X_N)\nuint32_t hamming_dist = 0;\n@@ -82,7 +82,7 @@ uint32_t Decoder_maximum_likelihood<B,R>\ntemplate <typename B, typename R>\nuint32_t Decoder_maximum_likelihood<B,R>\n-::compute_hamming_dist_soft(const B *X_N, const R *Y_N)\n+::compute_hamming_dist_soft(const B *X_N, const R *Y_N) const\n{\n// compute the Hamming distance between the input bits (Y_N) and the current codeword (X_N)\nuint32_t hamming_dist = 0;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a naive implem of a non-working Chase decoder.
8,490
29.01.2018 16:57:17
-3,600
1d6e26613eec51ec1010658c8e23cdf6d06f5b51
Fix the Chase decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hxx", "new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hxx", "diff": "@@ -57,7 +57,7 @@ float Decoder_maximum_likelihood<B,R>\nfloat euclidean_dist = 0.f;\nfor (auto n = 0; n < this->N; n++)\n{\n- auto tmp = (this->X_N[n] ? -1.f : +1.f) - (float)Y_N[n];\n+ auto tmp = (X_N[n] ? -1.f : +1.f) - (float)Y_N[n];\neuclidean_dist += tmp * tmp;\n// euclidean_dist += std::abs(tmp); // performance degradation with the abs\n}\n@@ -75,7 +75,7 @@ uint32_t Decoder_maximum_likelihood<B,R>\n// compute the Hamming distance between the input bits (Y_N) and the current codeword (X_N)\nuint32_t hamming_dist = 0;\nfor (auto n = 0; n < this->N; n++)\n- hamming_dist += this->X_N[n] != Y_N[n];\n+ hamming_dist += X_N[n] != Y_N[n];\nreturn hamming_dist;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the Chase decoder.
8,490
29.01.2018 17:32:22
-3,600
1a6bed2d1d66d1ebee0f65da632f99e7cbfa9172
Simplify a little bit the Chase decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "diff": "@@ -85,10 +85,6 @@ void Decoder_chase_naive<B,R>\n{\nthis->min_euclidean_dist = std::numeric_limits<float>::max();\n- for (auto n_flips = 0; n_flips <= (int)this->max_flips; n_flips++)\n- {\n- if (n_flips == 0)\n- {\nif (this->encoder.is_codeword(this->hard_Y_N.data()))\n{\n// compute the Euclidean distance between the input LLR and the current codeword\n@@ -101,8 +97,10 @@ void Decoder_chase_naive<B,R>\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.begin() + this->N, V_N);\n}\n}\n- }\n- else if (n_flips == 1)\n+\n+ for (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n+ {\n+ if (n_flips == 1)\n{\nfor (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n{\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify a little bit the Chase decoder.
8,490
29.01.2018 18:40:14
-3,600
6a2ab8dec0125cb3e96efbf32e6b26bc86cfb757
Add a more generic Chase decoder (but very slow...).
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Decoder.cpp", "new_path": "src/Factory/Module/Decoder/Decoder.cpp", "diff": "#include \"Module/Decoder/ML/Decoder_maximum_likelihood_std.hpp\"\n#include \"Module/Decoder/ML/Decoder_maximum_likelihood_naive.hpp\"\n#include \"Module/Decoder/ML/Decoder_chase_naive.hpp\"\n+#include \"Module/Decoder/ML/Decoder_chase_std.hpp\"\n#include \"Decoder.hpp\"\n@@ -112,6 +113,7 @@ module::Decoder_SIHO<B,Q>* Decoder::parameters\nelse if (this->type == \"CHASE\")\n{\nif (this->implem == \"NAIVE\") return new module::Decoder_chase_naive<B,Q>(this->K, this->N_cw, *encoder, this->flips, this->hamming, this->n_frames);\n+ if (this->implem == \"STD\" ) return new module::Decoder_chase_std <B,Q>(this->K, this->N_cw, *encoder, this->flips, this->hamming, this->n_frames);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "diff": "@@ -18,32 +18,19 @@ Decoder_chase_naive<B,R>\nDecoder_maximum_likelihood<B,R>(K, N, encoder, n_frames ),\nmax_flips(max_flips),\nhamming(hamming),\n- x_max(0),\nmin_euclidean_dist(std::numeric_limits<float>::max()),\nmin_hamming_dist(std::numeric_limits<uint32_t>::max())\n{\nconst std::string name = \"Decoder_chase_naive\";\nthis->set_name(name);\n- if (N > 64)\n+ if (max_flips > (uint32_t)N)\n{\nstd::stringstream message;\n- message << \"'N' has to be smaller or equal to 64 ('N' = \" << N << \").\";\n+ message << \"'max_flips' has to be smaller or equal to 'N' ('max_flips' = \" << max_flips\n+ << \", 'N' = \" << N << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n-\n- if (max_flips == 0)\n- {\n- std::stringstream message;\n- message << \"'max_flips' has to be bigger than 0 ('max_flips' = \" << max_flips << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- // determine the maximum sequence 'x' of codeword bits\n- if (N == 64)\n- this->x_max = std::numeric_limits<uint64_t>::max();\n- else\n- this->x_max = ((uint64_t)1 << (uint64_t)(N)) -1;\n}\ntemplate <typename B, typename R>\n@@ -105,7 +92,7 @@ void Decoder_chase_naive<B,R>\nfor (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n- this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\nif (this->encoder.is_codeword(this->X_N.data()))\n{\n@@ -127,8 +114,8 @@ void Decoder_chase_naive<B,R>\nfor (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n- this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n- this->X_N[flip2_pos] = this->X_N[flip2_pos] ? (B)0 : (B)1;\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\nif (this->encoder.is_codeword(this->X_N.data()))\n{\n@@ -151,9 +138,9 @@ void Decoder_chase_naive<B,R>\nfor (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n- this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n- this->X_N[flip2_pos] = this->X_N[flip2_pos] ? (B)0 : (B)1;\n- this->X_N[flip3_pos] = this->X_N[flip3_pos] ? (B)0 : (B)1;\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\nif (this->encoder.is_codeword(this->X_N.data()))\n{\n@@ -177,10 +164,10 @@ void Decoder_chase_naive<B,R>\nfor (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n- this->X_N[flip1_pos] = this->X_N[flip1_pos] ? (B)0 : (B)1;\n- this->X_N[flip2_pos] = this->X_N[flip2_pos] ? (B)0 : (B)1;\n- this->X_N[flip3_pos] = this->X_N[flip3_pos] ? (B)0 : (B)1;\n- this->X_N[flip4_pos] = this->X_N[flip4_pos] ? (B)0 : (B)1;\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\nif (this->encoder.is_codeword(this->X_N.data()))\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "diff": "@@ -13,11 +13,9 @@ class Decoder_chase_naive : public Decoder_maximum_likelihood<B,R>\nprotected:\nconst uint32_t max_flips;\nconst bool hamming;\n- uint64_t x_max;\nfloat min_euclidean_dist;\nuint32_t min_hamming_dist;\n-\npublic:\nDecoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\nconst bool hamming = false, const int n_frames = 1);\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/ML/Decoder_chase_std.cpp", "diff": "+#include <chrono>\n+#include <iostream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Algo/Bit_packer.hpp\"\n+#include \"Tools/Perf/hard_decision.h\"\n+\n+#include \"Decoder_chase_std.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B, typename R>\n+Decoder_chase_std<B,R>\n+::Decoder_chase_std(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips, const bool hamming,\n+ const int n_frames)\n+: Decoder (K, N, n_frames, 1),\n+ Decoder_chase_naive<B,R>(K, N, encoder, max_flips, hamming, n_frames ),\n+ flip_pos(max_flips)\n+{\n+ const std::string name = \"Decoder_chase_std\";\n+ this->set_name(name);\n+}\n+\n+template <typename B, typename R>\n+Decoder_chase_std<B,R>\n+::~Decoder_chase_std()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_std<B,R>\n+::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+{\n+ if (!this->encoder.is_sys())\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.is_sys()' has to be true.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->_decode_siho_cw(Y_N, this->best_X_N.data(), frame_id);\n+\n+ const auto &info_bits_pos = this->encoder.get_info_bits_pos();\n+ for (auto k = 0; k < this->K; k++)\n+ V_K[k] = this->best_X_N[info_bits_pos[k]];\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_std<B,R>\n+::_decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n+{\n+ if (n_flips == flip_pos.size())\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+\n+ // flip the bits\n+ for (uint32_t f = 0; f < max_flips; f++)\n+ this->X_N[this->flip_pos[f]] = !this->X_N[this->flip_pos[f]];\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ else\n+ {\n+ for (auto flip_pos = n_flips; flip_pos < (uint32_t)this->N; flip_pos++)\n+ {\n+ this->flip_pos[n_flips] = flip_pos;\n+ this->_decode_siho_cw_recursive(Y_N, V_N, n_flips +1, max_flips);\n+ }\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_std<B,R>\n+::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n+{\n+ tools::hard_decide(Y_N, this->hard_Y_N.data(), this->N);\n+\n+ this->min_euclidean_dist = std::numeric_limits<float>::max();\n+\n+ if (this->encoder.is_codeword(this->hard_Y_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(this->hard_Y_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.begin() + this->N, V_N);\n+ }\n+ }\n+\n+ for (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n+ this->_decode_siho_cw_recursive(Y_N, V_N, 0, n_flips);\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_std<B,R>\n+::_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+template <typename B, typename R>\n+void Decoder_chase_std<B,R>\n+::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n+{\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_chase_std<B_8,Q_8>;\n+template class aff3ct::module::Decoder_chase_std<B_16,Q_16>;\n+template class aff3ct::module::Decoder_chase_std<B_32,Q_32>;\n+template class aff3ct::module::Decoder_chase_std<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_chase_std<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/ML/Decoder_chase_std.hpp", "diff": "+#ifndef DECODER_CHASE_STD_HPP_\n+#define DECODER_CHASE_STD_HPP_\n+\n+#include \"Decoder_chase_naive.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_chase_std : public Decoder_chase_naive<B,R>\n+{\n+protected:\n+ std::vector<uint32_t> flip_pos;\n+\n+public:\n+ Decoder_chase_std(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\n+ const bool hamming = false, const int n_frames = 1);\n+ virtual ~Decoder_chase_std();\n+\n+protected:\n+ void _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n+ void _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id);\n+ void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n+ void _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n+\n+ void _decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n+};\n+}\n+}\n+\n+#endif /* DECODER_CHASE_STD_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a more generic Chase decoder (but very slow...).
8,490
29.01.2018 19:01:35
-3,600
2adbadad032ec3062069b23bec3f0ff12c6e6717
Improve a little bit the naive Chase decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "diff": "@@ -57,6 +57,24 @@ void Decoder_chase_naive<B,R>\nV_K[k] = this->best_X_N[info_bits_pos[k]];\n}\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_try_sequence(const R *Y_N, const B *X_N, B *V_N)\n+{\n+ if (this->encoder.is_codeword(X_N))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_euclidean_dist = this->compute_euclidean_dist(X_N, Y_N);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(X_N, X_N + this->N, V_N);\n+ }\n+ }\n+}\n+\ntemplate <typename B, typename R>\nvoid Decoder_chase_naive<B,R>\n::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n@@ -72,18 +90,7 @@ void Decoder_chase_naive<B,R>\n{\nthis->min_euclidean_dist = std::numeric_limits<float>::max();\n- if (this->encoder.is_codeword(this->hard_Y_N.data()))\n- {\n- // compute the Euclidean distance between the input LLR and the current codeword\n- auto cur_euclidean_dist = this->compute_euclidean_dist(this->hard_Y_N.data(), Y_N);\n-\n- // update the best codeword\n- if (cur_euclidean_dist < this->min_euclidean_dist)\n- {\n- this->min_euclidean_dist = cur_euclidean_dist;\n- std::copy(this->hard_Y_N.begin(), this->hard_Y_N.begin() + this->N, V_N);\n- }\n- }\n+ this->_try_sequence(Y_N, this->hard_Y_N.data(), V_N);\nfor (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n{\n@@ -94,18 +101,7 @@ void Decoder_chase_naive<B,R>\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\nthis->X_N[flip1_pos] = !this->X_N[flip1_pos];\n- if (this->encoder.is_codeword(this->X_N.data()))\n- {\n- // compute the Euclidean distance between the input LLR and the current codeword\n- auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n-\n- // update the best codeword\n- if (cur_euclidean_dist < this->min_euclidean_dist)\n- {\n- this->min_euclidean_dist = cur_euclidean_dist;\n- std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n- }\n- }\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 2)\n@@ -117,70 +113,175 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip1_pos] = !this->X_N[flip1_pos];\nthis->X_N[flip2_pos] = !this->X_N[flip2_pos];\n- if (this->encoder.is_codeword(this->X_N.data()))\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 3)\n{\n- // compute the Euclidean distance between the input LLR and the current codeword\n- auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n-\n- // update the best codeword\n- if (cur_euclidean_dist < this->min_euclidean_dist)\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n{\n- this->min_euclidean_dist = cur_euclidean_dist;\n- std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n}\n}\n+ else if (n_flips == 4)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n}\n}\n- else if (n_flips == 3)\n+ else if (n_flips == 5)\n{\nfor (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\nfor (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\nfor (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\nthis->X_N[flip1_pos] = !this->X_N[flip1_pos];\nthis->X_N[flip2_pos] = !this->X_N[flip2_pos];\nthis->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n- if (this->encoder.is_codeword(this->X_N.data()))\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 6)\n{\n- // compute the Euclidean distance between the input LLR and the current codeword\n- auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n-\n- // update the best codeword\n- if (cur_euclidean_dist < this->min_euclidean_dist)\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n{\n- this->min_euclidean_dist = cur_euclidean_dist;\n- std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n}\n}\n+ else if (n_flips == 7)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+ this->X_N[flip7_pos] = !this->X_N[flip7_pos];\n+\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n}\n}\n- else if (n_flips == 4)\n+ else if (n_flips == 8)\n{\nfor (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\nfor (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\nfor (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\nfor (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ for (auto flip8_pos = flip7_pos +1; flip8_pos < this->N; flip8_pos++)\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\nthis->X_N[flip1_pos] = !this->X_N[flip1_pos];\nthis->X_N[flip2_pos] = !this->X_N[flip2_pos];\nthis->X_N[flip3_pos] = !this->X_N[flip3_pos];\nthis->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+ this->X_N[flip7_pos] = !this->X_N[flip7_pos];\n+ this->X_N[flip8_pos] = !this->X_N[flip8_pos];\n- if (this->encoder.is_codeword(this->X_N.data()))\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 9)\n{\n- // compute the Euclidean distance between the input LLR and the current codeword\n- auto cur_euclidean_dist = this->compute_euclidean_dist(this->X_N.data(), Y_N);\n-\n- // update the best codeword\n- if (cur_euclidean_dist < this->min_euclidean_dist)\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ for (auto flip8_pos = flip7_pos +1; flip8_pos < this->N; flip8_pos++)\n+ for (auto flip9_pos = flip8_pos +1; flip9_pos < this->N; flip9_pos++)\n{\n- this->min_euclidean_dist = cur_euclidean_dist;\n- std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+ this->X_N[flip7_pos] = !this->X_N[flip7_pos];\n+ this->X_N[flip8_pos] = !this->X_N[flip8_pos];\n+ this->X_N[flip9_pos] = !this->X_N[flip9_pos];\n+\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n}\n}\n+ else if (n_flips == 10)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ for (auto flip8_pos = flip7_pos +1; flip8_pos < this->N; flip8_pos++)\n+ for (auto flip9_pos = flip8_pos +1; flip9_pos < this->N; flip9_pos++)\n+ for (auto flip10_pos = flip9_pos +1; flip10_pos < this->N; flip10_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos ] = !this->X_N[flip1_pos ];\n+ this->X_N[flip2_pos ] = !this->X_N[flip2_pos ];\n+ this->X_N[flip3_pos ] = !this->X_N[flip3_pos ];\n+ this->X_N[flip4_pos ] = !this->X_N[flip4_pos ];\n+ this->X_N[flip5_pos ] = !this->X_N[flip5_pos ];\n+ this->X_N[flip6_pos ] = !this->X_N[flip6_pos ];\n+ this->X_N[flip7_pos ] = !this->X_N[flip7_pos ];\n+ this->X_N[flip8_pos ] = !this->X_N[flip8_pos ];\n+ this->X_N[flip9_pos ] = !this->X_N[flip9_pos ];\n+ this->X_N[flip10_pos] = !this->X_N[flip10_pos];\n+\n+ this->_try_sequence(Y_N, this->X_N.data(), V_N);\n}\n}\nelse\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "diff": "@@ -26,6 +26,8 @@ protected:\nvoid _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id);\nvoid _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\nvoid _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n+\n+ inline void _try_sequence(const R *Y_N, const B *X_N, B *V_N);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve a little bit the naive Chase decoder.
8,490
29.01.2018 22:06:49
-3,600
c07e97392c43ff18dc4fc9113f5cde17c258b9c7
Add the hamming distance in the naive chase decoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "diff": "@@ -59,7 +59,7 @@ void Decoder_chase_naive<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_naive<B,R>\n-::_try_sequence(const R *Y_N, const B *X_N, B *V_N)\n+::_try_sequence_llrs(const R *Y_N, const B *X_N, B *V_N)\n{\nif (this->encoder.is_codeword(X_N))\n{\n@@ -75,6 +75,24 @@ void Decoder_chase_naive<B,R>\n}\n}\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_try_sequence_bits(const B *Y_N, const B *X_N, B *V_N)\n+{\n+ if (this->encoder.is_codeword(X_N))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_hamming_dist = this->compute_hamming_dist(X_N, Y_N);\n+\n+ // update the best codeword\n+ if (cur_hamming_dist < this->min_hamming_dist)\n+ {\n+ this->min_hamming_dist = cur_hamming_dist;\n+ std::copy(X_N, X_N + this->N, V_N);\n+ }\n+ }\n+}\n+\ntemplate <typename B, typename R>\nvoid Decoder_chase_naive<B,R>\n::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n@@ -90,7 +108,7 @@ void Decoder_chase_naive<B,R>\n{\nthis->min_euclidean_dist = std::numeric_limits<float>::max();\n- this->_try_sequence(Y_N, this->hard_Y_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->hard_Y_N.data(), V_N);\nfor (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n{\n@@ -101,7 +119,7 @@ void Decoder_chase_naive<B,R>\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\nthis->X_N[flip1_pos] = !this->X_N[flip1_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 2)\n@@ -113,7 +131,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip1_pos] = !this->X_N[flip1_pos];\nthis->X_N[flip2_pos] = !this->X_N[flip2_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 3)\n@@ -127,7 +145,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip2_pos] = !this->X_N[flip2_pos];\nthis->X_N[flip3_pos] = !this->X_N[flip3_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 4)\n@@ -143,7 +161,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip3_pos] = !this->X_N[flip3_pos];\nthis->X_N[flip4_pos] = !this->X_N[flip4_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 5)\n@@ -161,7 +179,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip4_pos] = !this->X_N[flip4_pos];\nthis->X_N[flip5_pos] = !this->X_N[flip5_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 6)\n@@ -181,7 +199,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip5_pos] = !this->X_N[flip5_pos];\nthis->X_N[flip6_pos] = !this->X_N[flip6_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 7)\n@@ -203,7 +221,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip6_pos] = !this->X_N[flip6_pos];\nthis->X_N[flip7_pos] = !this->X_N[flip7_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 8)\n@@ -227,7 +245,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip7_pos] = !this->X_N[flip7_pos];\nthis->X_N[flip8_pos] = !this->X_N[flip8_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 9)\n@@ -253,7 +271,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip8_pos] = !this->X_N[flip8_pos];\nthis->X_N[flip9_pos] = !this->X_N[flip9_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse if (n_flips == 10)\n@@ -281,7 +299,7 @@ void Decoder_chase_naive<B,R>\nthis->X_N[flip9_pos ] = !this->X_N[flip9_pos ];\nthis->X_N[flip10_pos] = !this->X_N[flip10_pos];\n- this->_try_sequence(Y_N, this->X_N.data(), V_N);\n+ this->_try_sequence_llrs(Y_N, this->X_N.data(), V_N);\n}\n}\nelse\n@@ -298,14 +316,232 @@ template <typename B, typename R>\nvoid Decoder_chase_naive<B,R>\n::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ if (!this->encoder.is_sys())\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.is_sys()' has to be true.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->_decode_hiho_cw(Y_N, this->best_X_N.data(), frame_id);\n+\n+ const auto &info_bits_pos = this->encoder.get_info_bits_pos();\n+ for (auto k = 0; k < this->K; k++)\n+ V_K[k] = this->best_X_N[info_bits_pos[k]];\n}\ntemplate <typename B, typename R>\nvoid Decoder_chase_naive<B,R>\n::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ this->min_hamming_dist = std::numeric_limits<uint32_t>::max();\n+\n+ if (this->encoder.is_codeword(Y_N))\n+ {\n+ std::copy(Y_N, Y_N + this->N, V_N);\n+ }\n+ else\n+ {\n+ for (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n+ {\n+ if (n_flips == 1)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 2)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 3)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 4)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 5)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 6)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 7)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+ this->X_N[flip7_pos] = !this->X_N[flip7_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 8)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ for (auto flip8_pos = flip7_pos +1; flip8_pos < this->N; flip8_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+ this->X_N[flip7_pos] = !this->X_N[flip7_pos];\n+ this->X_N[flip8_pos] = !this->X_N[flip8_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 9)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ for (auto flip8_pos = flip7_pos +1; flip8_pos < this->N; flip8_pos++)\n+ for (auto flip9_pos = flip8_pos +1; flip9_pos < this->N; flip9_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos] = !this->X_N[flip1_pos];\n+ this->X_N[flip2_pos] = !this->X_N[flip2_pos];\n+ this->X_N[flip3_pos] = !this->X_N[flip3_pos];\n+ this->X_N[flip4_pos] = !this->X_N[flip4_pos];\n+ this->X_N[flip5_pos] = !this->X_N[flip5_pos];\n+ this->X_N[flip6_pos] = !this->X_N[flip6_pos];\n+ this->X_N[flip7_pos] = !this->X_N[flip7_pos];\n+ this->X_N[flip8_pos] = !this->X_N[flip8_pos];\n+ this->X_N[flip9_pos] = !this->X_N[flip9_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else if (n_flips == 10)\n+ {\n+ for (auto flip1_pos = 0; flip1_pos < this->N; flip1_pos++)\n+ for (auto flip2_pos = flip1_pos +1; flip2_pos < this->N; flip2_pos++)\n+ for (auto flip3_pos = flip2_pos +1; flip3_pos < this->N; flip3_pos++)\n+ for (auto flip4_pos = flip3_pos +1; flip4_pos < this->N; flip4_pos++)\n+ for (auto flip5_pos = flip4_pos +1; flip5_pos < this->N; flip5_pos++)\n+ for (auto flip6_pos = flip5_pos +1; flip6_pos < this->N; flip6_pos++)\n+ for (auto flip7_pos = flip6_pos +1; flip7_pos < this->N; flip7_pos++)\n+ for (auto flip8_pos = flip7_pos +1; flip8_pos < this->N; flip8_pos++)\n+ for (auto flip9_pos = flip8_pos +1; flip9_pos < this->N; flip9_pos++)\n+ for (auto flip10_pos = flip9_pos +1; flip10_pos < this->N; flip10_pos++)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+ this->X_N[flip1_pos ] = !this->X_N[flip1_pos ];\n+ this->X_N[flip2_pos ] = !this->X_N[flip2_pos ];\n+ this->X_N[flip3_pos ] = !this->X_N[flip3_pos ];\n+ this->X_N[flip4_pos ] = !this->X_N[flip4_pos ];\n+ this->X_N[flip5_pos ] = !this->X_N[flip5_pos ];\n+ this->X_N[flip6_pos ] = !this->X_N[flip6_pos ];\n+ this->X_N[flip7_pos ] = !this->X_N[flip7_pos ];\n+ this->X_N[flip8_pos ] = !this->X_N[flip8_pos ];\n+ this->X_N[flip9_pos ] = !this->X_N[flip9_pos ];\n+ this->X_N[flip10_pos] = !this->X_N[flip10_pos];\n+\n+ this->_try_sequence_bits(Y_N, this->X_N.data(), V_N);\n+ }\n+ }\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"'max_flips' unsupported size ('max_flips' = \" << max_flips << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n+ }\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "diff": "@@ -27,7 +27,8 @@ protected:\nvoid _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\nvoid _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n- inline void _try_sequence(const R *Y_N, const B *X_N, B *V_N);\n+ inline void _try_sequence_llrs(const R *Y_N, const B *X_N, B *V_N);\n+ inline void _try_sequence_bits(const B *Y_N, const B *X_N, B *V_N);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the hamming distance in the naive chase decoder.
8,490
29.01.2018 22:07:20
-3,600
6cdd4383bac95bbe25efdaff29738522b12a82e2
Add the hamming distance in the std chase decoder (does not work at this time).
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_std.cpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_std.cpp", "diff": "@@ -50,7 +50,7 @@ template <typename B, typename R>\nvoid Decoder_chase_std<B,R>\n::_decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n{\n- if (n_flips == flip_pos.size())\n+ if (n_flips == max_flips)\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n@@ -81,12 +81,55 @@ void Decoder_chase_std<B,R>\n}\n}\n+template <typename B, typename R>\n+void Decoder_chase_std<B,R>\n+::_decode_hiho_cw_recursive(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n+{\n+ // TODO: /!\\ there is a bug in this code !!!\n+ if (n_flips == max_flips)\n+ {\n+ std::copy(Y_N, Y_N + this->K, this->X_N.begin());\n+\n+ // flip the bits\n+ for (uint32_t f = 0; f < max_flips; f++)\n+ this->X_N[this->flip_pos[f]] = !this->X_N[this->flip_pos[f]];\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ auto cur_hamming_dist = this->compute_hamming_dist(this->X_N.data(), Y_N);\n+\n+ // update the best codeword\n+ if (cur_hamming_dist < this->min_hamming_dist)\n+ {\n+ this->min_hamming_dist = cur_hamming_dist;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ else\n+ {\n+ for (auto flip_pos = n_flips; flip_pos < (uint32_t)this->N; flip_pos++)\n+ {\n+ this->flip_pos[n_flips] = flip_pos;\n+ this->_decode_hiho_cw_recursive(Y_N, V_N, n_flips +1, max_flips);\n+ }\n+ }\n+}\n+\ntemplate <typename B, typename R>\nvoid Decoder_chase_std<B,R>\n::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n{\ntools::hard_decide(Y_N, this->hard_Y_N.data(), this->N);\n+ if (this->hamming)\n+ {\n+ // TODO: /!\\ there is a bug in this code !!! (_decode_hiho_cw)\n+ this->_decode_hiho_cw(this->hard_Y_N.data(), V_N, frame_id);\n+ }\n+ else\n+ {\nthis->min_euclidean_dist = std::numeric_limits<float>::max();\nif (this->encoder.is_codeword(this->hard_Y_N.data()))\n@@ -105,19 +148,43 @@ void Decoder_chase_std<B,R>\nfor (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\nthis->_decode_siho_cw_recursive(Y_N, V_N, 0, n_flips);\n}\n+}\ntemplate <typename B, typename R>\nvoid Decoder_chase_std<B,R>\n::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ // TODO: /!\\ there is a bug in this code !!!\n+ if (!this->encoder.is_sys())\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.is_sys()' has to be true.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->_decode_hiho_cw(Y_N, this->best_X_N.data(), frame_id);\n+\n+ const auto &info_bits_pos = this->encoder.get_info_bits_pos();\n+ for (auto k = 0; k < this->K; k++)\n+ V_K[k] = this->best_X_N[info_bits_pos[k]];\n}\ntemplate <typename B, typename R>\nvoid Decoder_chase_std<B,R>\n::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ // TODO: /!\\ there is a bug in this code !!!\n+ this->min_hamming_dist = std::numeric_limits<uint32_t>::max();\n+\n+ if (this->encoder.is_codeword(Y_N))\n+ {\n+ std::copy(Y_N, Y_N + this->N, V_N);\n+ }\n+ else\n+ {\n+ for (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n+ this->_decode_hiho_cw_recursive(Y_N, V_N, 0, n_flips);\n+ }\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_std.hpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_std.hpp", "diff": "@@ -25,6 +25,7 @@ protected:\nvoid _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\nvoid _decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n+ void _decode_hiho_cw_recursive(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the hamming distance in the std chase decoder (does not work at this time).
8,490
29.01.2018 22:24:59
-3,600
d3745dd117dc3511b73548a048b713914b15548c
Fix the bug !
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/ML/Decoder_chase_std.cpp", "new_path": "src/Module/Decoder/ML/Decoder_chase_std.cpp", "diff": "@@ -85,10 +85,9 @@ template <typename B, typename R>\nvoid Decoder_chase_std<B,R>\n::_decode_hiho_cw_recursive(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n{\n- // TODO: /!\\ there is a bug in this code !!!\nif (n_flips == max_flips)\n{\n- std::copy(Y_N, Y_N + this->K, this->X_N.begin());\n+ std::copy(Y_N, Y_N + this->N, this->X_N.begin());\n// flip the bits\nfor (uint32_t f = 0; f < max_flips; f++)\n@@ -125,7 +124,6 @@ void Decoder_chase_std<B,R>\nif (this->hamming)\n{\n- // TODO: /!\\ there is a bug in this code !!! (_decode_hiho_cw)\nthis->_decode_hiho_cw(this->hard_Y_N.data(), V_N, frame_id);\n}\nelse\n@@ -154,7 +152,6 @@ template <typename B, typename R>\nvoid Decoder_chase_std<B,R>\n::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n{\n- // TODO: /!\\ there is a bug in this code !!!\nif (!this->encoder.is_sys())\n{\nstd::stringstream message;\n@@ -173,7 +170,6 @@ template <typename B, typename R>\nvoid Decoder_chase_std<B,R>\n::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n{\n- // TODO: /!\\ there is a bug in this code !!!\nthis->min_hamming_dist = std::numeric_limits<uint32_t>::max();\nif (this->encoder.is_codeword(Y_N))\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the bug !
8,483
30.01.2018 10:04:42
-3,600
98c67b8a05a0c131eb54f6738a4fa04ddd3f1b2d
Add factory encoder, decoder codec for TPC
[ { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "#include \"Launcher/Code/RSC_DB/RSC_DB.hpp\"\n#include \"Launcher/Code/Turbo/Turbo.hpp\"\n#include \"Launcher/Code/Turbo_DB/Turbo_DB.hpp\"\n+#include \"Launcher/Code/Turbo_product_code/Turbo_product_code.hpp\"\n#include \"Launcher/Code/Uncoded/Uncoded.hpp\"\n#include \"Launcher/Simulation/BFER_ite.hpp\"\n#include \"Launcher/Simulation/BFER_std.hpp\"\n@@ -281,6 +282,12 @@ launcher::Launcher* factory::Launcher::parameters\nreturn new launcher::Turbo_DB<launcher::BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n}\n+ if (this->cde_type == \"TPC\")\n+ {\n+ if (this->sim_type == \"BFER\")\n+ return new launcher::Turbo_product_code<launcher::BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n+ }\n+\nif (this->cde_type == \"REP\")\n{\nif (this->sim_type == \"BFER\")\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Codec/Turbo_product_code/Codec_turbo_product_code.cpp", "diff": "+#include \"Codec_turbo_product_code.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::factory;\n+\n+const std::string aff3ct::factory::Codec_turbo_product_code_name = \"Codec Turbo Product Code\";\n+const std::string aff3ct::factory::Codec_turbo_product_code_prefix = \"cdc\";\n+\n+Codec_turbo_product_code::parameters\n+::parameters(const std::string &prefix)\n+: Codec ::parameters(Codec_turbo_product_code_name, prefix),\n+ Codec_SISO_SIHO::parameters(Codec_turbo_product_code_name, prefix),\n+ enc(new Encoder_turbo_product_code::parameters<>(\"enc\")),\n+ dec(new Decoder_turbo_product_code::parameters<>(\"dec\")),\n+ pct(nullptr)\n+{\n+ Codec::parameters::enc = enc;\n+ Codec::parameters::dec = dec;\n+ Codec::parameters::itl = enc->itl;\n+ delete dec->itl; dec->itl = enc->itl;\n+}\n+\n+Codec_turbo_product_code::parameters\n+::~parameters()\n+{\n+ if (enc != nullptr) { enc->itl = nullptr; delete enc; enc = nullptr; }\n+ if (dec != nullptr) { dec->itl = nullptr; delete dec; dec = nullptr; }\n+\n+ Codec::parameters::enc = nullptr;\n+ Codec::parameters::dec = nullptr;\n+ if (Codec::parameters::itl != nullptr)\n+ {\n+ delete Codec::parameters::itl;\n+ Codec::parameters::itl = nullptr;\n+ }\n+}\n+\n+Codec_turbo_product_code::parameters* Codec_turbo_product_code::parameters\n+::clone() const\n+{\n+ auto clone = new Codec_turbo_product_code::parameters(*this);\n+\n+ if (enc != nullptr) { clone->enc = enc->clone(); }\n+ if (dec != nullptr) { clone->dec = dec->clone(); }\n+\n+ clone->set_enc(clone->enc);\n+ clone->set_dec(clone->dec);\n+ clone->set_itl(clone->enc->itl);\n+ delete clone->dec->itl; clone->dec->itl = clone->enc->itl;\n+\n+ return clone;\n+}\n+\n+void Codec_turbo_product_code::parameters\n+::get_description(arg_map &req_args, arg_map &opt_args) const\n+{\n+ Codec_SIHO::parameters::get_description(req_args, opt_args);\n+\n+ enc->get_description(req_args, opt_args);\n+ dec->get_description(req_args, opt_args);\n+\n+ auto pdec = dec->get_prefix();\n+ auto pdes = dec->sub1->get_prefix();\n+\n+ req_args.erase({pdec+\"-cw-size\", \"N\"});\n+ req_args.erase({pdec+\"-info-bits\", \"K\"});\n+ opt_args.erase({pdec+\"-fra\", \"F\"});\n+}\n+\n+void Codec_turbo_product_code::parameters\n+::store(const arg_val_map &vals)\n+{\n+ Codec_SIHO::parameters::store(vals);\n+\n+ enc->store(vals);\n+\n+ this->dec->K = this->enc->K;\n+ this->dec->N_cw = this->enc->N_cw;\n+ this->dec->sub1->buffered = this->enc->sub1->buffered;\n+ this->dec->sub2->buffered = this->enc->sub2->buffered;\n+ this->dec->n_frames = this->enc->n_frames;\n+ this->dec->sub1->n_frames = this->enc->sub1->n_frames;\n+ this->dec->sub2->n_frames = this->enc->sub2->n_frames;\n+\n+ dec->store(vals);\n+\n+ this->K = this->enc->K;\n+ this->N_cw = this->enc->N_cw;\n+ this->N = this->pct ? this->pct->N : this->enc->N_cw;\n+ this->tail_length = this->enc->tail_length;\n+}\n+\n+void Codec_turbo_product_code::parameters\n+::get_headers(std::map<std::string,header_list>& headers, const bool full) const\n+{\n+ Codec_SIHO::parameters::get_headers(headers, full);\n+ enc->get_headers(headers, full);\n+ dec->get_headers(headers, full);\n+ if (this->pct)\n+ pct->get_headers(headers, full);\n+}\n+\n+template <typename B, typename Q>\n+module::Codec_turbo_product_code<B,Q>* Codec_turbo_product_code::parameters\n+::build(module::CRC<B> *crc) const\n+{\n+ return new module::Codec_turbo_product_code<B,Q>(*enc, *dec, pct, crc);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+\n+template <typename B, typename Q>\n+module::Codec_turbo_product_code<B,Q>* Codec_turbo_product_code\n+::build(const parameters &params, module::CRC<B> *crc)\n+{\n+ return params.template build<B,Q>(crc);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Codec_turbo_product_code<B_8 ,Q_8 >* aff3ct::factory::Codec_turbo_product_code::parameters::build<B_8 ,Q_8 >(aff3ct::module::CRC<B_8 >*) const;\n+template aff3ct::module::Codec_turbo_product_code<B_16,Q_16>* aff3ct::factory::Codec_turbo_product_code::parameters::build<B_16,Q_16>(aff3ct::module::CRC<B_16>*) const;\n+template aff3ct::module::Codec_turbo_product_code<B_32,Q_32>* aff3ct::factory::Codec_turbo_product_code::parameters::build<B_32,Q_32>(aff3ct::module::CRC<B_32>*) const;\n+template aff3ct::module::Codec_turbo_product_code<B_64,Q_64>* aff3ct::factory::Codec_turbo_product_code::parameters::build<B_64,Q_64>(aff3ct::module::CRC<B_64>*) const;\n+template aff3ct::module::Codec_turbo_product_code<B_8 ,Q_8 >* aff3ct::factory::Codec_turbo_product_code::build<B_8 ,Q_8 >(const aff3ct::factory::Codec_turbo_product_code::parameters&, aff3ct::module::CRC<B_8 >*);\n+template aff3ct::module::Codec_turbo_product_code<B_16,Q_16>* aff3ct::factory::Codec_turbo_product_code::build<B_16,Q_16>(const aff3ct::factory::Codec_turbo_product_code::parameters&, aff3ct::module::CRC<B_16>*);\n+template aff3ct::module::Codec_turbo_product_code<B_32,Q_32>* aff3ct::factory::Codec_turbo_product_code::build<B_32,Q_32>(const aff3ct::factory::Codec_turbo_product_code::parameters&, aff3ct::module::CRC<B_32>*);\n+template aff3ct::module::Codec_turbo_product_code<B_64,Q_64>* aff3ct::factory::Codec_turbo_product_code::build<B_64,Q_64>(const aff3ct::factory::Codec_turbo_product_code::parameters&, aff3ct::module::CRC<B_64>*);\n+#else\n+template aff3ct::module::Codec_turbo_product_code<B,Q>* aff3ct::factory::Codec_turbo_product_code::parameters::build<B,Q>(aff3ct::module::CRC<B>*) const;\n+template aff3ct::module::Codec_turbo_product_code<B,Q>* aff3ct::factory::Codec_turbo_product_code::build<B,Q>(const aff3ct::factory::Codec_turbo_product_code::parameters&, aff3ct::module::CRC<B>*);\n+#endif\n+// ==================================================================================== explicit template instantiation\n+\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Codec/Turbo_product_code/Codec_turbo_product_code.hpp", "diff": "+#ifndef FACTORY_CODEC_TURBO_PRODUCT_CODE_HPP\n+#define FACTORY_CODEC_TURBO_PRODUCT_CODE_HPP\n+\n+#include <string>\n+#include <cmath>\n+\n+#include \"Factory/Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.hpp\"\n+#include \"Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.hpp\"\n+\n+#include \"Module/Codec/Turbo/Codec_turbo_product_code.hpp\"\n+\n+#include \"../Codec_SISO_SIHO.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace factory\n+{\n+extern const std::string Codec_turbo_product_code_name;\n+extern const std::string Codec_turbo_product_code_prefix;\n+struct Codec_turbo_product_code : public Codec_SISO_SIHO\n+{\n+ class parameters : public Codec_SISO_SIHO::parameters\n+ {\n+ public:\n+ // ------------------------------------------------------------------------------------------------- PARAMETERS\n+ // depending parameters\n+ Encoder_turbo ::parameters<> *enc;\n+ Decoder_turbo ::parameters<> *dec;\n+\n+ // ---------------------------------------------------------------------------------------------------- METHODS\n+ explicit parameters(const std::string &p = Codec_turbo_product_code_prefix);\n+ virtual ~parameters();\n+ Codec_turbo_product_code::parameters* clone() const;\n+ void enable_puncturer();\n+\n+ // parameters construction\n+ void get_description(arg_map &req_args, arg_map &opt_args ) const;\n+ void store (const arg_val_map &vals );\n+ void get_headers (std::map<std::string,header_list>& headers, const bool full = true) const;\n+\n+ // builder\n+ template <typename B = int, typename Q = float>\n+ module::Codec_turbo_product_code<B,Q>* build() const;\n+ };\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Codec_turbo_product_code<B,Q>* build(const parameters &params);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_CODEC_TURBO_PRODUCT_CODE_HPP */\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "diff": "#include \"Decoder_turbo_product_code.hpp\"\n-const std::string aff3ct::factory::Decoder_turbo_product_code_name = \"Decoder Turbo DB\";\n+const std::string aff3ct::factory::Decoder_turbo_product_code_name = \"Decoder Turbo Product Code\";\nconst std::string aff3ct::factory::Decoder_turbo_product_code_prefix = \"dec\";\nusing namespace aff3ct;\n@@ -186,7 +186,7 @@ module::Decoder_SIHO<B,Q>* Decoder_turbo_product_code::parameters\n}\ncatch (tools::cannot_allocate const&)\n{\n- if (this->type == \"TURBO_DB\")\n+ if (this->type == \"TPC\")\n{\nif (this->implem == \"STD\") return new module::Decoder_chase_pyndiah<B,Q>(this->n_ite, itl, hiho_n, hiho_i, alpha, n_least_reliable_positions, n_competitors);\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.cpp", "diff": "+#include \"Tools/Exception/exception.hpp\"\n+\n+#include \"Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.hpp\"\n+\n+#include \"Encoder_turbo_product_code.hpp\"\n+\n+const std::string aff3ct::factory::Encoder_turbo_product_code_name = \"Encoder Turbo Product Code\";\n+const std::string aff3ct::factory::Encoder_turbo_product_code_prefix = \"enc\";\n+\n+using namespace aff3ct;\n+using namespace aff3ct::factory;\n+\n+Encoder_turbo_product_code::parameters\n+::parameters(const std::string &prefix)\n+: Encoder::parameters(Encoder_turbo_product_code_name, prefix),\n+ sub(new Encoder_BCH::parameters(prefix+\"-sub\")),\n+ itl(new Interleaver::parameters(\"itl\"))\n+{\n+ this->type = \"TPC\";\n+}\n+\n+Encoder_turbo_product_code::parameters* Encoder_turbo_product_code::parameters\n+::clone() const\n+{\n+ auto clone = new Encoder_turbo_product_code::parameters(*this);\n+\n+ if (sub != nullptr) { clone->sub = sub->clone(); }\n+ if (itl != nullptr) { clone->itl = itl->clone(); }\n+\n+ return clone;\n+}\n+\n+std::vector<std::string> Encoder_turbo_product_code::parameters\n+::get_names() const\n+{\n+ auto n = Encoder::parameters::get_names();\n+ if (sub != nullptr) { auto nn = sub->get_names(); for (auto &x : nn) n.push_back(x); }\n+ if (itl != nullptr) { auto nn = itl->get_names(); for (auto &x : nn) n.push_back(x); }\n+ return n;\n+}\n+\n+std::vector<std::string> Encoder_turbo_product_code::parameters\n+::get_short_names() const\n+{\n+ auto sn = Encoder::parameters::get_short_names();\n+ if (sub != nullptr) { auto nn = sub->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ if (itl != nullptr) { auto nn = itl->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ return sn;\n+}\n+\n+std::vector<std::string> Encoder_turbo_product_code::parameters\n+::get_prefixes() const\n+{\n+ auto p = Encoder::parameters::get_prefixes();\n+ if (sub != nullptr) { auto nn = sub->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ if (itl != nullptr) { auto nn = itl->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ return p;\n+}\n+\n+Encoder_turbo_product_code::parameters\n+::~parameters()\n+{\n+ if (sub != nullptr) { delete sub; sub = nullptr; }\n+ if (itl != nullptr) { delete itl; itl = nullptr; }\n+}\n+\n+void Encoder_turbo_product_code::parameters\n+::get_description(arg_map &req_args, arg_map &opt_args) const\n+{\n+ Encoder::parameters::get_description(req_args, opt_args);\n+\n+ auto p = this->get_prefix();\n+\n+ req_args.erase({p+\"-info-bits\", \"K\"});\n+ req_args.erase({p+\"-cw-size\", \"N\"});\n+\n+ itl->get_description(req_args, opt_args);\n+\n+ auto pi = this->itl->get_prefix();\n+\n+ req_args.erase({pi+\"-size\" });\n+ opt_args.erase({pi+\"-fra\", \"F\"});\n+\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", TPC\";\n+\n+ opt_args[{p+\"-ext\"}] =\n+ {\"\",\n+ \"extends decoder with a parity bits.\"};\n+\n+ sub->get_description(req_args, opt_args);\n+\n+ auto ps = sub->get_prefix();\n+\n+ opt_args.erase({ps+\"-fra\", \"F\"});\n+}\n+\n+void Encoder_turbo_product_code::parameters\n+::store(const arg_val_map &vals)\n+{\n+ Encoder::parameters::store(vals);\n+\n+ auto p = this->get_prefix();\n+\n+ if(exist(vals, {p+\"-ext\"})) this->parity_extended = true;\n+\n+ this->sub->n_frames = this->n_frames;\n+\n+ sub->store(vals);\n+\n+ this->K = this->sub->K * this->sub->K;\n+\n+ this->R = (float)this->K / (float)this->N_cw;\n+\n+ this->itl->core->n_frames = this->n_frames;\n+ this->itl->core->type = \"ROW_COL\";\n+\n+ if (parity_extended)\n+ this->itl->core->n_cols = this->sub->N_cw +1;\n+ else\n+ this->itl->core->n_cols = this->sub->N_cw;\n+\n+ this->itl->core->size = this->itl->core->n_cols * this->itl->core->n_cols;\n+ this->N_cw = this->itl->core->size;\n+\n+ itl->store(vals);\n+}\n+\n+void Encoder_turbo_product_code::parameters\n+::get_headers(std::map<std::string,header_list>& headers, const bool full) const\n+{\n+ Encoder::parameters::get_headers(headers, full);\n+\n+ itl->get_headers(headers, full);\n+\n+ auto p = this->get_prefix();\n+\n+ headers[p].push_back(std::make_pair(\"Parity extended\", (this->parity_extended ? \"yes\" : \"no\")));\n+\n+ sub->get_headers(headers, full);\n+}\n+\n+template <typename B>\n+module::Encoder_turbo_product_code<B>* Encoder_turbo_product_code::parameters\n+::build(const module::Interleaver<B> &itl,\n+ module::Encoder_BCH<B> &enc_n,\n+ module::Encoder_BCH<B> &enc_i) const\n+{\n+ if (this->type == \"TPC\")\n+ {\n+ if (this->implem == \"STD\") return new module::Encoder_turbo_product_code<B>(this->n_ite, itl, enc_n, enc_i, alpha, n_least_reliable_positions, n_competitors);\n+ }\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+template <typename B>\n+module::Encoder_turbo_product_code<B>* Encoder_turbo_product_code\n+::build(const parameters &params,\n+ const module::Interleaver<B> &itl,\n+ module::Encoder_BCH<B> &enc_n,\n+ module::Encoder_BCH<B> &enc_i)\n+{\n+ return params.template build<B>(itl, enc_n, enc_i);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Encoder_turbo_product_code<B_8 >* aff3ct::factory::Encoder_turbo_product_code::parameters::build<B_8 >(const aff3ct::module::Interleaver<B_8 >&, aff3ct::module::Encoder_BCH<B_8 >&, aff3ct::module::Encoder_BCH<B_8 >&) const;\n+template aff3ct::module::Encoder_turbo_product_code<B_16>* aff3ct::factory::Encoder_turbo_product_code::parameters::build<B_16>(const aff3ct::module::Interleaver<B_16>&, aff3ct::module::Encoder_BCH<B_16>&, aff3ct::module::Encoder_BCH<B_16>&) const;\n+template aff3ct::module::Encoder_turbo_product_code<B_32>* aff3ct::factory::Encoder_turbo_product_code::parameters::build<B_32>(const aff3ct::module::Interleaver<B_32>&, aff3ct::module::Encoder_BCH<B_32>&, aff3ct::module::Encoder_BCH<B_32>&) const;\n+template aff3ct::module::Encoder_turbo_product_code<B_64>* aff3ct::factory::Encoder_turbo_product_code::parameters::build<B_64>(const aff3ct::module::Interleaver<B_64>&, aff3ct::module::Encoder_BCH<B_64>&, aff3ct::module::Encoder_BCH<B_64>&) const;\n+template aff3ct::module::Encoder_turbo_product_code<B_8 >* aff3ct::factory::Encoder_turbo_product_code::build<B_8 >(const aff3ct::factory::Encoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<B_8 >&, aff3ct::module::Encoder_BCH<B_8 >&, aff3ct::module::Encoder_BCH<B_8 >&);\n+template aff3ct::module::Encoder_turbo_product_code<B_16>* aff3ct::factory::Encoder_turbo_product_code::build<B_16>(const aff3ct::factory::Encoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<B_16>&, aff3ct::module::Encoder_BCH<B_16>&, aff3ct::module::Encoder_BCH<B_16>&);\n+template aff3ct::module::Encoder_turbo_product_code<B_32>* aff3ct::factory::Encoder_turbo_product_code::build<B_32>(const aff3ct::factory::Encoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<B_32>&, aff3ct::module::Encoder_BCH<B_32>&, aff3ct::module::Encoder_BCH<B_32>&);\n+template aff3ct::module::Encoder_turbo_product_code<B_64>* aff3ct::factory::Encoder_turbo_product_code::build<B_64>(const aff3ct::factory::Encoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<B_64>&, aff3ct::module::Encoder_BCH<B_64>&, aff3ct::module::Encoder_BCH<B_64>&);\n+#else\n+template aff3ct::module::Encoder_turbo_product_code<B>* aff3ct::factory::Encoder_turbo_product_code::parameters::build<B>(const aff3ct::module::Interleaver<B>&, aff3ct::module::Encoder_BCH<B>&, aff3ct::module::Encoder_BCH<B>&) const;\n+template aff3ct::module::Encoder_turbo_product_code<B>* aff3ct::factory::Encoder_turbo_product_code::build<B>(const aff3ct::factory::Encoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<B>&, aff3ct::module::Encoder_BCH<B>&, aff3ct::module::Encoder_BCH<B>&);\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.hpp", "diff": "+#ifndef FACTORY_ENCODER_TURBO_PRODUCT_CODE_HPP\n+#define FACTORY_ENCODER_TURBO_PRODUCT_CODE_HPP\n+\n+#include <string>\n+#include <type_traits>\n+\n+#include \"Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.hpp\"\n+#include \"Module/Interleaver/Interleaver.hpp\"\n+// #include \"Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.hpp\"\n+\n+#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n+#include \"Factory/Module/Encoder/BCH/Encoder_BCH.hpp\"\n+\n+#include \"../Encoder.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace factory\n+{\n+extern const std::string Encoder_turbo_product_code_name;\n+extern const std::string Encoder_turbo_product_code_prefix;\n+struct Encoder_turbo_product_code : public Encoder\n+{\n+ class parameters : public Encoder::parameters\n+ {\n+ public:\n+ // ------------------------------------------------------------------------------------------------- PARAMETERS\n+ // optional parameters\n+ int parity_extended = false;\n+\n+ // depending parameters\n+ Encoder_BCH ::parameters *sub;\n+ Interleaver ::parameters *itl;\n+\n+ // ---------------------------------------------------------------------------------------------------- METHODS\n+ explicit parameters(const std::string &p = Decoder_turbo_product_code_prefix);\n+ virtual ~parameters();\n+ Encoder_turbo_product_code::parameters* clone() const;\n+\n+ virtual std::vector<std::string> get_names () const;\n+ virtual std::vector<std::string> get_short_names() const;\n+ virtual std::vector<std::string> get_prefixes () const;\n+\n+ // parameters construction\n+ void get_description(arg_map &req_args, arg_map &opt_args ) const;\n+ void store (const arg_val_map &vals );\n+ void get_headers (std::map<std::string,header_list>& headers, const bool full = true) const;\n+\n+ // builder\n+ template <typename B = int>\n+ module::Encoder_turbo_product_code<B>* build(const module::Interleaver<B> &itl,\n+ module::Encoder_BCH<B> &enc_n,\n+ module::Encoder_BCH<B> &enc_i) const;\n+ };\n+\n+ template <typename B = int>\n+ static module::Encoder_turbo_product_code<B>* build(const parameters &params,\n+ const module::Interleaver<B> &itl,\n+ module::Encoder_BCH<B> &enc_n,\n+ module::Encoder_BCH<B> &enc_i);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_ENCODER_TURBO_PRODUCT_CODE_HPP */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Launcher/Code/Turbo_product_code/Turbo_product_code.cpp", "diff": "+#include <iostream>\n+#include <typeinfo>\n+#include <mipp.h>\n+\n+#include \"Launcher/Simulation/BFER_std.hpp\"\n+\n+#include \"Turbo_product_code.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::launcher;\n+\n+template <class L, typename B, typename R, typename Q>\n+Turbo_product_code<L,B,R,Q>\n+::Turbo_product_code(const int argc, const char **argv, std::ostream &stream)\n+: L(argc, argv, stream), params_cdc(new factory::Codec_turbo_product_code::parameters(\"cdc\"))\n+{\n+ this->params.set_cdc(params_cdc);\n+\n+ if (typeid(L) == typeid(BFER_std<B,R,Q>))\n+ params_cdc->enable_puncturer();\n+}\n+\n+template <class L, typename B, typename R, typename Q>\n+Turbo_product_code<L,B,R,Q>\n+::~Turbo_product_code()\n+{\n+}\n+\n+template <class L, typename B, typename R, typename Q>\n+void Turbo_product_code<L,B,R,Q>\n+::get_description_args()\n+{\n+ params_cdc->get_description(this->req_args, this->opt_args);\n+\n+ auto penc = params_cdc->enc->get_prefix();\n+ auto pitl = params_cdc->itl->get_prefix();\n+\n+ this->opt_args.erase({penc+\"-fra\", \"F\"});\n+ this->opt_args.erase({penc+\"-seed\", \"S\"});\n+ this->opt_args.erase({pitl+\"-seed\", \"S\"});\n+\n+ L::get_description_args();\n+}\n+\n+template <class L, typename B, typename R, typename Q>\n+void Turbo_product_code<L,B,R,Q>\n+::store_args()\n+{\n+ params_cdc->store(this->ar.get_args());\n+\n+ if (params_cdc->dec->sub1->simd_strategy == \"INTER\")\n+ this->params.src->n_frames = mipp::N<Q>();\n+ if (params_cdc->dec->sub1->simd_strategy == \"INTRA\")\n+ this->params.src->n_frames = (int)std::ceil(mipp::N<Q>() / 8.f);\n+\n+ if (std::is_same<Q,int8_t>())\n+ {\n+ this->params.qnt->n_bits = 6;\n+ this->params.qnt->n_decimals = 2;\n+ }\n+ else if (std::is_same<Q,int16_t>())\n+ {\n+ this->params.qnt->n_bits = 6;\n+ this->params.qnt->n_decimals = 3;\n+ }\n+\n+ L::store_args();\n+\n+ params_cdc->enc ->n_frames = this->params.src->n_frames;\n+ if (params_cdc->pct)\n+ params_cdc->pct ->n_frames = this->params.src->n_frames;\n+ params_cdc->dec ->n_frames = this->params.src->n_frames;\n+ params_cdc->itl->core->n_frames = this->params.src->n_frames;\n+ params_cdc->enc->sub1->n_frames = this->params.src->n_frames;\n+ params_cdc->enc->sub2->n_frames = this->params.src->n_frames;\n+ params_cdc->dec->sub1->n_frames = this->params.src->n_frames;\n+ params_cdc->dec->sub2->n_frames = this->params.src->n_frames;\n+\n+ params_cdc->itl->core->seed = this->params.global_seed;\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#include \"Launcher/Simulation/BFER_std.hpp\"\n+#ifdef MULTI_PREC\n+template class aff3ct::launcher::Turbo_product_code<aff3ct::launcher::BFER_std<B_8 ,R_8 ,Q_8 >,B_8 ,R_8 ,Q_8 >;\n+template class aff3ct::launcher::Turbo_product_code<aff3ct::launcher::BFER_std<B_16,R_16,Q_16>,B_16,R_16,Q_16>;\n+template class aff3ct::launcher::Turbo_product_code<aff3ct::launcher::BFER_std<B_32,R_32,Q_32>,B_32,R_32,Q_32>;\n+template class aff3ct::launcher::Turbo_product_code<aff3ct::launcher::BFER_std<B_64,R_64,Q_64>,B_64,R_64,Q_64>;\n+#else\n+template class aff3ct::launcher::Turbo_product_code<aff3ct::launcher::BFER_std<B,R,Q>,B,R,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Launcher/Code/Turbo_product_code/Turbo_product_code.hpp", "diff": "+#ifndef LAUNCHER_TURBO_PRODUCT_CODE_HPP_\n+#define LAUNCHER_TURBO_PRODUCT_CODE_HPP_\n+\n+#include \"Factory/Module/Codec/Turbo_product_code/Codec_turbo_product_code.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <class L, typename B = int, typename R = float, typename Q = R>\n+class Turbo_product_code : public L\n+{\n+protected:\n+ factory::Codec_turbo_product_code::parameters *params_cdc;\n+\n+public:\n+ Turbo_product_code(const int argc, const char **argv, std::ostream &stream = std::cout);\n+ virtual ~Turbo_product_code();\n+\n+protected:\n+ virtual void get_description_args();\n+ virtual void store_args();\n+};\n+}\n+}\n+\n+#endif /* LAUNCHER_TURBO_PRODUCT_CODE_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Codec/Turbo_product_code/Codec_turbo_product_code.cpp", "diff": "+#include \"Tools/Exception/exception.hpp\"\n+#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n+#include \"Factory/Module/Encoder/BCH/Encoder_BCH.hpp\"\n+#include \"Factory/Module/Decoder/BCH/Decoder_BCH.hpp\"\n+\n+#include \"Codec_turbo_product_code.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B, typename Q>\n+Codec_turbo_product_code<B,Q>\n+::Codec_turbo_product_code(const factory::Encoder_turbo_product_code::parameters<> &enc_params,\n+ const factory::Decoder_turbo_product_code::parameters<> &dec_params)\n+: Codec <B,Q>(enc_params.K, enc_params.N_cw, pct_params ? pct_params->N : enc_params.N_cw, enc_params.tail_length, enc_params.n_frames),\n+ Codec_SISO_SIHO<B,Q>(enc_params.K, enc_params.N_cw, pct_params ? pct_params->N : enc_params.N_cw, enc_params.tail_length, enc_params.n_frames),\n+ sub_enc(nullptr),\n+ sub_dec(nullptr)\n+{\n+ const std::string name = \"Codec_turbo_product_code\";\n+ this->set_name(name);\n+\n+ // ----------------------------------------------------------------------------------------------------- exceptions\n+ if (enc_params.K != dec_params.K)\n+ {\n+ std::stringstream message;\n+ message << \"'enc_params.K' has to be equal to 'dec_params.K' ('enc_params.K' = \" << enc_params.K\n+ << \", 'dec_params.K' = \" << dec_params.K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (enc_params.N_cw != dec_params.N_cw)\n+ {\n+ std::stringstream message;\n+ message << \"'enc_params.N_cw' has to be equal to 'dec_params.N_cw' ('enc_params.N_cw' = \" << enc_params.N_cw\n+ << \", 'dec_params.N_cw' = \" << dec_params.N_cw << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (enc_params.n_frames != dec_params.n_frames)\n+ {\n+ std::stringstream message;\n+ message << \"'enc_params.n_frames' has to be equal to 'dec_params.n_frames' ('enc_params.n_frames' = \"\n+ << enc_params.n_frames << \", 'dec_params.n_frames' = \" << dec_params.n_frames << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ // ---------------------------------------------------------------------------------------------------------- tools\n+ if (!enc_params.json_path.empty())\n+ {\n+ json_stream.open(enc_params.json_path.c_str(), std::ios::out | std::ios::trunc);\n+ json_stream << \"[\" << std::endl;\n+ }\n+\n+ auto encoder_RSC = factory::Encoder_RSC::build<B>(*enc_params.sub1);\n+ trellis = encoder_RSC->get_trellis();\n+ delete encoder_RSC;\n+\n+ // ---------------------------------------------------------------------------------------------------- allocations\n+ this->set_interleaver(factory::Interleaver_core::build<>(*dec_params.itl->core));\n+\n+ if (pct_params)\n+ {\n+ try\n+ {\n+ this->set_puncturer(factory::Puncturer_turbo::build<B,Q>(*pct_params));\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\n+ this->set_puncturer(factory::Puncturer::build<B,Q>(*pct_params));\n+ }\n+ }\n+ else\n+ {\n+ factory::Puncturer::parameters pctno_params;\n+ pctno_params.type = \"NO\";\n+ pctno_params.K = enc_params.K;\n+ pctno_params.N = enc_params.N_cw;\n+ pctno_params.N_cw = enc_params.N_cw;\n+ pctno_params.n_frames = enc_params.n_frames;\n+\n+ this->set_puncturer(factory::Puncturer::build<B,Q>(pctno_params));\n+ }\n+\n+ Encoder_turbo<B> *encoder_turbo = nullptr;\n+ try\n+ {\n+ sub_enc = factory::Encoder_RSC::build<B>(*enc_params.sub1, json_stream);\n+ encoder_turbo = factory::Encoder_turbo::build<B>(enc_params, this->get_interleaver_bit(), sub_enc, sub_enc);\n+ this->set_encoder(encoder_turbo);\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\n+ this->set_encoder(factory::Encoder::build<B>(enc_params));\n+ }\n+\n+ Decoder_turbo<B,Q>* decoder_turbo = nullptr;\n+ try\n+ {\n+ this->set_decoder_siho(factory::Decoder_turbo::build<B,Q>(dec_params, encoder_turbo));\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\n+ sub_dec = factory::Decoder_RSC::build_siso<B,Q>(*dec_params.sub1, trellis, json_stream, dec_params.n_ite);\n+ decoder_turbo = factory::Decoder_turbo::build<B,Q>(dec_params, this->get_interleaver_llr(), *sub_dec, *sub_dec);\n+ this->set_decoder_siho(decoder_turbo);\n+ }\n+\n+ // ------------------------------------------------------------------------------------------------ post processing\n+ if (decoder_turbo)\n+ {\n+ if (dec_params.sf->enable)\n+ post_pros.push_back(factory::Scaling_factor::build<B,Q>(*dec_params.sf));\n+\n+ if (dec_params.fnc->enable)\n+ {\n+ if (crc == nullptr || crc->get_size() == 0)\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, \"The Flip aNd Check requires a CRC.\");\n+\n+ post_pros.push_back(factory::Flip_and_check::build<B,Q>(*dec_params.fnc, *crc));\n+ }\n+ else if (crc != nullptr && crc->get_size() > 0)\n+ post_pros.push_back(new tools::CRC_checker<B,Q>(*crc, 2, decoder_turbo->get_simd_inter_frame_level()));\n+\n+ if (dec_params.self_corrected)\n+ post_pros.push_back(new tools::Self_corrected<B,Q>(dec_params.K,\n+ dec_params.n_ite,\n+ 4,\n+ dec_params.n_ite,\n+ decoder_turbo->get_simd_inter_frame_level()));\n+\n+ for (auto i = 0; i < (int)post_pros.size(); i++)\n+ if (post_pros[i] != nullptr)\n+ {\n+ using namespace std::placeholders;\n+\n+ auto pp = post_pros[i];\n+ decoder_turbo->add_handler_siso_n(std::bind(&tools::Post_processing_SISO<B,Q>::siso_n, pp, _1, _2, _3, _4));\n+ decoder_turbo->add_handler_siso_i(std::bind(&tools::Post_processing_SISO<B,Q>::siso_i, pp, _1, _2, _3 ));\n+ decoder_turbo->add_handler_end (std::bind(&tools::Post_processing_SISO<B,Q>::end, pp, _1 ));\n+ }\n+ }\n+}\n+\n+template <typename B, typename Q>\n+Codec_turbo_product_code<B,Q>\n+::~Codec_turbo_product_code()\n+{\n+ if (sub_enc != nullptr) { delete sub_enc; sub_enc = nullptr; }\n+ if (sub_dec != nullptr) { delete sub_dec; sub_dec = nullptr; }\n+\n+ if (post_pros.size())\n+ for (auto i = 0; i < (int)post_pros.size(); i++)\n+ if (post_pros[i] != nullptr)\n+ {\n+ delete post_pros[i];\n+ post_pros[i] = nullptr;\n+ }\n+ post_pros.clear();\n+\n+ if (json_stream.is_open())\n+ {\n+ json_stream << \"[{\\\"stage\\\": \\\"end\\\"}]]\" << std::endl;\n+ json_stream.close();\n+ }\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Codec_turbo_product_code<B_8,Q_8>;\n+template class aff3ct::module::Codec_turbo_product_code<B_16,Q_16>;\n+template class aff3ct::module::Codec_turbo_product_code<B_32,Q_32>;\n+template class aff3ct::module::Codec_turbo_product_code<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Codec_turbo_product_code<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Codec/Turbo_product_code/Codec_turbo_product_code.hpp", "diff": "+#ifndef CODEC_TURBO_PRODUCT_CODE_HPP_\n+#define CODEC_TURBO_PRODUCT_CODE_HPP_\n+\n+#include <vector>\n+#include <fstream>\n+\n+#include \"Module/Encoder/BCH/Encoder_BCH.hpp\"\n+#include \"Module/Decoder/BCH/Decoder_BCH.hpp\"\n+#include \"Module/Decoder/Decoder_SISO_SIHO.hpp\"\n+\n+#include \"Factory/Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.hpp\"\n+#include \"Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.hpp\"\n+\n+#include \"../Codec_SISO_SIHO.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename Q = float>\n+class Codec_turbo_product_code : public Codec_SIHO<B,Q>\n+{\n+protected:\n+ const aff3ct::tools::BCH_polynomial_generator GF_poly;\n+ aff3ct::module::Encoder_BCH<B,Q> enc_bch;\n+ aff3ct::module::Decoder_BCH<B,Q> dec_bch;\n+\n+public:\n+ Codec_turbo_product_code(const factory::Encoder_turbo ::parameters<> &enc_params,\n+ const factory::Decoder_turbo ::parameters<> &dec_params);\n+ virtual ~Codec_turbo_product_code();\n+};\n+}\n+}\n+\n+#endif /* CODEC_TURBO_PRODUCT_CODE_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
Add factory encoder, decoder codec for TPC
8,490
30.01.2018 16:36:01
-3,600
44657a214075fb83a581d741cce41042f839d1c2
Add the 'is_codeword()', 'is_sys()' and 'get_info_bits_pos()' methods to the BCH encoder.
[ { "change_type": "MODIFY", "old_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp", "new_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp", "diff": "@@ -22,6 +22,8 @@ Encoder_BCH<B>\n<< GF_poly.get_n_rdncy() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ std::iota(this->info_bits_pos.begin(), this->info_bits_pos.end(), this->N - this->K);\n}\ntemplate <typename B>\n@@ -32,7 +34,7 @@ Encoder_BCH<B>\ntemplate <typename B>\nvoid Encoder_BCH<B>\n-::_encode(const B *U_K, B *X_N, const int frame_id)\n+::__encode(const B *U_K, B *bb)\n{\nfor (auto i = 0; i < this->N - this->K; i++)\nbb[i] = (B)0;\n@@ -55,25 +57,30 @@ void Encoder_BCH<B>\nbb[0] = 0;\n}\n}\n-\n- for (auto i = 0; i < this->N - this->K; i++)\n- X_N[i] = bb[i];\n- for (auto i = 0; i < this->K; i++)\n- X_N[i + this->N - this->K] = U_K[i];\n}\ntemplate <typename B>\n-const std::vector<uint32_t>& Encoder_BCH<B>\n-::get_info_bits_pos()\n+void Encoder_BCH<B>\n+::_encode(const B *U_K, B *X_N, const int frame_id)\n{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ // generate the parity bits\n+ this->__encode(U_K, X_N);\n+\n+ // copy the sys bits at the end of the codeword\n+ std::copy(U_K, U_K + this->K, X_N + this->N - this->K);\n}\ntemplate <typename B>\nbool Encoder_BCH<B>\n-::is_sys() const\n+::is_codeword(const B *X_N)\n{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+ this->__encode(X_N + this->N - this->K, this->bb.data());\n+\n+ auto par_size = this->N - this->K;\n+ auto p = 0;\n+ while (p < par_size && (X_N[p] == this->bb[p])) p++;\n+\n+ return p == par_size;\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "new_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "diff": "@@ -23,12 +23,11 @@ public:\nvirtual ~Encoder_BCH();\n- const std::vector<uint32_t>& get_info_bits_pos();\n-\n- bool is_sys() const;\n+ bool is_codeword(const B *X_N);\nprotected:\nvoid _encode(const B *U_K, B *X_N, const int frame_id);\n+ void __encode(const B *U_K, B *bb);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the 'is_codeword()', 'is_sys()' and 'get_info_bits_pos()' methods to the BCH encoder.
8,483
30.01.2018 16:59:27
-3,600
afcf08997256fe06ff1088200ad94e01a182c44a
Fix decoder TPC
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -27,12 +27,13 @@ Decoder_chase_pyndiah<B,R>\nalpha (alpha_ ),\nn_least_reliable_positions(n_least_reliable_positions_ ),\nleast_reliable_pos (n_least_reliable_positions ),\n- hard_Rprime (std::max(hiho_r.get_N(), hiho_c.get_N()) ),\n+ hard_Rprime (std::max(hiho_r.get_N(), hiho_c.get_N()) +1 ), // +1 for parity bit if any\nn_test_vectors ((int)1 << n_least_reliable_positions ),\ntest_vect (n_test_vectors * hard_Rprime.size() ),\nmetrics (n_test_vectors ),\nn_competitors (n_competitors_ ? n_competitors_ : n_test_vectors),\n- competitors (n_test_vectors )\n+ competitors (n_test_vectors ),\n+ Y_N_cha_i (pi.get_core().get_size() )\n{\nconst std::string name = \"Decoder_chase_pyndiah\";\nthis->set_name(name);\n@@ -60,11 +61,13 @@ Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::_decode(const R *Y_N, int return_K_siso)\n+::_decode(const R *Y_N_cha, int return_K_siso)\n{\nconst int n_cols = this->hiho_r.get_N() + (this->parity_extended ? 1 : 0);\nconst int n_rows = this->hiho_c.get_N() + (this->parity_extended ? 1 : 0);\n+ this->pi.interleave(Y_N_cha, this->Y_N_cha_i.data(), 0, 1); // interleave data from the channel\n+\nfor (int i = 0; i < this->n_ite; i++)\n{\n@@ -72,30 +75,28 @@ void Decoder_chase_pyndiah<B,R>\n// decode each col\nfor (int j = 0; j < n_cols; j++)\n- _decode_row_siso(Y_N, this->Y_N_pi.data() + j*n_rows, this->Y_N_pi.data() + j*n_rows, this->hiho_c, n_rows); // overwrite Y_N_pi\n+ _decode_row_siso(Y_N_cha_i.data() + j*n_rows, this->Y_N_pi.data() + j*n_rows, this->Y_N_pi.data() + j*n_rows, this->hiho_c, n_rows); // overwrite Y_N_pi\nthis->pi.deinterleave(this->Y_N_pi.data(), this->Y_N_i.data(), 0, 1); // rows go back as columns\n// decode each row\n-\nif (i < this->n_ite -1 || (return_K_siso != 0 && return_K_siso != 1))\n{\nfor (int j = 0; j < n_rows; j++)\n- {\n- _decode_row_siso(Y_N, this->Y_N_i.data() + j*n_cols, this->Y_N_i.data() + j*n_cols, this->hiho_r, n_cols); // overwrite Y_N_i\n- }\n+ _decode_row_siso(Y_N_cha + j*n_cols, this->Y_N_i.data() + j*n_cols, this->Y_N_i.data() + j*n_cols, this->hiho_r, n_cols); // overwrite Y_N_i\n}\nelse if(return_K_siso == 0)\n{\nfor (int j = 0; j < this->hiho_c.get_K(); j++)\n- _decode_row_siho(Y_N, this->Y_N_i.data() + j*n_cols, this->V_K_i.data() + j*this->hiho_r.get_K(), this->hiho_r, n_cols, true);\n+ _decode_row_siho(Y_N_cha + j*n_cols, this->Y_N_i.data() + j*n_cols, this->V_K_i.data() + j*this->hiho_r.get_K(), this->hiho_r, n_cols, true);\n}\nelse if (return_K_siso == 1)\n{\nfor (int j = 0; j < n_cols; j++)\n- _decode_row_siho(Y_N, this->Y_N_i.data() + j*n_cols, this->V_N_i.data() + j*n_cols, this->hiho_r, n_cols, false);\n+ _decode_row_siho(Y_N_cha + j*n_cols, this->Y_N_i.data() + j*n_cols, this->V_N_i.data() + j*n_cols, this->hiho_r, n_cols, false);\n}\n+\n}\n}\n@@ -213,7 +214,7 @@ void Decoder_chase_pyndiah<B,R>\n}\n}\n- // reorder metrics -> decided word is at metric position\n+ // reorder metrics -> decided word is at first position of copetitors list\nfor (int c = 0; c < n_test_vectors; c++)\n{\ncompetitors[c].metric = metrics[c];\n@@ -260,8 +261,6 @@ void Decoder_chase_pyndiah<B,R>\nif (DB) // if DB is a 1\nreliability = -reliability; // set as negative\n-\n- R_dec[i] = R_cha[i] + alpha * (reliability - R_prime[i]);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -36,6 +36,8 @@ protected:\nconst int n_competitors;\nstd::vector<info> competitors; // map of the competitor metric and its related test vector position\n+ std::vector<R> Y_N_cha_i;\n+\npublic:\nDecoder_chase_pyndiah(const int& n_ite,\n@@ -47,7 +49,7 @@ public:\nconst int n_competitors = 0);\nprotected:\n- void _decode(const R *Y_N, int return_K_siso); // return_K_siso = 0 then hard decode and fill V_K_i else if = 1 then hard decode and fill V_H_i else soft decode and fill nothing\n+ void _decode(const R *Y_N, int return_K_siso); // return_K_siso = 0 then hard decode and fill V_K_i else if = 1 then hard decode and fill V_H_i else soft decode and fill Y_N_i\nvoid _decode_row_siso(const R *R_cha, const R *R_prime, R *R_dec, Decoder_HIHO<B> &hiho, const int size); // size is length with parity bit if any\nvoid _decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size, const bool return_K = true);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "new_path": "src/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "diff": "@@ -107,7 +107,7 @@ void Decoder_turbo_product_code<B, R>\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(Y_N1, false);\n+ this->_decode(Y_N1, 2);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -128,7 +128,7 @@ void Decoder_turbo_product_code<B, R>\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(Y_N, true);\n+ this->_decode(Y_N, 0);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -149,7 +149,7 @@ void Decoder_turbo_product_code<B, R>\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(Y_N, false);\n+ this->_decode(Y_N, 1);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix decoder TPC
8,483
30.01.2018 17:04:57
-3,600
ebd0b74bb20ae97f437558a13bead27c263db439
Fix Decoder_chase_pyndiah
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -261,6 +261,8 @@ void Decoder_chase_pyndiah<B,R>\nif (DB) // if DB is a 1\nreliability = -reliability; // set as negative\n+\n+ R_dec[i] = R_cha[i] + alpha * (reliability - R_prime[i]);\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix Decoder_chase_pyndiah
8,483
30.01.2018 17:21:09
-3,600
b29ea4909f13e17d453b69a84dd8cf096451f474
Fix parity computation in TPC Encoder
[ { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.cpp", "new_path": "src/Module/Encoder/Turbo_product_code/Encoder_turbo_product_code.cpp", "diff": "#include <sstream>\n#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Perf/compute_parity.h\"\n#include \"Encoder_turbo_product_code.hpp\"\n@@ -68,7 +69,7 @@ void Encoder_turbo_product_code<B>\nthis->enc_r.encode(U_K + j*n_cols_K, this->X_N_i.data() + j*n_cols_N); // last parity bit ignored if any\nif (this->parity_extended)\n- this->X_N_i[(j+1)*n_cols_N -1] = 0; // parity null for a BCH\n+ this->X_N_i[(j+1)*n_cols_N -1] = tools::compute_parity(this->X_N_i.data() + j*n_cols_N, n_cols_N -1);\n}\npi.interleave(this->X_N_i.data(), X_N, 0);\n@@ -79,7 +80,7 @@ void Encoder_turbo_product_code<B>\nthis->enc_c.encode(X_N + j*n_rows_N, this->X_N_i.data() + j*n_rows_N); // last parity bit ignored if any\nif (this->parity_extended)\n- this->X_N_i[(j+1)*n_rows_N -1] = 0; // parity null for a BCH\n+ this->X_N_i[(j+1)*n_rows_N -1] = tools::compute_parity(this->X_N_i.data() + j*n_rows_N, n_rows_N -1);\n}\npi.deinterleave(this->X_N_i.data(), X_N, 0);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix parity computation in TPC Encoder
8,483
31.01.2018 08:39:16
-3,600
bd1e8ad190399ef3a79493ff59ad92db66b73559
Fix chase pyndiah to work with BCH
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -75,7 +75,11 @@ void Decoder_chase_pyndiah<B,R>\n// decode each col\nfor (int j = 0; j < n_cols; j++)\n- _decode_row_siso(Y_N_cha_i.data() + j*n_rows, this->Y_N_pi.data() + j*n_rows, this->Y_N_pi.data() + j*n_rows, this->hiho_c, n_rows); // overwrite Y_N_pi\n+ _decode_row_siso(Y_N_cha_i .data() + j*n_rows,\n+ this->Y_N_pi.data() + j*n_rows,\n+ this->Y_N_pi.data() + j*n_rows,\n+ this->hiho_c,\n+ n_rows); // overwrite Y_N_pi\nthis->pi.deinterleave(this->Y_N_pi.data(), this->Y_N_i.data(), 0, 1); // rows go back as columns\n@@ -84,17 +88,29 @@ void Decoder_chase_pyndiah<B,R>\nif (i < this->n_ite -1 || (return_K_siso != 0 && return_K_siso != 1))\n{\nfor (int j = 0; j < n_rows; j++)\n- _decode_row_siso(Y_N_cha + j*n_cols, this->Y_N_i.data() + j*n_cols, this->Y_N_i.data() + j*n_cols, this->hiho_r, n_cols); // overwrite Y_N_i\n+ _decode_row_siso(Y_N_cha + j*n_cols,\n+ this->Y_N_i.data() + j*n_cols,\n+ this->Y_N_i.data() + j*n_cols,\n+ this->hiho_r,\n+ n_cols); // overwrite Y_N_i\n}\nelse if(return_K_siso == 0)\n{\nfor (int j = 0; j < this->hiho_c.get_K(); j++)\n- _decode_row_siho(Y_N_cha + j*n_cols, this->Y_N_i.data() + j*n_cols, this->V_K_i.data() + j*this->hiho_r.get_K(), this->hiho_r, n_cols, true);\n+ _decode_row_siho(Y_N_cha + j*n_cols,\n+ this->Y_N_i.data() + (j + this->hiho_c.get_N() - this->hiho_c.get_K())*n_cols,\n+ this->V_K_i.data() + j*this->hiho_r.get_K(),\n+ this->hiho_r, n_cols,\n+ true);\n}\nelse if (return_K_siso == 1)\n{\nfor (int j = 0; j < n_cols; j++)\n- _decode_row_siho(Y_N_cha + j*n_cols, this->Y_N_i.data() + j*n_cols, this->V_N_i.data() + j*n_cols, this->hiho_r, n_cols, false);\n+ _decode_row_siho(Y_N_cha + j*n_cols,\n+ this->Y_N_i.data() + j*n_cols,\n+ this->V_N_i.data() + j*n_cols,\n+ this->hiho_r, n_cols,\n+ false);\n}\n}\n@@ -107,12 +123,17 @@ void Decoder_chase_pyndiah<B,R>\n{\nif (_decode_chase(R_prime, hiho, size))\n{ // syndrome ok, R_prime is a code word, then copy its hard decided version and exit the function\n- std::copy(hard_Rprime.data(), hard_Rprime.data() + (return_K ? hiho.get_K() : size), R_dec);\n+ std::copy(hard_Rprime.data() + (return_K ? hiho.get_N() - hiho.get_K() : 0),\n+ hard_Rprime.data() + (return_K ? hiho.get_N() : size),\n+ R_dec);\nreturn;\n}\nauto* DW = test_vect.data() + competitors.front().pos;\n- std::copy(DW, DW + (return_K ? hiho.get_K() : size), R_dec);\n+\n+ std::copy(DW + (return_K ? hiho.get_N() - hiho.get_K() : 0),\n+ DW + (return_K ? hiho.get_N() : size),\n+ R_dec);\n}\ntemplate <typename B, typename R>\n@@ -139,12 +160,6 @@ bool Decoder_chase_pyndiah<B,R>\n// else\n// parity_diff = false;\n- // if (! dec_hiho->check_syndrome(hard_Rprime.data()) && ! parity_diff)\n- // {\n- // // std::cerr << \"(II) check_syndrome : \" << std::endl;\n- // return true;\n- // }\n-\nfind_least_reliable_pos(R_prime, hiho.get_N()); // without parity bit if any\ncompute_test_vectors (hiho, size );\ncompute_metrics (R_prime, size );\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -55,7 +55,6 @@ protected:\nvoid _decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size, const bool return_K = true);\nbool _decode_chase (const R *R_prime, Decoder_HIHO<B> &hiho, const int size);\n- B compute_parity (const B* data, const int size);\nvoid find_least_reliable_pos(const R* R_prime, const int size);\nvoid compute_test_vectors (Decoder_HIHO<B> &hiho, const int size);\nvoid compute_metrics (const R* R_prime, const int size);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix chase pyndiah to work with BCH
8,483
31.01.2018 09:13:03
-3,600
7d6582a10306b050e7e8bf631301b9d680d4dc7e
Add the info bits positions as decoder TPC input to return the info bits whatever is there positions
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "diff": "@@ -176,8 +176,10 @@ void Decoder_turbo_product_code::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_turbo_product_code::parameters\n::build(const module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i,\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c,\nmodule::Encoder <B> *encoder) const\n{\ntry\n@@ -188,7 +190,9 @@ module::Decoder_SIHO<B,Q>* Decoder_turbo_product_code::parameters\n{\nif (this->type == \"TPC\")\n{\n- if (this->implem == \"STD\") return new module::Decoder_chase_pyndiah<B,Q>(this->n_ite, itl, hiho_n, hiho_i, alpha, n_least_reliable_positions, n_competitors);\n+ if (this->implem == \"STD\")\n+ return new module::Decoder_chase_pyndiah<B,Q>(this->n_ite, itl, hiho_r, hiho_c, enc_r.get_info_bits_pos(), enc_r.get_info_bits_pos(),\n+ alpha, n_least_reliable_positions, n_competitors);\n}\n}\n@@ -198,8 +202,10 @@ module::Decoder_SIHO<B,Q>* Decoder_turbo_product_code::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_turbo_product_code::parameters\n::build_siso(const module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i) const\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c) const\n{\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n@@ -208,50 +214,54 @@ template <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_turbo_product_code\n::build(const parameters &params,\nconst module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i,\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c,\nmodule::Encoder <B> *encoder)\n{\n- return params.template build<B,Q>(itl, hiho_n, hiho_i, encoder);\n+ return params.template build<B,Q>(itl, hiho_r, hiho_c, enc_r, enc_c, encoder);\n}\ntemplate <typename B, typename Q>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_turbo_product_code\n::build_siso(const parameters &params,\nconst module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i)\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c)\n{\n- return params.template build_siso<B,Q>(itl, hiho_n, hiho_i);\n+ return params.template build_siso<B,Q>(itl, hiho_r, hiho_c, enc_r, enc_c);\n}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_8 ,Q_8 >(const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, module::Encoder<B_8 >*) const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_16,Q_16>(const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&, module::Encoder<B_16>*) const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_32,Q_32>(const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&, module::Encoder<B_32>*) const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_64,Q_64>(const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&, module::Encoder<B_64>*) const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, module::Encoder<B_8 >*);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::build<B_16,Q_16>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&, module::Encoder<B_16>*);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::build<B_32,Q_32>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&, module::Encoder<B_32>*);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::build<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&, module::Encoder<B_64>*);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_8 ,Q_8 >(const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, module::Encoder<B_8 >&, module::Encoder<B_8 >&, module::Encoder<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_16,Q_16>(const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&, module::Encoder<B_16>&, module::Encoder<B_16>&, module::Encoder<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_32,Q_32>(const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&, module::Encoder<B_32>&, module::Encoder<B_32>&, module::Encoder<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B_64,Q_64>(const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&, module::Encoder<B_64>&, module::Encoder<B_64>&, module::Encoder<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, module::Encoder<B_8 >&, module::Encoder<B_8 >&, module::Encoder<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::build<B_16,Q_16>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&, module::Encoder<B_16>&, module::Encoder<B_16>&, module::Encoder<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::build<B_32,Q_32>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&, module::Encoder<B_32>&, module::Encoder<B_32>&, module::Encoder<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::build<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&, module::Encoder<B_64>&, module::Encoder<B_64>&, module::Encoder<B_64>*);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B,Q>(const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&, module::Encoder<B>*) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::build<B,Q>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&, module::Encoder<B>*);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::parameters::build<B,Q>(const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&, module::Encoder<B>&, module::Encoder<B>&, module::Encoder<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::build<B,Q>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&, module::Encoder<B>&, module::Encoder<B>&, module::Encoder<B>*);\n#endif\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_8 ,Q_8 >(const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_16,Q_16>(const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_32,Q_32>(const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_64,Q_64>(const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_8 ,Q_8 >(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&);\n-template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_16,Q_16>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&);\n-template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_32,Q_32>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&);\n-template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_8 ,Q_8 >(const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, module::Encoder<B_8 >&, module::Encoder<B_8 >&) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_16,Q_16>(const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&, module::Encoder<B_16>&, module::Encoder<B_16>&) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_32,Q_32>(const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&, module::Encoder<B_32>&, module::Encoder<B_32>&) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B_64,Q_64>(const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&, module::Encoder<B_64>&, module::Encoder<B_64>&) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_8 ,Q_8 >(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, aff3ct::module::Decoder_HIHO<B_8 >&, module::Encoder<B_8 >&, module::Encoder<B_8 >&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_16,Q_16>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_16>&, aff3ct::module::Decoder_HIHO<B_16>&, aff3ct::module::Decoder_HIHO<B_16>&, module::Encoder<B_16>&, module::Encoder<B_16>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_32,Q_32>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_32>&, aff3ct::module::Decoder_HIHO<B_32>&, aff3ct::module::Decoder_HIHO<B_32>&, module::Encoder<B_32>&, module::Encoder<B_32>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_HIHO<B_64>&, aff3ct::module::Decoder_HIHO<B_64>&, module::Encoder<B_64>&, module::Encoder<B_64>&);\n#else\n-template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B,Q>(const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B,Q>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&);\n+template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::parameters::build_siso<B,Q>(const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&, module::Encoder<B>&, module::Encoder<B>&) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product_code::build_siso<B,Q>(const aff3ct::factory::Decoder_turbo_product_code::parameters&, const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_HIHO<B>&, aff3ct::module::Decoder_HIHO<B>&, module::Encoder<B>&, module::Encoder<B>&);\n#endif\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.hpp", "new_path": "src/Factory/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.hpp", "diff": "@@ -54,29 +54,37 @@ struct Decoder_turbo_product_code : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\nmodule::Decoder_SIHO<B,Q>* build(const module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i,\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c,\nmodule::Encoder <B> *encoder = nullptr) const;\ntemplate <typename B = int, typename Q = float>\nmodule::Decoder_SISO_SIHO<B,Q>* build_siso(const module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i) const;\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c) const;\n};\ntemplate <typename B = int, typename Q = float>\nstatic module::Decoder_SIHO<B,Q>* build(const parameters &params,\nconst module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i,\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c,\nmodule::Encoder <B> *encoder = nullptr);\ntemplate <typename B = int, typename Q = float>\nstatic module::Decoder_SISO_SIHO<B,Q>* build_siso(const parameters &params,\nconst module::Interleaver <Q> &itl,\n- module::Decoder_HIHO<B> &hiho_n,\n- module::Decoder_HIHO<B> &hiho_i);\n+ module::Decoder_HIHO<B> &hiho_r,\n+ module::Decoder_HIHO<B> &hiho_c,\n+ module::Encoder <B> &enc_r,\n+ module::Encoder <B> &enc_c);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_product_code/Codec_turbo_product_code.cpp", "new_path": "src/Module/Codec/Turbo_product_code/Codec_turbo_product_code.cpp", "diff": "@@ -74,13 +74,15 @@ Codec_turbo_product_code<B,Q>\ndec_bch = factory::Decoder_BCH::build_hiho<B,Q>(*dec_params.sub, GF_poly);\ntry\n{\n- auto decoder_siso_siho = factory::Decoder_turbo_product_code::build_siso<B,Q>(dec_params, this->get_interleaver_llr(), *dec_bch, *dec_bch);\n+ auto decoder_siso_siho = factory::Decoder_turbo_product_code::build_siso<B,Q>(dec_params, this->get_interleaver_llr(),\n+ *dec_bch, *dec_bch, *enc_bch, *enc_bch);\nthis->set_decoder_siso(decoder_siso_siho);\nthis->set_decoder_siho(decoder_siso_siho);\n}\ncatch (tools::cannot_allocate const&)\n{\n- this->set_decoder_siho(factory::Decoder_turbo_product_code::build<B,Q>(dec_params, this->get_interleaver_llr(), *dec_bch, *dec_bch, encoder_tpc));\n+ this->set_decoder_siho(factory::Decoder_turbo_product_code::build<B,Q>(dec_params, this->get_interleaver_llr(),\n+ *dec_bch, *dec_bch, *enc_bch, *enc_bch, encoder_tpc));\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -18,11 +18,13 @@ Decoder_chase_pyndiah<B,R>\nconst Interleaver<R> &pi,\nDecoder_HIHO<B> &hiho_r,\nDecoder_HIHO<B> &hiho_c,\n+ const std::vector<uint32_t> &info_bits_pos_r,\n+ const std::vector<uint32_t> &info_bits_pos_c,\nconst R alpha_,\nconst int n_least_reliable_positions_,\nconst int n_competitors_)\n: Decoder(hiho_r.get_K() * hiho_c.get_K(), pi.get_core().get_size(), hiho_r.get_n_frames(), hiho_r.get_simd_inter_frame_level()),\n- Decoder_turbo_product_code<B,R>(n_ite, pi, hiho_r, hiho_c),\n+ Decoder_turbo_product_code<B,R>(n_ite, pi, hiho_r, hiho_c, info_bits_pos_r, info_bits_pos_c),\nalpha (alpha_ ),\nn_least_reliable_positions(n_least_reliable_positions_ ),\n@@ -97,19 +99,27 @@ void Decoder_chase_pyndiah<B,R>\nelse if(return_K_siso == 0)\n{\nfor (int j = 0; j < this->hiho_c.get_K(); j++)\n- _decode_row_siho(Y_N_cha + j*n_cols,\n- this->Y_N_i.data() + (j + this->hiho_c.get_N() - this->hiho_c.get_K())*n_cols,\n+ {\n+ auto pos = this->info_bits_pos_c[j];\n+\n+ _decode_row_siho(Y_N_cha + pos*n_cols,\n+ this->Y_N_i.data() + pos*n_cols,\nthis->V_K_i.data() + j*this->hiho_r.get_K(),\n- this->hiho_r, n_cols,\n+ this->hiho_r,\n+ n_cols,\n+ this->info_bits_pos_r,\ntrue);\n}\n+ }\nelse if (return_K_siso == 1)\n{\nfor (int j = 0; j < n_cols; j++)\n_decode_row_siho(Y_N_cha + j*n_cols,\nthis->Y_N_i.data() + j*n_cols,\nthis->V_N_i.data() + j*n_cols,\n- this->hiho_r, n_cols,\n+ this->hiho_r,\n+ n_cols,\n+ this->info_bits_pos_r,\nfalse);\n}\n@@ -119,21 +129,35 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::_decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size, const bool return_K)\n+::_decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size,\n+ const std::vector<uint32_t>& info_bits_pos, const bool return_K)\n{\nif (_decode_chase(R_prime, hiho, size))\n{ // syndrome ok, R_prime is a code word, then copy its hard decided version and exit the function\n- std::copy(hard_Rprime.data() + (return_K ? hiho.get_N() - hiho.get_K() : 0),\n- hard_Rprime.data() + (return_K ? hiho.get_N() : size),\n- R_dec);\n+\n+ if (return_K)\n+ {\n+ for (int j = 0; j < hiho.get_K(); j++)\n+ R_dec[j] = hard_Rprime[info_bits_pos[j]];\n+ }\n+ else\n+ {\n+ std::copy(hard_Rprime.data(), hard_Rprime.data() + size, R_dec);\n+ }\nreturn;\n}\nauto* DW = test_vect.data() + competitors.front().pos;\n- std::copy(DW + (return_K ? hiho.get_N() - hiho.get_K() : 0),\n- DW + (return_K ? hiho.get_N() : size),\n- R_dec);\n+ if (return_K)\n+ {\n+ for (int j = 0; j < hiho.get_K(); j++)\n+ R_dec[j] = DW[info_bits_pos[j]];\n+ }\n+ else\n+ {\n+ std::copy(DW, DW + size, R_dec);\n+ }\n}\ntemplate <typename B, typename R>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -44,6 +44,8 @@ public:\nconst Interleaver<R> &pi,\nDecoder_HIHO<B> &hiho_r,\nDecoder_HIHO<B> &hiho_c,\n+ const std::vector<uint32_t> &info_bits_pos_r,\n+ const std::vector<uint32_t> &info_bits_pos_c,\nconst R alpha = 0.5,\nconst int n_least_reliable_positions = 2,\nconst int n_competitors = 0);\n@@ -52,7 +54,8 @@ protected:\nvoid _decode(const R *Y_N, int return_K_siso); // return_K_siso = 0 then hard decode and fill V_K_i else if = 1 then hard decode and fill V_H_i else soft decode and fill Y_N_i\nvoid _decode_row_siso(const R *R_cha, const R *R_prime, R *R_dec, Decoder_HIHO<B> &hiho, const int size); // size is length with parity bit if any\n- void _decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size, const bool return_K = true);\n+ void _decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size,\n+ const std::vector<uint32_t>& info_bits_pos, const bool return_K = true);\nbool _decode_chase (const R *R_prime, Decoder_HIHO<B> &hiho, const int size);\nvoid find_least_reliable_pos(const R* R_prime, const int size);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "new_path": "src/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.cpp", "diff": "@@ -18,7 +18,9 @@ Decoder_turbo_product_code<B,R>\n::Decoder_turbo_product_code(const int& n_ite,\nconst Interleaver<R> &pi,\nDecoder_HIHO<B> &hiho_r,\n- Decoder_HIHO<B> &hiho_c)\n+ Decoder_HIHO<B> &hiho_c,\n+ const std::vector<uint32_t> &info_bits_pos_r,\n+ const std::vector<uint32_t> &info_bits_pos_c)\n: Decoder (hiho_r.get_K() * hiho_c.get_K(), pi.get_core().get_size(), hiho_r.get_n_frames(), hiho_r.get_simd_inter_frame_level()),\nDecoder_SISO_SIHO<B,R>(hiho_r.get_K() * hiho_c.get_K(), pi.get_core().get_size(), hiho_r.get_n_frames(), hiho_r.get_simd_inter_frame_level()),\nn_ite (n_ite ),\n@@ -26,6 +28,9 @@ Decoder_turbo_product_code<B,R>\nhiho_r(hiho_r),\nhiho_c(hiho_c),\n+ info_bits_pos_r(info_bits_pos_r),\n+ info_bits_pos_c(info_bits_pos_c),\n+\nparity_extended(this->N == (hiho_r.get_N() +1) * (hiho_c.get_N() +1)),\nY_N_i (this->N),\n@@ -71,6 +76,23 @@ Decoder_turbo_product_code<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+ if ((int)info_bits_pos_r.size() != hiho_r.get_K())\n+ {\n+ std::stringstream message;\n+ message << \"'info_bits_pos_r.size()' has to be equal to 'hiho_r.get_K()' \"\n+ << \"('info_bits_pos_r.size()' = \" << info_bits_pos_r.size()\n+ << \", 'hiho_r.get_K()' = \" << hiho_r.get_K() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if ((int)info_bits_pos_c.size() != hiho_c.get_K())\n+ {\n+ std::stringstream message;\n+ message << \"'info_bits_pos_c.size()' has to be equal to 'hiho_c.get_K()' \"\n+ << \"('info_bits_pos_c.size()' = \" << info_bits_pos_c.size()\n+ << \", 'hiho_c.get_K()' = \" << hiho_c.get_K() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\nif (this->K != hiho_r.get_K() * hiho_c.get_K())\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.hpp", "new_path": "src/Module/Decoder/Turbo_product_code/Decoder_turbo_product_code.hpp", "diff": "@@ -20,6 +20,9 @@ protected:\nDecoder_HIHO<B> &hiho_r; // row decoder\nDecoder_HIHO<B> &hiho_c; // col decoder\n+ const std::vector<uint32_t> &info_bits_pos_r;\n+ const std::vector<uint32_t> &info_bits_pos_c;\n+\nconst bool parity_extended;\nstd::vector<R> Y_N_i;\n@@ -31,7 +34,9 @@ public:\nDecoder_turbo_product_code(const int& n_ite,\nconst Interleaver<R> &pi,\nDecoder_HIHO<B> &hiho_r,\n- Decoder_HIHO<B> &hiho_c);\n+ Decoder_HIHO<B> &hiho_c,\n+ const std::vector<uint32_t> &info_bits_pos_r,\n+ const std::vector<uint32_t> &info_bits_pos_c);\nvirtual ~Decoder_turbo_product_code();\nprotected:\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the info bits positions as decoder TPC input to return the info bits whatever is there positions
8,483
31.01.2018 09:19:52
-3,600
040479fc448753d5201e6520a0b47861f3b0b2c6
Change std::signobit in a simple comparison to cover integral data types
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product_code/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -246,7 +246,7 @@ void Decoder_chase_pyndiah<B,R>\nfor (int i = 0; i < size; i++)\n{\n- B sign = std::signbit(R_prime[i]) ? 1 : 0;\n+ B sign = (R_prime[i] < 0) ? 1 : 0;\nif (sign ^ test_vect[tv_off + i])\nmetrics[c] += std::abs(R_prime[i]);\n" } ]
C++
MIT License
aff3ct/aff3ct
Change std::signobit in a simple comparison to cover integral data types
8,483
31.01.2018 11:50:02
-3,600
603b266b2ef1776e2018d5545def79a80034791f
Set back seed automatically for channel
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "new_path": "src/Simulation/BFER/Standard/BFER_std.cpp", "diff": "@@ -203,7 +203,7 @@ module::Channel<R>* BFER_std<B,R,Q>\nconst auto seed_chn = rd_engine_seed[tid]();\nauto params_chn = this->params_BFER_std.chn->clone();\n- params_chn->seed = 0;//seed_chn;\n+ params_chn->seed = seed_chn;\nauto c = params_chn->template build<R>();\ndelete params_chn;\nreturn c;\n" } ]
C++
MIT License
aff3ct/aff3ct
Set back seed automatically for channel
8,483
31.01.2018 15:06:37
-3,600
1e83e9b79459c4aad9a64e7ed107be840db5bb88
Fix decoder TPC by removing metrics in double to select competitors
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -17,7 +17,7 @@ Decoder_turbo_product::parameters\nsub(new Decoder_BCH::parameters(prefix+\"-sub\")),\nitl(new Interleaver::parameters(\"itl\"))\n{\n- this->type = \"TPC\";\n+ this->type = \"CP\";\nthis->implem = \"STD\";\n}\n@@ -83,9 +83,7 @@ void Decoder_turbo_product::parameters\nreq_args.erase({pi+\"-size\" });\nopt_args.erase({pi+\"-fra\", \"F\"});\n- opt_args[{p+\"-type\", \"D\"}][2] += \", TPC\";\n-\n- opt_args[{p+\"-implem\"}].push_back(\"STD\");\n+ opt_args[{p+\"-type\", \"D\"}][2] += \", CP\";\nopt_args[{p+\"-ite\", \"i\"}] =\n{\"strictly_positive_int\",\n@@ -188,7 +186,7 @@ module::Decoder_SIHO<B,Q>* Decoder_turbo_product::parameters\n}\ncatch (tools::cannot_allocate const&)\n{\n- if (this->type == \"TPC\")\n+ if (this->type == \"CP\")\n{\nif (this->implem == \"STD\")\nreturn new module::Decoder_chase_pyndiah<B,Q>(this->n_ite, itl, hiho_r, hiho_c, enc_r.get_info_bits_pos(), enc_r.get_info_bits_pos(),\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n+#define NDEBUG\n+\ntemplate <typename B, typename R>\nDecoder_chase_pyndiah<B,R>\n::Decoder_chase_pyndiah(const int& n_ite,\n@@ -77,11 +79,19 @@ void Decoder_chase_pyndiah<B,R>\n// decode each col\nfor (int j = 0; j < n_cols; j++)\n+ {\n+#ifndef NDEBUG\n+ std::cerr << std::endl;\n+ std::cerr << std::endl;\n+ std::cerr << std::endl;\n+ std::cerr << \"(II) col : \" << j << std::endl;\n+#endif\n_decode_row_siso(Y_N_cha_i .data() + j*n_rows,\nthis->Y_N_pi.data() + j*n_rows,\nthis->Y_N_pi.data() + j*n_rows,\nthis->hiho_c,\nn_rows); // overwrite Y_N_pi\n+ }\nthis->pi.deinterleave(this->Y_N_pi.data(), this->Y_N_i.data(), 0, 1); // rows go back as columns\n@@ -90,12 +100,20 @@ void Decoder_chase_pyndiah<B,R>\nif (i < this->n_ite -1 || (return_K_siso != 0 && return_K_siso != 1))\n{\nfor (int j = 0; j < n_rows; j++)\n+ {\n+#ifndef NDEBUG\n+ std::cerr << std::endl;\n+ std::cerr << std::endl;\n+ std::cerr << std::endl;\n+ std::cerr << \"(II) row : \" << j << std::endl;\n+#endif\n_decode_row_siso(Y_N_cha + j*n_cols,\nthis->Y_N_i.data() + j*n_cols,\nthis->Y_N_i.data() + j*n_cols,\nthis->hiho_r,\nn_cols); // overwrite Y_N_i\n}\n+ }\nelse if(return_K_siso == 0)\n{\nfor (int j = 0; j < this->hiho_c.get_K(); j++)\n@@ -171,14 +189,39 @@ void Decoder_chase_pyndiah<B,R>\n}\ncompute_reliability(R_cha, R_prime, R_dec, size);\n+\n+#ifndef NDEBUG\n+ std::cerr << \"(II) R_dec : \" << std::endl;\n+\n+ for (int i = 0; i < size; i++)\n+ std::cerr << R_dec[i] << \" \";\n+ std::cerr << std::endl;\n+#endif\n}\ntemplate <typename B, typename R>\nbool Decoder_chase_pyndiah<B,R>\n::_decode_chase(const R *R_prime, Decoder_HIHO<B> &hiho, const int size)\n{\n+\ntools::hard_decide(R_prime, hard_Rprime.data(), size);\n+#ifndef NDEBUG\n+ std::cerr << \"(II) R_prime : \" << std::endl;\n+ for (int i = 0; i < size; i++)\n+ {\n+ std::cerr << R_prime[i] << \" \";\n+ }\n+ std::cerr << std::endl;\n+\n+ std::cerr << \"(II) hard_Rprime : \" << std::endl;\n+ for (unsigned i = 0; hard_Rprime.size() > i; i++)\n+ {\n+ std::cerr << hard_Rprime[i] << \" \";\n+ }\n+ std::cerr << std::endl;\n+#endif\n+\n// if (this->parity_extended)\n// parity_diff = tools::compute_parity(hard_Rprime.data()) ^ hard_Rprime[N -1];\n// else\n@@ -188,6 +231,28 @@ bool Decoder_chase_pyndiah<B,R>\ncompute_test_vectors (hiho, size );\ncompute_metrics (R_prime, size );\n+#ifndef NDEBUG\n+ std::cerr << \"(II) least_reliable_pos : \" << std::endl;\n+ for (unsigned i = 0; i < least_reliable_pos.size(); i++)\n+ {\n+ std::cerr << i << \". (\" << least_reliable_pos[i].pos << \", \" << least_reliable_pos[i].metric << \")\" << std::endl;\n+ }\n+\n+ std::cerr << \"(II) Metriques : \" << std::endl;\n+ for (unsigned i = 0; i < metrics.size(); i++)\n+ {\n+ std::cerr << i << \". \" << metrics[i] << std::endl;\n+ }\n+\n+ auto* DW = test_vect.data() + competitors.front().pos;\n+ std::cerr << \"(II) DW : \" << std::endl;\n+ for (int i = 0; i < size; i++)\n+ {\n+ std::cerr << DW[i] << \" \";\n+ }\n+ std::cerr << std::endl;\n+#endif\n+\nreturn false;\n}\n@@ -253,7 +318,7 @@ void Decoder_chase_pyndiah<B,R>\n}\n}\n- // reorder metrics -> decided word is at first position of copetitors list\n+ // reorder metrics -> decided word is at first position of competitors list\nfor (int c = 0; c < n_test_vectors; c++)\n{\ncompetitors[c].metric = metrics[c];\n@@ -261,6 +326,43 @@ void Decoder_chase_pyndiah<B,R>\n}\nstd::sort(competitors.begin(), competitors.end(), [](const info& a, const info& b) { return a.metric < b.metric; });\n+\n+\n+ // remove duplicated metrics\n+ unsigned start_pos = 0;\n+ while ((int)competitors.size() > n_competitors && start_pos < (competitors.size() -2))\n+ {\n+ auto it = competitors.begin();\n+ std::advance(it, start_pos +1);\n+\n+ // remove all duplications of the metric at position 'start_pos'\n+ while (it != competitors.end())\n+ {\n+ if (it->metric == competitors[start_pos].metric)\n+ {\n+ it = competitors.erase(it);\n+\n+ if ((int)competitors.size() == n_competitors)\n+ break;\n+ }\n+ else\n+ it++;\n+ }\n+\n+ start_pos++; // try with the next one\n+ }\n+\n+ competitors.resize(n_test_vectors);\n+\n+\n+#ifndef NDEBUG\n+ std::cerr << \"(II) competitors : \" << std::endl;\n+ for (unsigned i = 0; i < competitors.size(); i++)\n+ {\n+ std::cerr << i << \". \" << competitors[i].pos << \" \" << competitors[i].metric << std::endl;\n+ }\n+ std::cerr << std::endl;\n+#endif\n}\ntemplate <typename B, typename R>\n@@ -272,8 +374,11 @@ void Decoder_chase_pyndiah<B,R>\n// compute beta, the sum of the least reliable position reliabilities in the decided word\nR beta = 0;\nfor (int i = 0; i < n_least_reliable_positions; i++)\n- beta += least_reliable_pos[i].metric;\n+ beta += 2 * least_reliable_pos[i].metric;\n+#ifndef NDEBUG\n+ std::cerr << \"beta = \" << beta << \", alpha = \" << alpha<< \", DW.metric = \" << DW.metric << std::endl;\n+#endif\nfor (int i = 0; i < size; i++)\n{\n@@ -289,11 +394,11 @@ void Decoder_chase_pyndiah<B,R>\nif (j < n_competitors) // then there is a competitor with a different bit at the position i\n{\n- reliability = competitors[j].metric - DW.metric;\n+ reliability = competitors[j].metric - DW.metric; // << mettre calcul avant : competitors[j].metric -= DW.metric >> reliability = competitors[j].metric;\n}\nelse // same bits for each candidates\n{\n- reliability = std::abs(R_prime[i]) + beta - DW.metric;\n+ reliability = std::abs(R_prime[i]) + beta - DW.metric; // << mettre calcul avant : beta -= DW.metric >> reliability = std::abs(R_prime[i]) + beta;\nif (reliability < 0)\nreliability = 0;\n}\n@@ -301,7 +406,14 @@ void Decoder_chase_pyndiah<B,R>\nif (DB) // if DB is a 1\nreliability = -reliability; // set as negative\n+#ifndef NDEBUG\n+ std::cerr << \"Rel: i = \" << i << \", R_prime = \" << R_prime[i] << \", competitors[\" << j << \"].metric = \" << competitors[j].metric;\n+#endif\n+\nR_dec[i] = R_cha[i] + alpha * (reliability - R_prime[i]);\n+#ifndef NDEBUG\n+ std::cerr << \", reliability = \" << reliability << \", R_cha = \" << R_cha[i]<< \", R_dec = \" << R_dec[i] << std::endl;\n+#endif\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix decoder TPC by removing metrics in double to select competitors
8,483
31.01.2018 17:19:10
-3,600
6d3bcdf6664d6aec1a041b8fa50085aa514c4a11
Improve some computations
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -275,8 +275,8 @@ void Decoder_chase_pyndiah<B,R>\nif (val < it->metric)\n{ // R[i] is weak, then save its position\n- least_reliable_pos.erase(least_reliable_pos.end() -1); // remove the last position that is not weak enough\n- least_reliable_pos.insert(it, {val, i});\n+ least_reliable_pos.pop_back(); // remove the last position that is not weak enough\n+ it = least_reliable_pos.insert(it, {val, i});\nbreak;\n}\n}\n@@ -330,7 +330,7 @@ void Decoder_chase_pyndiah<B,R>\n// remove duplicated metrics\nunsigned start_pos = 0;\n- while ((int)competitors.size() > n_competitors && start_pos < (competitors.size() -2))\n+ while ((int)competitors.size() > n_competitors && start_pos < (competitors.size() -1))\n{\nauto it = competitors.begin();\nstd::advance(it, start_pos +1);\n@@ -380,12 +380,16 @@ void Decoder_chase_pyndiah<B,R>\nstd::cerr << \"beta = \" << beta << \", alpha = \" << alpha<< \", DW.metric = \" << DW.metric << std::endl;\n#endif\n+ beta -= DW.metric;\n+\n+ for (int j = 1; j < n_competitors; j++)\n+ competitors[j].metric -= DW.metric;\n+\nfor (int i = 0; i < size; i++)\n{\nconst auto DB = test_vect[DW.pos + i]; // decided bit at the position i\nint j = 1;\n-\nfor (; j < n_competitors; j++)\nif (test_vect[competitors[j].pos + i] != DB)\nbreak;\n@@ -394,11 +398,11 @@ void Decoder_chase_pyndiah<B,R>\nif (j < n_competitors) // then there is a competitor with a different bit at the position i\n{\n- reliability = competitors[j].metric - DW.metric; // << mettre calcul avant : competitors[j].metric -= DW.metric >> reliability = competitors[j].metric;\n+ reliability = competitors[j].metric;\n}\nelse // same bits for each candidates\n{\n- reliability = std::abs(R_prime[i]) + beta - DW.metric; // << mettre calcul avant : beta -= DW.metric >> reliability = std::abs(R_prime[i]) + beta;\n+ reliability = std::abs(R_prime[i]) + beta;\nif (reliability < 0)\nreliability = 0;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve some computations
8,490
01.02.2018 14:31:00
-3,600
86454e7267f71b74ff47c6f11bc1b5a604402c95
Add a build test for the Intel compiler.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -52,6 +52,13 @@ build-linux-gcc-4.8:\nscript:\n- ./ci/build-linux-gcc-4.8.sh\n+build-linux-icpc:\n+ stage: build\n+ tags:\n+ - linux\n+ script:\n+ - ./ci/build-linux-icpc.sh\n+\nbuild-windows-gcc:\nstage: build\ntags:\n" }, { "change_type": "ADD", "old_path": null, "new_path": "ci/build-linux-icpc.sh", "diff": "+#!/bin/bash\n+set -x\n+\n+source /opt/intel/vars-intel.sh\n+mkdir build\n+cd build\n+#cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=icpc -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DENABLE_MKL=ON -DCMAKE_CXX_FLAGS=\"-funroll-loops -march=native -DMULTI_PREC -std=c++11 -Wall -Warray-bounds -Wchar-subscripts -Wcomment -Wenum-compare -Wformat -Wuninitialized -Wmaybe-uninitialized -Wmain -Wnarrowing -Wnonnull -Wparentheses -Wpointer-sign -Wreorder -Wreturn-type -Wsign-compare -Wsequence-point -Wtrigraphs -Wunused-function -Wunused-but-set-variable -Wunused-variable -Wwrite-strings\"\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=icpc -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DENABLE_MKL=ON -DCMAKE_CXX_FLAGS=\"-funroll-loops -march=native -DMULTI_PREC -std=c++11 -Wall\"\n+THREADS=$(grep -c ^processor /proc/cpuinfo)\n+make -j $THREADS\n+\n+./bin/aff3ct --version\n+./bin/aff3ct -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --chn-implem MKL --crc-poly 32-GZIP --dec-type ASCL --ter-freq 0\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a build test for the Intel compiler.
8,490
01.02.2018 15:37:48
-3,600
b038b917539fc36a3696e396a2789d2586f8629c
Speedup the Polar encoder 'is_codeword()' method.
[ { "change_type": "MODIFY", "old_path": "src/Module/Encoder/Polar/Encoder_polar.cpp", "new_path": "src/Module/Encoder/Polar/Encoder_polar.cpp", "diff": "@@ -76,22 +76,25 @@ void Encoder_polar<B>\n}\n}\n+#include <iostream>\n+\ntemplate <typename B>\nbool Encoder_polar<B>\n::is_codeword(const B *X_N)\n{\n- for (auto i = 0; i < this->N; i++)\n- this->X_N_tmp[i] = (B)(!this->frozen_bits[i]) && X_N[i];\n- this->light_encode(this->X_N_tmp.data());\n+ std::copy(X_N, X_N + this->N, this->X_N_tmp.data());\n- for (auto i = 0; i < this->N; i++)\n- this->X_N_tmp[i] = (B)(!this->frozen_bits[i]) && this->X_N_tmp[i];\n- this->light_encode(this->X_N_tmp.data());\n+ for (auto k = (this->N >> 1); k > 0; k >>= 1)\n+ for (auto j = 0; j < this->N; j += 2 * k)\n+ {\n+ for (auto i = 0; i < k; i++)\n+ this->X_N_tmp[j + i] = this->X_N_tmp[j + i] ^ this->X_N_tmp[k + j + i];\n- auto n = 0;\n- while (n < this->N && (X_N[n] == this->X_N_tmp[n])) n++;\n+ if (this->frozen_bits[j + k -1] && this->X_N_tmp[j + k -1])\n+ return false;\n+ }\n- return n == this->N;\n+ return true;\n}\ntemplate <typename B>\n" } ]
C++
MIT License
aff3ct/aff3ct
Speedup the Polar encoder 'is_codeword()' method.
8,483
01.02.2018 16:47:53
-3,600
bd307d44ebdbf5c4748c8cf735444c94d1a86ad9
Add n_test_vectors at the argument list of the Chase Pyndiah; Implement a method to generate the least realiable positions bit flipping
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -97,6 +97,10 @@ void Decoder_turbo_product::parameters\n{\"strictly_positive_int\",\n\"number of least reliable positions.\"};\n+ opt_args[{p+\"-t\"}] =\n+ {\"positive_int\",\n+ \"number of test vectors (0 means equal to 2^p).\"};\n+\nopt_args[{p+\"-c\"}] =\n{\"positive_int\",\n\"number of competitors (0 means equal to number of test vectors).\"};\n@@ -121,6 +125,7 @@ void Decoder_turbo_product::parameters\nif(exist(vals, {p+\"-ite\", \"i\"})) this->n_ite = std::stoi(vals.at({p+\"-ite\", \"i\"}));\nif(exist(vals, {p+\"-p\" })) this->n_least_reliable_positions = std::stoi(vals.at({p+\"-p\" }));\n+ if(exist(vals, {p+\"-t\" })) this->n_test_vectors = std::stoi(vals.at({p+\"-t\" }));\nif(exist(vals, {p+\"-c\" })) this->n_competitors = std::stoi(vals.at({p+\"-c\" }));\nif(exist(vals, {p+\"-alpha\" })) this->alpha = std::stof(vals.at({p+\"-alpha\" }));\nif(exist(vals, {p+\"-ext\" })) this->parity_extended = true;\n@@ -162,6 +167,9 @@ void Decoder_turbo_product::parameters\nheaders[p].push_back(std::make_pair(\"alpha\", std::to_string(alpha )));\nheaders[p].push_back(std::make_pair(\"Num. least reliable pos (p)\", std::to_string(n_least_reliable_positions)));\n+ if (n_test_vectors != 0)\n+ headers[p].push_back(std::make_pair(\"Num. test vectors (t)\", std::to_string(n_test_vectors)));\n+\nif (n_competitors != 0)\nheaders[p].push_back(std::make_pair(\"Num. competitors (c)\", std::to_string(n_competitors)));\n@@ -189,8 +197,8 @@ module::Decoder_SIHO<B,Q>* Decoder_turbo_product::parameters\nif (this->type == \"CP\")\n{\nif (this->implem == \"STD\")\n- return new module::Decoder_chase_pyndiah<B,Q>(this->n_ite, itl, hiho_r, hiho_c, enc_r.get_info_bits_pos(), enc_r.get_info_bits_pos(),\n- alpha, n_least_reliable_positions, n_competitors);\n+ return new module::Decoder_chase_pyndiah<B,Q>(n_ite, itl, hiho_r, hiho_c, enc_r.get_info_bits_pos(), enc_r.get_info_bits_pos(),\n+ alpha, n_least_reliable_positions, n_test_vectors, n_competitors);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "diff": "@@ -30,6 +30,7 @@ struct Decoder_turbo_product : public Decoder\nint n_ite = 4;\nfloat alpha = 0.5;\nint n_least_reliable_positions = 2;\n+ int n_test_vectors = 0;\nint n_competitors = 0;\nint parity_extended = false;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -22,7 +22,7 @@ protected:\nint pos;\n};\n- const R alpha;\n+ R alpha;\nconst int n_least_reliable_positions;\nstd::vector<info> least_reliable_pos;\n@@ -38,6 +38,9 @@ protected:\nstd::vector<R> Y_N_cha_i;\n+ std::vector<std::vector<bool>> tv_candidates;\n+\n+ const std::vector<float> Alpha;\npublic:\nDecoder_chase_pyndiah(const int& n_ite,\n@@ -48,6 +51,7 @@ public:\nconst std::vector<uint32_t> &info_bits_pos_c,\nconst R alpha = 0.5,\nconst int n_least_reliable_positions = 2,\n+ const int n_test_vectors = 0,\nconst int n_competitors = 0);\nprotected:\n@@ -63,7 +67,9 @@ protected:\nvoid compute_metrics (const R* R_prime, const int size);\nvoid compute_reliability (const R* R_cha, const R* R_prime, R* R_dec, const int size);\n- void apply_candidate(B* hard_vect, const int c);\n+ void bit_flipping(B* hard_vect, const int c);\n+\n+ void generate_bit_flipping_candidates();\n};\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add n_test_vectors at the argument list of the Chase Pyndiah; Implement a method to generate the least realiable positions bit flipping
8,490
01.02.2018 18:50:09
-3,600
bd75fb01126a4876c94622696e5e7550547d0787
First implem of a generic Chase decoder.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Decoder.cpp", "new_path": "src/Factory/Module/Decoder/Decoder.cpp", "diff": "-#include \"Module/Decoder/ML/Decoder_maximum_likelihood_std.hpp\"\n-#include \"Module/Decoder/ML/Decoder_maximum_likelihood_naive.hpp\"\n-#include \"Module/Decoder/ML/Decoder_chase_naive.hpp\"\n-#include \"Module/Decoder/ML/Decoder_chase_std.hpp\"\n+#include \"Module/Decoder/Generic/ML/Decoder_maximum_likelihood_std.hpp\"\n+#include \"Module/Decoder/Generic/ML/Decoder_maximum_likelihood_naive.hpp\"\n+#include \"Module/Decoder/Generic/ML/Decoder_maximum_likelihood_reduced_std.hpp\"\n+#include \"Module/Decoder/Generic/ML/Decoder_maximum_likelihood_reduced_naive.hpp\"\n+#include \"Module/Decoder/Generic/Chase/Decoder_chase_naive.hpp\"\n#include \"Decoder.hpp\"\n@@ -48,7 +49,7 @@ void Decoder::parameters\nopt_args[{p+\"-type\", \"D\"}] =\n{\"string\",\n\"select the algorithm you want to decode the codeword.\",\n- \"ML, CHASE\"};\n+ \"ML, ML_RED, CHASE\"};\nopt_args[{p+\"-implem\"}] =\n{\"string\",\n@@ -110,10 +111,14 @@ module::Decoder_SIHO<B,Q>* Decoder::parameters\nif (this->implem == \"STD\" ) return new module::Decoder_ML_std <B,Q>(this->K, this->N_cw, *encoder, this->hamming, this->n_frames);\nif (this->implem == \"NAIVE\") return new module::Decoder_ML_naive<B,Q>(this->K, this->N_cw, *encoder, this->hamming, this->n_frames);\n}\n+ else if (this->type == \"ML_RED\")\n+ {\n+ if (this->implem == \"NAIVE\") return new module::Decoder_ML_reduced_naive<B,Q>(this->K, this->N_cw, *encoder, this->flips, this->hamming, this->n_frames);\n+ if (this->implem == \"STD\" ) return new module::Decoder_ML_reduced_std <B,Q>(this->K, this->N_cw, *encoder, this->flips, this->hamming, this->n_frames);\n+ }\nelse if (this->type == \"CHASE\")\n{\nif (this->implem == \"NAIVE\") return new module::Decoder_chase_naive<B,Q>(this->K, this->N_cw, *encoder, this->flips, this->hamming, this->n_frames);\n- if (this->implem == \"STD\" ) return new module::Decoder_chase_std <B,Q>(this->K, this->N_cw, *encoder, this->flips, this->hamming, this->n_frames);\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/Generic/Chase/Decoder_chase_naive.cpp", "diff": "+#include <chrono>\n+#include <iostream>\n+#include <algorithm>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Algo/Bit_packer.hpp\"\n+#include \"Tools/Perf/hard_decision.h\"\n+\n+#include \"Decoder_chase_naive.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B, typename R>\n+Decoder_chase_naive<B,R>\n+::Decoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips, const bool hamming,\n+ const int n_frames)\n+: Decoder (K, N, n_frames, 1),\n+ Decoder_generic<B,R>(K, N, encoder, n_frames ),\n+ max_flips(max_flips),\n+ hamming(hamming),\n+ x_max(0),\n+ min_euclidean_dist(std::numeric_limits<float>::max()),\n+ min_hamming_dist(std::numeric_limits<uint32_t>::max()),\n+ llrs_indexes(N),\n+ flip_pos(max_flips)\n+{\n+ const std::string name = \"Decoder_chase_naive\";\n+ this->set_name(name);\n+}\n+\n+template <typename B, typename R>\n+Decoder_chase_naive<B,R>\n+::~Decoder_chase_naive()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+{\n+ if (!this->encoder.is_sys())\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.is_sys()' has to be true.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->_decode_siho_cw(Y_N, this->best_X_N.data(), frame_id);\n+\n+ const auto &info_bits_pos = this->encoder.get_info_bits_pos();\n+ for (auto k = 0; k < this->K; k++)\n+ V_K[k] = this->best_X_N[info_bits_pos[k]];\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n+{\n+ if (n_flips == max_flips)\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.end(), this->X_N.begin());\n+\n+ // flip the bits\n+ for (uint32_t f = 0; f < max_flips; f++)\n+ this->X_N[this->llrs_indexes[this->flip_pos[f]]] = !this->X_N[this->llrs_indexes[this->flip_pos[f]]];\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // compute the Euclidean dist\n+ auto cur_euclidean_dist = 0.f;\n+ for (uint32_t f = 0; f < max_flips; f++)\n+ cur_euclidean_dist += std::abs(Y_N[this->llrs_indexes[this->flip_pos[f]]]);\n+\n+ // update the best codeword\n+ if (cur_euclidean_dist < this->min_euclidean_dist)\n+ {\n+ this->min_euclidean_dist = cur_euclidean_dist;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+ }\n+ }\n+ }\n+ else\n+ {\n+ for (auto flip_pos = n_flips; flip_pos < (uint32_t)this->N; flip_pos++)\n+ {\n+ this->flip_pos[n_flips] = flip_pos;\n+ this->_decode_siho_cw_recursive(Y_N, V_N, n_flips +1, max_flips);\n+ }\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n+{\n+ tools::hard_decide(Y_N, this->hard_Y_N.data(), this->N);\n+ if (this->encoder.is_codeword(this->hard_Y_N.data()))\n+ {\n+ std::copy(this->hard_Y_N.begin(), this->hard_Y_N.begin() + this->N, V_N);\n+ }\n+ else\n+ {\n+ this->min_euclidean_dist = std::numeric_limits<float>::max();\n+\n+ std::iota(llrs_indexes.begin(), llrs_indexes.end(), 0);\n+ std::partial_sort(llrs_indexes.begin(), llrs_indexes.begin() + this->max_flips, llrs_indexes.end(),\n+ [&Y_N](const uint32_t i1, const uint32_t i2) {\n+ return std::abs(Y_N[i1]) < std::abs(Y_N[i2]);\n+ });\n+\n+ for (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n+ this->_decode_siho_cw_recursive(Y_N, V_N, 0, n_flips);\n+ }\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n+{\n+ if (!this->encoder.is_sys())\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.is_sys()' has to be true.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->_decode_hiho_cw(Y_N, this->best_X_N.data(), frame_id);\n+\n+ const auto &info_bits_pos = this->encoder.get_info_bits_pos();\n+ for (auto k = 0; k < this->K; k++)\n+ V_K[k] = this->best_X_N[info_bits_pos[k]];\n+}\n+\n+template <typename B, typename R>\n+void Decoder_chase_naive<B,R>\n+::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n+{\n+ throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_chase_naive<B_8,Q_8>;\n+template class aff3ct::module::Decoder_chase_naive<B_16,Q_16>;\n+template class aff3ct::module::Decoder_chase_naive<B_32,Q_32>;\n+template class aff3ct::module::Decoder_chase_naive<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_chase_naive<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n\\ No newline at end of file\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.hpp", "new_path": "src/Module/Decoder/Generic/Chase/Decoder_chase_naive.hpp", "diff": "#ifndef DECODER_CHASE_NAIVE_HPP_\n#define DECODER_CHASE_NAIVE_HPP_\n-#include \"Decoder_maximum_likelihood.hpp\"\n+#include \"../Decoder_generic.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_chase_naive : public Decoder_maximum_likelihood<B,R>\n+class Decoder_chase_naive : public Decoder_generic<B,R>\n{\nprotected:\nconst uint32_t max_flips;\nconst bool hamming;\n+ uint64_t x_max;\nfloat min_euclidean_dist;\nuint32_t min_hamming_dist;\n+ std::vector<uint32_t> llrs_indexes;\n+ std::vector<uint32_t> flip_pos;\n+\npublic:\nDecoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\n- const bool hamming = false, const int n_frames = 1);\n+ const bool hamming = false,\n+ const int n_frames = 1);\nvirtual ~Decoder_chase_naive();\nprotected:\n@@ -27,8 +32,7 @@ protected:\nvoid _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\nvoid _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n- inline void _try_sequence_llrs(const R *Y_N, const B *X_N, B *V_N);\n- inline void _try_sequence_bits(const B *Y_N, const B *X_N, B *V_N);\n+ void _decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n};\n}\n}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/Generic/Decoder_generic.hpp", "diff": "+#ifndef DECODER_GENERIC_HPP_\n+#define DECODER_GENERIC_HPP_\n+\n+#include \"Module/Encoder/Encoder.hpp\"\n+\n+#include \"../Decoder_SIHO_HIHO.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_generic : public Decoder_SIHO_HIHO<B,R>\n+{\n+protected:\n+ Encoder<B> &encoder;\n+ std::vector<B> U_K;\n+ std::vector<B> X_N;\n+ std::vector<B> best_U_K;\n+ std::vector<B> best_X_N;\n+ std::vector<B> hard_Y_N;\n+\n+public:\n+ virtual ~Decoder_generic();\n+\n+protected:\n+ Decoder_generic(const int K, const int N, Encoder<B> &encoder, const int n_frames = 1);\n+\n+ inline float compute_euclidean_dist (const B *X_N, const R *Y_N) const;\n+ inline float compute_euclidean_dist_soft(const R *Y_N1, const R *Y_N2) const;\n+ inline uint32_t compute_hamming_dist (const B *X_N, const B *Y_N) const;\n+ inline uint32_t compute_hamming_dist_soft (const B *X_N, const R *Y_N) const;\n+};\n+}\n+}\n+\n+#include \"Decoder_generic.hxx\"\n+\n+#endif /* DECODER_GENERIC_HPP_ */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hxx", "new_path": "src/Module/Decoder/Generic/Decoder_generic.hxx", "diff": "#include \"Tools/Algo/Bit_packer.hpp\"\n#include \"Tools/Perf/hard_decision.h\"\n-#include \"Decoder_maximum_likelihood.hpp\"\n+#include \"Decoder_generic.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B, typename R>\n-Decoder_maximum_likelihood<B,R>\n-::Decoder_maximum_likelihood(const int K, const int N, Encoder<B> &encoder, const int n_frames)\n+Decoder_generic<B,R>\n+::Decoder_generic(const int K, const int N, Encoder<B> &encoder, const int n_frames)\n: Decoder (K, N, n_frames, 1),\nDecoder_SIHO_HIHO<B,R>(K, N, n_frames, 1),\nencoder(encoder),\n@@ -23,7 +23,7 @@ Decoder_maximum_likelihood<B,R>\nbest_X_N(N),\nhard_Y_N(N)\n{\n- const std::string name = \"Decoder_maximum_likelihood\";\n+ const std::string name = \"Decoder_generic\";\nthis->set_name(name);\nif (encoder.get_K() != K)\n@@ -44,13 +44,13 @@ Decoder_maximum_likelihood<B,R>\n}\ntemplate <typename B, typename R>\n-Decoder_maximum_likelihood<B,R>\n-::~Decoder_maximum_likelihood()\n+Decoder_generic<B,R>\n+::~Decoder_generic()\n{\n}\ntemplate <typename B, typename R>\n-float Decoder_maximum_likelihood<B,R>\n+float Decoder_generic<B,R>\n::compute_euclidean_dist(const B *X_N, const R *Y_N) const\n{\n// compute the Euclidean distance between the LLR (Y_N) and the current codeword (X_N)\n@@ -69,7 +69,26 @@ float Decoder_maximum_likelihood<B,R>\n}\ntemplate <typename B, typename R>\n-uint32_t Decoder_maximum_likelihood<B,R>\n+float Decoder_generic<B,R>\n+::compute_euclidean_dist_soft(const R *Y_N1, const R *Y_N2) const\n+{\n+ // compute the Euclidean distance between the LLR (Y_N) and the current codeword (X_N)\n+ float euclidean_dist = 0.f;\n+ for (auto n = 0; n < this->N; n++)\n+ {\n+ auto tmp = Y_N1[n] - (float)Y_N2[n];\n+ euclidean_dist += tmp * tmp;\n+ // euclidean_dist += std::abs(tmp); // performance degradation with the abs\n+ }\n+\n+ // we can avoid the sqrt because of the monotonicity of the sqrt function\n+ // euclidean_dist = std::sqrt(euclidean_dist);\n+\n+ return euclidean_dist;\n+}\n+\n+template <typename B, typename R>\n+uint32_t Decoder_generic<B,R>\n::compute_hamming_dist(const B *X_N, const B *Y_N) const\n{\n// compute the Hamming distance between the input bits (Y_N) and the current codeword (X_N)\n@@ -81,7 +100,7 @@ uint32_t Decoder_maximum_likelihood<B,R>\n}\ntemplate <typename B, typename R>\n-uint32_t Decoder_maximum_likelihood<B,R>\n+uint32_t Decoder_generic<B,R>\n::compute_hamming_dist_soft(const B *X_N, const R *Y_N) const\n{\n// compute the Hamming distance between the input bits (Y_N) and the current codeword (X_N)\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood_naive.cpp", "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_naive.cpp", "diff": "@@ -14,7 +14,7 @@ template <typename B, typename R>\nDecoder_maximum_likelihood_naive<B,R>\n::Decoder_maximum_likelihood_naive(const int K, const int N, Encoder<B> &encoder, const bool hamming, const int n_frames)\n: Decoder (K, N, n_frames, 1),\n- Decoder_maximum_likelihood<B,R>(K, N, encoder, n_frames ),\n+ Decoder_generic<B,R>(K, N, encoder, n_frames ),\nhamming(hamming),\nx_max(0),\nmin_euclidean_dist(std::numeric_limits<float>::max()),\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood_naive.hpp", "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_naive.hpp", "diff": "#ifndef DECODER_MAXIMUM_LIKELIHOOD_NAIVE_HPP_\n#define DECODER_MAXIMUM_LIKELIHOOD_NAIVE_HPP_\n-#include \"Decoder_maximum_likelihood.hpp\"\n+#include \"../Decoder_generic.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_maximum_likelihood_naive : public Decoder_maximum_likelihood<B,R>\n+class Decoder_maximum_likelihood_naive : public Decoder_generic<B,R>\n{\nprotected:\nconst bool hamming;\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_chase_naive.cpp", "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_reduced_naive.cpp", "diff": "#include \"Tools/Algo/Bit_packer.hpp\"\n#include \"Tools/Perf/hard_decision.h\"\n-#include \"Decoder_chase_naive.hpp\"\n+#include \"Decoder_maximum_likelihood_reduced_naive.hpp\"\nusing namespace aff3ct;\nusing namespace aff3ct::module;\ntemplate <typename B, typename R>\n-Decoder_chase_naive<B,R>\n-::Decoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips, const bool hamming,\n- const int n_frames)\n+Decoder_maximum_likelihood_reduced_naive<B,R>\n+::Decoder_maximum_likelihood_reduced_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips,\n+ const bool hamming, const int n_frames)\n: Decoder (K, N, n_frames, 1),\n- Decoder_maximum_likelihood<B,R>(K, N, encoder, n_frames ),\n+ Decoder_generic<B,R>(K, N, encoder, n_frames ),\nmax_flips(max_flips),\nhamming(hamming),\nmin_euclidean_dist(std::numeric_limits<float>::max()),\nmin_hamming_dist(std::numeric_limits<uint32_t>::max())\n{\n- const std::string name = \"Decoder_chase_naive\";\n+ const std::string name = \"Decoder_maximum_likelihood_reduced_naive\";\nthis->set_name(name);\nif (max_flips > (uint32_t)N)\n@@ -34,13 +34,13 @@ Decoder_chase_naive<B,R>\n}\ntemplate <typename B, typename R>\n-Decoder_chase_naive<B,R>\n-::~Decoder_chase_naive()\n+Decoder_maximum_likelihood_reduced_naive<B,R>\n+::~Decoder_maximum_likelihood_reduced_naive()\n{\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n+void Decoder_maximum_likelihood_reduced_naive<B,R>\n::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n{\nif (!this->encoder.is_sys())\n@@ -58,7 +58,7 @@ void Decoder_chase_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n+void Decoder_maximum_likelihood_reduced_naive<B,R>\n::_try_sequence_llrs(const R *Y_N, const B *X_N, B *V_N)\n{\nif (this->encoder.is_codeword(X_N))\n@@ -76,7 +76,7 @@ void Decoder_chase_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n+void Decoder_maximum_likelihood_reduced_naive<B,R>\n::_try_sequence_bits(const B *Y_N, const B *X_N, B *V_N)\n{\nif (this->encoder.is_codeword(X_N))\n@@ -94,7 +94,7 @@ void Decoder_chase_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n+void Decoder_maximum_likelihood_reduced_naive<B,R>\n::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n{\ntools::hard_decide(Y_N, this->hard_Y_N.data(), this->N);\n@@ -313,7 +313,7 @@ void Decoder_chase_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n+void Decoder_maximum_likelihood_reduced_naive<B,R>\n::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n{\nif (!this->encoder.is_sys())\n@@ -331,7 +331,7 @@ void Decoder_chase_naive<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n+void Decoder_maximum_likelihood_reduced_naive<B,R>\n::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n{\nthis->min_hamming_dist = std::numeric_limits<uint32_t>::max();\n@@ -547,11 +547,11 @@ void Decoder_chase_naive<B,R>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class aff3ct::module::Decoder_chase_naive<B_8,Q_8>;\n-template class aff3ct::module::Decoder_chase_naive<B_16,Q_16>;\n-template class aff3ct::module::Decoder_chase_naive<B_32,Q_32>;\n-template class aff3ct::module::Decoder_chase_naive<B_64,Q_64>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_naive<B_8,Q_8>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_naive<B_16,Q_16>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_naive<B_32,Q_32>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_naive<B_64,Q_64>;\n#else\n-template class aff3ct::module::Decoder_chase_naive<B,Q>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_naive<B,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_reduced_naive.hpp", "diff": "+#ifndef DECODER_MAXIMUM_LIKELIHOOD_REDUCED_NAIVE_HPP_\n+#define DECODER_MAXIMUM_LIKELIHOOD_REDUCED_NAIVE_HPP_\n+\n+#include \"../Decoder_generic.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_maximum_likelihood_reduced_naive : public Decoder_generic<B,R>\n+{\n+protected:\n+ const uint32_t max_flips;\n+ const bool hamming;\n+ float min_euclidean_dist;\n+ uint32_t min_hamming_dist;\n+\n+public:\n+ Decoder_maximum_likelihood_reduced_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\n+ const bool hamming = false, const int n_frames = 1);\n+ virtual ~Decoder_maximum_likelihood_reduced_naive();\n+\n+protected:\n+ void _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n+ void _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id);\n+ void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n+ void _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n+\n+ inline void _try_sequence_llrs(const R *Y_N, const B *X_N, B *V_N);\n+ inline void _try_sequence_bits(const B *Y_N, const B *X_N, B *V_N);\n+};\n+\n+template <typename B = int, typename R = float>\n+using Decoder_ML_reduced_naive = Decoder_maximum_likelihood_reduced_naive<B,R>;\n+}\n+}\n+\n+#endif /* DECODER_MAXIMUM_LIKELIHOOD_REDUCED_NAIVE_HPP_ */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_chase_std.cpp", "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_reduced_std.cpp", "diff": "#include \"Tools/Algo/Bit_packer.hpp\"\n#include \"Tools/Perf/hard_decision.h\"\n-#include \"Decoder_chase_std.hpp\"\n+#include \"Decoder_maximum_likelihood_reduced_std.hpp\"\nusing namespace aff3ct;\nusing namespace aff3ct::module;\ntemplate <typename B, typename R>\n-Decoder_chase_std<B,R>\n-::Decoder_chase_std(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips, const bool hamming,\n- const int n_frames)\n+Decoder_maximum_likelihood_reduced_std<B,R>\n+::Decoder_maximum_likelihood_reduced_std(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips,\n+ const bool hamming, const int n_frames)\n: Decoder (K, N, n_frames, 1),\n- Decoder_chase_naive<B,R>(K, N, encoder, max_flips, hamming, n_frames ),\n+ Decoder_maximum_likelihood_reduced_naive<B,R>(K, N, encoder, max_flips, hamming, n_frames ),\nflip_pos(max_flips)\n{\n- const std::string name = \"Decoder_chase_std\";\n+ const std::string name = \"Decoder_maximum_likelihood_reduced_std\";\nthis->set_name(name);\n}\ntemplate <typename B, typename R>\n-Decoder_chase_std<B,R>\n-::~Decoder_chase_std()\n+Decoder_maximum_likelihood_reduced_std<B,R>\n+::~Decoder_maximum_likelihood_reduced_std()\n{\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_std<B,R>\n+void Decoder_maximum_likelihood_reduced_std<B,R>\n::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n{\nif (!this->encoder.is_sys())\n@@ -47,7 +47,7 @@ void Decoder_chase_std<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_std<B,R>\n+void Decoder_maximum_likelihood_reduced_std<B,R>\n::_decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n{\nif (n_flips == max_flips)\n@@ -82,7 +82,7 @@ void Decoder_chase_std<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_std<B,R>\n+void Decoder_maximum_likelihood_reduced_std<B,R>\n::_decode_hiho_cw_recursive(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n{\nif (n_flips == max_flips)\n@@ -117,7 +117,7 @@ void Decoder_chase_std<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_std<B,R>\n+void Decoder_maximum_likelihood_reduced_std<B,R>\n::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n{\ntools::hard_decide(Y_N, this->hard_Y_N.data(), this->N);\n@@ -149,7 +149,7 @@ void Decoder_chase_std<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_std<B,R>\n+void Decoder_maximum_likelihood_reduced_std<B,R>\n::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n{\nif (!this->encoder.is_sys())\n@@ -167,7 +167,7 @@ void Decoder_chase_std<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_chase_std<B,R>\n+void Decoder_maximum_likelihood_reduced_std<B,R>\n::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n{\nthis->min_hamming_dist = std::numeric_limits<uint32_t>::max();\n@@ -186,11 +186,11 @@ void Decoder_chase_std<B,R>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class aff3ct::module::Decoder_chase_std<B_8,Q_8>;\n-template class aff3ct::module::Decoder_chase_std<B_16,Q_16>;\n-template class aff3ct::module::Decoder_chase_std<B_32,Q_32>;\n-template class aff3ct::module::Decoder_chase_std<B_64,Q_64>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_std<B_8,Q_8>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_std<B_16,Q_16>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_std<B_32,Q_32>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_std<B_64,Q_64>;\n#else\n-template class aff3ct::module::Decoder_chase_std<B,Q>;\n+template class aff3ct::module::Decoder_maximum_likelihood_reduced_std<B,Q>;\n#endif\n// ==================================================================================== explicit template instantiation\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_reduced_std.hpp", "diff": "+#ifndef DECODER_MAXIMUM_LIKELIHOOD_REDUCED_STD_HPP_\n+#define DECODER_MAXIMUM_LIKELIHOOD_REDUCED_STD_HPP_\n+\n+#include \"Decoder_maximum_likelihood_reduced_naive.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_maximum_likelihood_reduced_std : public Decoder_maximum_likelihood_reduced_naive<B,R>\n+{\n+protected:\n+ std::vector<uint32_t> flip_pos;\n+\n+public:\n+ Decoder_maximum_likelihood_reduced_std(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\n+ const bool hamming = false, const int n_frames = 1);\n+ virtual ~Decoder_maximum_likelihood_reduced_std();\n+\n+protected:\n+ void _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n+ void _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id);\n+ void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n+ void _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n+\n+ void _decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n+ void _decode_hiho_cw_recursive(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n+};\n+\n+template <typename B = int, typename R = float>\n+using Decoder_ML_reduced_std = Decoder_maximum_likelihood_reduced_std<B,R>;\n+}\n+}\n+\n+#endif /* DECODER_MAXIMUM_LIKELIHOOD_REDUCED_STD_HPP_ */\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood_std.cpp", "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_std.cpp", "diff": "@@ -14,7 +14,7 @@ template <typename B, typename R>\nDecoder_maximum_likelihood_std<B,R>\n::Decoder_maximum_likelihood_std(const int K, const int N, Encoder<B> &encoder, const bool hamming, const int n_frames)\n: Decoder (K, N, n_frames, 1),\n- Decoder_maximum_likelihood<B,R>(K, N, encoder, n_frames ),\n+ Decoder_generic<B,R>(K, N, encoder, n_frames ),\nhamming(hamming),\nu_max(0),\nmin_euclidean_dist(std::numeric_limits<float>::max()),\n" }, { "change_type": "RENAME", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood_std.hpp", "new_path": "src/Module/Decoder/Generic/ML/Decoder_maximum_likelihood_std.hpp", "diff": "#ifndef DECODER_MAXIMUM_LIKELIHOOD_STD_HPP_\n#define DECODER_MAXIMUM_LIKELIHOOD_STD_HPP_\n-#include \"Decoder_maximum_likelihood.hpp\"\n+#include \"../Decoder_generic.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_maximum_likelihood_std : public Decoder_maximum_likelihood<B,R>\n+class Decoder_maximum_likelihood_std : public Decoder_generic<B,R>\n{\nprotected:\nconst bool hamming;\n" }, { "change_type": "DELETE", "old_path": "src/Module/Decoder/ML/Decoder_chase_std.hpp", "new_path": null, "diff": "-#ifndef DECODER_CHASE_STD_HPP_\n-#define DECODER_CHASE_STD_HPP_\n-\n-#include \"Decoder_chase_naive.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace module\n-{\n-template <typename B = int, typename R = float>\n-class Decoder_chase_std : public Decoder_chase_naive<B,R>\n-{\n-protected:\n- std::vector<uint32_t> flip_pos;\n-\n-public:\n- Decoder_chase_std(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\n- const bool hamming = false, const int n_frames = 1);\n- virtual ~Decoder_chase_std();\n-\n-protected:\n- void _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n- void _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id);\n- void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n- void _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\n-\n- void _decode_siho_cw_recursive(const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n- void _decode_hiho_cw_recursive(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n-};\n-}\n-}\n-\n-#endif /* DECODER_CHASE_STD_HPP_ */\n" }, { "change_type": "DELETE", "old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hpp", "new_path": null, "diff": "-#ifndef DECODER_MAXIMUM_LIKELIHOOD_HPP_\n-#define DECODER_MAXIMUM_LIKELIHOOD_HPP_\n-\n-#include \"Module/Encoder/Encoder.hpp\"\n-\n-#include \"../Decoder_SIHO_HIHO.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace module\n-{\n-template <typename B = int, typename R = float>\n-class Decoder_maximum_likelihood : public Decoder_SIHO_HIHO<B,R>\n-{\n-protected:\n- Encoder<B> &encoder;\n- std::vector<B> U_K;\n- std::vector<B> X_N;\n- std::vector<B> best_U_K;\n- std::vector<B> best_X_N;\n- std::vector<B> hard_Y_N;\n-\n-public:\n- virtual ~Decoder_maximum_likelihood();\n-\n-protected:\n- Decoder_maximum_likelihood(const int K, const int N, Encoder<B> &encoder, const int n_frames = 1);\n-\n- inline float compute_euclidean_dist (const B *X_N, const R *Y_N) const;\n- inline uint32_t compute_hamming_dist (const B *X_N, const B *Y_N) const;\n- inline uint32_t compute_hamming_dist_soft(const B *X_N, const R *Y_N) const;\n-};\n-}\n-}\n-\n-#include \"Decoder_maximum_likelihood.hxx\"\n-\n-#endif /* DECODER_MAXIMUM_LIKELIHOOD_HPP_ */\n" } ]
C++
MIT License
aff3ct/aff3ct
First implem of a generic Chase decoder.
8,483
02.02.2018 14:23:53
-3,600
2ea803c4ea2ea909aa8ea6bdab9463bd80b2e701
Correct the beta computation and the bit flipping
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -103,7 +103,7 @@ void Decoder_turbo_product::parameters\nopt_args[{p+\"-c\"}] =\n{\"positive_int\",\n- \"number of competitors (0 means equal to number of test vectors).\"};\n+ \"number of competitors (0 means equal to number of test vectors, 1 means only the decided word).\"};\nopt_args[{p+\"-ext\"}] =\n{\"\",\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-#define NDEBUG\n+// #define NDEBUG\ntemplate <typename B, typename R>\nDecoder_chase_pyndiah<B,R>\n@@ -211,13 +211,18 @@ void Decoder_chase_pyndiah<B,R>\n#endif\n}\n+#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n+\ntemplate <typename B, typename R>\nbool Decoder_chase_pyndiah<B,R>\n::_decode_chase(const R *R_prime, Decoder_HIHO<B> &hiho, const int size)\n{\n+ tools::Frame_trace<> ft;\ntools::hard_decide(R_prime, hard_Rprime.data(), size);\n+\n+\n#ifndef NDEBUG\nstd::cerr << \"(II) R_prime : \" << std::endl;\nfor (int i = 0; i < size; i++)\n@@ -225,6 +230,7 @@ bool Decoder_chase_pyndiah<B,R>\nstd::cerr << R_prime[i] << \" \";\n}\nstd::cerr << std::endl;\n+ { std::vector<R> v(R_prime, R_prime+size); ft.display_real_vector(v); }\nstd::cerr << \"(II) hard_Rprime : \" << std::endl;\nfor (unsigned i = 0; hard_Rprime.size() > i; i++)\n@@ -232,6 +238,7 @@ bool Decoder_chase_pyndiah<B,R>\nstd::cerr << hard_Rprime[i] << \" \";\n}\nstd::cerr << std::endl;\n+ { ft.display_bit_vector(hard_Rprime); }\n#endif\n// if (this->parity_extended)\n@@ -251,22 +258,33 @@ bool Decoder_chase_pyndiah<B,R>\nstd::cerr << \"(II) least_reliable_pos : \" << std::endl;\nfor (unsigned i = 0; i < least_reliable_pos.size(); i++)\n{\n- std::cerr << i << \". (\" << least_reliable_pos[i].pos << \", \" << least_reliable_pos[i].metric << \")\" << std::endl;\n+ std::cerr << i << \". (\" << least_reliable_pos[i].pos << \", \" << least_reliable_pos[i].metric << \") -> \" << hard_Rprime[least_reliable_pos[i].pos] << std::endl;\n}\n+\n+ std::cerr << \"(II) Test vectors : \" << std::endl;\n+ ft.display_bit_vector(test_vect, size);\n+\nstd::cerr << \"(II) Metriques : \" << std::endl;\nfor (unsigned i = 0; i < metrics.size(); i++)\n{\n- std::cerr << i << \". \" << metrics[i] << std::endl;\n+ std::cerr << i << \". \" << metrics[i] << \" -> \";\n+\n+ for (unsigned j = 0; j < tv_candidates[i].size(); j++)\n+ std::cerr << tv_candidates[i][j] << \" \";\n+\n+\n+ std::cerr << std::endl;\n}\nauto* DW = test_vect.data() + competitors.front().pos;\nstd::cerr << \"(II) DW : \" << std::endl;\n- for (int i = 0; i < size; i++)\n+ for (int i = 0; size > i; i++)\n{\nstd::cerr << DW[i] << \" \";\n}\nstd::cerr << std::endl;\n+ { std::vector<R> v(DW, DW+size); ft.display_bit_vector(v); }\n#endif\nreturn false;\n@@ -303,6 +321,7 @@ template <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n::compute_test_vectors(Decoder_HIHO<B> &hiho, const int size)\n{\n+ tools::Frame_trace<> ft;\nfor (int c = 0; c < n_test_vectors; c++)\n{\n// rearrange hard_Rprime to be a good candidate\n@@ -310,6 +329,9 @@ void Decoder_chase_pyndiah<B,R>\nhiho.decode_hiho_cw(hard_Rprime.data(), test_vect.data() + c*size); // parity bit is ignored by the decoder\n+#ifndef NDEBUG\n+ ft.display_bit_vector(hard_Rprime);\n+#endif\nif (this->parity_extended)\ntest_vect[(c+1)*size -1] = tools::compute_parity(test_vect.data() + c*size, hiho.get_N());\n@@ -388,7 +410,7 @@ void Decoder_chase_pyndiah<B,R>\n// compute beta, the sum of the least reliable position reliabilities in the decided word\nR beta = 0;\nfor (int i = 0; i < n_least_reliable_positions; i++)\n- beta += 2 * least_reliable_pos[i].metric;\n+ beta += least_reliable_pos[i].metric;\n#ifndef NDEBUG\nstd::cerr << \"beta = \" << beta << \", alpha = \" << alpha<< \", DW.metric = \" << DW.metric << std::endl;\n@@ -441,7 +463,7 @@ void Decoder_chase_pyndiah<B,R>\n::bit_flipping(B* hard_vect, const int c)\n{\nfor (int i = 0; i < n_least_reliable_positions; i++)\n- hard_vect[least_reliable_pos[i].pos] = tv_candidates[c][i] ? hard_vect[least_reliable_pos[i].pos] : !hard_vect[least_reliable_pos[i].pos];\n+ hard_vect[least_reliable_pos[i].pos] = tv_candidates[c][i] ? !hard_vect[least_reliable_pos[i].pos] : hard_vect[least_reliable_pos[i].pos];\n}\ntemplate <typename B, typename R>\n" } ]
C++
MIT License
aff3ct/aff3ct
Correct the beta computation and the bit flipping
8,490
02.02.2018 15:32:28
-3,600
9d5265ba1b7daf9072e6df5241843a1b96742b1f
Add the hamming distance support in the Chase.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Generic/Chase/Decoder_chase_naive.cpp", "new_path": "src/Module/Decoder/Generic/Chase/Decoder_chase_naive.cpp", "diff": "@@ -16,10 +16,13 @@ Decoder_chase_naive<B,R>\n::Decoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips, const bool hamming,\nconst int n_frames)\n: Decoder (K, N, n_frames, 1),\n- Decoder_generic<B,R>(K, N, encoder, n_frames ),\n+ Decoder_SIHO<B,R>(K, N, n_frames, 1),\n+ encoder(encoder),\n+ X_N(N+7), // +7 to avoid segmentation fault when casting B to uint64_t\n+ best_X_N(N),\n+ hard_Y_N(N),\nmax_flips(max_flips),\nhamming(hamming),\n- x_max(0),\nmin_euclidean_dist(std::numeric_limits<float>::max()),\nmin_hamming_dist(std::numeric_limits<uint32_t>::max()),\nllrs_indexes(N),\n@@ -90,53 +93,74 @@ void Decoder_chase_naive<B,R>\n}\n}\n+template <typename B, typename R>\n+bool Decoder_chase_naive<B,R>\n+::_decode_siho_cw_recursive_hard(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips)\n+{\n+ if (n_flips == max_flips)\n+ {\n+ std::copy(Y_N, Y_N + this->N, this->X_N.begin());\n+\n+ // flip the bits\n+ for (uint32_t f = 0; f < max_flips; f++)\n+ this->X_N[this->llrs_indexes[this->flip_pos[f]]] = !this->X_N[this->llrs_indexes[this->flip_pos[f]]];\n+\n+ if (this->encoder.is_codeword(this->X_N.data()))\n+ {\n+ // update the best codeword\n+ if (max_flips < this->min_hamming_dist)\n+ {\n+ this->min_hamming_dist = max_flips;\n+ std::copy(this->X_N.begin(), this->X_N.begin() + this->N, V_N);\n+\n+ return true;\n+ }\n+ }\n+ }\n+ else\n+ {\n+ for (auto flip_pos = n_flips; flip_pos < (uint32_t)this->N; flip_pos++)\n+ {\n+ this->flip_pos[n_flips] = flip_pos;\n+ if (this->_decode_siho_cw_recursive_hard(Y_N, V_N, n_flips +1, max_flips))\n+ return true;\n+ }\n+ }\n+\n+ return false;\n+}\n+\ntemplate <typename B, typename R>\nvoid Decoder_chase_naive<B,R>\n::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n{\ntools::hard_decide(Y_N, this->hard_Y_N.data(), this->N);\n+\nif (this->encoder.is_codeword(this->hard_Y_N.data()))\n{\nstd::copy(this->hard_Y_N.begin(), this->hard_Y_N.begin() + this->N, V_N);\n}\nelse\n{\n- this->min_euclidean_dist = std::numeric_limits<float>::max();\n-\nstd::iota(llrs_indexes.begin(), llrs_indexes.end(), 0);\nstd::partial_sort(llrs_indexes.begin(), llrs_indexes.begin() + this->max_flips, llrs_indexes.end(),\n[&Y_N](const uint32_t i1, const uint32_t i2) {\nreturn std::abs(Y_N[i1]) < std::abs(Y_N[i2]);\n});\n+ if (this->hamming)\n+ {\n+ this->min_hamming_dist = std::numeric_limits<uint32_t>::max();\nfor (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n- this->_decode_siho_cw_recursive(Y_N, V_N, 0, n_flips);\n- }\n+ this->_decode_siho_cw_recursive_hard(this->hard_Y_N.data(), V_N, 0, n_flips);\n}\n-\n-template <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n-::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n-{\n- if (!this->encoder.is_sys())\n+ else\n{\n- std::stringstream message;\n- message << \"'encoder.is_sys()' has to be true.\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ this->min_euclidean_dist = std::numeric_limits<float>::max();\n+ for (auto n_flips = 1; n_flips <= (int)this->max_flips; n_flips++)\n+ this->_decode_siho_cw_recursive(Y_N, V_N, 0, n_flips);\n}\n-\n- this->_decode_hiho_cw(Y_N, this->best_X_N.data(), frame_id);\n-\n- const auto &info_bits_pos = this->encoder.get_info_bits_pos();\n- for (auto k = 0; k < this->K; k++)\n- V_K[k] = this->best_X_N[info_bits_pos[k]];\n}\n-\n-template <typename B, typename R>\n-void Decoder_chase_naive<B,R>\n-::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n-{\n- throw tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Generic/Chase/Decoder_chase_naive.hpp", "new_path": "src/Module/Decoder/Generic/Chase/Decoder_chase_naive.hpp", "diff": "#ifndef DECODER_CHASE_NAIVE_HPP_\n#define DECODER_CHASE_NAIVE_HPP_\n-#include \"../Decoder_generic.hpp\"\n+#include \"Module/Encoder/Encoder.hpp\"\n+\n+#include \"../../Decoder_SIHO_HIHO.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_chase_naive : public Decoder_generic<B,R>\n+class Decoder_chase_naive : public Decoder_SIHO<B,R>\n{\nprotected:\n+ Encoder<B> &encoder;\n+\n+ std::vector<B> X_N;\n+ std::vector<B> best_X_N;\n+ std::vector<B> hard_Y_N;\n+\nconst uint32_t max_flips;\nconst bool hamming;\n- uint64_t x_max;\nfloat min_euclidean_dist;\nuint32_t min_hamming_dist;\n@@ -22,17 +29,15 @@ protected:\npublic:\nDecoder_chase_naive(const int K, const int N, Encoder<B> &encoder, const uint32_t max_flips = 3,\n- const bool hamming = false,\n- const int n_frames = 1);\n+ const bool hamming = false, const int n_frames = 1);\nvirtual ~Decoder_chase_naive();\nprotected:\nvoid _decode_siho (const R *Y_N, B *V_K, const int frame_id);\nvoid _decode_siho_cw(const R *Y_N, B *V_N, const int frame_id);\n- void _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\n- void _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\nvoid _decode_siho_cw_recursive (const R *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n+ bool _decode_siho_cw_recursive_hard(const B *Y_N, B *V_N, const uint32_t n_flips, const uint32_t max_flips);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the hamming distance support in the Chase.
8,483
02.02.2018 16:05:43
-3,600
170b3958821861907ccd8fe8d517d58f7964ef7f
Add the encoder in the decoder TPC to get the info bit pos and to call is codeword method as genius
[ { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -77,7 +77,7 @@ void factory::Launcher::parameters\nreq_args[{p+\"-cde-type\", \"C\"}] =\n{\"string\",\n\"select the code type you want to use.\",\n- \"POLAR, TURBO, TURBO_DB, TPC, LDPC, REP, RA, RSC, RSC_DB, BCH, UNCODED\"};\n+ \"POLAR, TURBO, TURBO_DB, TURBO_PROD, LDPC, REP, RA, RSC, RSC_DB, BCH, UNCODED\"};\nopt_args[{p+\"-type\"}] =\n{\"string\",\n@@ -282,7 +282,7 @@ launcher::Launcher* factory::Launcher::parameters\nreturn new launcher::Turbo_DB<launcher::BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n}\n- if (this->cde_type == \"TPC\")\n+ if (this->cde_type == \"TURBO_PROD\")\n{\nif (this->sim_type == \"BFER\")\nreturn new launcher::Turbo_product<launcher::BFER_std<B,R,Q>,B,R,Q>(argc, argv);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec_SIHO.cpp", "new_path": "src/Factory/Module/Codec/Codec_SIHO.cpp", "diff": "@@ -49,7 +49,7 @@ module::Codec_SIHO<B,Q>* Codec_SIHO::parameters\nelse if (get_name() == \"Codec Turbo\" ) return dynamic_cast<const Codec_turbo ::parameters&>(*this).template build<B,Q>(crc);\nelse if (get_name() == \"Codec Turbo DB\" ) return dynamic_cast<const Codec_turbo_DB ::parameters&>(*this).template build<B,Q>(crc);\nelse if (get_name() == \"Codec Uncoded\" ) return dynamic_cast<const Codec_uncoded ::parameters&>(*this).template build<B,Q>(crc);\n- else if (get_name() == \"Codec TPC\" ) return dynamic_cast<const Codec_turbo_product::parameters&>(*this).template build<B,Q>(crc);\n+ else if (get_name() == \"Codec Turbo Prod\") return dynamic_cast<const Codec_turbo_product::parameters&>(*this).template build<B,Q>(crc);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec_SISO.cpp", "new_path": "src/Factory/Module/Codec/Codec_SISO.cpp", "diff": "@@ -39,7 +39,7 @@ module::Codec_SISO<B,Q>* Codec_SISO::parameters\nelse if (get_name() == \"Codec RSC\" ) return dynamic_cast<const Codec_RSC ::parameters&>(*this).template build<B,Q>(crc);\nelse if (get_name() == \"Codec RSC DB\" ) return dynamic_cast<const Codec_RSC_DB ::parameters&>(*this).template build<B,Q>(crc);\nelse if (get_name() == \"Codec Uncoded\" ) return dynamic_cast<const Codec_uncoded ::parameters&>(*this).template build<B,Q>(crc);\n- else if (get_name() == \"Codec TPC\" ) return dynamic_cast<const Codec_turbo_product::parameters&>(*this).template build<B,Q>(crc);\n+ else if (get_name() == \"Codec Turbo Prod\") return dynamic_cast<const Codec_turbo_product::parameters&>(*this).template build<B,Q>(crc);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "new_path": "src/Factory/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::factory;\n-const std::string aff3ct::factory::Codec_turbo_product_name = \"Codec TPC\";\n+const std::string aff3ct::factory::Codec_turbo_product_name = \"Codec Turbo Prod\";\nconst std::string aff3ct::factory::Codec_turbo_product_prefix = \"cdc\";\nCodec_turbo_product::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -197,7 +197,7 @@ module::Decoder_SIHO<B,Q>* Decoder_turbo_product::parameters\nif (this->type == \"CP\")\n{\nif (this->implem == \"STD\")\n- return new module::Decoder_chase_pyndiah<B,Q>(n_ite, itl, hiho_r, hiho_c, enc_r.get_info_bits_pos(), enc_r.get_info_bits_pos(),\n+ return new module::Decoder_chase_pyndiah<B,Q>(n_ite, itl, hiho_r, hiho_c, enc_r, enc_c,\nalpha, n_least_reliable_positions, n_test_vectors, n_competitors);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/Turbo_product/Encoder_turbo_product.cpp", "new_path": "src/Factory/Module/Encoder/Turbo_product/Encoder_turbo_product.cpp", "diff": "@@ -16,7 +16,7 @@ Encoder_turbo_product::parameters\nsub(new Encoder_BCH::parameters(prefix+\"-sub\")),\nitl(new Interleaver::parameters(\"itl\"))\n{\n- this->type = \"TPC\";\n+ this->type = \"TURBO_PROD\";\n}\nEncoder_turbo_product::parameters* Encoder_turbo_product::parameters\n@@ -81,7 +81,7 @@ void Encoder_turbo_product::parameters\nreq_args.erase({pi+\"-size\" });\nopt_args.erase({pi+\"-fra\", \"F\"});\n- opt_args[{p+\"-type\"}][2] += \", TPC\";\n+ opt_args[{p+\"-type\"}][2] += \", TURBO_PROD\";\nopt_args[{p+\"-ext\"}] =\n{\"\",\n@@ -145,7 +145,7 @@ module::Encoder_turbo_product<B>* Encoder_turbo_product::parameters\nmodule::Encoder_BCH<B> &enc_n,\nmodule::Encoder_BCH<B> &enc_i) const\n{\n- if (this->type == \"TPC\")\n+ if (this->type == \"TURBO_PROD\")\nreturn new module::Encoder_turbo_product<B>(itl, enc_n, enc_i);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-// #define NDEBUG\n+#define NDEBUG\ntemplate <typename B, typename R>\nDecoder_chase_pyndiah<B,R>\n::Decoder_chase_pyndiah(const int& n_ite,\nconst Interleaver<R> &pi,\n- Decoder_HIHO<B> &hiho_r,\n- Decoder_HIHO<B> &hiho_c,\n- const std::vector<uint32_t> &info_bits_pos_r,\n- const std::vector<uint32_t> &info_bits_pos_c,\n+ Decoder_HIHO<B> &dec_r,\n+ Decoder_HIHO<B> &dec_c,\n+ Encoder <B> &enc_r,\n+ Encoder <B> &enc_c,\nconst R alpha_,\nconst int n_least_reliable_positions_,\nconst int n_test_vectors_,\nconst int n_competitors_)\n-: Decoder(hiho_r.get_K() * hiho_c.get_K(), pi.get_core().get_size(), hiho_r.get_n_frames(), hiho_r.get_simd_inter_frame_level()),\n- Decoder_turbo_product<B,R>(n_ite, pi, hiho_r, hiho_c, info_bits_pos_r, info_bits_pos_c),\n-\n+: Decoder(dec_r.get_K() * dec_c.get_K(), pi.get_core().get_size(), dec_r.get_n_frames(), dec_r.get_simd_inter_frame_level()),\n+ Decoder_turbo_product<B,R>(n_ite, pi, dec_r, dec_c, enc_r, enc_c),\nalpha (alpha_ ),\nn_least_reliable_positions(n_least_reliable_positions_ ),\nleast_reliable_pos (n_least_reliable_positions ),\n- hard_Rprime (std::max(hiho_r.get_N(), hiho_c.get_N()) +1 ), // +1 for parity bit if any\n+ hard_Rprime (std::max(dec_r.get_N(), dec_c.get_N()) +1 ), // +1 for parity bit if any\nn_test_vectors (n_test_vectors_ ? n_test_vectors_ : (int)1 << n_least_reliable_positions),\ntest_vect (n_test_vectors * hard_Rprime.size() ),\nmetrics (n_test_vectors ),\n+ is_wrong (n_test_vectors ),\nn_competitors (n_competitors_ ? n_competitors_ : n_test_vectors ),\ncompetitors (n_test_vectors ),\n- Y_N_cha_i (pi.get_core().get_size() ),\n- Alpha ({0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.35, 0.35,0.35,0.35,0.35,0.4,0.4,0.4,0.5})\n+ Y_N_cha_i (pi.get_core().get_size() )\n+ // Alpha ({0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.35, 0.35,0.35,0.35,0.35,0.4,0.4,0.4,0.5})\n{\nconst std::string name = \"Decoder_chase_pyndiah\";\nthis->set_name(name);\n- if (n_least_reliable_positions <= 0 || n_least_reliable_positions >= hiho_r.get_N() || n_least_reliable_positions >= hiho_c.get_N())\n+ if (n_least_reliable_positions <= 0 || n_least_reliable_positions >= dec_r.get_N() || n_least_reliable_positions >= dec_c.get_N())\n{\nstd::stringstream message;\n- message << \"'n_least_reliable_positions' has to be positive and lower than 'hiho_r.get_N()' and 'hiho_c.get_N()' ('n_least_reliable_positions' = \"\n- << n_least_reliable_positions << \", 'hiho_c.get_N()' = \" << hiho_c.get_N() << \" and 'hiho_r.get_N()' = \" << hiho_r.get_N() << \").\";\n+ message << \"'n_least_reliable_positions' has to be positive and lower than 'dec_r.get_N()' and 'dec_c.get_N()' ('n_least_reliable_positions' = \"\n+ << n_least_reliable_positions << \", 'dec_c.get_N()' = \" << dec_c.get_N() << \" and 'dec_r.get_N()' = \" << dec_r.get_N() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -75,8 +75,8 @@ template <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n::_decode(const R *Y_N_cha, int return_K_siso)\n{\n- const int n_cols = this->hiho_r.get_N() + (this->parity_extended ? 1 : 0);\n- const int n_rows = this->hiho_c.get_N() + (this->parity_extended ? 1 : 0);\n+ const int n_cols = this->dec_r.get_N() + (this->parity_extended ? 1 : 0);\n+ const int n_rows = this->dec_c.get_N() + (this->parity_extended ? 1 : 0);\nthis->pi.interleave(Y_N_cha, this->Y_N_cha_i.data(), 0, 1); // interleave data from the channel\n@@ -100,7 +100,8 @@ void Decoder_chase_pyndiah<B,R>\n_decode_row_siso(Y_N_cha_i .data() + j*n_rows,\nthis->Y_N_pi.data() + j*n_rows,\nthis->Y_N_pi.data() + j*n_rows,\n- this->hiho_c,\n+ this->dec_c,\n+ this->enc_c,\nn_rows); // overwrite Y_N_pi\n}\n@@ -122,22 +123,23 @@ void Decoder_chase_pyndiah<B,R>\n_decode_row_siso(Y_N_cha + j*n_cols,\nthis->Y_N_i.data() + j*n_cols,\nthis->Y_N_i.data() + j*n_cols,\n- this->hiho_r,\n+ this->dec_r,\n+ this->enc_r,\nn_cols); // overwrite Y_N_i\n}\n}\nelse if(return_K_siso == 0)\n{\n- for (int j = 0; j < this->hiho_c.get_K(); j++)\n+ for (int j = 0; j < this->dec_c.get_K(); j++)\n{\n- auto pos = this->info_bits_pos_c[j];\n+ auto pos = this->enc_c.get_info_bits_pos()[j];\n_decode_row_siho(Y_N_cha + pos*n_cols,\nthis->Y_N_i.data() + pos*n_cols,\n- this->V_K_i.data() + j*this->hiho_r.get_K(),\n- this->hiho_r,\n+ this->V_K_i.data() + j*this->dec_r.get_K(),\n+ this->dec_r,\n+ this->enc_r,\nn_cols,\n- this->info_bits_pos_r,\ntrue);\n}\n}\n@@ -147,9 +149,9 @@ void Decoder_chase_pyndiah<B,R>\n_decode_row_siho(Y_N_cha + j*n_cols,\nthis->Y_N_i.data() + j*n_cols,\nthis->V_N_i.data() + j*n_cols,\n- this->hiho_r,\n+ this->dec_r,\n+ this->enc_r,\nn_cols,\n- this->info_bits_pos_r,\nfalse);\n}\n@@ -159,15 +161,17 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::_decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size,\n- const std::vector<uint32_t>& info_bits_pos, const bool return_K)\n+::_decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size,\n+ const bool return_K)\n{\n- if (_decode_chase(R_prime, hiho, size))\n+ auto& info_bits_pos = enc.get_info_bits_pos();\n+\n+ if (_decode_chase(R_prime, dec, enc, size))\n{ // syndrome ok, R_prime is a code word, then copy its hard decided version and exit the function\nif (return_K)\n{\n- for (int j = 0; j < hiho.get_K(); j++)\n+ for (int j = 0; j < dec.get_K(); j++)\nR_dec[j] = hard_Rprime[info_bits_pos[j]];\n}\nelse\n@@ -181,7 +185,7 @@ void Decoder_chase_pyndiah<B,R>\nif (return_K)\n{\n- for (int j = 0; j < hiho.get_K(); j++)\n+ for (int j = 0; j < dec.get_K(); j++)\nR_dec[j] = DW[info_bits_pos[j]];\n}\nelse\n@@ -192,9 +196,9 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::_decode_row_siso(const R *R_cha, const R *R_prime, R *R_dec, Decoder_HIHO<B> &hiho, const int size)\n+::_decode_row_siso(const R *R_cha, const R *R_prime, R *R_dec, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size)\n{\n- if (_decode_chase(R_prime, hiho, size))\n+ if (_decode_chase(R_prime, dec, enc, size))\n{ // syndrome ok, R_prime is a code word, then copy it as decided word and exit the function\nstd::copy(R_prime, R_prime + size, R_dec);\nreturn;\n@@ -215,14 +219,12 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nbool Decoder_chase_pyndiah<B,R>\n-::_decode_chase(const R *R_prime, Decoder_HIHO<B> &hiho, const int size)\n+::_decode_chase(const R *R_prime, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size)\n{\n- tools::Frame_trace<> ft;\n+ tools::Frame_trace<> ft(0,3,std::cerr);\ntools::hard_decide(R_prime, hard_Rprime.data(), size);\n-\n-\n#ifndef NDEBUG\nstd::cerr << \"(II) R_prime : \" << std::endl;\nfor (int i = 0; i < size; i++)\n@@ -243,15 +245,15 @@ bool Decoder_chase_pyndiah<B,R>\n// if (this->parity_extended)\n// {\n- // auto parity_calc = tools::compute_parity(hard_Rprime.data(), hiho.get_N());\n- // parity_diff = parity_calc ^ hard_Rprime[hiho.get_N()];\n- // hard_Rprime[hiho.get_N()] = parity_calc;\n+ // auto parity_calc = tools::compute_parity(hard_Rprime.data(), dec.get_N());\n+ // parity_diff = parity_calc ^ hard_Rprime[dec.get_N()];\n+ // hard_Rprime[dec.get_N()] = parity_calc;\n// }\n// else\n// parity_diff = false;\n- find_least_reliable_pos(R_prime, hiho.get_N()); // without parity bit if any\n- compute_test_vectors (hiho, size );\n+ find_least_reliable_pos(R_prime, dec.get_N()); // without parity bit if any\n+ compute_test_vectors (dec, enc, size);\ncompute_metrics (R_prime, size);\n#ifndef NDEBUG\n@@ -308,7 +310,7 @@ void Decoder_chase_pyndiah<B,R>\nR val = std::abs(R_prime[i]);\nif (val < it->metric)\n- { // R[i] is weak, then save its position\n+ { // R_prime[i] is weak, then save its position\nleast_reliable_pos.pop_back(); // remove the last position that is not weak enough\nit = least_reliable_pos.insert(it, {val, i});\nbreak;\n@@ -319,22 +321,26 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::compute_test_vectors(Decoder_HIHO<B> &hiho, const int size)\n+::compute_test_vectors(Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size)\n{\n- tools::Frame_trace<> ft;\n+ tools::Frame_trace<> ft(0,3,std::cerr);\nfor (int c = 0; c < n_test_vectors; c++)\n{\n// rearrange hard_Rprime to be a good candidate\nbit_flipping(hard_Rprime.data(), c);\n- hiho.decode_hiho_cw(hard_Rprime.data(), test_vect.data() + c*size); // parity bit is ignored by the decoder\n+ dec.decode_hiho_cw(hard_Rprime.data(), test_vect.data() + c*size); // parity bit is ignored by the decoder\n+ is_wrong[c] = !enc.is_codeword(test_vect.data() + c*size);\n+\n+ if (this->parity_extended)\n+ test_vect[(c+1)*size -1] = tools::compute_parity(test_vect.data() + c*size, dec.get_N());\n#ifndef NDEBUG\n+ std::cerr << \"(II) Test vectors \" << c << \" before correction\" << std::endl;\nft.display_bit_vector(hard_Rprime);\n+ std::cerr << \"(II) Test vectors \" << c << \" after correction : is wrong = \" << is_wrong[c] << std::endl;\n+ { std::vector<B> v(test_vect.data() + c*size, test_vect.data() + (c+1)*size); ft.display_bit_vector(v); }\n#endif\n- if (this->parity_extended)\n- test_vect[(c+1)*size -1] = tools::compute_parity(test_vect.data() + c*size, hiho.get_N());\n-\nbit_flipping(hard_Rprime.data(), c); // apply again the bit flipping to recover the original hard_Rprime\n}\n}\n@@ -347,6 +353,12 @@ void Decoder_chase_pyndiah<B,R>\nfor (int c = 0; c < n_test_vectors; c++)\n{\n+ if (is_wrong[c])\n+ {\n+ metrics[c] = std::numeric_limits<R>::max()/2;\n+ continue;\n+ }\n+\nint tv_off = c*size;\nfor (int i = 0; i < size; i++)\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -32,6 +32,7 @@ protected:\nconst int n_test_vectors;\nstd::vector<B> test_vect;\nstd::vector<R> metrics;\n+ std::vector<bool> is_wrong;\nconst int n_competitors;\nstd::vector<info> competitors; // map of the competitor metric and its related test vector position\n@@ -45,10 +46,10 @@ public:\nDecoder_chase_pyndiah(const int& n_ite,\nconst Interleaver<R> &pi,\n- Decoder_HIHO<B> &hiho_r,\n- Decoder_HIHO<B> &hiho_c,\n- const std::vector<uint32_t> &info_bits_pos_r,\n- const std::vector<uint32_t> &info_bits_pos_c,\n+ Decoder_HIHO<B> &dec_r,\n+ Decoder_HIHO<B> &dec_c,\n+ Encoder <B> &enc_r,\n+ Encoder <B> &enc_c,\nconst R alpha = 0.5,\nconst int n_least_reliable_positions = 2,\nconst int n_test_vectors = 0,\n@@ -57,13 +58,13 @@ public:\nprotected:\nvoid _decode(const R *Y_N, int return_K_siso); // return_K_siso = 0 then hard decode and fill V_K_i else if = 1 then hard decode and fill V_H_i else soft decode and fill Y_N_i\n- void _decode_row_siso(const R *R_cha, const R *R_prime, R *R_dec, Decoder_HIHO<B> &hiho, const int size); // size is length with parity bit if any\n- void _decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &hiho, const int size,\n- const std::vector<uint32_t>& info_bits_pos, const bool return_K = true);\n+ void _decode_row_siso(const R *R_cha, const R *R_prime, R *R_dec, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size); // size is length with parity bit if any\n+ void _decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size,\n+ const bool return_K = true);\n- bool _decode_chase (const R *R_prime, Decoder_HIHO<B> &hiho, const int size);\n+ bool _decode_chase (const R *R_prime, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size);\nvoid find_least_reliable_pos(const R* R_prime, const int size);\n- void compute_test_vectors (Decoder_HIHO<B> &hiho, const int size);\n+ void compute_test_vectors ( Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size);\nvoid compute_metrics (const R* R_prime, const int size);\nvoid compute_reliability (const R* R_cha, const R* R_prime, R* R_dec, const int size);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -17,21 +17,20 @@ template <typename B, typename R>\nDecoder_turbo_product<B,R>\n::Decoder_turbo_product(const int& n_ite,\nconst Interleaver<R> &pi,\n- Decoder_HIHO<B> &hiho_r,\n- Decoder_HIHO<B> &hiho_c,\n- const std::vector<uint32_t> &info_bits_pos_r,\n- const std::vector<uint32_t> &info_bits_pos_c)\n-: Decoder (hiho_r.get_K() * hiho_c.get_K(), pi.get_core().get_size(), hiho_r.get_n_frames(), hiho_r.get_simd_inter_frame_level()),\n- Decoder_SISO_SIHO<B,R>(hiho_r.get_K() * hiho_c.get_K(), pi.get_core().get_size(), hiho_r.get_n_frames(), hiho_r.get_simd_inter_frame_level()),\n+ Decoder_HIHO<B> &dec_r,\n+ Decoder_HIHO<B> &dec_c,\n+ Encoder <B> &enc_r,\n+ Encoder <B> &enc_c)\n+: Decoder (dec_r.get_K() * dec_c.get_K(), pi.get_core().get_size(), dec_r.get_n_frames(), dec_r.get_simd_inter_frame_level()),\n+ Decoder_SISO_SIHO<B,R>(dec_r.get_K() * dec_c.get_K(), pi.get_core().get_size(), dec_r.get_n_frames(), dec_r.get_simd_inter_frame_level()),\nn_ite(n_ite),\npi (pi ),\n- hiho_r(hiho_r),\n- hiho_c(hiho_c),\n+ dec_r(dec_r),\n+ dec_c(dec_c),\n+ enc_r(enc_r),\n+ enc_c(enc_c),\n- info_bits_pos_r(info_bits_pos_r),\n- info_bits_pos_c(info_bits_pos_c),\n-\n- parity_extended(this->N == (hiho_r.get_N() +1) * (hiho_c.get_N() +1)),\n+ parity_extended(this->N == (dec_r.get_N() +1) * (dec_c.get_N() +1)),\nY_N_i (this->N),\nY_N_pi(this->N),\n@@ -41,13 +40,13 @@ Decoder_turbo_product<B,R>\nconst std::string name = \"Decoder_turbo_product\";\nthis->set_name(name);\n- if ((parity_extended && this->N != (hiho_r.get_N() +1) * (hiho_c.get_N() +1)) || (!parity_extended && this->N != hiho_r.get_N() * hiho_c.get_N()))\n+ if ((parity_extended && this->N != (dec_r.get_N() +1) * (dec_c.get_N() +1)) || (!parity_extended && this->N != dec_r.get_N() * dec_c.get_N()))\n{\nstd::stringstream message;\n- message << \"'N' has to be equal to ('hiho_r.get_N()' +1) * ('hiho_c.get_N()' +1) if parity code extension, \"\n- << \"else equal to 'hiho_r.get_N()' * 'hiho_c.get_N()' ('N' = \"\n- << this->N << \", 'hiho_r.get_N()' = \" << hiho_r.get_N()\n- << \", 'hiho_c.get_N()' = \" << hiho_c.get_N()\n+ message << \"'N' has to be equal to ('dec_r.get_N()' +1) * ('dec_c.get_N()' +1) if parity code extension, \"\n+ << \"else equal to 'dec_r.get_N()' * 'dec_c.get_N()' ('N' = \"\n+ << this->N << \", 'dec_r.get_N()' = \" << dec_r.get_N()\n+ << \", 'dec_c.get_N()' = \" << dec_c.get_N()\n<< \" and 'parity_extended' = \" << parity_extended << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -59,48 +58,48 @@ Decoder_turbo_product<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (hiho_r.get_n_frames() != hiho_c.get_n_frames())\n+ if (dec_r.get_n_frames() != dec_c.get_n_frames())\n{\nstd::stringstream message;\n- message << \"'hiho_r.get_n_frames()' has to be equal to 'hiho_c.get_n_frames()' ('hiho_r.get_n_frames()' = \"\n- << hiho_r.get_n_frames() << \", 'hiho_c.get_n_frames()' = \" << hiho_c.get_n_frames() << \").\";\n+ message << \"'dec_r.get_n_frames()' has to be equal to 'dec_c.get_n_frames()' ('dec_r.get_n_frames()' = \"\n+ << dec_r.get_n_frames() << \", 'dec_c.get_n_frames()' = \" << dec_c.get_n_frames() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (hiho_r.get_simd_inter_frame_level() != hiho_c.get_simd_inter_frame_level())\n+ if (dec_r.get_simd_inter_frame_level() != dec_c.get_simd_inter_frame_level())\n{\nstd::stringstream message;\n- message << \"'hiho_r.get_simd_inter_frame_level()' has to be equal to 'hiho_c.get_simd_inter_frame_level()' \"\n- << \"('hiho_r.get_simd_inter_frame_level()' = \" << hiho_r.get_simd_inter_frame_level()\n- << \", 'hiho_c.get_simd_inter_frame_level()' = \" << hiho_c.get_simd_inter_frame_level() << \").\";\n+ message << \"'dec_r.get_simd_inter_frame_level()' has to be equal to 'dec_c.get_simd_inter_frame_level()' \"\n+ << \"('dec_r.get_simd_inter_frame_level()' = \" << dec_r.get_simd_inter_frame_level()\n+ << \", 'dec_c.get_simd_inter_frame_level()' = \" << dec_c.get_simd_inter_frame_level() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if ((int)info_bits_pos_r.size() != hiho_r.get_K())\n+ if (enc_r.get_K() != dec_r.get_K())\n{\nstd::stringstream message;\n- message << \"'info_bits_pos_r.size()' has to be equal to 'hiho_r.get_K()' \"\n- << \"('info_bits_pos_r.size()' = \" << info_bits_pos_r.size()\n- << \", 'hiho_r.get_K()' = \" << hiho_r.get_K() << \").\";\n+ message << \"'enc_r.get_K()' has to be equal to 'dec_r.get_K()' \"\n+ << \"('enc_r.get_K()' = \" << enc_r.get_K()\n+ << \", 'dec_r.get_K()' = \" << dec_r.get_K() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if ((int)info_bits_pos_c.size() != hiho_c.get_K())\n+ if (enc_c.get_K() != dec_c.get_K())\n{\nstd::stringstream message;\n- message << \"'info_bits_pos_c.size()' has to be equal to 'hiho_c.get_K()' \"\n- << \"('info_bits_pos_c.size()' = \" << info_bits_pos_c.size()\n- << \", 'hiho_c.get_K()' = \" << hiho_c.get_K() << \").\";\n+ message << \"'enc_c.get_K()' has to be equal to 'dec_c.get_K()' \"\n+ << \"('enc_c.get_K()' = \" << enc_c.get_K()\n+ << \", 'dec_c.get_K()' = \" << dec_c.get_K() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (this->K != hiho_r.get_K() * hiho_c.get_K())\n+ if (this->K != dec_r.get_K() * dec_c.get_K())\n{\nstd::stringstream message;\n- message << \"'K' has to be equal to 'hiho_r.get_K()' * 'hiho_c.get_K()' ('K' = \"\n- << this->K << \", 'hiho_r.get_K()' = \" << hiho_r.get_K()\n- << \", 'hiho_c.get_K()' = \" << hiho_c.get_K() << \").\";\n+ message << \"'K' has to be equal to 'dec_r.get_K()' * 'dec_c.get_K()' ('K' = \"\n+ << this->K << \", 'dec_r.get_K()' = \" << dec_r.get_K()\n+ << \", 'dec_c.get_K()' = \" << dec_c.get_K() << \").\";\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n@@ -178,9 +177,9 @@ void Decoder_turbo_product<B, R>\nstd::copy(V_N_i.data(), V_N_i.data() + this->N, V_N);\n// auto d_store = std::chrono::steady_clock::now() - t_store;\n-// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::load, d_load);\n-// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::decode, d_decod);\n-// (*this)[dec::tsk::decode_hiho_cw].update_timer(dec::tm::decode_hiho_cw::store, d_store);\n+// (*this)[dec::tsk::decode_dec_cw].update_timer(dec::tm::decode_dec_cw::load, d_load);\n+// (*this)[dec::tsk::decode_dec_cw].update_timer(dec::tm::decode_dec_cw::decode, d_decod);\n+// (*this)[dec::tsk::decode_dec_cw].update_timer(dec::tm::decode_dec_cw::store, d_store);\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "new_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "diff": "#include \"../Decoder_SISO_SIHO.hpp\"\n#include \"../Decoder_HIHO.hpp\"\n+#include \"../../Encoder/Encoder.hpp\"\nnamespace aff3ct\n{\n@@ -17,11 +18,10 @@ class Decoder_turbo_product : public Decoder_SISO_SIHO<B,R>\nprotected:\nconst int n_ite; // number of iterations\nconst Interleaver<R> &pi;\n- Decoder_HIHO<B> &hiho_r; // row decoder\n- Decoder_HIHO<B> &hiho_c; // col decoder\n-\n- const std::vector<uint32_t> &info_bits_pos_r;\n- const std::vector<uint32_t> &info_bits_pos_c;\n+ Decoder_HIHO<B> &dec_r; // row decoder\n+ Decoder_HIHO<B> &dec_c; // col decoder\n+ Encoder <B> &enc_r; // row encoder\n+ Encoder <B> &enc_c; // col encoder\nconst bool parity_extended;\n@@ -33,10 +33,10 @@ protected:\npublic:\nDecoder_turbo_product(const int& n_ite,\nconst Interleaver<R> &pi,\n- Decoder_HIHO<B> &hiho_r,\n- Decoder_HIHO<B> &hiho_c,\n- const std::vector<uint32_t> &info_bits_pos_r,\n- const std::vector<uint32_t> &info_bits_pos_c);\n+ Decoder_HIHO<B> &dec_r,\n+ Decoder_HIHO<B> &dec_c,\n+ Encoder <B> &enc_r,\n+ Encoder <B> &enc_c);\nvirtual ~Decoder_turbo_product();\nprotected:\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the encoder in the decoder TPC to get the info bit pos and to call is codeword method as genius
8,483
02.02.2018 16:20:16
-3,600
1d2f5521b8bb40281749f3441c93e239d4e22fbd
Remove syndrome check after the Chase decode; Add comments
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -68,7 +68,7 @@ Decoder_chase_pyndiah<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- generate_bit_flipping_candidates();\n+ generate_bit_flipping_candidates(); // generate bit flipping patterns\n}\ntemplate <typename B, typename R>\n@@ -164,24 +164,10 @@ void Decoder_chase_pyndiah<B,R>\n::_decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size,\nconst bool return_K)\n{\n- auto& info_bits_pos = enc.get_info_bits_pos();\n-\n- if (_decode_chase(R_prime, dec, enc, size))\n- { // syndrome ok, R_prime is a code word, then copy its hard decided version and exit the function\n-\n- if (return_K)\n- {\n- for (int j = 0; j < dec.get_K(); j++)\n- R_dec[j] = hard_Rprime[info_bits_pos[j]];\n- }\n- else\n- {\n- std::copy(hard_Rprime.data(), hard_Rprime.data() + size, R_dec);\n- }\n- return;\n- }\n+ _decode_chase(R_prime, dec, enc, size);\nauto* DW = test_vect.data() + competitors.front().pos;\n+ auto& info_bits_pos = enc.get_info_bits_pos();\nif (return_K)\n{\n@@ -198,11 +184,7 @@ template <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n::_decode_row_siso(const R *R_cha, const R *R_prime, R *R_dec, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size)\n{\n- if (_decode_chase(R_prime, dec, enc, size))\n- { // syndrome ok, R_prime is a code word, then copy it as decided word and exit the function\n- std::copy(R_prime, R_prime + size, R_dec);\n- return;\n- }\n+ _decode_chase(R_prime, dec, enc, size);\ncompute_reliability(R_cha, R_prime, R_dec, size);\n@@ -218,7 +200,7 @@ void Decoder_chase_pyndiah<B,R>\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\ntemplate <typename B, typename R>\n-bool Decoder_chase_pyndiah<B,R>\n+void Decoder_chase_pyndiah<B,R>\n::_decode_chase(const R *R_prime, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size)\n{\ntools::Frame_trace<> ft(0,3,std::cerr);\n@@ -253,8 +235,8 @@ bool Decoder_chase_pyndiah<B,R>\n// parity_diff = false;\nfind_least_reliable_pos(R_prime, dec.get_N()); // without parity bit if any\n- compute_test_vectors (dec, enc, size);\n- compute_metrics (R_prime, size);\n+ compute_test_vectors (dec, enc, size); // make bit flipping of least reliable positions and try to decode them\n+ compute_metrics (R_prime, size); // compute euclidian metrics for each test vectors\n#ifndef NDEBUG\nstd::cerr << \"(II) least_reliable_pos : \" << std::endl;\n@@ -288,8 +270,6 @@ bool Decoder_chase_pyndiah<B,R>\nstd::cerr << std::endl;\n{ std::vector<R> v(DW, DW+size); ft.display_bit_vector(v); }\n#endif\n-\n- return false;\n}\ntemplate <typename B, typename R>\n@@ -496,7 +476,7 @@ void Decoder_chase_pyndiah<B,R>\n// (1) flip one by one all least reliable positions -> 'n_least_reliable_positions' test vectors\n// (2) always flip the least realiable position and do (1) on the 'n_least_reliable_positions' -1 left bits -> 'n_least_reliable_positions' -1 test vectors\n// (3) always flip the two least reliable position and do (1) on the 'n_least_reliable_positions' -2 left bits -> 'n_least_reliable_positions' -2 test vectors\n- // (4) and so on until reaching the will number of test vectors with a maximum of the sum from 1 to 'n_least_reliable_positions' + 1\n+ // (4) and so on until reaching the wish number of test vectors with a maximum of the sum from 1 to 'n_least_reliable_positions' + 1\nint idx_pos = 0, start_idx_pos = 0;\nint least_reliable_pos_mask = 0;\n@@ -524,6 +504,10 @@ void Decoder_chase_pyndiah<B,R>\nelse\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"unimplemented method\");\n+\n+ // one 'tv_candidates' element is the bit flipping pattern to apply on the least reliable positions\n+ // in this pattern, the first position is the instruction to flip or not the least reliable position\n+ // the second position is the instruction to flip the second least reliable position, and so on.\nfor (int i = 0; i < n_test_vectors; i++)\nfor (int j = 0; j < n_least_reliable_positions; j++)\ntv_candidates[i][j] = ((cand[i] >> j) & (int)1) != 0;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -62,7 +62,7 @@ protected:\nvoid _decode_row_siho(const R *R_cha, const R *R_prime, B *R_dec, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size,\nconst bool return_K = true);\n- bool _decode_chase (const R *R_prime, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size);\n+ void _decode_chase (const R *R_prime, Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size);\nvoid find_least_reliable_pos(const R* R_prime, const int size);\nvoid compute_test_vectors ( Decoder_HIHO<B> &dec, Encoder<B> &enc, const int size);\nvoid compute_metrics (const R* R_prime, const int size);\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove syndrome check after the Chase decode; Add comments
8,490
02.02.2018 23:31:52
-3,600
746b3d7ca919c30a499eff39d846e885ad6172a7
Add the '--sim-debug-hex' option.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.cpp", "new_path": "src/Factory/Simulation/Simulation.cpp", "diff": "@@ -56,6 +56,10 @@ void Simulation::parameters\n{\"\",\n\"enable debug mode: print array values after each step.\"};\n+ opt_args[{p+\"-debug-hex\"}] =\n+ {\"\",\n+ \"debug mode prints values in the hexadecimal format.\"};\n+\nopt_args[{p+\"-debug-prec\"}] =\n{\"positive_int\",\n\"set the decimal precision of real elements when displayed in debug mode.\"};\n@@ -111,6 +115,11 @@ void Simulation::parameters\nthis->debug = true;\nthis->debug_limit = std::stoi(vals.at({p+\"-debug-limit\"}));\n}\n+ if(exist(vals, {p+\"-debug-hex\"}))\n+ {\n+ this->debug = true;\n+ this->debug_hex = true;\n+ }\nif(exist(vals, {p+\"-debug-prec\"}))\n{\nthis->debug = true;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.hpp", "new_path": "src/Factory/Simulation/Simulation.hpp", "diff": "@@ -38,6 +38,7 @@ struct Simulation : Launcher\nstd::string pyber = \"\";\nfloat snr_step = 0.1f;\nbool debug = false;\n+ bool debug_hex = false;\nbool statistics = false;\nint n_threads = 1;\nint local_seed = 0;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -20,6 +20,7 @@ Task::Task(const Module &module, const std::string &name, const bool autoalloc,\nstats(stats),\nfast(fast),\ndebug(debug),\n+ debug_hex(false),\ndebug_limit(-1),\ndebug_precision(2),\ncodelet([]() -> int { throw tools::unimplemented_error(__FILE__, __LINE__, __func__); return 0; }),\n@@ -100,6 +101,11 @@ void Task::set_debug(const bool debug)\nthis->set_fast(false);\n}\n+void Task::set_debug_hex(const bool debug_hex)\n+{\n+ this->debug_hex = debug_hex;\n+}\n+\nvoid Task::set_debug_limit(const uint32_t limit)\n{\nthis->debug_limit = (int32_t)limit;\n@@ -113,13 +119,23 @@ void Task::set_debug_precision(const uint8_t prec)\ntemplate <typename T>\nstatic inline void display_data(const T *data,\nconst size_t fra_size, const size_t n_fra, const size_t limit,\n- const uint8_t p, const uint8_t n_spaces)\n+ const uint8_t p, const uint8_t n_spaces, const bool hex)\n{\n+ bool is_float_type = std::is_same<float, T>::value || std::is_same<double, T>::value;\n+ if (hex)\n+ {\n+ if (is_float_type)\n+ std::cout << std::hexfloat << std::hex;\n+ else\n+ std::cout << std::hex;\n+ }\n+ else\n+ std::cout << std::fixed << std::setprecision(p) << std::setw(p +3);\n+\nif (n_fra == 1)\n{\nfor (auto i = 0; i < (int)limit; i++)\n- std::cout << std::fixed << std::setprecision(p) << std::setw(p +3) << +data[i]\n- << (i < (int)limit -1 ? \", \" : \"\");\n+ std::cout << (hex && !is_float_type ? \"0x\" : \"\") << +data[i] << (i < (int)limit -1 ? \", \" : \"\");\nstd::cout << (limit < fra_size ? \", ...\" : \"\");\n}\nelse\n@@ -131,11 +147,14 @@ static inline void display_data(const T *data,\nstd::string fra_id = tools::format(\"f\" + std::to_string(f+1) + \":\", sty_fra);\nstd::cout << (f >= 1 ? spaces : \"\") << fra_id << \"(\";\nfor (auto i = 0; i < (int)limit; i++)\n- std::cout << std::fixed << std::setprecision(p) << std::setw(p +3) << +data[f * fra_size +i]\n+ std::cout << (hex && !is_float_type ? \"0x\" : \"\") << +data[f * fra_size +i]\n<< (i < (int)limit -1 ? \", \" : \"\");\nstd::cout << (limit < fra_size ? \", ...\" : \"\") << \")\" << (f < (int)n_fra -1 ? \", \\n\" : \"\");\n}\n}\n+\n+ if (hex && is_float_type)\n+ std::cout << std::defaultfloat;\n}\nint Task::exec()\n@@ -184,12 +203,12 @@ int Task::exec()\nauto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nauto p = debug_precision;\nstd::cout << \"# {IN} \" << s->get_name() << spaces << \" = [\";\n- if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n+ if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\nstd::cout << \"]\" << std::endl;\n}\n}\n@@ -233,12 +252,12 @@ int Task::exec()\nauto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nauto p = debug_precision;\nstd::cout << \"# {OUT} \" << s->get_name() << spaces << \" = [\";\n- if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n- else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12);\n+ if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\nstd::cout << \"]\" << std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.hpp", "new_path": "src/Module/Task.hpp", "diff": "@@ -42,6 +42,7 @@ protected:\nbool stats;\nbool fast;\nbool debug;\n+ bool debug_hex;\nint32_t debug_limit;\nuint8_t debug_precision;\nstd::function<int(void)> codelet;\n@@ -82,6 +83,7 @@ public:\nvoid set_stats (const bool stats );\nvoid set_fast (const bool fast );\nvoid set_debug (const bool debug );\n+ void set_debug_hex (const bool debug_hex);\nvoid set_debug_limit (const uint32_t limit );\nvoid set_debug_precision(const uint8_t prec );\n@@ -90,6 +92,7 @@ public:\ninline bool is_stats ( ) const { return this->stats; }\ninline bool is_fast ( ) const { return this->fast; }\ninline bool is_debug ( ) const { return this->debug; }\n+ inline bool is_debug_hex ( ) const { return this->debug_hex; }\ninline bool is_last_input_socket(const Socket &s_in) const { return last_input_socket == &s_in; }\ninline bool can_exec ( ) const;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -33,6 +33,7 @@ void Simulation\nif (params.debug)\n{\nt->set_debug(true);\n+ t->set_debug_hex(params.debug_hex);\nif (params.debug_limit)\nt->set_debug_limit((uint32_t)params.debug_limit);\nif (params.debug_precision)\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the '--sim-debug-hex' option.
8,488
02.02.2018 20:23:32
18,000
4414ebda7292848d1bcca7e1fc2719d23fe2d68f
Reset number of values per frame and returned status to decimal format in sim-debug-hex mode.
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -184,7 +184,7 @@ int Task::exec()\nstd::cout << (s_type == IN ? tools::format(\"const \", sty_type) : \"\")\n<< tools::format(s.get_datatype_string(), sty_type)\n<< \" \" << s.get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n- << (n_elmts / n_fra) << \"]\"\n+ << std::dec << (n_elmts / n_fra) << \"]\"\n<< (i < (int)sockets.size() -1 ? \", \" : \"\");\nmax_n_chars = std::max(s.get_name().size(), max_n_chars);\n@@ -261,7 +261,7 @@ int Task::exec()\nstd::cout << \"]\" << std::endl;\n}\n}\n- std::cout << \"# Returned status: \" << exec_status << std::endl;\n+ std::cout << \"# Returned status: \" << std::dec << exec_status << std::endl;\nstd::cout << \"#\" << std::endl;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Reset number of values per frame and returned status to decimal format in sim-debug-hex mode.
8,490
03.02.2018 09:27:18
-3,600
984a7c696b9f81d70e9406e08bfa3dea8bb87584
Fix issues with the new '--sim-debug-hex' option.
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "#include <iostream>\n#include <iomanip>\n+#include <ios>\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n@@ -121,21 +122,26 @@ static inline void display_data(const T *data,\nconst size_t fra_size, const size_t n_fra, const size_t limit,\nconst uint8_t p, const uint8_t n_spaces, const bool hex)\n{\n- bool is_float_type = std::is_same<float, T>::value || std::is_same<double, T>::value;\n+ constexpr bool is_float_type = std::is_same<float, T>::value || std::is_same<double, T>::value;\n+\n+ std::ios::fmtflags f(std::cout.flags());\nif (hex)\n{\n- if (is_float_type)\n- std::cout << std::hexfloat << std::hex;\n- else\n- std::cout << std::hex;\n+ if (is_float_type) std::cout << std::hexfloat << std::hex;\n+ else std::cout << std::hex;\n}\nelse\n- std::cout << std::fixed << std::setprecision(p) << std::setw(p +3);\n+ std::cout << std::fixed << std::setprecision(p);\nif (n_fra == 1)\n{\nfor (auto i = 0; i < (int)limit; i++)\n- std::cout << (hex && !is_float_type ? \"0x\" : \"\") << +data[i] << (i < (int)limit -1 ? \", \" : \"\");\n+ {\n+ if (hex)\n+ std::cout << (!is_float_type ? \"0x\" : \"\") << +data[i] << (i < (int)limit -1 ? \", \" : \"\");\n+ else\n+ std::cout << std::setw(p +3) << +data[i] << (i < (int)limit -1 ? \", \" : \"\");\n+ }\nstd::cout << (limit < fra_size ? \", ...\" : \"\");\n}\nelse\n@@ -147,14 +153,18 @@ static inline void display_data(const T *data,\nstd::string fra_id = tools::format(\"f\" + std::to_string(f+1) + \":\", sty_fra);\nstd::cout << (f >= 1 ? spaces : \"\") << fra_id << \"(\";\nfor (auto i = 0; i < (int)limit; i++)\n- std::cout << (hex && !is_float_type ? \"0x\" : \"\") << +data[f * fra_size +i]\n+ {\n+ if (hex)\n+ std::cout << std::setw(p +3) << +data[f * fra_size +i] << (i < (int)limit -1 ? \", \" : \"\");\n+ else\n+ std::cout << (!is_float_type ? \"0x\" : \"\") << +data[f * fra_size +i]\n<< (i < (int)limit -1 ? \", \" : \"\");\n+ }\nstd::cout << (limit < fra_size ? \", ...\" : \"\") << \")\" << (f < (int)n_fra -1 ? \", \\n\" : \"\");\n}\n}\n- if (hex && is_float_type)\n- std::cout << std::defaultfloat;\n+ std::cout.flags(f);\n}\nint Task::exec()\n@@ -184,7 +194,7 @@ int Task::exec()\nstd::cout << (s_type == IN ? tools::format(\"const \", sty_type) : \"\")\n<< tools::format(s.get_datatype_string(), sty_type)\n<< \" \" << s.get_name() << \"[\" << (n_fra > 1 ? std::to_string(n_fra) + \"x\" : \"\")\n- << std::dec << (n_elmts / n_fra) << \"]\"\n+ << (n_elmts / n_fra) << \"]\"\n<< (i < (int)sockets.size() -1 ? \", \" : \"\");\nmax_n_chars = std::max(s.get_name().size(), max_n_chars);\n@@ -261,7 +271,7 @@ int Task::exec()\nstd::cout << \"]\" << std::endl;\n}\n}\n- std::cout << \"# Returned status: \" << std::dec << exec_status << std::endl;\n+ std::cout << \"# Returned status: \" << exec_status << std::endl;\nstd::cout << \"#\" << std::endl;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix issues with the new '--sim-debug-hex' option.
8,490
03.02.2018 11:28:00
-3,600
71d3f206bf0904ebe6d429d14245679deaf52aff
Fix compilation error on gcc-4.
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -117,6 +117,18 @@ void Task::set_debug_precision(const uint8_t prec)\nthis->debug_precision = prec;\n}\n+// trick to compile on the GNU compiler version 4 (where 'std::hexfloat' is unavailable)\n+#if defined(__GNUC__) && defined(__cplusplus) && __GNUC__ < 5\n+namespace std {\n+class Hexfloat {\n+public:\n+ void message(std::ostream &os) const { os << \" /!\\\\ 'std::hexfloat' is not supported by this compiler. /!\\\\ \"; }\n+};\n+Hexfloat hexfloat;\n+}\n+std::ostream& operator<<(std::ostream &os, const std::Hexfloat &obj) { obj.message(os); return os; }\n+#endif\n+\ntemplate <typename T>\nstatic inline void display_data(const T *data,\nconst size_t fra_size, const size_t n_fra, const size_t limit,\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix compilation error on gcc-4.
8,490
03.02.2018 19:13:58
-3,600
e2a0f4774ad78b761ee70a1832fc2c0905539ec1
Use aligned memory for the task buffers.
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -61,7 +61,7 @@ void Task::set_autoalloc(const bool autoalloc)\nfor (auto *s : sockets)\nif (get_socket_type(*s) == OUT)\n{\n- out_buffers.push_back(std::vector<uint8_t>(s->databytes));\n+ out_buffers.push_back(mipp::vector<uint8_t>(s->databytes));\ns->dataptr = out_buffers.back().data();\n}\n}\n@@ -358,7 +358,7 @@ Socket& Task::create_socket_out(const std::string &name, const size_t n_elmts)\n// memory allocation\nif (is_autoalloc())\n{\n- out_buffers.push_back(std::vector<uint8_t>(s.databytes));\n+ out_buffers.push_back(mipp::vector<uint8_t>(s.databytes));\ns.dataptr = out_buffers.back().data();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Task.hpp", "new_path": "src/Module/Task.hpp", "diff": "#include <functional>\n#include <unordered_map>\n+#include <mipp.h>\n+\n#include \"Tools/Exception/exception.hpp\"\nnamespace aff3ct\n@@ -46,7 +48,7 @@ protected:\nint32_t debug_limit;\nuint8_t debug_precision;\nstd::function<int(void)> codelet;\n- std::vector<std::vector<uint8_t>> out_buffers;\n+ std::vector<mipp::vector<uint8_t>> out_buffers;\n// stats\nuint32_t n_calls;\n" } ]
C++
MIT License
aff3ct/aff3ct
Use aligned memory for the task buffers.
8,490
03.02.2018 19:41:55
-3,600
1c739b7a7983c88339f8b2831b5f1c8c7c34b656
Fix a bug in the hexadecimal format, again...
[ { "change_type": "MODIFY", "old_path": "src/Module/Task.cpp", "new_path": "src/Module/Task.cpp", "diff": "@@ -143,7 +143,7 @@ static inline void display_data(const T *data,\nelse std::cout << std::hex;\n}\nelse\n- std::cout << std::fixed << std::setprecision(p);\n+ std::cout << std::fixed << std::setprecision(p) << std::dec;\nif (n_fra == 1)\n{\n@@ -167,10 +167,10 @@ static inline void display_data(const T *data,\nfor (auto i = 0; i < (int)limit; i++)\n{\nif (hex)\n- std::cout << std::setw(p +3) << +data[f * fra_size +i] << (i < (int)limit -1 ? \", \" : \"\");\n- else\nstd::cout << (!is_float_type ? \"0x\" : \"\") << +data[f * fra_size +i]\n<< (i < (int)limit -1 ? \", \" : \"\");\n+ else\n+ std::cout << std::setw(p +3) << +data[f * fra_size +i] << (i < (int)limit -1 ? \", \" : \"\");\n}\nstd::cout << (limit < fra_size ? \", ...\" : \"\") << \")\" << (f < (int)n_fra -1 ? \", \\n\" : \"\");\n}\n@@ -224,13 +224,14 @@ int Task::exec()\nauto fra_size = n_elmts / n_fra;\nauto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nauto p = debug_precision;\n+ auto h = debug_hex;\nstd::cout << \"# {IN} \" << s->get_name() << spaces << \" = [\";\n- if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\nstd::cout << \"]\" << std::endl;\n}\n}\n@@ -273,13 +274,14 @@ int Task::exec()\nauto fra_size = n_elmts / n_fra;\nauto limit = debug_limit != -1 ? std::min(fra_size, (size_t)debug_limit) : fra_size;\nauto p = debug_precision;\n+ auto h = debug_hex;\nstd::cout << \"# {OUT} \" << s->get_name() << spaces << \" = [\";\n- if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n- else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, this->debug_hex);\n+ if (s->get_datatype() == typeid(int8_t )) display_data((int8_t *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(int16_t)) display_data((int16_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(int32_t)) display_data((int32_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(int64_t)) display_data((int64_t*)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(float )) display_data((float *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\n+ else if (s->get_datatype() == typeid(double )) display_data((double *)s->get_dataptr(), fra_size, n_fra, limit, p, (uint8_t)max_n_chars +12, h);\nstd::cout << \"]\" << std::endl;\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix a bug in the hexadecimal format, again...
8,490
04.02.2018 12:05:14
-3,600
4498f794bfd9af7e021bf4c7fd90de89f0ce38e2
Put a pointer to the puncturer in the mother class.
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec.cpp", "new_path": "src/Factory/Module/Codec/Codec.cpp", "diff": "@@ -44,6 +44,7 @@ std::vector<std::string> Codec::parameters\nauto n = Factory::parameters::get_names();\nif (enc != nullptr) { auto nn = enc->get_names(); for (auto &x : nn) n.push_back(x); }\nif (dec != nullptr) { auto nn = dec->get_names(); for (auto &x : nn) n.push_back(x); }\n+ if (pct != nullptr) { auto nn = pct->get_names(); for (auto &x : nn) n.push_back(x); }\nif (itl != nullptr) { auto nn = itl->get_names(); for (auto &x : nn) n.push_back(x); }\nreturn n;\n}\n@@ -54,6 +55,7 @@ std::vector<std::string> Codec::parameters\nauto sn = Factory::parameters::get_short_names();\nif (enc != nullptr) { auto nn = enc->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (dec != nullptr) { auto nn = dec->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n+ if (pct != nullptr) { auto nn = pct->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nif (itl != nullptr) { auto nn = itl->get_short_names(); for (auto &x : nn) sn.push_back(x); }\nreturn sn;\n}\n@@ -64,6 +66,7 @@ std::vector<std::string> Codec::parameters\nauto p = Factory::parameters::get_prefixes();\nif (enc != nullptr) { auto nn = enc->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (dec != nullptr) { auto nn = dec->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n+ if (pct != nullptr) { auto nn = pct->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nif (itl != nullptr) { auto nn = itl->get_prefixes(); for (auto &x : nn) p.push_back(x); }\nreturn p;\n}\n@@ -108,6 +111,12 @@ void Codec::parameters\nthis->dec = dec;\n}\n+void Codec::parameters\n+::set_pct(Puncturer::parameters *pct)\n+{\n+ this->pct = pct;\n+}\n+\nvoid Codec::parameters\n::set_itl(Interleaver::parameters *itl)\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec.hpp", "new_path": "src/Factory/Module/Codec/Codec.hpp", "diff": "#include \"Factory/Module/Encoder/Encoder.hpp\"\n#include \"Factory/Module/Decoder/Decoder.hpp\"\n+#include \"Factory/Module/Puncturer/Puncturer.hpp\"\n#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n#include \"../../Factory.hpp\"\n@@ -24,6 +25,7 @@ struct Codec : Factory\n// depending parameters\nEncoder::parameters *enc = nullptr;\nDecoder::parameters *dec = nullptr;\n+ Puncturer::parameters *pct = nullptr;\nInterleaver::parameters *itl = nullptr;\n// deduced parameters\n@@ -52,6 +54,7 @@ struct Codec : Factory\nvoid set_enc(Encoder ::parameters *enc);\nvoid set_dec(Decoder ::parameters *dec);\n+ void set_pct(Puncturer ::parameters *pct);\nvoid set_itl(Interleaver::parameters *itl);\n};\n};\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -48,30 +48,7 @@ void Codec_LDPC::parameters\n::enable_puncturer()\n{\nthis->pct = new Puncturer_LDPC::parameters(\"pct\");\n-}\n-\n-std::vector<std::string> Codec_LDPC::parameters\n-::get_names() const\n-{\n- auto n = Codec::parameters::get_names();\n- if (pct != nullptr) { auto nn = pct->get_names(); for (auto &x : nn) n.push_back(x); }\n- return n;\n-}\n-\n-std::vector<std::string> Codec_LDPC::parameters\n-::get_short_names() const\n-{\n- auto sn = Codec::parameters::get_short_names();\n- if (pct != nullptr) { auto nn = pct->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n- return sn;\n-}\n-\n-std::vector<std::string> Codec_LDPC::parameters\n-::get_prefixes() const\n-{\n- auto p = Codec::parameters::get_prefixes();\n- if (pct != nullptr) { auto nn = pct->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n- return p;\n+ this->set_pct(this->pct);\n}\nvoid Codec_LDPC::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.hpp", "new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.hpp", "diff": "@@ -35,10 +35,6 @@ struct Codec_LDPC : public Codec_SISO_SIHO\nCodec_LDPC::parameters* clone() const;\nvoid enable_puncturer();\n- virtual std::vector<std::string> get_names () const;\n- virtual std::vector<std::string> get_short_names() const;\n- virtual std::vector<std::string> get_prefixes () const;\n-\n// parameters construction\nvoid get_description(arg_map &req_args, arg_map &opt_args ) const;\nvoid store (const arg_val_map &vals );\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Polar/Codec_polar.cpp", "new_path": "src/Factory/Module/Codec/Polar/Codec_polar.cpp", "diff": "@@ -51,6 +51,7 @@ void Codec_polar::parameters\n::enable_puncturer()\n{\nthis->pct = new Puncturer_polar::parameters(\"pct\");\n+ this->set_pct(this->pct);\n}\nstd::vector<std::string> Codec_polar::parameters\n@@ -71,7 +72,6 @@ std::vector<std::string> Codec_polar::parameters\n}\n// if (fbg != nullptr) { auto nn = fbg->get_names(); for (auto &x : nn) n.push_back(x); }\n- if (pct != nullptr) { auto nn = pct->get_names(); for (auto &x : nn) n2.push_back(x); }\nreturn n2;\n}\n@@ -93,7 +93,6 @@ std::vector<std::string> Codec_polar::parameters\n}\n// if (fbg != nullptr) { auto nn = fbg->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n- if (pct != nullptr) { auto nn = pct->get_short_names(); for (auto &x : nn) sn2.push_back(x); }\nreturn sn2;\n}\n@@ -115,7 +114,6 @@ std::vector<std::string> Codec_polar::parameters\n}\n// if (fbg != nullptr) { auto nn = fbg->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n- if (pct != nullptr) { auto nn = pct->get_prefixes(); for (auto &x : nn) p2.push_back(x); }\nreturn p2;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo/Codec_turbo.cpp", "new_path": "src/Factory/Module/Codec/Turbo/Codec_turbo.cpp", "diff": "@@ -57,30 +57,7 @@ void Codec_turbo::parameters\n::enable_puncturer()\n{\nthis->pct = new Puncturer_turbo::parameters(\"pct\");\n-}\n-\n-std::vector<std::string> Codec_turbo::parameters\n-::get_names() const\n-{\n- auto n = Codec::parameters::get_names();\n- if (pct != nullptr) { auto nn = pct->get_names(); for (auto &x : nn) n.push_back(x); }\n- return n;\n-}\n-\n-std::vector<std::string> Codec_turbo::parameters\n-::get_short_names() const\n-{\n- auto sn = Codec::parameters::get_short_names();\n- if (pct != nullptr) { auto nn = pct->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n- return sn;\n-}\n-\n-std::vector<std::string> Codec_turbo::parameters\n-::get_prefixes() const\n-{\n- auto p = Codec::parameters::get_prefixes();\n- if (pct != nullptr) { auto nn = pct->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n- return p;\n+ this->set_pct(this->pct);\n}\nvoid Codec_turbo::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo/Codec_turbo.hpp", "new_path": "src/Factory/Module/Codec/Turbo/Codec_turbo.hpp", "diff": "@@ -36,10 +36,6 @@ struct Codec_turbo : public Codec_SIHO\nCodec_turbo::parameters* clone() const;\nvoid enable_puncturer();\n- virtual std::vector<std::string> get_names () const;\n- virtual std::vector<std::string> get_short_names() const;\n- virtual std::vector<std::string> get_prefixes () const;\n-\n// parameters construction\nvoid get_description(arg_map &req_args, arg_map &opt_args ) const;\nvoid store (const arg_val_map &vals );\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -57,30 +57,7 @@ void Codec_turbo_DB::parameters\n::enable_puncturer()\n{\nthis->pct = new Puncturer_turbo_DB::parameters(\"pct\");\n-}\n-\n-std::vector<std::string> Codec_turbo_DB::parameters\n-::get_names() const\n-{\n- auto n = Codec::parameters::get_names();\n- if (pct != nullptr) { auto nn = pct->get_names(); for (auto &x : nn) n.push_back(x); }\n- return n;\n-}\n-\n-std::vector<std::string> Codec_turbo_DB::parameters\n-::get_short_names() const\n-{\n- auto sn = Codec::parameters::get_short_names();\n- if (pct != nullptr) { auto nn = pct->get_short_names(); for (auto &x : nn) sn.push_back(x); }\n- return sn;\n-}\n-\n-std::vector<std::string> Codec_turbo_DB::parameters\n-::get_prefixes() const\n-{\n- auto p = Codec::parameters::get_prefixes();\n- if (pct != nullptr) { auto nn = pct->get_prefixes(); for (auto &x : nn) p.push_back(x); }\n- return p;\n+ this->set_pct(this->pct);\n}\nvoid Codec_turbo_DB::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp", "new_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp", "diff": "@@ -36,10 +36,6 @@ struct Codec_turbo_DB : public Codec_SIHO\nCodec_turbo_DB::parameters* clone() const;\nvoid enable_puncturer();\n- virtual std::vector<std::string> get_names () const;\n- virtual std::vector<std::string> get_short_names() const;\n- virtual std::vector<std::string> get_prefixes () const;\n-\n// parameters construction\nvoid get_description(arg_map &req_args, arg_map &opt_args ) const;\nvoid store (const arg_val_map &vals );\n" } ]
C++
MIT License
aff3ct/aff3ct
Put a pointer to the puncturer in the mother class.
8,490
04.02.2018 12:06:07
-3,600
65787544c4b9066a925f37cf7e743719056b0f42
Add two methods in the modem: 'is_filter()' and 'is_demodulator()'.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/BPSK/Modem_BPSK.cpp", "new_path": "src/Module/Modem/BPSK/Modem_BPSK.cpp", "diff": "@@ -15,6 +15,9 @@ Modem_BPSK<B,R,Q>\n{\nconst std::string name = \"Modem_BPSK\";\nthis->set_name(name);\n+\n+ if (disable_sig2)\n+ this->set_demodulator(false);\n}\ntemplate <typename B, typename R, typename Q>\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": "@@ -16,6 +16,9 @@ Modem_BPSK_fast<B,R,Q>\n{\nconst std::string name = \"Modem_BPSK_fast\";\nthis->set_name(name);\n+\n+ if (disable_sig2)\n+ this->set_demodulator(false);\n}\ntemplate <typename B, typename R, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/CPM/Modem_CPM.hxx", "new_path": "src/Module/Modem/CPM/Modem_CPM.hxx", "diff": "@@ -59,6 +59,8 @@ Modem_CPM<B,R,Q,MAX>\nconst std::string name = \"Modem_CPM\";\nthis->set_name(name);\n+ this->set_filter(true);\n+\nif (N % bits_per_symbol)\n{\nstd::stringstream message;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/Modem.hpp", "new_path": "src/Module/Modem/Modem.hpp", "diff": "@@ -61,6 +61,9 @@ protected:\nconst int N_fil; /*!< Number of transmitted elements after the filtering process */\nR sigma; /*!< Sigma^2, the noise variance */\n+ bool enable_filter;\n+ bool enable_demodulator;\n+\npublic:\n/*!\n* \\brief Constructor.\n@@ -72,7 +75,7 @@ public:\n* \\param name: Modem's name.\n*/\nModem(const int N, const int N_mod, const int N_fil, const R sigma = -1.f, const int n_frames = 1)\n- : Module(n_frames), N(N), N_mod(N_mod), N_fil(N_fil), sigma(sigma)\n+ : Module(n_frames), N(N), N_mod(N_mod), N_fil(N_fil), sigma(sigma), enable_filter(false), enable_demodulator(true)\n{\nconst std::string name = \"Modem\";\nthis->set_name(name);\n@@ -111,7 +114,7 @@ public:\n* \\param name: Modem's name.\n*/\nModem(const int N, const int N_mod, const R sigma = -1.f, const int n_frames = 1)\n- : Module(n_frames), N(N), N_mod(N_mod), N_fil(N_mod), sigma(sigma)\n+ : Module(n_frames), N(N), N_mod(N_mod), N_fil(N_mod), sigma(sigma), enable_filter(false), enable_demodulator(true)\n{\nconst std::string name = \"Modem\";\nthis->set_name(name);\n@@ -142,7 +145,7 @@ public:\n* \\param name: Modem's name.\n*/\nModem(const int N, const R sigma = -1.f, const int n_frames = 1)\n- : Module(n_frames), N(N), N_mod(N), N_fil(N), sigma(sigma)\n+ : Module(n_frames), N(N), N_mod(N), N_fil(N), sigma(sigma), enable_filter(false), enable_demodulator(true)\n{\nconst std::string name = \"Modem\";\nthis->set_name(name);\n@@ -273,6 +276,16 @@ public:\nreturn this->sigma;\n}\n+ bool is_filter() const\n+ {\n+ return this->enable_filter;\n+ }\n+\n+ bool is_demodulator() const\n+ {\n+ return this->enable_demodulator;\n+ }\n+\nvirtual void set_sigma(const R sigma)\n{\nif (sigma <= 0)\n@@ -715,6 +728,16 @@ protected:\n{\nthrow tools::unimplemented_error(__FILE__, __LINE__, __func__);\n}\n+\n+ void set_filter(const bool filter)\n+ {\n+ this->enable_filter = filter;\n+ }\n+\n+ void set_demodulator(const bool demodulator)\n+ {\n+ this->enable_demodulator = demodulator;\n+ }\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add two methods in the modem: 'is_filter()' and 'is_demodulator()'.
8,490
04.02.2018 12:07:30
-3,600
0086e9cb7f210be5aa8f06893dcf9f29d220e89e
Automatically disable the useless modules in the simulation chain.
[ { "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": "@@ -118,6 +118,13 @@ void BFER_std_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_std.crc->type == \"NO\")\n+ crc[crc::tsk::build][crc::sck::build::U_K2](src[src::tsk::generate][src::sck::generate::U_K]);\n+ if (this->params_BFER_std.cdc->enc->type == \"NO\")\n+ enc[enc::tsk::encode][enc::sck::encode::X_N](crc[crc::tsk::build][crc::sck::build::U_K2]);\n+ if (this->params_BFER_std.cdc->pct == nullptr || this->params_BFER_std.cdc->pct->type == \"NO\")\n+ pct[pct::tsk::puncture][pct::sck::puncture::X_N2](enc[enc::tsk::encode][enc::sck::encode::X_N]);\n+\ncrc[crc::tsk::build ][crc::sck::build ::U_K1](src[src::tsk::generate][src::sck::generate::U_K ]);\nenc[enc::tsk::encode ][enc::sck::encode ::U_K ](crc[crc::tsk::build ][crc::sck::build ::U_K2]);\npct[pct::tsk::puncture][pct::sck::puncture::X_N1](enc[enc::tsk::encode ][enc::sck::encode ::X_N ]);\n@@ -126,6 +133,20 @@ void BFER_std_threads<B,R,Q>\nif (this->params_BFER_std.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n+ if (this->params_BFER_std.chn->type == \"NO\")\n+ {\n+ chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::Y_N](mdm[mdm::tsk::modulate][mdm::sck::modulate::X_N2]);\n+ auto chn_data = (uint8_t*)(chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::H_N].get_dataptr());\n+ auto chn_bytes = chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::H_N].get_databytes();\n+ std::fill(chn_data, chn_data + chn_bytes, 0);\n+ }\n+ if (!mdm.is_filter())\n+ mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2](chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::Y_N]);\n+ if (!mdm.is_demodulator())\n+ mdm[mdm::tsk::demodulate_wg][mdm::sck::demodulate_wg::Y_N2](mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2]);\n+ if (this->params_BFER_std.qnt->type == \"NO\")\n+ qnt[qnt::tsk::process][qnt::sck::process::Y_N2](mdm[mdm::tsk::demodulate_wg][mdm::sck::demodulate_wg::Y_N2]);\n+\nchn[chn::tsk::add_noise_wg ][chn::sck::add_noise_wg ::X_N ](mdm[mdm::tsk::modulate ][mdm::sck::modulate ::X_N2]);\nmdm[mdm::tsk::demodulate_wg][mdm::sck::demodulate_wg::H_N ](chn[chn::tsk::add_noise_wg ][chn::sck::add_noise_wg ::H_N ]);\nmdm[mdm::tsk::filter ][mdm::sck::filter ::Y_N1](chn[chn::tsk::add_noise_wg ][chn::sck::add_noise_wg ::Y_N ]);\n@@ -134,12 +155,24 @@ void BFER_std_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_std.chn->type == \"NO\")\n+ chn[chn::tsk::add_noise][chn::sck::add_noise::Y_N](mdm[mdm::tsk::modulate][mdm::sck::modulate::X_N2]);\n+ if (!mdm.is_filter())\n+ mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2](chn[chn::tsk::add_noise][chn::sck::add_noise::Y_N]);\n+ if (!mdm.is_demodulator())\n+ mdm[mdm::tsk::demodulate][mdm::sck::demodulate::Y_N2](mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2]);\n+ if (this->params_BFER_std.qnt->type == \"NO\")\n+ qnt[qnt::tsk::process][qnt::sck::process::Y_N2](mdm[mdm::tsk::demodulate][mdm::sck::demodulate::Y_N2]);\n+\nchn[chn::tsk::add_noise ][chn::sck::add_noise ::X_N ](mdm[mdm::tsk::modulate ][mdm::sck::modulate ::X_N2]);\nmdm[mdm::tsk::filter ][mdm::sck::filter ::Y_N1](chn[chn::tsk::add_noise ][chn::sck::add_noise ::Y_N ]);\nmdm[mdm::tsk::demodulate][mdm::sck::demodulate::Y_N1](mdm[mdm::tsk::filter ][mdm::sck::filter ::Y_N2]);\nqnt[qnt::tsk::process ][qnt::sck::process ::Y_N1](mdm[mdm::tsk::demodulate][mdm::sck::demodulate::Y_N2]);\n}\n+ if (this->params_BFER_std.cdc->pct == nullptr || this->params_BFER_std.cdc->pct->type == \"NO\")\n+ pct[pct::tsk::depuncture][pct::sck::depuncture::Y_N2](qnt[qnt::tsk::process][qnt::sck::process::Y_N2]);\n+\npct[pct::tsk::depuncture][pct::sck::depuncture::Y_N1](qnt[qnt::tsk::process][qnt::sck::process::Y_N2]);\nif (this->params_BFER_std.coset)\n@@ -155,6 +188,9 @@ void BFER_std_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_std.crc->type == \"NO\")\n+ crc[crc::tsk::extract][crc::sck::extract::V_K2](csb[cst::tsk::apply][cst::sck::apply::out]);\n+\ndec[dec::tsk::decode_siho][dec::sck::decode_siho::Y_N ](csr[cst::tsk::apply ][cst::sck::apply ::out ]);\ncsb[cst::tsk::apply ][cst::sck::apply ::ref ](crc[crc::tsk::build ][crc::sck::build ::U_K2]);\ncsb[cst::tsk::apply ][cst::sck::apply ::in ](dec[dec::tsk::decode_siho][dec::sck::decode_siho::V_K ]);\n@@ -169,6 +205,9 @@ void BFER_std_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_std.crc->type == \"NO\")\n+ crc[crc::tsk::extract][crc::sck::extract::V_K2](dec[dec::tsk::decode_siho][dec::sck::decode_siho::V_K]);\n+\ndec[dec::tsk::decode_siho][dec::sck::decode_siho::Y_N ](pct[pct::tsk::depuncture ][pct::sck::depuncture ::Y_N2]);\ncrc[crc::tsk::extract ][crc::sck::extract ::V_K1](dec[dec::tsk::decode_siho][dec::sck::decode_siho::V_K ]);\n}\n@@ -234,27 +273,39 @@ void BFER_std_threads<B,R,Q>\nif (this->params_BFER_std.src->type != \"AZCW\")\n{\nsource[src::tsk::generate].exec();\n+ if (this->params_BFER_std.crc->type != \"NO\")\ncrc[crc::tsk::build].exec();\n+ if (this->params_BFER_std.cdc->enc->type != \"NO\")\nencoder[enc::tsk::encode].exec();\n+ if (this->params_BFER_std.cdc->pct != nullptr && this->params_BFER_std.cdc->pct->type != \"NO\")\npuncturer[pct::tsk::puncture].exec();\nmodem[mdm::tsk::modulate].exec();\n}\nif (this->params_BFER_std.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n+ if (this->params_BFER_std.chn->type != \"NO\")\nchannel[chn::tsk::add_noise_wg].exec();\n+ if (modem.is_filter())\nmodem[mdm::tsk::filter].exec();\n+ if (modem.is_demodulator())\nmodem[mdm::tsk::demodulate_wg].exec();\n+ if (this->params_BFER_std.qnt->type != \"NO\")\nquantizer[qnt::tsk::process].exec();\n}\nelse\n{\n+ if (this->params_BFER_std.chn->type != \"NO\")\nchannel[chn::tsk::add_noise].exec();\n+ if (modem.is_filter())\nmodem[mdm::tsk::filter].exec();\n+ if (modem.is_demodulator())\nmodem[mdm::tsk::demodulate].exec();\n+ if (this->params_BFER_std.qnt->type != \"NO\")\nquantizer[qnt::tsk::process].exec();\n}\n+ if (this->params_BFER_std.cdc->pct != nullptr && this->params_BFER_std.cdc->pct->type != \"NO\")\npuncturer[pct::tsk::depuncture].exec();\nif (this->params_BFER_std.coset)\n@@ -270,6 +321,7 @@ void BFER_std_threads<B,R,Q>\n{\ndecoder [dec::tsk::decode_siho].exec();\ncoset_bit[cst::tsk::apply ].exec();\n+ if (this->params_BFER_std.crc->type != \"NO\")\ncrc[crc::tsk::extract].exec();\n}\n}\n@@ -282,6 +334,7 @@ void BFER_std_threads<B,R,Q>\nelse\n{\ndecoder[dec::tsk::decode_siho].exec();\n+ if (this->params_BFER_std.crc->type != \"NO\")\ncrc[crc::tsk::extract].exec();\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Automatically disable the useless modules in the simulation chain.
8,490
04.02.2018 13:08:29
-3,600
63f65965d4b5dbd7e3c166837a60d2a1ead0fef6
Automatically disable the useless modules in the simulation chain (BFER ite).
[ { "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": "@@ -122,6 +122,11 @@ void BFER_ite_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_ite.crc->type == \"NO\")\n+ crc[crc::tsk::build][crc::sck::build::U_K2](src[src::tsk::generate][src::sck::generate::U_K]);\n+ if (this->params_BFER_ite.cdc->enc->type == \"NO\")\n+ enc[enc::tsk::encode][enc::sck::encode::X_N](crc[crc::tsk::build][crc::sck::build::U_K2]);\n+\ncrc[crc::tsk::build ][crc::sck::build ::U_K1](src[src::tsk::generate ][src::sck::generate ::U_K ]);\nenc[enc::tsk::encode ][enc::sck::encode ::U_K ](crc[crc::tsk::build ][crc::sck::build ::U_K2]);\nitb[itl::tsk::interleave][itl::sck::interleave::nat ](enc[enc::tsk::encode ][enc::sck::encode ::X_N ]);\n@@ -145,6 +150,20 @@ void BFER_ite_threads<B,R,Q>\nif (this->params_BFER_ite.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n+ if (this->params_BFER_ite.chn->type == \"NO\")\n+ {\n+ chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::Y_N](mdm[mdm::tsk::modulate][mdm::sck::modulate::X_N2]);\n+ auto chn_data = (uint8_t*)(chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::H_N].get_dataptr());\n+ auto chn_bytes = chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::H_N].get_databytes();\n+ std::fill(chn_data, chn_data + chn_bytes, 0);\n+ }\n+ if (!mdm.is_filter())\n+ mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2](chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::Y_N]);\n+ if (this->params_BFER_ite.qnt->type == \"NO\")\n+ qnt[qnt::tsk::process][qnt::sck::process::Y_N2](mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2]);\n+ if (!mdm.is_demodulator())\n+ mdm[mdm::tsk::demodulate_wg][mdm::sck::demodulate_wg::Y_N2](qnt[qnt::tsk::process][qnt::sck::process::Y_N2]);\n+\nchn[chn::tsk::add_noise_wg ][chn::sck::add_noise_wg ::X_N ](mdm[mdm::tsk::modulate ][mdm::sck::modulate ::X_N2]);\nmdm[mdm::tsk::demodulate_wg][mdm::sck::demodulate_wg::H_N ](chn[chn::tsk::add_noise_wg ][chn::sck::add_noise_wg::H_N ]);\nmdm[mdm::tsk::filter ][mdm::sck::filter ::Y_N1](chn[chn::tsk::add_noise_wg ][chn::sck::add_noise_wg::Y_N ]);\n@@ -153,6 +172,15 @@ void BFER_ite_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_ite.chn->type == \"NO\")\n+ chn[chn::tsk::add_noise][chn::sck::add_noise::Y_N](mdm[mdm::tsk::modulate][mdm::sck::modulate::X_N2]);\n+ if (!mdm.is_filter())\n+ mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2](chn[chn::tsk::add_noise][chn::sck::add_noise::Y_N]);\n+ if (this->params_BFER_ite.qnt->type == \"NO\")\n+ qnt[qnt::tsk::process][qnt::sck::process::Y_N2](mdm[mdm::tsk::filter][mdm::sck::filter::Y_N2]);\n+ if (!mdm.is_demodulator())\n+ mdm[mdm::tsk::demodulate][mdm::sck::demodulate::Y_N2](qnt[qnt::tsk::process][qnt::sck::process::Y_N2]);\n+\nchn[chn::tsk::add_noise ][chn::sck::add_noise ::X_N ](mdm[mdm::tsk::modulate ][mdm::sck::modulate ::X_N2]);\nmdm[mdm::tsk::filter ][mdm::sck::filter ::Y_N1](chn[chn::tsk::add_noise][chn::sck::add_noise::Y_N ]);\nqnt[qnt::tsk::process ][qnt::sck::process ::Y_N1](mdm[mdm::tsk::filter ][mdm::sck::filter ::Y_N2]);\n@@ -195,16 +223,22 @@ void BFER_ite_threads<B,R,Q>\n// --------------------------------------------------------------------------------------------------- demodulation\nif (this->params_BFER_ite.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n- // output socket binding (trick to avoid runtime re-binding)\n+ if (!mdm.is_demodulator())\n+ mdm[mdm::tsk::tdemodulate_wg][mdm::sck::tdemodulate_wg::Y_N3](qnt[qnt::tsk::process][qnt::sck::process::Y_N2]);\n+ else // output socket binding (trick to avoid runtime re-binding)\nmdm[mdm::tsk::tdemodulate_wg][mdm::sck::tdemodulate_wg::Y_N3](mdm[mdm::tsk::demodulate][mdm::sck::demodulate::Y_N2]);\n+\nmdm[mdm::tsk::tdemodulate_wg][mdm::sck::tdemodulate_wg::Y_N1](qnt[qnt::tsk::process ][qnt::sck::process ::Y_N2]);\nmdm[mdm::tsk::tdemodulate_wg][mdm::sck::tdemodulate_wg::H_N ](chn[chn::tsk::add_noise_wg][chn::sck::add_noise_wg::H_N ]);\nmdm[mdm::tsk::tdemodulate_wg][mdm::sck::tdemodulate_wg::Y_N2](itl[itl::tsk::interleave ][itl::sck::interleave ::itl ]);\n}\nelse\n{\n- // output socket binding (trick to avoid runtime re-binding)\n+ if (!mdm.is_demodulator())\n+ mdm[mdm::tsk::tdemodulate][mdm::sck::tdemodulate::Y_N3](qnt[qnt::tsk::process][qnt::sck::process::Y_N2]);\n+ else // output socket binding (trick to avoid runtime re-binding)\nmdm[mdm::tsk::tdemodulate][mdm::sck::tdemodulate::Y_N3](mdm[mdm::tsk::demodulate][mdm::sck::demodulate::Y_N2]);\n+\nmdm[mdm::tsk::tdemodulate][mdm::sck::tdemodulate::Y_N1](qnt[qnt::tsk::process ][qnt::sck::process ::Y_N2]);\nmdm[mdm::tsk::tdemodulate][mdm::sck::tdemodulate::Y_N2](itl[itl::tsk::interleave][itl::sck::interleave::itl ]);\n}\n@@ -230,6 +264,9 @@ void BFER_ite_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_ite.crc->type == \"NO\")\n+ crc[crc::tsk::extract][crc::sck::extract::V_K2](csb[cst::tsk::apply][cst::sck::apply::out]);\n+\ndch[dec::tsk::decode_siho][dec::sck::decode_siho::Y_N ](csr[cst::tsk::apply ][cst::sck::apply ::out]);\ncsb[cst::tsk::apply ][cst::sck::apply ::in ](dch[dec::tsk::decode_siho][dec::sck::decode_siho::V_K]);\ncrc[crc::tsk::extract ][crc::sck::extract ::V_K1](csb[cst::tsk::apply ][cst::sck::apply ::out]);\n@@ -243,6 +280,9 @@ void BFER_ite_threads<B,R,Q>\n}\nelse\n{\n+ if (this->params_BFER_ite.crc->type == \"NO\")\n+ crc[crc::tsk::extract][crc::sck::extract::V_K2](dch[dec::tsk::decode_siho ][dec::sck::decode_siho::V_K]);\n+\ndch[dec::tsk::decode_siho][dec::sck::decode_siho::Y_N ](itl[itl::tsk::deinterleave][itl::sck::deinterleave::nat]);\ncrc[crc::tsk::extract ][crc::sck::extract ::V_K1](dch[dec::tsk::decode_siho ][dec::sck::decode_siho ::V_K]);\n}\n@@ -304,24 +344,35 @@ void BFER_ite_threads<B,R,Q>\nif (this->params_BFER_ite.src->type != \"AZCW\")\n{\nsource[src::tsk::generate].exec();\n+ if (this->params_BFER_ite.crc->type != \"NO\")\ncrc[crc::tsk::build].exec();\n+ if (this->params_BFER_ite.cdc->enc->type != \"NO\")\nencoder[enc::tsk::encode].exec();\n+\ninterleaver_bit[itl::tsk::interleave].exec();\nmodem [mdm::tsk::modulate ].exec();\n}\nif (this->params_BFER_ite.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n{\n+ if (this->params_BFER_ite.chn->type != \"NO\")\nchannel[chn::tsk::add_noise_wg].exec();\n+ if (modem.is_filter())\nmodem [mdm::tsk::filter].exec();\n+ if (this->params_BFER_ite.qnt->type != \"NO\")\nquantizer[qnt::tsk::process].exec();\n+ if (modem.is_demodulator())\nmodem[mdm::tsk::demodulate_wg].exec();\n}\nelse\n{\n+ if (this->params_BFER_ite.chn->type != \"NO\")\nchannel[chn::tsk::add_noise].exec();\n+ if (modem.is_filter())\nmodem[mdm::tsk::filter].exec();\n+ if (this->params_BFER_ite.qnt->type != \"NO\")\nquantizer[qnt::tsk::process].exec();\n+ if (modem.is_demodulator())\nmodem[mdm::tsk::demodulate].exec();\n}\n@@ -357,9 +408,15 @@ void BFER_ite_threads<B,R,Q>\n// ------------------------------------------------------------------------------------------- demodulation\nif (this->params_BFER_ite.chn->type.find(\"RAYLEIGH\") != std::string::npos)\n+ {\n+ if (modem.is_demodulator())\nmodem[mdm::tsk::tdemodulate_wg].exec();\n+ }\nelse\n+ {\n+ if (modem.is_demodulator())\nmodem[mdm::tsk::tdemodulate].exec();\n+ }\n// ----------------------------------------------------------------------------------------- deinterleaving\ninterleaver_llr[itl::tsk::deinterleave].exec();\n@@ -378,6 +435,8 @@ void BFER_ite_threads<B,R,Q>\n{\ndecoder_siho[dec::tsk::decode_siho].exec();\ncoset_bit [cst::tsk::apply ].exec();\n+\n+ if (this->params_BFER_ite.crc->type != \"NO\")\ncrc[crc::tsk::extract].exec();\n}\n}\n@@ -390,6 +449,8 @@ void BFER_ite_threads<B,R,Q>\nelse\n{\ndecoder_siho[dec::tsk::decode_siho].exec();\n+\n+ if (this->params_BFER_ite.crc->type != \"NO\")\ncrc[crc::tsk::extract].exec();\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Automatically disable the useless modules in the simulation chain (BFER ite).
8,490
04.02.2018 18:42:26
-3,600
e9fee88275af00d7e55ace24389d1dbf7836677e
Fix the 'SIM_THR' terminal indicator with the '--sim-coded' option.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -75,16 +75,16 @@ BFER<B,R,Q>\n#ifdef ENABLE_MPI\n// build a monitor to compute BER/FER (reduce the other monitors)\n- this->monitor_red = new module::Monitor_BFER_reduction_mpi<B>(params_BFER.src->K,\n- params_BFER.mnt->n_frame_errors,\n+ this->monitor_red = new module::Monitor_BFER_reduction_mpi<B>(this->monitor[0]->get_size(),\n+ this->monitor[0]->get_fe_limit(),\nthis->monitor,\nstd::this_thread::get_id(),\nparams_BFER.mpi_comm_freq,\nparams_BFER.src->n_frames);\n#else\n// build a monitor to compute BER/FER (reduce the other monitors)\n- this->monitor_red = new module::Monitor_BFER_reduction<B>(params_BFER.src->K,\n- params_BFER.mnt->n_frame_errors,\n+ this->monitor_red = new module::Monitor_BFER_reduction<B>(this->monitor[0]->get_size(),\n+ this->monitor[0]->get_fe_limit(),\nthis->monitor,\nparams_BFER.src->n_frames);\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the 'SIM_THR' terminal indicator with the '--sim-coded' option.
8,483
05.02.2018 08:52:29
-3,600
2f359bfdf913871704ef0cd1a8ed4d77c6771b17
Remove chrono tests
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "#include <sstream>\n#include <algorithm>\n#include <cmath>\n-#include <chrono>\n#include \"Decoder_chase_pyndiah.hpp\"\n@@ -217,15 +216,10 @@ void Decoder_chase_pyndiah<B,R>\n#endif\n}\n-\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n::find_least_reliable_pos(const R* R_prime)\n{\n- using namespace std::chrono;\n-\n- // high_resolution_clock::time_point t1 = high_resolution_clock::now();\n-\nfor (auto it = least_reliable_pos.begin(); it != least_reliable_pos.end(); it++)\n{\nit->metric = std::numeric_limits<R>::max();\n@@ -247,55 +241,6 @@ void Decoder_chase_pyndiah<B,R>\n}\n}\n}\n-\n- // high_resolution_clock::time_point t2 = high_resolution_clock::now();\n-\n-\n- // std::vector<int> llrs_indexes(this->N);\n- // // high_resolution_clock::time_point t1 = high_resolution_clock::now();\n-\n- // std::iota(llrs_indexes.begin(), llrs_indexes.end(), 0);\n- // std::partial_sort(llrs_indexes.begin(), llrs_indexes.begin() + n_least_reliable_positions, llrs_indexes.end(),\n- // [&R_prime](const uint32_t i1, const uint32_t i2) { return std::abs(R_prime[i1]) < std::abs(R_prime[i2]);}\n- // );\n-\n-\n- // std::vector<info> least_reliable_pos2(least_reliable_pos.size());\n-\n- // bool diff = false;\n-\n- // for (int i = 0; i < n_least_reliable_positions; i++)\n- // {\n- // least_reliable_pos2[i].pos = llrs_indexes[i];\n- // least_reliable_pos2[i].metric = std::abs(R_prime[llrs_indexes[i]]);\n-\n- // if (least_reliable_pos2[i].pos != least_reliable_pos[i].pos)\n- // diff = true;\n- // }\n-\n- // if (diff)\n- // {\n- // for (int i = 0; i < n_least_reliable_positions; i++)\n- // {\n- // std::cerr << i << \". pos \" << least_reliable_pos[i].pos << \", metric \" << least_reliable_pos[i].metric;\n- // std::cerr << \" vs pos \" << least_reliable_pos2[i].pos << \", metric \" << least_reliable_pos2[i].metric << std::endl;\n- // }\n- // }\n-\n- // high_resolution_clock::time_point t2 = high_resolution_clock::now();\n-\n- // time_span += duration_cast<duration<double>>(t2 - t1);\n- // count++;\n-\n- // if (count == 1000000)\n- // {\n- // std::stringstream ss;\n- // ss << \"Total = \" << time_span.count() << \" seconds\" << std::endl;\n- // ss << \"Average = \" << time_span.count()/count << \" usec/exec\" << std::endl;\n-\n- // std::cout << ss.str();\n- // std::exit(1);\n- // }\n}\ntemplate <typename B, typename R>\n" } ]
C++
MIT License
aff3ct/aff3ct
Remove chrono tests
8,483
05.02.2018 10:59:55
-3,600
1181623fd578f9425e17d320a3ca090097e1c821
Modify TPC and Chase Pyndiah decoder to be completely independant (extrinsic with alpha and channel values are computed in TURBO Product decoder); Make alpha argument a vector with a value for each half iteration
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/general_utils.h\"\n#include \"Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp\"\n#include \"Module/Decoder/Turbo_product/Decoder_turbo_product.hpp\"\n@@ -91,8 +92,8 @@ void Decoder_turbo_product::parameters\n\"maximal number of iterations in the turbo.\"};\nopt_args[{p+\"-alpha\"}] =\n- {\"float\",\n- \"extrinsic coefficient.\"};\n+ {\"string\",\n+ \"extrinsic coefficients, one by half iteration (so twice more than number of iterations). If only one, then automatically extended to all iterations.\"};\nopt_args[{p+\"-p\"}] =\n{\"strictly_positive_int\",\n@@ -128,9 +129,37 @@ void Decoder_turbo_product::parameters\nif(exist(vals, {p+\"-p\" })) this->n_least_reliable_positions = std::stoi(vals.at({p+\"-p\" }));\nif(exist(vals, {p+\"-t\" })) this->n_test_vectors = std::stoi(vals.at({p+\"-t\" }));\nif(exist(vals, {p+\"-c\" })) this->n_competitors = std::stoi(vals.at({p+\"-c\" }));\n- if(exist(vals, {p+\"-alpha\" })) this->alpha = std::stof(vals.at({p+\"-alpha\" }));\nif(exist(vals, {p+\"-ext\" })) this->parity_extended = true;\n+ this->alpha.resize(this->n_ite*2);\n+\n+ if(exist(vals, {p+\"-alpha\"}))\n+ {\n+ auto alpha_list = tools::split(vals.at({p+\"-alpha\"}), ',');\n+\n+\n+ if (alpha_list.size() == 1)\n+ {\n+ std::fill(this->alpha.begin(), this->alpha.end(), std::stof(alpha_list.front()));\n+ }\n+ else if (alpha_list.size() == this->alpha.size())\n+ {\n+ for (unsigned i = 0; i < alpha_list.size(); i++)\n+ this->alpha[i] = std::stof(alpha_list[i]);\n+ }\n+ else\n+ {\n+ std::stringstream message;\n+ message << \"'\" << p << \"-alpha' argument has to be twice the length given in '\" << p << \"-ite'.\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ }\n+ else\n+ {\n+ std::fill(this->alpha.begin(), this->alpha.end(), 0.5f);\n+ }\n+\nthis->sub->n_frames = this->n_frames;\nsub->store(vals);\n@@ -165,7 +194,14 @@ void Decoder_turbo_product::parameters\nitl->get_headers(headers, full);\nheaders[p].push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(n_ite)));\n- headers[p].push_back(std::make_pair(\"alpha\", std::to_string(alpha )));\n+\n+ std::stringstream alpha_str;\n+ alpha_str << \"{\";\n+ for (unsigned i = 0; i < this->alpha.size(); i++)\n+ alpha_str << this->alpha[i] << (i == this->alpha.size()-1 ?\"\":\", \");\n+ alpha_str << \"}\";\n+\n+ headers[p].push_back(std::make_pair(\"alpha\", alpha_str.str()));\nheaders[p].push_back(std::make_pair(\"Num. least reliable pos (p)\", std::to_string(n_least_reliable_positions)));\nif (n_test_vectors != 0)\n@@ -196,7 +232,7 @@ module::Decoder_SIHO<B,Q>* Decoder_turbo_product::parameters\nif (this->type == \"CP\")\n{\nif (this->implem == \"STD\")\n- return new module::Decoder_turbo_product<B,Q>(n_ite, itl, cp_r, cp_c);\n+ return new module::Decoder_turbo_product<B,Q>(n_ite, alpha, itl, cp_r, cp_c);\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "diff": "@@ -29,7 +29,7 @@ struct Decoder_turbo_product : public Decoder\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// optional parameters\nint n_ite = 4;\n- float alpha = 0.5;\n+ std::vector<float> alpha;\nint n_least_reliable_positions = 2;\nint n_test_vectors = 0;\nint n_competitors = 0;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "new_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "diff": "@@ -65,7 +65,6 @@ Codec_turbo_product<B,Q>\ndec_bch = factory::Decoder_BCH::build_hiho<B,Q>(*dec_params.sub, GF_poly);\ncp = new Decoder_chase_pyndiah<B,Q>(dec_bch->get_K(), dec_bch->get_N() + (dec_params.parity_extended?1:0),\n*dec_bch, *enc_bch,\n- dec_params.alpha,\ndec_params.n_least_reliable_positions,\ndec_params.n_test_vectors,\ndec_params.n_competitors);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -19,7 +19,6 @@ Decoder_chase_pyndiah<B,R>\n::Decoder_chase_pyndiah(const int K, const int N, // N includes the parity bit if any\nDecoder_HIHO<B> &dec_,\nEncoder <B> &enc_,\n- const R alpha_,\nconst int n_least_reliable_positions_,\nconst int n_test_vectors_,\nconst int n_competitors_)\n@@ -29,7 +28,6 @@ Decoder_chase_pyndiah<B,R>\nenc (enc_ ),\nN_np (dec.get_N() ),\nparity_extended (this->N == (N_np +1) ),\n- alpha (alpha_ ),\nn_least_reliable_positions(n_least_reliable_positions_ ),\nleast_reliable_pos (n_least_reliable_positions ),\nhard_Rprime (this->N ),\n@@ -39,7 +37,6 @@ Decoder_chase_pyndiah<B,R>\nis_wrong (n_test_vectors ),\nn_competitors (n_competitors_ ? n_competitors_ : n_test_vectors ),\ncompetitors (n_test_vectors )\n- // Alpha ({0.3,0.3,0.3,0.3,0.3,0.3,0.3,0.35, 0.35,0.35,0.35,0.35,0.4,0.4,0.4,0.5})\n{\nconst std::string name = \"Decoder_chase_pyndiah\";\nthis->set_name(name);\n@@ -87,9 +84,6 @@ Decoder_chase_pyndiah<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- time_span = std::chrono::seconds(0);\n- count= 0;\n-\ngenerate_bit_flipping_candidates(); // generate bit flipping patterns\n}\n@@ -102,7 +96,7 @@ const std::vector<uint32_t>& Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::tdecode_siho(const R *R_cha, const R *R_prime, B *R_dec)\n+::decode_siho(const R *R_prime, B *R_dec)\n{\ndecode_chase(R_prime);\n@@ -115,7 +109,7 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::tdecode_siho_cw(const R *R_cha, const R *R_prime, B *R_dec)\n+::decode_siho_cw(const R *R_prime, B *R_dec)\n{\ndecode_chase(R_prime);\n@@ -126,11 +120,11 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::tdecode_siso(const R *R_cha, const R *R_prime, R *R_dec)\n+::decode_siso(const R *R_prime, R *R_dec)\n{\ndecode_chase(R_prime);\n- compute_reliability(R_cha, R_prime, R_dec);\n+ compute_reliability(R_prime, R_dec);\n#ifndef NDEBUG\nstd::cerr << \"(II) R_dec : \" << std::endl;\n@@ -339,7 +333,7 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::compute_reliability(const R* R_cha, const R* R_prime, R* R_dec)\n+::compute_reliability(const R* R_prime, R* R_dec)\n{\nconst auto & DW = competitors.front(); // the Decided Word\n@@ -387,10 +381,10 @@ void Decoder_chase_pyndiah<B,R>\nstd::cerr << \"Rel: i = \" << i << \", R_prime = \" << R_prime[i] << \", competitors[\" << j << \"].metric = \" << competitors[j].metric;\n#endif\n- R_dec[i] = R_cha[i] + alpha * (reliability - R_prime[i]);\n+ R_dec[i] = reliability - R_prime[i];\n#ifndef NDEBUG\n- std::cerr << \", reliability = \" << reliability << \", R_cha = \" << R_cha[i]<< \", R_dec = \" << R_dec[i] << std::endl;\n+ std::cerr << \", reliability = \" << reliability << \", R_dec = \" << R_dec[i] << std::endl;\n#endif\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -31,7 +31,6 @@ protected:\nconst int N_np; // N without the parity bit: can be equal to N if there is no parity bit in the code\nconst bool parity_extended;\n- R alpha;\nconst int n_least_reliable_positions;\nstd::vector<info> least_reliable_pos;\n@@ -48,24 +47,18 @@ protected:\nstd::vector<std::vector<bool>> tv_candidates;\n- const std::vector<float> Alpha;\n-\n-\n- std::chrono::duration<double> time_span;\n- unsigned count;\npublic:\nDecoder_chase_pyndiah(const int K, const int N, // N with the parity bit if any\nDecoder_HIHO<B> &dec,\nEncoder <B> &enc,\n- const R alpha = 0.5,\nconst int n_least_reliable_positions = 2,\nconst int n_test_vectors = 0,\nconst int n_competitors = 0);\n- void tdecode_siso (const R *R_cha, const R *R_prime, R *R_dec); // size is length with parity bit if any\n- void tdecode_siho (const R *R_cha, const R *R_prime, B *R_dec);\n- void tdecode_siho_cw(const R *R_cha, const R *R_prime, B *R_dec);\n+ void decode_siso (const R *R_prime, R *R_dec); // size is length with parity bit if any\n+ void decode_siho (const R *R_prime, B *R_dec);\n+ void decode_siho_cw(const R *R_prime, B *R_dec);\nconst std::vector<uint32_t>& get_info_bits_pos();\n@@ -74,7 +67,7 @@ protected:\nvoid find_least_reliable_pos(const R* R_prime);\nvoid compute_test_vectors ( );\nvoid compute_metrics (const R* R_prime);\n- void compute_reliability (const R* R_cha, const R* R_prime, R* R_dec);\n+ void compute_reliability (const R* R_prime, R* R_dec);\nvoid bit_flipping(B* hard_vect, const int c);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -16,12 +16,14 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_turbo_product<B,R>\n::Decoder_turbo_product(const int& n_ite,\n+ const std::vector<float>& alpha,\nconst Interleaver<R>& pi,\nDecoder_chase_pyndiah<B,R> &cp_r,\nDecoder_chase_pyndiah<B,R> &cp_c)\n: Decoder (cp_r.get_K() * cp_c.get_K(), pi.get_core().get_size(), cp_r.get_n_frames(), cp_r.get_simd_inter_frame_level()),\nDecoder_SISO_SIHO<B,R>(cp_r.get_K() * cp_c.get_K(), pi.get_core().get_size(), cp_r.get_n_frames(), cp_r.get_simd_inter_frame_level()),\nn_ite(n_ite),\n+ alpha(alpha),\npi (pi ),\ncp_r (cp_r ),\ncp_c (cp_c ),\n@@ -43,6 +45,13 @@ Decoder_turbo_product<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (n_ite*2 != (int)alpha.size())\n+ {\n+ std::stringstream message;\n+ message << \"'alpha.size()' has to be twice 'n_ite' ('n_ite' = \" << n_ite << \" and 'alpha.size()' = \" << alpha.size() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nif (cp_r.get_n_frames() != cp_c.get_n_frames())\n{\nstd::stringstream message;\n@@ -167,23 +176,25 @@ void Decoder_turbo_product<B,R>\npi.interleave(Y_N_cha, Y_N_cha_i.data(), 0, 1); // interleave data from the channel\n-\nfor (int i = 0; i < n_ite; i++)\n{\n- // alpha = Alpha[2*i];\n-\n-\npi.interleave(Y_N_i.data(), Y_N_pi.data(), 0, 1); // columns becomes rows\n// decode each col\nfor (int j = 0; j < n_cols; j++)\n{\n- cp_c.tdecode_siso(Y_N_cha_i .data() + j*n_rows,\n- Y_N_pi.data() + j*n_rows,\n- Y_N_pi.data() + j*n_rows); // overwrite Y_N_pi\n+ cp_c.decode_siso(Y_N_pi.data() + j*n_rows, Y_N_pi.data() + j*n_rows); // overwrite Y_N_pi\n+\n+ auto* cha_ptr = Y_N_cha_i.data() + j*n_rows;\n+ auto* last_it = Y_N_pi.data() + (j+1)*n_rows;\n+\n+ for (auto it = Y_N_pi.data() + j*n_rows; it < last_it; it++, cha_ptr++)\n+ {\n+ *it *= (R)alpha[2*i];\n+ *it += *cha_ptr;\n+ }\n}\n- // alpha = Alpha[2*i+1];\npi.deinterleave(Y_N_pi.data(), Y_N_i.data(), 0, 1); // rows go back as columns\n@@ -192,9 +203,16 @@ void Decoder_turbo_product<B,R>\n{\nfor (int j = 0; j < n_rows; j++)\n{\n- cp_r.tdecode_siso(Y_N_cha + j*n_cols,\n- Y_N_i.data() + j*n_cols,\n- Y_N_i.data() + j*n_cols); // overwrite Y_N_i\n+ cp_r.decode_siso(Y_N_i.data() + j*n_cols, Y_N_i.data() + j*n_cols); // overwrite Y_N_i\n+\n+ auto* cha_ptr = Y_N_cha + j*n_cols;\n+ auto* last_it = Y_N_i.data() + (j+1)*n_cols;\n+\n+ for (auto it = Y_N_i.data() + j*n_cols; it < last_it; it++, cha_ptr++)\n+ {\n+ *it *= (R)alpha[2*i+1];\n+ *it += *cha_ptr;\n+ }\n}\n}\nelse if(return_K_siso == 0)\n@@ -203,19 +221,14 @@ void Decoder_turbo_product<B,R>\n{\nauto pos = cp_c.get_info_bits_pos()[j];\n- cp_r.tdecode_siho(Y_N_cha + pos*n_cols,\n- Y_N_i.data() + pos*n_cols,\n- V_K_i.data() + j*cp_r.get_K());\n+ cp_r.decode_siho(Y_N_i.data() + pos*n_cols, V_K_i.data() + j*cp_r.get_K());\n}\n}\nelse if (return_K_siso == 1)\n{\nfor (int j = 0; j < n_cols; j++)\n- cp_r.tdecode_siho_cw(Y_N_cha + j*n_cols,\n- Y_N_i.data() + j*n_cols,\n- V_N_i.data() + j*n_cols);\n+ cp_r.decode_siho_cw(Y_N_i.data() + j*n_cols, V_N_i.data() + j*n_cols);\n}\n-\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "new_path": "src/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "diff": "@@ -19,6 +19,8 @@ class Decoder_turbo_product : public Decoder_SISO_SIHO<B,R>\n{\nprotected:\nconst int n_ite; // number of iterations\n+ const std::vector<float> alpha;\n+\nconst Interleaver<R> &pi;\nDecoder_chase_pyndiah<B,R> &cp_r; // row decoder\nDecoder_chase_pyndiah<B,R> &cp_c; // col decoder\n@@ -32,6 +34,7 @@ protected:\npublic:\nDecoder_turbo_product(const int& n_ite,\n+ const std::vector<float>& alpha,\nconst Interleaver<R> &pi,\nDecoder_chase_pyndiah<B,R> &cp_r,\nDecoder_chase_pyndiah<B,R> &cp_c);\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify TPC and Chase Pyndiah decoder to be completely independant (extrinsic with alpha and channel values are computed in TURBO Product decoder); Make alpha argument a vector with a value for each half iteration
8,483
05.02.2018 11:18:15
-3,600
6a12bd0a39d80f9c44d2248e251f158d4b9713f9
Cosmetics + comments
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "#include \"Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp\"\n#include \"Module/Decoder/Turbo_product/Decoder_turbo_product.hpp\"\n-#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n#include \"Decoder_turbo_product.hpp\"\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "#include \"Tools/Perf/hard_decision.h\"\n#include \"Tools/Perf/compute_parity.h\"\n+\n+#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n+\n+\nusing namespace aff3ct;\nusing namespace aff3ct::module;\n@@ -27,16 +31,17 @@ Decoder_chase_pyndiah<B,R>\ndec (dec_ ),\nenc (enc_ ),\nN_np (dec.get_N() ),\n- parity_extended (this->N == (N_np +1) ),\nn_least_reliable_positions(n_least_reliable_positions_ ),\n- least_reliable_pos (n_least_reliable_positions ),\n- hard_Rprime (this->N ),\nn_test_vectors (n_test_vectors_ ? n_test_vectors_ : (int)1 << n_least_reliable_positions),\n- test_vect (n_test_vectors * hard_Rprime.size() ),\n- metrics (n_test_vectors ),\n- is_wrong (n_test_vectors ),\nn_competitors (n_competitors_ ? n_competitors_ : n_test_vectors ),\n- competitors (n_test_vectors )\n+ parity_extended (this->N == (N_np +1) ),\n+\n+ least_reliable_pos (n_least_reliable_positions ),\n+ competitors (n_test_vectors ),\n+ hard_Y_N (this->N ),\n+ test_vect (n_test_vectors * hard_Y_N.size() ),\n+ metrics (n_test_vectors ),\n+ is_wrong (n_test_vectors )\n{\nconst std::string name = \"Decoder_chase_pyndiah\";\nthis->set_name(name);\n@@ -84,7 +89,7 @@ Decoder_chase_pyndiah<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- generate_bit_flipping_candidates(); // generate bit flipping patterns\n+ generate_bit_flipping_candidates(); // generate bit flipping patterns in 'tv_candidates'\n}\ntemplate <typename B, typename R>\n@@ -96,91 +101,89 @@ const std::vector<uint32_t>& Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::decode_siho(const R *R_prime, B *R_dec)\n+::decode_siho(const R *Y_N, B *V_K)\n{\n- decode_chase(R_prime);\n+ decode_chase(Y_N);\nauto* DW = test_vect.data() + competitors.front().pos;\nauto& info_bits_pos = enc.get_info_bits_pos();\nfor (int j = 0; j < this->K; j++)\n- R_dec[j] = DW[info_bits_pos[j]];\n+ V_K[j] = DW[info_bits_pos[j]];\n}\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::decode_siho_cw(const R *R_prime, B *R_dec)\n+::decode_siho_cw(const R *Y_N, B *V_N)\n{\n- decode_chase(R_prime);\n+ decode_chase(Y_N);\nauto* DW = test_vect.data() + competitors.front().pos;\n- std::copy(DW, DW + this->N, R_dec);\n+ std::copy(DW, DW + this->N, V_N);\n}\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::decode_siso(const R *R_prime, R *R_dec)\n+::decode_siso(const R *Y_N1, R *Y_N2)\n{\n- decode_chase(R_prime);\n+ decode_chase(Y_N1);\n- compute_reliability(R_prime, R_dec);\n+ compute_reliability(Y_N1, Y_N2);\n#ifndef NDEBUG\n- std::cerr << \"(II) R_dec : \" << std::endl;\n+ std::cerr << \"(II) Y_N2 : \" << std::endl;\nfor (int i = 0; i < this->N; i++)\n- std::cerr << R_dec[i] << \" \";\n+ std::cerr << Y_N2[i] << \" \";\nstd::cerr << std::endl;\n#endif\n}\n-#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n-\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::decode_chase(const R *R_prime)\n+::decode_chase(const R *Y_N)\n{\n- tools::hard_decide(R_prime, hard_Rprime.data(), this->N);\n+ tools::hard_decide(Y_N, hard_Y_N.data(), this->N);\n#ifndef NDEBUG\ntools::Frame_trace<> ft(0,3,std::cerr);\n- std::cerr << \"(II) R_prime : \" << std::endl;\n+ std::cerr << \"(II) Y_N : \" << std::endl;\nfor (int i = 0; i < this->N; i++)\n{\n- std::cerr << R_prime[i] << \" \";\n+ std::cerr << Y_N[i] << \" \";\n}\nstd::cerr << std::endl;\n- { std::vector<R> v(R_prime, R_prime+this->N); ft.display_real_vector(v); }\n+ { std::vector<R> v(Y_N, Y_N+this->N); ft.display_real_vector(v); }\n- std::cerr << \"(II) hard_Rprime : \" << std::endl;\n- for (unsigned i = 0; hard_Rprime.size() > i; i++)\n+ std::cerr << \"(II) hard_Y_N : \" << std::endl;\n+ for (unsigned i = 0; hard_Y_N.size() > i; i++)\n{\n- std::cerr << hard_Rprime[i] << \" \";\n+ std::cerr << hard_Y_N[i] << \" \";\n}\nstd::cerr << std::endl;\n- { ft.display_bit_vector(hard_Rprime); }\n+ { ft.display_bit_vector(hard_Y_N); }\n#endif\n// if (this->parity_extended)\n// {\n- // auto parity_calc = tools::compute_parity(hard_Rprime.data(), dec.get_N());\n- // parity_diff = parity_calc ^ hard_Rprime[dec.get_N()];\n- // hard_Rprime[dec.get_N()] = parity_calc;\n+ // auto parity_calc = tools::compute_parity(hard_Y_N.data(), dec.get_N());\n+ // parity_diff = parity_calc ^ hard_Y_N[dec.get_N()];\n+ // hard_Y_N[dec.get_N()] = parity_calc;\n// }\n// else\n// parity_diff = false;\n- find_least_reliable_pos(R_prime); // without parity bit if any\n+ find_least_reliable_pos(Y_N); // without parity bit if any\ncompute_test_vectors ( ); // make bit flipping of least reliable positions and try to decode them\n- compute_metrics (R_prime); // compute euclidian metrics for each test vectors\n+ compute_metrics (Y_N); // compute euclidian metrics for each test vectors\n#ifndef NDEBUG\nstd::cerr << \"(II) least_reliable_pos : \" << std::endl;\nfor (unsigned i = 0; i < least_reliable_pos.size(); i++)\n{\n- std::cerr << i << \". (\" << least_reliable_pos[i].pos << \", \" << least_reliable_pos[i].metric << \") -> \" << hard_Rprime[least_reliable_pos[i].pos] << std::endl;\n+ std::cerr << i << \". (\" << least_reliable_pos[i].pos << \", \" << least_reliable_pos[i].metric << \") -> \" << hard_Y_N[least_reliable_pos[i].pos] << std::endl;\n}\n@@ -212,7 +215,7 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::find_least_reliable_pos(const R* R_prime)\n+::find_least_reliable_pos(const R* Y_N)\n{\nfor (auto it = least_reliable_pos.begin(); it != least_reliable_pos.end(); it++)\n{\n@@ -225,10 +228,10 @@ void Decoder_chase_pyndiah<B,R>\n// check if R[i] is a least reliable value compared to the already saved positions\nfor (auto it = least_reliable_pos.begin(); it != least_reliable_pos.end(); it++)\n{\n- R val = std::abs(R_prime[i]);\n+ R val = std::abs(Y_N[i]);\nif (val < it->metric)\n- { // R_prime[i] is weak, then save its position\n+ { // Y_N[i] is weak, then save its position\nleast_reliable_pos.pop_back(); // remove the last position that is not weak enough\nit = least_reliable_pos.insert(it, {val, i});\nbreak;\n@@ -244,10 +247,10 @@ void Decoder_chase_pyndiah<B,R>\ntools::Frame_trace<> ft(0,3,std::cerr);\nfor (int c = 0; c < n_test_vectors; c++)\n{\n- // rearrange hard_Rprime to be a good candidate\n- bit_flipping(hard_Rprime.data(), c);\n+ // rearrange hard_Y_N to be a good candidate\n+ bit_flipping(hard_Y_N.data(), c);\n- dec.decode_hiho_cw(hard_Rprime.data(), test_vect.data() + c*this->N); // parity bit is ignored by the decoder\n+ dec.decode_hiho_cw(hard_Y_N.data(), test_vect.data() + c*this->N); // parity bit is ignored by the decoder\nis_wrong[c] = !enc.is_codeword(test_vect.data() + c*this->N);\nif (this->parity_extended)\n@@ -255,17 +258,17 @@ void Decoder_chase_pyndiah<B,R>\n#ifndef NDEBUG\nstd::cerr << \"(II) Test vectors \" << c << \" before correction\" << std::endl;\n- ft.display_bit_vector(hard_Rprime);\n+ ft.display_bit_vector(hard_Y_N);\nstd::cerr << \"(II) Test vectors \" << c << \" after correction : is wrong = \" << is_wrong[c] << std::endl;\n{ std::vector<B> v(test_vect.data() + c*this->N, test_vect.data() + (c+1)*this->N); ft.display_bit_vector(v); }\n#endif\n- bit_flipping(hard_Rprime.data(), c); // apply again the bit flipping to recover the original hard_Rprime\n+ bit_flipping(hard_Y_N.data(), c); // apply again the bit flipping to recover the original hard_Y_N\n}\n}\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::compute_metrics(const R* R_prime)\n+::compute_metrics(const R* Y_N)\n{\nstd::fill(metrics.begin(), metrics.end(), (R)0);\n@@ -280,8 +283,8 @@ void Decoder_chase_pyndiah<B,R>\nint tv_off = c*this->N;\nfor (int i = 0; i < this->N; i++)\n- if (hard_Rprime[i] ^ test_vect[tv_off + i])\n- metrics[c] += std::abs(R_prime[i]);\n+ if (hard_Y_N[i] ^ test_vect[tv_off + i])\n+ metrics[c] += std::abs(Y_N[i]);\n}\n// reorder metrics -> decided word is at first position of competitors list\n@@ -333,7 +336,7 @@ void Decoder_chase_pyndiah<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n-::compute_reliability(const R* R_prime, R* R_dec)\n+::compute_reliability(const R* Y_N1, R* Y_N2)\n{\nconst auto & DW = competitors.front(); // the Decided Word\n@@ -369,7 +372,7 @@ void Decoder_chase_pyndiah<B,R>\n}\nelse // same bits for each candidates\n{\n- reliability = std::abs(R_prime[i]) + beta;\n+ reliability = std::abs(Y_N1[i]) + beta;\nif (reliability < 0)\nreliability = 0;\n}\n@@ -378,13 +381,13 @@ void Decoder_chase_pyndiah<B,R>\nreliability = -reliability; // set as negative\n#ifndef NDEBUG\n- std::cerr << \"Rel: i = \" << i << \", R_prime = \" << R_prime[i] << \", competitors[\" << j << \"].metric = \" << competitors[j].metric;\n+ std::cerr << \"Rel: i = \" << i << \", Y_N1 = \" << Y_N1[i] << \", competitors[\" << j << \"].metric = \" << competitors[j].metric;\n#endif\n- R_dec[i] = reliability - R_prime[i];\n+ Y_N2[i] = reliability - Y_N1[i];\n#ifndef NDEBUG\n- std::cerr << \", reliability = \" << reliability << \", R_dec = \" << R_dec[i] << std::endl;\n+ std::cerr << \", reliability = \" << reliability << \", Y_N2 = \" << Y_N2[i] << std::endl;\n#endif\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -29,23 +29,19 @@ protected:\nEncoder <B> &enc;\nconst int N_np; // N without the parity bit: can be equal to N if there is no parity bit in the code\n- const bool parity_extended;\n-\nconst int n_least_reliable_positions;\n-\n- std::vector<info> least_reliable_pos;\n- std::vector<B> hard_Rprime;\n- B parity_diff;\n-\nconst int n_test_vectors;\n- std::vector<B> test_vect;\n- std::vector<R> metrics;\n- std::vector<bool> is_wrong;\n-\nconst int n_competitors;\n- std::vector<info> competitors; // map of the competitor metric and its related test vector position\n+ const bool parity_extended;\n+ // bool parity_diff;\n- std::vector<std::vector<bool>> tv_candidates;\n+ std::vector<info> least_reliable_pos; // the list of least reliable positions\n+ std::vector<info> competitors; // the competitors' metric and their related test vector position\n+ std::vector<B> hard_Y_N; // the taken hard decision at the input of the chase\n+ std::vector<B> test_vect; // the test vectors after being corrected by the decoder 'dec'\n+ std::vector<R> metrics; // the metrics of each test vector\n+ std::vector<bool> is_wrong; // if true then the matching test vector is not a codeword\n+ std::vector<std::vector<bool>> tv_candidates; // the patterns of the least reliable position to flip\npublic:\n@@ -56,18 +52,18 @@ public:\nconst int n_test_vectors = 0,\nconst int n_competitors = 0);\n- void decode_siso (const R *R_prime, R *R_dec); // size is length with parity bit if any\n- void decode_siho (const R *R_prime, B *R_dec);\n- void decode_siho_cw(const R *R_prime, B *R_dec);\n+ void decode_siso (const R *Y_N1, R *Y_N2); // size is length with parity bit if any\n+ void decode_siho (const R *Y_N, B *V_K );\n+ void decode_siho_cw(const R *Y_N, B *V_N );\nconst std::vector<uint32_t>& get_info_bits_pos();\nprotected:\n- void decode_chase (const R *R_prime);\n- void find_least_reliable_pos(const R* R_prime);\n+ void decode_chase (const R *Y_N);\n+ void find_least_reliable_pos(const R* Y_N);\nvoid compute_test_vectors ( );\n- void compute_metrics (const R* R_prime);\n- void compute_reliability (const R* R_prime, R* R_dec);\n+ void compute_metrics (const R* Y_N);\n+ void compute_reliability (const R* Y_N1, R* Y_N2);\nvoid bit_flipping(B* hard_vect, const int c);\n" } ]
C++
MIT License
aff3ct/aff3ct
Cosmetics + comments
8,483
05.02.2018 11:50:09
-3,600
bd8a5b850b99f243de80e314fbbbc495e9c0d1b6
Add a interrupt counter to quit after four SIGINT cought
[ { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.cpp", "new_path": "src/Module/Monitor/Monitor.cpp", "diff": "bool aff3ct::module::Monitor::interrupt = false;\nbool aff3ct::module::Monitor::first_interrupt = true;\n+int aff3ct::module::Monitor::interrupt_cnt = 0;\nbool aff3ct::module::Monitor::over = false;\nstd::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> aff3ct::module::Monitor::t_last_interrupt;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.hpp", "new_path": "src/Module/Monitor/Monitor.hpp", "diff": "@@ -52,6 +52,7 @@ class Monitor : public Module\nprotected:\nstatic bool interrupt; /*!< True if there is a SIGINT signal (ctrl+C). */\nstatic bool first_interrupt; /*!< True if this is the first time that SIGIN is called. */\n+ static int interrupt_cnt; /*!< The number of gor interrupt signal. */\nstatic bool over; /*!< True if SIGINT is called twice in the Monitor::d_delta_interrupt time */\nstatic std::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> t_last_interrupt; /*!< Time point of the last call to SIGINT */\n@@ -111,6 +112,7 @@ public:\nvirtual void reset()\n{\nMonitor::interrupt = false;\n+ Monitor::interrupt_cnt = 0;\n}\nvirtual void clear_callbacks()\n@@ -149,12 +151,22 @@ public:\nprivate:\nstatic void signal_interrupt_handler(int signal)\n{\n+ Monitor::interrupt_cnt++;\n+\nauto t_now = std::chrono::steady_clock::now();\nif (!Monitor::first_interrupt)\n{\nauto d_delta_interrupt = t_now - Monitor::t_last_interrupt;\nif (d_delta_interrupt < std::chrono::milliseconds(500))\nMonitor::stop();\n+\n+ if (d_delta_interrupt < std::chrono::milliseconds(2000))\n+ {\n+ if (Monitor::interrupt_cnt >= 4)\n+ std::exit(EXIT_FAILURE);\n+ }\n+ else\n+ Monitor::interrupt_cnt = 1;\n}\nMonitor::t_last_interrupt = t_now;\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a interrupt counter to quit after four SIGINT cought
8,483
05.02.2018 11:55:19
-3,600
accf617aacab3256a7487025a4e17e0e417064f8
Move from the .hpp, the Monitor method implementations in the .cpp
[ { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.cpp", "new_path": "src/Module/Monitor/Monitor.cpp", "diff": "@@ -8,3 +8,109 @@ int aff3ct::module::Monitor::interrupt_cnt = 0;\nbool aff3ct::module::Monitor::over = false;\nstd::chrono::time_point<std::chrono::steady_clock, std::chrono::nanoseconds> aff3ct::module::Monitor::t_last_interrupt;\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+Monitor\n+::Monitor(const int size, int n_frames)\n+: Module(n_frames), size(size)\n+{\n+ const std::string name = \"Monitor\";\n+ this->set_name(name);\n+ this->set_short_name(name);\n+\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+ }\n+\n+ Monitor::interrupt = false;\n+\n+#ifndef ENABLE_MPI\n+ // Install a signal handler\n+ std::signal(SIGINT, Monitor::signal_interrupt_handler);\n+#endif\n+\n+ this->tasks_with_nullptr.resize(mnt::tsk::SIZE);\n+ for (size_t t = 0; t < mnt::tsk::SIZE; t++)\n+ this->tasks_with_nullptr[t] = nullptr;\n+}\n+\n+/*!\n+ * \\brief Destructor.\n+ */\n+Monitor\n+::~Monitor()\n+{\n+}\n+\n+/*!\n+ * \\brief Gets the number of bits in a frame.\n+ *\n+ * \\return the number of bits.\n+ */\n+int Monitor\n+::get_size() const\n+{\n+ return size;\n+}\n+\n+void Monitor\n+::reset()\n+{\n+ Monitor::interrupt = false;\n+ Monitor::interrupt_cnt = 0;\n+}\n+\n+void Monitor\n+::clear_callbacks()\n+{\n+}\n+\n+bool Monitor\n+::is_interrupt()\n+{\n+ return Monitor::interrupt;\n+}\n+\n+bool Monitor\n+::is_over()\n+{\n+ return Monitor::over;\n+}\n+\n+void Monitor\n+::stop()\n+{\n+ Monitor::interrupt = true;\n+ Monitor::over = true;\n+}\n+\n+void Monitor\n+::signal_interrupt_handler(int signal)\n+{\n+ Monitor::interrupt_cnt++;\n+\n+ auto t_now = std::chrono::steady_clock::now();\n+ if (!Monitor::first_interrupt)\n+ {\n+ auto d_delta_interrupt = t_now - Monitor::t_last_interrupt;\n+ if (d_delta_interrupt < std::chrono::milliseconds(500))\n+ Monitor::stop();\n+\n+ if (d_delta_interrupt < std::chrono::milliseconds(2100))\n+ {\n+ if (Monitor::interrupt_cnt >= 4)\n+ std::exit(EXIT_FAILURE);\n+ }\n+ else\n+ Monitor::interrupt_cnt = 1;\n+ }\n+ Monitor::t_last_interrupt = t_now;\n+\n+ Monitor::first_interrupt = false;\n+ Monitor::interrupt = true;\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.hpp", "new_path": "src/Module/Monitor/Monitor.hpp", "diff": "@@ -66,113 +66,45 @@ public:\n*\n* \\param size: number of bits.\n*/\n- Monitor(const int size, int n_frames = 1)\n- : Module(n_frames), size(size)\n- {\n- const std::string name = \"Monitor\";\n- this->set_name(name);\n- this->set_short_name(name);\n-\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- }\n-\n- Monitor::interrupt = false;\n-\n-#ifndef ENABLE_MPI\n- // Install a signal handler\n- std::signal(SIGINT, Monitor::signal_interrupt_handler);\n-#endif\n-\n- this->tasks_with_nullptr.resize(mnt::tsk::SIZE);\n- for (size_t t = 0; t < mnt::tsk::SIZE; t++)\n- this->tasks_with_nullptr[t] = nullptr;\n- }\n+ Monitor(const int size, int n_frames = 1);\n/*!\n* \\brief Destructor.\n*/\n- virtual ~Monitor()\n- {\n- }\n+ virtual ~Monitor();\n/*!\n* \\brief Gets the number of bits in a frame.\n*\n* \\return the number of bits.\n*/\n- int get_size() const\n- {\n- return size;\n- }\n+ int get_size() const;\n- virtual void reset()\n- {\n- Monitor::interrupt = false;\n- Monitor::interrupt_cnt = 0;\n- }\n+ virtual void reset();\n- virtual void clear_callbacks()\n- {\n- }\n+ virtual void clear_callbacks();\n/*!\n* \\brief Tells if the user asked for stopping the current computations.\n*\n* \\return true if the SIGINT (ctrl+c) is called.\n*/\n- static bool is_interrupt()\n- {\n- return Monitor::interrupt;\n- }\n+ static bool is_interrupt();\n/*!\n* \\brief Tells if the user asked for stopping the whole simulation.\n*\n* \\return true if the SIGINT (ctrl+c) is called twice.\n*/\n- static bool is_over()\n- {\n- return Monitor::over;\n- }\n+ static bool is_over();\n/*!\n* \\brief Put Monitor<B,R>::interrupt and Monitor<B,R>::over to true.\n*/\n- static void stop()\n- {\n- Monitor::interrupt = true;\n- Monitor::over = true;\n- }\n+ static void stop();\nprivate:\n- static void signal_interrupt_handler(int signal)\n- {\n- Monitor::interrupt_cnt++;\n-\n- auto t_now = std::chrono::steady_clock::now();\n- if (!Monitor::first_interrupt)\n- {\n- auto d_delta_interrupt = t_now - Monitor::t_last_interrupt;\n- if (d_delta_interrupt < std::chrono::milliseconds(500))\n- Monitor::stop();\n-\n- if (d_delta_interrupt < std::chrono::milliseconds(2000))\n- {\n- if (Monitor::interrupt_cnt >= 4)\n- std::exit(EXIT_FAILURE);\n- }\n- else\n- Monitor::interrupt_cnt = 1;\n- }\n- Monitor::t_last_interrupt = t_now;\n-\n- Monitor::first_interrupt = false;\n- Monitor::interrupt = true;\n- }\n+ static void signal_interrupt_handler(int signal);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Move from the .hpp, the Monitor method implementations in the .cpp
8,490
05.02.2018 14:47:53
-3,600
8c531214f0a7b2614c6db0351317af94c5525c03
Add a message when the user interrupts the simulation.
[ { "change_type": "MODIFY", "old_path": "src/Module/Monitor/Monitor.cpp", "new_path": "src/Module/Monitor/Monitor.cpp", "diff": "@@ -104,8 +104,13 @@ void Monitor\nif (d_delta_interrupt < std::chrono::milliseconds(2100))\n{\nif (Monitor::interrupt_cnt >= 4)\n+ {\n+ std::cerr << \"\\r# Killed by user interruption!\"\n+ \" \"\n+ << std::endl;\nstd::exit(EXIT_FAILURE);\n}\n+ }\nelse\nMonitor::interrupt_cnt = 1;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a message when the user interrupts the simulation.
8,488
05.02.2018 10:13:37
18,000
973fc72f4014ff2242ca0ebd89ff5821747c3da4
Refactor export_as_source.
[ { "change_type": "MODIFY", "old_path": "scripts/debug_parser/aff3ct_debug_parser.py", "new_path": "scripts/debug_parser/aff3ct_debug_parser.py", "diff": "@@ -57,20 +57,11 @@ class OutputStructure:\nprint(\"Specified frame index superior to the number of frames. Frame 0 is exported instead.\")\nframe_index = 0\n- if self.data_format == \"int8\":\n- c_type = \"signed char\"\n- elif self.data_format == \"int16\":\n- c_type = \"signed short\"\n- elif self.data_format == \"int32\":\n- c_type = \"signed int\"\n- elif self.data_format == \"int64\":\n- c_type = \"signed long\"\n- elif self.data_format == \"float32\":\n- c_type = \"float\"\n- elif self.data_format == \"float64\":\n- c_type = \"double\"\n- else:\n- \"Unknown format\"\n+ # get c_type (signed char, signed short...)\n+ c_type = self.get_c_type()\n+\n+ # unable to identify c_type -> exit\n+ if not c_type:\nreturn\nwith open(path, \"w\") as fout:\n@@ -100,6 +91,23 @@ class OutputStructure:\nfout.write(\"};\\n\\n\")\nfout.write(\"#endif //\" + self.name.upper() + \"_H\\n\")\n+ def get_c_type(self):\n+ if self.data_format == \"int8\":\n+ c_type = \"signed char\"\n+ elif self.data_format == \"int16\":\n+ c_type = \"signed short\"\n+ elif self.data_format == \"int32\":\n+ c_type = \"signed int\"\n+ elif self.data_format == \"int64\":\n+ c_type = \"signed long\"\n+ elif self.data_format == \"float32\":\n+ c_type = \"float\"\n+ elif self.data_format == \"float64\":\n+ c_type = \"double\"\n+ else:\n+ c_type = \"\"\n+ return c_type\n+\ndef export_as_bin(self, path):\nif self.data_format == \"int8\":\nfloat_code = 0\n" } ]
C++
MIT License
aff3ct/aff3ct
Refactor export_as_source.
8,488
05.02.2018 12:01:15
18,000
7ab55c049db5a119af4508cb0ce9a32c38a3852b
Either multiple or a single frame(s) can now exported as source. Modified args. Refactor export_as_source
[ { "change_type": "MODIFY", "old_path": "scripts/debug_parser/aff3ct_debug_parser.py", "new_path": "scripts/debug_parser/aff3ct_debug_parser.py", "diff": "@@ -52,8 +52,12 @@ class OutputStructure:\nfout.write(value)\nfout.write(\"\\n\")\n- def export_as_source(self, path, frame_index):\n- if frame_index > len(self.frames) - 1:\n+ def export_as_source(self, path, frame_index=-1):\n+ export_all = False\n+ if frame_index < 0:\n+ export_all = True\n+\n+ elif frame_index > len(self.frames) - 1:\nprint(\"Specified frame index superior to the number of frames. Frame 0 is exported instead.\")\nframe_index = 0\n@@ -65,10 +69,28 @@ class OutputStructure:\nreturn\nwith open(path, \"w\") as fout:\n- fout.write(\"#ifndef \" + self.name.upper() + \"_H\\n\")\n- fout.write(\"#define \" + self.name.upper() + \"_H\\n\")\n+ fout.write(\"#ifndef {0}_H\\n\".format(self.name.upper()))\n+ fout.write(\"#define {0}_H\\n\".format(self.name.upper()))\n+ fout.write(\"\\n\")\n+ fout.write(\"{0} {1}\".format(c_type, self.name))\n+ if export_all:\n+ fout.write(\"[{0}]\".format(str(len(self.frames))))\n+ fout.write(\"[{0}] = \".format(str(self.frame_length)))\n+\n+ if export_all:\n+ fout.write(\"\\n{\\n\")\n+ for inner_frame_index in range(0, len(self.frames)):\n+ self.write_array(fout, inner_frame_index)\nfout.write(\"\\n\")\n- fout.write(c_type + \" \" + self.name + \"[\" + str(self.frame_length) + \"] = {\\n\\t\")\n+ fout.write(\"}\\n\")\n+ else:\n+ self.write_array(fout, frame_index)\n+\n+ fout.write(\";\\n\\n\")\n+ fout.write(\"#endif //{0}_H\\n\".format(self.name.upper()))\n+\n+ def write_array(self, fout, frame_index):\n+ fout.write(\"{\\n\\t\")\nfor i, value in enumerate(self.frames[frame_index]):\nif i:\nfout.write(\",\")\n@@ -87,9 +109,7 @@ class OutputStructure:\nvalue = ctypes.c_int64(int(value, 16)).value\nvalue = str(value)\nfout.write('{:>4}'.format(value))\n- fout.write(\"\\n\")\n- fout.write(\"};\\n\\n\")\n- fout.write(\"#endif //\" + self.name.upper() + \"_H\\n\")\n+ fout.write(\"\\n}\")\ndef get_c_type(self):\nif self.data_format == \"int8\":\n@@ -176,8 +196,11 @@ def adp_parse_args():\nparser.add_argument(\"path\", type=str, help=\"path to the file to be parsed\")\nparser.add_argument(\"--mod\", type=str, required=True, help=\"module to be extracted, ex : Source_random_fast\")\nparser.add_argument(\"--tsk\", type=str, required=True, help=\"task to be extracted, ex : generate\")\n+ parser.add_argument(\"--txt\", help=\"export as txt\", action='store_true')\n+ parser.add_argument(\"--bin\", help=\"export as bin\", action='store_true')\n+ src_help = \"export as c array source. only the frame SRC is exported if SRC is specified\"\n+ parser.add_argument(\"--src\", help=src_help, type=str, nargs=\"?\", const=\"all\", default=\"\")\nparser.add_argument(\"-o\", \"--output\", type=str, help=\"path to the output folder\", default=\"./\")\n- parser.add_argument(\"--src\", type=int, help=\"export specified frame as .h source file\")\nargs = parser.parse_args()\nreturn args\n@@ -239,21 +262,30 @@ def main():\nout_sct.import_frames(lines, key, inter_frame)\n# export frames as text\n-\n+ if args.txt:\nfor out_sct in out_structures:\nbase_path = os.path.join(args.output, out_sct.name)\nout_sct.export_as_text(base_path + \".txt\")\n# export frames as bin\n+ if args.bin:\nfor out_sct in out_structures:\nbase_path = os.path.join(args.output, out_sct.name)\nout_sct.export_as_bin(base_path + \".bin\")\n# export frames as source\nif args.src:\n+ try:\n+ int(args.src)\n+ except ValueError:\n+ args.src = \"all\"\n+\nfor out_sct in out_structures:\nbase_path = os.path.join(args.output, out_sct.name)\n- out_sct.export_as_source(base_path + \".h\", args.src)\n+ if args.src == \"all\":\n+ out_sct.export_as_source(base_path + \".h\")\n+ else:\n+ out_sct.export_as_source(base_path + \".h\", int(args.src))\nif __name__ == \"__main__\":\n" }, { "change_type": "MODIFY", "old_path": "scripts/debug_parser/test/V_K_gold.h", "new_path": "scripts/debug_parser/test/V_K_gold.h", "diff": "#ifndef V_K_H\n#define V_K_H\n-signed char V_K[32] = {\n+signed char V_K[23][32] =\n+{\n+{\n+ -128, 0, -128, 0, 0, -128, 0, -128,\n+ -128, -128, -128, 0, -128, 0, 0, 0,\n+ -128, -128, 0, -128, -128, 0, 0, 0,\n+ -128, -128, 0, 0, 0, -128, 0, -128\n+}\n+{\n0, -128, 0, -128, 0, 0, -128, 0,\n0, 0, 0, 0, -128, 0, -128, -128,\n0, -128, -128, 0, -128, 0, -128, 0,\n0, 0, 0, -128, 0, 0, 0, -128\n-};\n+}\n+{\n+ 0, 0, -128, -128, -128, 0, 0, -128,\n+ 0, -128, 0, 0, -128, 0, -128, 0,\n+ -128, -128, -128, 0, -128, -128, -128, 0,\n+ -128, 0, 0, 0, 0, -128, 0, 0\n+}\n+{\n+ 0, -128, -128, -128, -128, -128, -128, -128,\n+ 0, 0, -128, -128, -128, 0, -128, 0,\n+ 0, -128, -128, -128, -128, -128, -128, 0,\n+ 0, -128, 0, 0, -128, -128, 0, 0\n+}\n+{\n+ 0, -128, 0, 0, -128, 0, 0, -128,\n+ 0, -128, 0, -128, 0, -128, -128, 0,\n+ 0, 0, 0, -128, 0, -128, 0, 0,\n+ 0, 0, 0, -128, 0, 0, 0, 0\n+}\n+{\n+ 0, -128, -128, 0, 0, -128, 0, -128,\n+ 0, 0, 0, -128, 0, -128, 0, 0,\n+ -128, -128, 0, 0, 0, 0, -128, 0,\n+ -128, -128, -128, 0, -128, -128, -128, 0\n+}\n+{\n+ -128, 0, 0, 0, 0, -128, 0, 0,\n+ -128, -128, -128, -128, -128, 0, 0, 0,\n+ -128, 0, -128, 0, -128, 0, -128, 0,\n+ -128, 0, -128, 0, 0, 0, 0, 0\n+}\n+{\n+ 0, 0, 0, -128, 0, 0, 0, -128,\n+ 0, 0, -128, 0, -128, -128, 0, -128,\n+ 0, 0, -128, -128, 0, -128, 0, 0,\n+ 0, 0, -128, 0, 0, 0, 0, -128\n+}\n+{\n+ -128, -128, 0, 0, -128, 0, -128, -128,\n+ -128, 0, 0, -128, 0, 0, -128, 0,\n+ -128, -128, 0, 0, 0, -128, -128, -128,\n+ 0, 0, -128, -128, -128, -128, 0, -128\n+}\n+{\n+ -128, -128, 0, -128, 0, 0, 0, 0,\n+ -128, 0, -128, -128, -128, -128, 0, -128,\n+ 0, 0, 0, -128, -128, 0, 0, 0,\n+ 0, -128, -128, -128, 0, 0, -128, -128\n+}\n+{\n+ 0, 0, -128, -128, -128, -128, 0, -128,\n+ 0, 0, 0, 0, -128, 0, 0, -128,\n+ 0, 0, 0, -128, -128, -128, 0, 0,\n+ 0, -128, -128, -128, -128, -128, -128, -128\n+}\n+{\n+ -128, -128, 0, -128, 0, 0, 0, -128,\n+ 0, -128, 0, 0, -128, -128, 0, 0,\n+ -128, -128, 0, 0, 0, 0, 0, 0,\n+ -128, 0, -128, 0, 0, 0, -128, -128\n+}\n+{\n+ -128, 0, -128, 0, -128, 0, 0, 0,\n+ -128, -128, -128, -128, -128, -128, -128, 0,\n+ -128, 0, 0, 0, 0, -128, -128, -128,\n+ -128, -128, -128, 0, -128, 0, 0, 0\n+}\n+{\n+ -128, -128, -128, 0, -128, 0, -128, 0,\n+ -128, 0, 0, 0, -128, 0, 0, -128,\n+ 0, 0, -128, -128, -128, -128, -128, -128,\n+ -128, -128, 0, 0, -128, -128, 0, -128\n+}\n+{\n+ -128, -128, 0, -128, -128, -128, 0, -128,\n+ 0, 0, -128, 0, -128, -128, -128, 0,\n+ -128, 0, -128, 0, 0, 0, -128, 0,\n+ 0, 0, -128, -128, -128, 0, -128, 0\n+}\n+{\n+ -128, -128, 0, -128, -128, -128, 0, 0,\n+ 0, -128, -128, 0, -128, 0, 0, 0,\n+ -128, -128, -128, -128, 0, 0, -128, 0,\n+ 0, 0, -128, 0, -128, 0, -128, 0\n+}\n+{\n+ -128, -128, 0, 0, 0, 0, -128, 0,\n+ -128, -128, -128, 0, -128, -128, 0, -128,\n+ 0, 0, 0, -128, 0, -128, 0, 0,\n+ 0, 0, -128, -128, -128, 0, 0, 0\n+}\n+{\n+ 0, -128, 0, 0, -128, 0, 0, -128,\n+ 0, 0, -128, -128, 0, 0, -128, 0,\n+ 0, 0, 0, 0, -128, 0, 0, 0,\n+ 0, 0, 0, 0, -128, -128, -128, 0\n+}\n+{\n+ 0, -128, 0, 0, 0, 0, 0, -128,\n+ 0, -128, 0, 0, -128, 0, 0, 0,\n+ -128, 0, -128, 0, -128, 0, 0, -128,\n+ -128, 0, -128, 0, -128, 0, -128, 0\n+}\n+{\n+ -128, -128, -128, -128, -128, -128, -128, -128,\n+ 0, -128, -128, -128, -128, 0, 0, 0,\n+ 0, 0, -128, 0, 0, 0, -128, 0,\n+ -128, -128, -128, -128, -128, -128, -128, -128\n+}\n+{\n+ -128, -128, -128, 0, -128, -128, -128, 0,\n+ 0, 0, -128, 0, -128, 0, 0, -128,\n+ -128, 0, 0, 0, 0, -128, 0, 0,\n+ -128, 0, 0, -128, -128, 0, 0, -128\n+}\n+{\n+ 0, -128, -128, -128, -128, -128, 0, 0,\n+ 0, 0, -128, 0, 0, 0, -128, 0,\n+ 0, 0, 0, 0, -128, -128, 0, -128,\n+ -128, -128, -128, 0, 0, 0, 0, 0\n+}\n+{\n+ -128, -128, -128, 0, -128, -128, 0, -128,\n+ 0, 0, -128, -128, 0, 0, 0, -128,\n+ 0, -128, -128, 0, -128, -128, 0, -128,\n+ -128, -128, -128, -128, -128, -128, 0, -128\n+}\n+}\n+;\n#endif //V_K_H\n" }, { "change_type": "MODIFY", "old_path": "scripts/debug_parser/test/Y_N_gold.h", "new_path": "scripts/debug_parser/test/Y_N_gold.h", "diff": "#ifndef Y_N_H\n#define Y_N_H\n-signed char Y_N[64] = {\n+signed char Y_N[23][64] =\n+{\n+{\n+ -5, 8, 4, -11, 4, 11, -9, -8,\n+ 4, -6, -6, -6, 9, 4, 1, -6,\n+ 2, -13, -12, -14, -7, 6, 1, 6,\n+ 6, -13, -12, 13, 13, -6, 10, -13,\n+ 11, 1, -3, 2, -2, 12, -4, -13,\n+ -7, -13, 8, -8, 18, 9, 18, -13,\n+ -15, -17, 7, -6, -3, 14, -2, 2,\n+ -4, -1, 17, 18, 5, -12, 12, -8\n+}\n+{\n-9, 9, 12, 3, 8, -6, 9, 9,\n-6, 5, -6, 6, 1, 8, -3, 9,\n0, 0, -14, 13, -6, 7, 6, -9,\n@@ -10,6 +22,218 @@ signed char Y_N[64] = {\n1, 6, -9, -13, 20, -5, -10, 10,\n7, -12, -6, -1, -9, 1, -4, 7,\n-1, 10, 4, -6, 5, 11, 1, -5\n-};\n+}\n+{\n+ -11, -7, 7, -10, 11, -16, -9, -11,\n+ -19, -15, -4, 10, -10, 12, 11, 11,\n+ 0, -1, -7, 7, -5, -6, 13, -2,\n+ -1, -5, -13, -15, -11, 11, 11, -7,\n+ 4, -13, 4, -11, 13, -10, 11, -2,\n+ 0, 9, 11, -8, -1, -10, 10, -2,\n+ -8, -11, -16, 1, -6, -12, 0, 10,\n+ -21, 17, 15, 16, 12, -3, 5, 14\n+}\n+{\n+ 9, 9, 1, 15, 8, 12, 3, 7,\n+ 11, 10, -9, -12, -11, 19, 10, 5,\n+ -3, -10, 4, 7, -8, -6, 6, -8,\n+ 10, -8, -7, -5, -11, -10, -11, -10,\n+ 7, -10, -8, -1, -9, 0, 13, 11,\n+ -1, -19, -11, -5, 6, -7, 1, 13,\n+ -7, -7, -2, -4, -14, -5, -10, 6,\n+ -8, -11, 2, 6, -2, -10, 4, 8\n+}\n+{\n+ -11, -2, 8, -1, -9, 11, -16, -6,\n+ 6, -12, 3, 0, -10, 3, -3, 17,\n+ 3, 2, 4, 5, -12, -9, 2, -9,\n+ -7, 8, 14, 2, -18, 9, 0, -7,\n+ -12, -6, -10, -7, -11, -10, 6, -2,\n+ 6, 18, -6, 3, -3, 0, 11, 11,\n+ -16, 11, 10, -1, 6, -8, 15, 6,\n+ 14, 10, 12, -4, 10, 15, 9, 12\n+}\n+{\n+ 10, 8, -7, -7, -7, 9, -19, -16,\n+ -19, -15, -13, 2, 6, 8, -8, -5,\n+ 6, 1, -4, 12, 5, 19, 8, -12,\n+ -5, 0, 6, 13, 2, -1, 11, -4,\n+ -3, -5, 2, -14, 1, 5, 4, 17,\n+ -6, 16, -10, 0, 3, 6, -2, -5,\n+ 5, -9, -2, 4, 12, 10, -13, 8,\n+ 2, -6, 0, 9, -18, -7, -1, 13\n+}\n+{\n+ -8, 5, 17, -10, -7, -5, -9, 0,\n+ -14, 7, 9, -4, 4, -20, 12, 2,\n+ 6, -8, 18, 0, -13, -7, -9, 4,\n+ 11, -8, 6, 1, 9, -7, 1, 15,\n+ 2, -9, -11, -7, 0, 11, -8, -7,\n+ 10, -8, -16, -5, 5, 7, 2, -15,\n+ 7, 6, -13, 11, -6, 9, -5, 4,\n+ 3, 7, -2, 8, 0, 5, 4, 13\n+}\n+{\n+ -5, -15, 12, 2, 13, 10, 13, 17,\n+ -5, 8, -12, 9, -5, -4, 0, 6,\n+ 14, 3, 9, 8, 14, -7, 11, 8,\n+ -5, -11, 6, -12, 6, 13, 5, -11,\n+ 5, 11, -6, 2, 8, 17, 3, 5,\n+ -1, -10, 6, -11, -11, -1, -14, 15,\n+ -3, 1, -8, -9, -1, -5, 6, 6,\n+ 12, 14, -10, 11, 0, 6, 11, -8\n+}\n+{\n+ -10, 7, -4, -7, -7, -8, 10, 6,\n+ 11, 4, 6, -3, 5, 5, -15, -3,\n+ 0, -5, 1, -11, 6, 10, 1, 1,\n+ 5, 10, 5, 13, -9, 10, -5, -2,\n+ 1, 10, -5, 14, -3, -6, -7, 10,\n+ 20, 4, 0, 12, 7, -7, 11, -11,\n+ -16, -13, 7, 11, 8, -9, -12, -20,\n+ -6, 4, 0, -9, 8, -14, 9, -16\n+}\n+{\n+ 5, 6, 0, 12, -3, 6, 2, -9,\n+ 4, 2, 10, -11, -9, 2, 9, -4,\n+ -1, -10, 1, -7, -8, 11, -1, -6,\n+ 0, 12, 8, -9, 11, 17, 14, 0,\n+ 5, 0, -15, 13, -5, -4, -10, -1,\n+ 10, -12, -6, 0, -5, 2, -5, 9,\n+ -3, 13, 12, -17, -14, 0, 9, 15,\n+ 9, -5, -7, -13, 11, 11, -7, -11\n+}\n+{\n+ 10, 9, -17, 4, 21, -7, -5, 1,\n+ 4, 18, 8, -11, 14, 6, 7, 13,\n+ -10, 4, 11, -11, 0, -6, -7, 2,\n+ -14, 10, -2, -5, 5, -15, 23, -6,\n+ 0, 11, -6, 7, 2, -9, 11, 12,\n+ 2, 10, 8, -8, 19, 13, -8, 16,\n+ 13, 8, 21, -18, -2, -13, -2, 4,\n+ 8, -10, -6, -10, -12, -9, -11, -11\n+}\n+{\n+ -3, 8, 7, 23, -7, 14, 4, 10,\n+ -10, -4, -11, 2, -8, 11, -11, 3,\n+ 6, 1, 5, 1, -2, 5, 15, -14,\n+ -13, -9, 11, -7, 5, 2, 14, -11,\n+ 14, 1, 7, 12, 12, -12, 11, -8,\n+ -2, 9, 12, -6, -9, 5, 10, -9,\n+ -12, -18, 0, 2, 10, 6, 12, 5,\n+ -7, 14, -18, 2, 8, 12, -9, -13\n+}\n+{\n+ -8, 8, -19, 0, -14, 3, 13, 12,\n+ 1, -10, -4, -17, -7, -13, 16, -2,\n+ -2, -10, -5, -11, -14, 5, 14, 2,\n+ -6, -2, -7, 2, -11, 11, 3, 3,\n+ 9, -4, 4, 8, -2, -8, -3, -3,\n+ 13, -4, -14, -3, 0, -10, 16, -9,\n+ -4, 10, 11, 15, 5, -5, 0, -6,\n+ -13, -5, -10, 3, -4, 11, 3, 11\n+}\n+{\n+ -10, 14, 10, 0, 3, -2, -3, -1,\n+ -16, 6, -7, -7, 11, -13, 9, -13,\n+ 7, -6, -12, 0, 5, -1, -4, -7,\n+ -13, -9, 2, 10, -4, 14, -11, 3,\n+ 2, -13, 0, 8, 0, 6, -3, 7,\n+ -5, 14, 9, 2, 4, 12, -1, 0,\n+ -8, -1, -2, 4, -1, -18, -5, 0,\n+ 9, -8, 1, 11, -1, -10, 12, -13\n+}\n+{\n+ 8, -16, 16, 17, -12, 12, -3, 10,\n+ 11, 13, 13, 4, 16, -16, 5, -11,\n+ 13, 12, 7, 9, 17, 5, 10, -1,\n+ 12, 4, 0, -9, -7, -4, 0, -6,\n+ -4, 8, 13, -4, 5, 10, 9, 17,\n+ -15, -12, 6, -10, -11, -11, 7, -11,\n+ -2, 12, -17, 3, 13, 16, -6, 1,\n+ 11, 3, 0, -4, -4, 14, -16, 12\n+}\n+{\n+ 18, -9, 0, 11, 9, 3, 12, 4,\n+ 12, -12, -8, 1, 9, -11, -16, -7,\n+ 6, 10, -7, 0, -17, 5, -2, -3,\n+ 9, 11, 10, -6, -15, -8, 1, 1,\n+ -12, 15, 9, 10, -14, 5, 7, -12,\n+ 5, -2, 6, -16, 9, 6, 14, -13,\n+ -8, -8, -7, -19, 11, 0, -9, 0,\n+ -4, 8, 5, -4, -4, 7, -14, 5\n+}\n+{\n+ -8, -4, 5, -17, -15, 6, 2, -17,\n+ -12, -6, -1, -3, -15, -17, -1, -13,\n+ -3, 10, 6, -10, 4, 6, 4, -3,\n+ -12, -15, 11, 16, 9, 6, -12, 17,\n+ 4, 8, -2, 5, 12, -3, -9, -14,\n+ -10, -7, 14, -1, -10, 11, -13, 5,\n+ -6, 10, 1, -18, 3, -4, 13, 14,\n+ 11, 5, -14, -4, -4, 12, 8, 3\n+}\n+{\n+ -7, 15, -5, -16, 7, -2, 1, 4,\n+ 7, 10, 6, -6, -9, -9, 15, 11,\n+ -3, 14, 14, 15, -13, -11, -15, -9,\n+ -5, 5, 2, 3, -10, 7, -1, 1,\n+ 2, -4, 4, 7, -7, 20, -4, 12,\n+ 11, -12, 1, 9, 5, -9, 6, 14,\n+ 8, 10, -1, 17, -15, 4, 2, 3,\n+ 8, 8, 3, 16, -5, -9, -2, 14\n+}\n+{\n+ -1, -19, -13, -10, -6, 8, 13, -8,\n+ -1, -11, -2, -2, -14, 8, -5, 10,\n+ -11, 2, -5, -13, -17, -10, 8, -2,\n+ 9, -16, 3, 16, 5, -2, 11, -13,\n+ -4, -5, -9, 5, -3, -13, 9, -13,\n+ 9, 4, 7, -12, 11, 9, 10, -8,\n+ -5, 15, -5, 11, 0, 18, 9, -21,\n+ -6, 10, -12, 9, -11, 6, -14, 13\n+}\n+{\n+ 1, 0, -16, 6, -3, -9, -4, -10,\n+ 6, 7, 17, 1, -1, 4, -18, -15,\n+ -8, -16, 4, -14, -9, -15, -2, -8,\n+ -1, -6, -9, -6, 3, -7, -13, -10,\n+ 9, 13, -13, 2, -17, -16, -1, -8,\n+ -13, -6, -6, -9, 3, 10, 0, 22,\n+ 4, 14, -9, 14, 7, 6, -10, 6,\n+ -13, -5, 1, -5, -14, -4, -14, -12\n+}\n+{\n+ 12, -4, -8, 5, -7, -12, 8, 11,\n+ -10, -7, 10, -12, -3, 12, -9, -13,\n+ -3, -10, -7, -11, 0, 9, -5, -4,\n+ -17, 2, -13, 7, -11, -1, -12, 6,\n+ 2, -2, 0, 7, 8, -7, 11, 7,\n+ 11, -17, 11, 3, 5, 15, -7, -9,\n+ -10, 14, 12, 21, 12, -9, 9, 9,\n+ -9, 0, 14, -1, -9, 10, 10, 0\n+}\n+{\n+ 0, -4, -5, 13, 10, 6, 0, -8,\n+ 9, -15, 6, 1, -9, 10, 2, 2,\n+ -2, 8, 3, -3, 0, 16, 8, -14,\n+ 3, -4, 0, -7, -5, -9, 13, 5,\n+ 14, -3, -12, -3, -5, -8, 5, 10,\n+ -15, 5, 15, 16, 6, -13, 9, 12,\n+ 10, 1, 13, -7, -9, -10, 11, -4,\n+ -5, 0, 1, 15, -2, 7, 10, 4\n+}\n+{\n+ -15, -10, -12, -16, 15, 0, -16, -4,\n+ -14, -7, 3, 3, -13, -17, 13, 5,\n+ 2, 4, 13, -14, -13, 11, 2, 3,\n+ -15, 3, -5, 3, -5, 4, 12, -8,\n+ 7, -16, 8, -6, -1, 1, 13, 9,\n+ 8, -1, -1, 15, 1, 2, -6, 3,\n+ 11, -20, -22, 13, 5, -2, -1, -4,\n+ 2, -9, -14, -7, -5, -11, 4, -11\n+}\n+}\n+;\n#endif //Y_N_H\n" }, { "change_type": "MODIFY", "old_path": "scripts/debug_parser/test/test.sh", "new_path": "scripts/debug_parser/test/test.sh", "diff": "@@ -3,7 +3,7 @@ cd test\necho \"Test 1...\"\nrm -f Y_N.txt V_K.txt Y_N.bin V_K.bin Y_N.h V_K.h\n-python3 ../aff3ct_debug_parser.py ./dump_debug_gold.txt --mod Decoder_polar_SC_fast_sys --tsk decode_siho --src 1\n+python3 ../aff3ct_debug_parser.py ./dump_debug_gold.txt --mod Decoder_polar_SC_fast_sys --tsk decode_siho --src --txt --bin\ndiff -s Y_N.txt Y_N_gold.txt\ndiff -s V_K.txt V_K_gold.txt\ndiff -s Y_N.bin Y_N_gold.bin\n@@ -15,7 +15,7 @@ echo \"Test 1 Done.\"\necho \"Test 2...\"\nrm -f Y_N.txt X_N.txt H_N.txt Y_N.bin X_N.bin H_N.bin Y_N.h X_N.h H_N.h\n-python3 ../aff3ct_debug_parser.py ./dump_debug_gold2.txt --mod Channel_Rayleigh_LLR --tsk add_noise_wg --src 2\n+python3 ../aff3ct_debug_parser.py ./dump_debug_gold2.txt --mod Channel_Rayleigh_LLR --tsk add_noise_wg --src 2 --txt --bin\ndiff -s Y_N.txt Y_N_gold2.txt\ndiff -s X_N.txt X_N_gold2.txt\ndiff -s H_N.txt H_N_gold2.txt\n@@ -30,7 +30,7 @@ echo \"Test 2 Done.\"\necho \"Test 3...\"\nrm -f Y_N1.txt Y_N2.txt Y_N1.bin Y_N2.bin Y_N1.h Y_N2.h\n-python3 ../aff3ct_debug_parser.py ./dump_debug_gold.txt --mod Quantizer_standard --tsk process --src 3\n+python3 ../aff3ct_debug_parser.py ./dump_debug_gold.txt --mod Quantizer_standard --tsk process --src 3 --txt --bin\ndiff -s Y_N1.txt Y_N1_gold3.txt\ndiff -s Y_N2.txt Y_N2_gold3.txt\ndiff -s Y_N1.bin Y_N1_gold3.bin\n@@ -42,7 +42,7 @@ echo \"Test 3 Done.\"\necho \"Test 4...\"\nrm -f Y_N1.txt Y_N2.txt Y_N1.bin Y_N2.bin Y_N1.h Y_N2.h\n-python3 ../aff3ct_debug_parser.py ./dump_debug_gold4.txt --mod Quantizer_standard --tsk process --src 3\n+python3 ../aff3ct_debug_parser.py ./dump_debug_gold4.txt --mod Quantizer_standard --tsk process --src 3 --txt --bin\ndiff -s Y_N1.txt Y_N1_gold4.txt\ndiff -s Y_N2.txt Y_N2_gold4.txt\ndiff -s Y_N1.bin Y_N1_gold4.bin\n" } ]
C++
MIT License
aff3ct/aff3ct
Either multiple or a single frame(s) can now exported as source. Modified args. Refactor export_as_source
8,488
05.02.2018 13:03:44
18,000
f366e85a957bd052d8e869ace90bcb9a37e17649
Fix bug in source export.
[ { "change_type": "MODIFY", "old_path": "scripts/debug_parser/aff3ct_debug_parser.py", "new_path": "scripts/debug_parser/aff3ct_debug_parser.py", "diff": "@@ -80,9 +80,10 @@ class OutputStructure:\nif export_all:\nfout.write(\"\\n{\\n\")\nfor inner_frame_index in range(0, len(self.frames)):\n+ if inner_frame_index:\n+ fout.write(\",\\n\")\nself.write_array(fout, inner_frame_index)\n- fout.write(\"\\n\")\n- fout.write(\"}\\n\")\n+ fout.write(\"\\n}\\n\")\nelse:\nself.write_array(fout, frame_index)\n" }, { "change_type": "MODIFY", "old_path": "scripts/debug_parser/test/V_K_gold.h", "new_path": "scripts/debug_parser/test/V_K_gold.h", "diff": "@@ -8,133 +8,133 @@ signed char V_K[23][32] =\n-128, -128, -128, 0, -128, 0, 0, 0,\n-128, -128, 0, -128, -128, 0, 0, 0,\n-128, -128, 0, 0, 0, -128, 0, -128\n-}\n+},\n{\n0, -128, 0, -128, 0, 0, -128, 0,\n0, 0, 0, 0, -128, 0, -128, -128,\n0, -128, -128, 0, -128, 0, -128, 0,\n0, 0, 0, -128, 0, 0, 0, -128\n-}\n+},\n{\n0, 0, -128, -128, -128, 0, 0, -128,\n0, -128, 0, 0, -128, 0, -128, 0,\n-128, -128, -128, 0, -128, -128, -128, 0,\n-128, 0, 0, 0, 0, -128, 0, 0\n-}\n+},\n{\n0, -128, -128, -128, -128, -128, -128, -128,\n0, 0, -128, -128, -128, 0, -128, 0,\n0, -128, -128, -128, -128, -128, -128, 0,\n0, -128, 0, 0, -128, -128, 0, 0\n-}\n+},\n{\n0, -128, 0, 0, -128, 0, 0, -128,\n0, -128, 0, -128, 0, -128, -128, 0,\n0, 0, 0, -128, 0, -128, 0, 0,\n0, 0, 0, -128, 0, 0, 0, 0\n-}\n+},\n{\n0, -128, -128, 0, 0, -128, 0, -128,\n0, 0, 0, -128, 0, -128, 0, 0,\n-128, -128, 0, 0, 0, 0, -128, 0,\n-128, -128, -128, 0, -128, -128, -128, 0\n-}\n+},\n{\n-128, 0, 0, 0, 0, -128, 0, 0,\n-128, -128, -128, -128, -128, 0, 0, 0,\n-128, 0, -128, 0, -128, 0, -128, 0,\n-128, 0, -128, 0, 0, 0, 0, 0\n-}\n+},\n{\n0, 0, 0, -128, 0, 0, 0, -128,\n0, 0, -128, 0, -128, -128, 0, -128,\n0, 0, -128, -128, 0, -128, 0, 0,\n0, 0, -128, 0, 0, 0, 0, -128\n-}\n+},\n{\n-128, -128, 0, 0, -128, 0, -128, -128,\n-128, 0, 0, -128, 0, 0, -128, 0,\n-128, -128, 0, 0, 0, -128, -128, -128,\n0, 0, -128, -128, -128, -128, 0, -128\n-}\n+},\n{\n-128, -128, 0, -128, 0, 0, 0, 0,\n-128, 0, -128, -128, -128, -128, 0, -128,\n0, 0, 0, -128, -128, 0, 0, 0,\n0, -128, -128, -128, 0, 0, -128, -128\n-}\n+},\n{\n0, 0, -128, -128, -128, -128, 0, -128,\n0, 0, 0, 0, -128, 0, 0, -128,\n0, 0, 0, -128, -128, -128, 0, 0,\n0, -128, -128, -128, -128, -128, -128, -128\n-}\n+},\n{\n-128, -128, 0, -128, 0, 0, 0, -128,\n0, -128, 0, 0, -128, -128, 0, 0,\n-128, -128, 0, 0, 0, 0, 0, 0,\n-128, 0, -128, 0, 0, 0, -128, -128\n-}\n+},\n{\n-128, 0, -128, 0, -128, 0, 0, 0,\n-128, -128, -128, -128, -128, -128, -128, 0,\n-128, 0, 0, 0, 0, -128, -128, -128,\n-128, -128, -128, 0, -128, 0, 0, 0\n-}\n+},\n{\n-128, -128, -128, 0, -128, 0, -128, 0,\n-128, 0, 0, 0, -128, 0, 0, -128,\n0, 0, -128, -128, -128, -128, -128, -128,\n-128, -128, 0, 0, -128, -128, 0, -128\n-}\n+},\n{\n-128, -128, 0, -128, -128, -128, 0, -128,\n0, 0, -128, 0, -128, -128, -128, 0,\n-128, 0, -128, 0, 0, 0, -128, 0,\n0, 0, -128, -128, -128, 0, -128, 0\n-}\n+},\n{\n-128, -128, 0, -128, -128, -128, 0, 0,\n0, -128, -128, 0, -128, 0, 0, 0,\n-128, -128, -128, -128, 0, 0, -128, 0,\n0, 0, -128, 0, -128, 0, -128, 0\n-}\n+},\n{\n-128, -128, 0, 0, 0, 0, -128, 0,\n-128, -128, -128, 0, -128, -128, 0, -128,\n0, 0, 0, -128, 0, -128, 0, 0,\n0, 0, -128, -128, -128, 0, 0, 0\n-}\n+},\n{\n0, -128, 0, 0, -128, 0, 0, -128,\n0, 0, -128, -128, 0, 0, -128, 0,\n0, 0, 0, 0, -128, 0, 0, 0,\n0, 0, 0, 0, -128, -128, -128, 0\n-}\n+},\n{\n0, -128, 0, 0, 0, 0, 0, -128,\n0, -128, 0, 0, -128, 0, 0, 0,\n-128, 0, -128, 0, -128, 0, 0, -128,\n-128, 0, -128, 0, -128, 0, -128, 0\n-}\n+},\n{\n-128, -128, -128, -128, -128, -128, -128, -128,\n0, -128, -128, -128, -128, 0, 0, 0,\n0, 0, -128, 0, 0, 0, -128, 0,\n-128, -128, -128, -128, -128, -128, -128, -128\n-}\n+},\n{\n-128, -128, -128, 0, -128, -128, -128, 0,\n0, 0, -128, 0, -128, 0, 0, -128,\n-128, 0, 0, 0, 0, -128, 0, 0,\n-128, 0, 0, -128, -128, 0, 0, -128\n-}\n+},\n{\n0, -128, -128, -128, -128, -128, 0, 0,\n0, 0, -128, 0, 0, 0, -128, 0,\n0, 0, 0, 0, -128, -128, 0, -128,\n-128, -128, -128, 0, 0, 0, 0, 0\n-}\n+},\n{\n-128, -128, -128, 0, -128, -128, 0, -128,\n0, 0, -128, -128, 0, 0, 0, -128,\n" }, { "change_type": "MODIFY", "old_path": "scripts/debug_parser/test/Y_N_gold.h", "new_path": "scripts/debug_parser/test/Y_N_gold.h", "diff": "@@ -12,7 +12,7 @@ signed char Y_N[23][64] =\n-7, -13, 8, -8, 18, 9, 18, -13,\n-15, -17, 7, -6, -3, 14, -2, 2,\n-4, -1, 17, 18, 5, -12, 12, -8\n-}\n+},\n{\n-9, 9, 12, 3, 8, -6, 9, 9,\n-6, 5, -6, 6, 1, 8, -3, 9,\n@@ -22,7 +22,7 @@ signed char Y_N[23][64] =\n1, 6, -9, -13, 20, -5, -10, 10,\n7, -12, -6, -1, -9, 1, -4, 7,\n-1, 10, 4, -6, 5, 11, 1, -5\n-}\n+},\n{\n-11, -7, 7, -10, 11, -16, -9, -11,\n-19, -15, -4, 10, -10, 12, 11, 11,\n@@ -32,7 +32,7 @@ signed char Y_N[23][64] =\n0, 9, 11, -8, -1, -10, 10, -2,\n-8, -11, -16, 1, -6, -12, 0, 10,\n-21, 17, 15, 16, 12, -3, 5, 14\n-}\n+},\n{\n9, 9, 1, 15, 8, 12, 3, 7,\n11, 10, -9, -12, -11, 19, 10, 5,\n@@ -42,7 +42,7 @@ signed char Y_N[23][64] =\n-1, -19, -11, -5, 6, -7, 1, 13,\n-7, -7, -2, -4, -14, -5, -10, 6,\n-8, -11, 2, 6, -2, -10, 4, 8\n-}\n+},\n{\n-11, -2, 8, -1, -9, 11, -16, -6,\n6, -12, 3, 0, -10, 3, -3, 17,\n@@ -52,7 +52,7 @@ signed char Y_N[23][64] =\n6, 18, -6, 3, -3, 0, 11, 11,\n-16, 11, 10, -1, 6, -8, 15, 6,\n14, 10, 12, -4, 10, 15, 9, 12\n-}\n+},\n{\n10, 8, -7, -7, -7, 9, -19, -16,\n-19, -15, -13, 2, 6, 8, -8, -5,\n@@ -62,7 +62,7 @@ signed char Y_N[23][64] =\n-6, 16, -10, 0, 3, 6, -2, -5,\n5, -9, -2, 4, 12, 10, -13, 8,\n2, -6, 0, 9, -18, -7, -1, 13\n-}\n+},\n{\n-8, 5, 17, -10, -7, -5, -9, 0,\n-14, 7, 9, -4, 4, -20, 12, 2,\n@@ -72,7 +72,7 @@ signed char Y_N[23][64] =\n10, -8, -16, -5, 5, 7, 2, -15,\n7, 6, -13, 11, -6, 9, -5, 4,\n3, 7, -2, 8, 0, 5, 4, 13\n-}\n+},\n{\n-5, -15, 12, 2, 13, 10, 13, 17,\n-5, 8, -12, 9, -5, -4, 0, 6,\n@@ -82,7 +82,7 @@ signed char Y_N[23][64] =\n-1, -10, 6, -11, -11, -1, -14, 15,\n-3, 1, -8, -9, -1, -5, 6, 6,\n12, 14, -10, 11, 0, 6, 11, -8\n-}\n+},\n{\n-10, 7, -4, -7, -7, -8, 10, 6,\n11, 4, 6, -3, 5, 5, -15, -3,\n@@ -92,7 +92,7 @@ signed char Y_N[23][64] =\n20, 4, 0, 12, 7, -7, 11, -11,\n-16, -13, 7, 11, 8, -9, -12, -20,\n-6, 4, 0, -9, 8, -14, 9, -16\n-}\n+},\n{\n5, 6, 0, 12, -3, 6, 2, -9,\n4, 2, 10, -11, -9, 2, 9, -4,\n@@ -102,7 +102,7 @@ signed char Y_N[23][64] =\n10, -12, -6, 0, -5, 2, -5, 9,\n-3, 13, 12, -17, -14, 0, 9, 15,\n9, -5, -7, -13, 11, 11, -7, -11\n-}\n+},\n{\n10, 9, -17, 4, 21, -7, -5, 1,\n4, 18, 8, -11, 14, 6, 7, 13,\n@@ -112,7 +112,7 @@ signed char Y_N[23][64] =\n2, 10, 8, -8, 19, 13, -8, 16,\n13, 8, 21, -18, -2, -13, -2, 4,\n8, -10, -6, -10, -12, -9, -11, -11\n-}\n+},\n{\n-3, 8, 7, 23, -7, 14, 4, 10,\n-10, -4, -11, 2, -8, 11, -11, 3,\n@@ -122,7 +122,7 @@ signed char Y_N[23][64] =\n-2, 9, 12, -6, -9, 5, 10, -9,\n-12, -18, 0, 2, 10, 6, 12, 5,\n-7, 14, -18, 2, 8, 12, -9, -13\n-}\n+},\n{\n-8, 8, -19, 0, -14, 3, 13, 12,\n1, -10, -4, -17, -7, -13, 16, -2,\n@@ -132,7 +132,7 @@ signed char Y_N[23][64] =\n13, -4, -14, -3, 0, -10, 16, -9,\n-4, 10, 11, 15, 5, -5, 0, -6,\n-13, -5, -10, 3, -4, 11, 3, 11\n-}\n+},\n{\n-10, 14, 10, 0, 3, -2, -3, -1,\n-16, 6, -7, -7, 11, -13, 9, -13,\n@@ -142,7 +142,7 @@ signed char Y_N[23][64] =\n-5, 14, 9, 2, 4, 12, -1, 0,\n-8, -1, -2, 4, -1, -18, -5, 0,\n9, -8, 1, 11, -1, -10, 12, -13\n-}\n+},\n{\n8, -16, 16, 17, -12, 12, -3, 10,\n11, 13, 13, 4, 16, -16, 5, -11,\n@@ -152,7 +152,7 @@ signed char Y_N[23][64] =\n-15, -12, 6, -10, -11, -11, 7, -11,\n-2, 12, -17, 3, 13, 16, -6, 1,\n11, 3, 0, -4, -4, 14, -16, 12\n-}\n+},\n{\n18, -9, 0, 11, 9, 3, 12, 4,\n12, -12, -8, 1, 9, -11, -16, -7,\n@@ -162,7 +162,7 @@ signed char Y_N[23][64] =\n5, -2, 6, -16, 9, 6, 14, -13,\n-8, -8, -7, -19, 11, 0, -9, 0,\n-4, 8, 5, -4, -4, 7, -14, 5\n-}\n+},\n{\n-8, -4, 5, -17, -15, 6, 2, -17,\n-12, -6, -1, -3, -15, -17, -1, -13,\n@@ -172,7 +172,7 @@ signed char Y_N[23][64] =\n-10, -7, 14, -1, -10, 11, -13, 5,\n-6, 10, 1, -18, 3, -4, 13, 14,\n11, 5, -14, -4, -4, 12, 8, 3\n-}\n+},\n{\n-7, 15, -5, -16, 7, -2, 1, 4,\n7, 10, 6, -6, -9, -9, 15, 11,\n@@ -182,7 +182,7 @@ signed char Y_N[23][64] =\n11, -12, 1, 9, 5, -9, 6, 14,\n8, 10, -1, 17, -15, 4, 2, 3,\n8, 8, 3, 16, -5, -9, -2, 14\n-}\n+},\n{\n-1, -19, -13, -10, -6, 8, 13, -8,\n-1, -11, -2, -2, -14, 8, -5, 10,\n@@ -192,7 +192,7 @@ signed char Y_N[23][64] =\n9, 4, 7, -12, 11, 9, 10, -8,\n-5, 15, -5, 11, 0, 18, 9, -21,\n-6, 10, -12, 9, -11, 6, -14, 13\n-}\n+},\n{\n1, 0, -16, 6, -3, -9, -4, -10,\n6, 7, 17, 1, -1, 4, -18, -15,\n@@ -202,7 +202,7 @@ signed char Y_N[23][64] =\n-13, -6, -6, -9, 3, 10, 0, 22,\n4, 14, -9, 14, 7, 6, -10, 6,\n-13, -5, 1, -5, -14, -4, -14, -12\n-}\n+},\n{\n12, -4, -8, 5, -7, -12, 8, 11,\n-10, -7, 10, -12, -3, 12, -9, -13,\n@@ -212,7 +212,7 @@ signed char Y_N[23][64] =\n11, -17, 11, 3, 5, 15, -7, -9,\n-10, 14, 12, 21, 12, -9, 9, 9,\n-9, 0, 14, -1, -9, 10, 10, 0\n-}\n+},\n{\n0, -4, -5, 13, 10, 6, 0, -8,\n9, -15, 6, 1, -9, 10, 2, 2,\n@@ -222,7 +222,7 @@ signed char Y_N[23][64] =\n-15, 5, 15, 16, 6, -13, 9, 12,\n10, 1, 13, -7, -9, -10, 11, -4,\n-5, 0, 1, 15, -2, 7, 10, 4\n-}\n+},\n{\n-15, -10, -12, -16, 15, 0, -16, -4,\n-14, -7, 3, 3, -13, -17, 13, 5,\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bug in source export.
8,483
06.02.2018 10:59:59
-3,600
31f56fa3511ee403cda674091600c43c3cd6277e
Move argument range sets in their own folder; Add an example set that check nothing (only an example of options)
[ { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp", "new_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp", "diff": "@@ -37,7 +37,7 @@ public:\n#include \"Min.hpp\"\n#include \"Max.hpp\"\n-#include \"Set.hpp\"\n+#include \"Set/Set.hpp\"\n#include \"Non_zero.hpp\"\n#include \"Negative.hpp\"\n#include \"Positive.hpp\"\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_range/Non_zero.hpp", "new_path": "src/Tools/Arguments/Argument_range/Non_zero.hpp", "diff": "#include <string>\n-#include \"Set.hpp\"\n+#include \"Set/Set.hpp\"\nnamespace aff3ct\n{\n" }, { "change_type": "DELETE", "old_path": "src/Tools/Arguments/Argument_range/Set.hpp", "new_path": null, "diff": "-#ifndef ARGUMENT_SET_RANGE_HPP_\n-#define ARGUMENT_SET_RANGE_HPP_\n-\n-#include \"Argument_range.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-\n-template <typename T>\n-class Set_range : public Argument_range\n-{\n-protected:\n- std::vector<T> options;\n-\n-public:\n- explicit Set_range(const std::string& title, const std::vector<T>& options)\n- : Argument_range(title)\n- {\n- add_options(options);\n- }\n-\n- virtual ~Set_range() {};\n-\n- void add_options(const std::vector<T>& new_options)\n- {\n- for (const auto& o : new_options)\n- add_option(o);\n- }\n-\n- void add_option(const T& o)\n- {\n- options.push_back(o);\n- }\n-\n- virtual std::string get_title() const\n- {\n- return this->title + \"=\" + this->get_option_list();\n- }\n-\n- virtual std::string get_option_list() const\n- {\n- std::stringstream options_list;\n- options_list << \"{\";\n-\n- for (unsigned i = 0; i < options.size(); i++)\n- {\n- options_list << options[i];\n- if (i < (options.size()-1))\n- options_list << \"|\";\n- }\n- options_list << \"}\";\n-\n- return options_list.str();\n- }\n-\n- virtual void check(const T& val) const = 0;\n-};\n-\n-\n-\n-template <typename T>\n-class Including_set_range : public Set_range<T>\n-{\n-public:\n- explicit Including_set_range(const std::vector<T>& options)\n- : Set_range<T>(\"including set\", options)\n- { }\n-\n- virtual ~Including_set_range() {};\n-\n- virtual Including_set_range<T>* clone() const\n- {\n- return new Including_set_range<T>(*this);\n- }\n-\n- void check(const T& val) const\n- {\n- if (this->options.empty())\n- throw std::runtime_error(\"accepts no argument\");\n-\n- auto it = std::find(this->options.begin(), this->options.end(), val);\n-\n- if (it == this->options.end())\n- throw std::runtime_error(\"shall be in the set \" + this->get_option_list());\n- }\n-};\n-\n-template <typename T, typename... O>\n-typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n-Including_set(const T option, const O... options)\n-{\n- return new Including_set_range<T>({option, options...});\n-}\n-\n-template <typename T, typename... O>\n-typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n-Including_set(const T option, const O... options)\n-{\n- std::vector<std::string> list = {option, options...};\n- return new Including_set_range<std::string>(list);\n-}\n-\n-template <typename T>\n-typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n-Including_set(const std::vector<T>& options)\n-{\n- return new Including_set_range<T>(options);\n-}\n-\n-template <typename T>\n-typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n-Including_set(const std::vector<T>& options)\n-{\n- std::vector<std::string> list(options.size());\n-\n- std::copy(options.begin(), options.end(), list.begin());\n-\n- return new Including_set_range<std::string>(list);\n-}\n-\n-template <typename T>\n-Set_range<T>* Including_set()\n-{\n- return new Including_set_range<T>({});\n-}\n-\n-\n-\n-\n-template <typename T>\n-class Excluding_set_range : public Set_range<T>\n-{\n-public:\n- explicit Excluding_set_range(const std::vector<T>& options)\n- : Set_range<T>(\"excluding set\", options)\n- { }\n-\n- virtual ~Excluding_set_range() {};\n-\n- virtual Excluding_set_range<T>* clone() const\n- {\n- return new Excluding_set_range<T>(*this);\n- }\n-\n- virtual void check(const T& val) const\n- {\n- if (this->options.empty())\n- return;\n-\n- auto it = std::find(this->options.begin(), this->options.end(), val);\n-\n- if (it != this->options.end())\n- throw std::runtime_error(\"shall NOT be in the set \" + this->get_option_list());\n- }\n-};\n-\n-template <typename T, typename... O>\n-typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n-Excluding_set(const T option, const O... options)\n-{\n- return new Excluding_set_range<T>({option, options...});\n-}\n-\n-template <typename T, typename... O>\n-typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n-Excluding_set(const T option, const O... options)\n-{\n- std::vector<std::string> list = {option, options...};\n- return new Excluding_set_range<std::string>(list);\n-}\n-\n-template <typename T>\n-typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n-Excluding_set(const std::vector<T>& options)\n-{\n- return new Excluding_set_range<T>(options);\n-}\n-\n-template <typename T>\n-typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n-Excluding_set(const std::vector<T>& options)\n-{\n- std::vector<std::string> list(options.size());\n-\n- std::copy(options.begin(), options.end(), list.begin());\n-\n- return new Excluding_set_range<std::string>(list);\n-}\n-\n-\n-template <typename T>\n-Set_range<T>* Excluding_set()\n-{\n- return new Excluding_set_range<T>({});\n-}\n-\n-}\n-}\n-\n-#endif\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Arguments/Argument_range/Set/Example_set.hpp", "diff": "+#ifndef ARGUMENT_EXAMPLE_SET_RANGE_HPP_\n+#define ARGUMENT_EXAMPLE_SET_RANGE_HPP_\n+\n+#include \"Set.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Example_set_range : public Set_range<T>\n+{\n+public:\n+ explicit Example_set_range(const std::vector<T>& options)\n+ : Set_range<T>(\"example set\", options)\n+ { }\n+\n+ virtual ~Example_set_range() {};\n+\n+ virtual Example_set_range<T>* clone() const\n+ {\n+ return new Example_set_range<T>(*this);\n+ }\n+\n+ void check(const T& val) const\n+ {\n+ // do nothing, options are just examples\n+ }\n+};\n+\n+template <typename T, typename... O>\n+typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n+Example_set(const T option, const O... options)\n+{\n+ return new Example_set_range<T>({option, options...});\n+}\n+\n+template <typename T, typename... O>\n+typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n+Example_set(const T option, const O... options)\n+{\n+ std::vector<std::string> list = {option, options...};\n+ return new Example_set_range<std::string>(list);\n+}\n+\n+template <typename T>\n+typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n+Example_set(const std::vector<T>& options)\n+{\n+ return new Example_set_range<T>(options);\n+}\n+\n+template <typename T>\n+typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n+Example_set(const std::vector<T>& options)\n+{\n+ std::vector<std::string> list(options.size());\n+\n+ std::copy(options.begin(), options.end(), list.begin());\n+\n+ return new Example_set_range<std::string>(list);\n+}\n+\n+template <typename T>\n+Set_range<T>* Example_set()\n+{\n+ return new Example_set_range<T>({});\n+}\n+\n+}\n+}\n+\n+#endif\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Arguments/Argument_range/Set/Excluding_set.hpp", "diff": "+#ifndef ARGUMENT_EXCLUDING_SET_RANGE_HPP_\n+#define ARGUMENT_EXCLUDING_SET_RANGE_HPP_\n+\n+#include \"Set.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Excluding_set_range : public Set_range<T>\n+{\n+public:\n+ explicit Excluding_set_range(const std::vector<T>& options)\n+ : Set_range<T>(\"excluding set\", options)\n+ { }\n+\n+ virtual ~Excluding_set_range() {};\n+\n+ virtual Excluding_set_range<T>* clone() const\n+ {\n+ return new Excluding_set_range<T>(*this);\n+ }\n+\n+ virtual void check(const T& val) const\n+ {\n+ if (this->options.empty())\n+ return;\n+\n+ auto it = this->options.find(val);\n+\n+ if (it != this->options.end())\n+ throw std::runtime_error(\"shall NOT be in the set \" + this->get_option_list());\n+ }\n+};\n+\n+template <typename T, typename... O>\n+typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n+Excluding_set(const T option, const O... options)\n+{\n+ return new Excluding_set_range<T>({option, options...});\n+}\n+\n+template <typename T, typename... O>\n+typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n+Excluding_set(const T option, const O... options)\n+{\n+ std::vector<std::string> list = {option, options...};\n+ return new Excluding_set_range<std::string>(list);\n+}\n+\n+template <typename T>\n+typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n+Excluding_set(const std::vector<T>& options)\n+{\n+ return new Excluding_set_range<T>(options);\n+}\n+\n+template <typename T>\n+typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n+Excluding_set(const std::vector<T>& options)\n+{\n+ std::vector<std::string> list(options.size());\n+\n+ std::copy(options.begin(), options.end(), list.begin());\n+\n+ return new Excluding_set_range<std::string>(list);\n+}\n+\n+\n+template <typename T>\n+Set_range<T>* Excluding_set()\n+{\n+ return new Excluding_set_range<T>({});\n+}\n+\n+}\n+}\n+\n+#endif\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Arguments/Argument_range/Set/Including_set.hpp", "diff": "+#ifndef ARGUMENT_INCLUDING_SET_RANGE_HPP_\n+#define ARGUMENT_INCLUDING_SET_RANGE_HPP_\n+\n+#include \"Set.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Including_set_range : public Set_range<T>\n+{\n+public:\n+ explicit Including_set_range(const std::vector<T>& options)\n+ : Set_range<T>(\"including set\", options)\n+ { }\n+\n+ virtual ~Including_set_range() {};\n+\n+ virtual Including_set_range<T>* clone() const\n+ {\n+ return new Including_set_range<T>(*this);\n+ }\n+\n+ void check(const T& val) const\n+ {\n+ if (this->options.empty())\n+ throw std::runtime_error(\"accepts no argument\");\n+\n+ auto it = this->options.find(val);\n+\n+ if (it == this->options.end())\n+ throw std::runtime_error(\"shall be in the set \" + this->get_option_list());\n+ }\n+};\n+\n+template <typename T, typename... O>\n+typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n+Including_set(const T option, const O... options)\n+{\n+ return new Including_set_range<T>({option, options...});\n+}\n+\n+template <typename T, typename... O>\n+typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n+Including_set(const T option, const O... options)\n+{\n+ std::vector<std::string> list = {option, options...};\n+ return new Including_set_range<std::string>(list);\n+}\n+\n+template <typename T>\n+typename std::enable_if<!std::is_same<T, char const*>::value, Set_range<T>*>::type\n+Including_set(const std::vector<T>& options)\n+{\n+ return new Including_set_range<T>(options);\n+}\n+\n+template <typename T>\n+typename std::enable_if<std::is_same<T, char const*>::value, Set_range<std::string>*>::type\n+Including_set(const std::vector<T>& options)\n+{\n+ std::vector<std::string> list(options.size());\n+\n+ std::copy(options.begin(), options.end(), list.begin());\n+\n+ return new Including_set_range<std::string>(list);\n+}\n+\n+template <typename T>\n+Set_range<T>* Including_set()\n+{\n+ return new Including_set_range<T>({});\n+}\n+\n+}\n+}\n+\n+#endif\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Tools/Arguments/Argument_range/Set/Set.hpp", "diff": "+#ifndef ARGUMENT_SET_RANGE_HPP_\n+#define ARGUMENT_SET_RANGE_HPP_\n+\n+#include <set>\n+\n+#include \"../Argument_range.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Set_range : public Argument_range\n+{\n+protected:\n+ std::set<T> options;\n+\n+public:\n+ explicit Set_range(const std::string& title, const std::vector<T>& options)\n+ : Argument_range(title)\n+ {\n+ add_options(options);\n+ }\n+\n+ virtual ~Set_range() {};\n+\n+ void add_options(const std::vector<T>& new_options)\n+ {\n+ for (const auto& o : new_options)\n+ add_option(o);\n+ }\n+\n+ void add_option(const T& o)\n+ {\n+ options.emplace(o);\n+ }\n+\n+ virtual std::string get_title() const\n+ {\n+ return this->title + \"=\" + this->get_option_list();\n+ }\n+\n+ virtual std::string get_option_list() const\n+ {\n+ std::stringstream options_list;\n+ options_list << \"{\";\n+\n+ for (auto it = options.begin(); it != options.end(); it++)\n+ {\n+ options_list << *it;\n+ if (it != --(options.end()))\n+ options_list << \"|\";\n+ }\n+ options_list << \"}\";\n+\n+ return options_list.str();\n+ }\n+\n+ virtual void check(const T& val) const = 0;\n+};\n+\n+}\n+}\n+\n+#include \"Including_set.hpp\"\n+#include \"Excluding_set.hpp\"\n+#include \"Example_set.hpp\"\n+\n+#endif\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Move argument range sets in their own folder; Add an example set that check nothing (only an example of options)
8,483
06.02.2018 11:02:29
-3,600
ef74af868e066f78560c7dd121db8cc4ed322450
In polar decoder factory, change dec-implem ranges from Including set into example set
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Decoder.cpp", "new_path": "src/Factory/Module/Decoder/Decoder.cpp", "diff": "@@ -49,12 +49,12 @@ void Decoder::parameters\nopt_args.add(\n{p+\"-type\", \"D\"},\n- tools::Text(tools::Including_set<std::string>(\"ML\", \"CHASE\")),\n+ tools::Text(tools::Including_set(\"ML\", \"CHASE\")),\n\"select the algorithm you want to decode the codeword.\");\nopt_args.add(\n{p+\"-implem\"},\n- tools::Text(tools::Including_set<std::string>(\"STD\", \"NAIVE\")),\n+ tools::Text(tools::Including_set(\"STD\", \"NAIVE\")),\n\"select the implementation of the algorithm to decode.\");\nopt_args.add(\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "new_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "diff": "@@ -77,8 +77,13 @@ void Decoder_polar::parameters\nauto p = this->get_prefix();\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"SC\", \"SCL\", \"SCL_MEM\", \"ASCL\", \"ASCL_MEM\", \"SCAN\");\n- tools::add_options(opt_args.at({p+\"-implem\" }), 0, \"NAIVE\", \"FAST\");\n- // tools::add_ranges<tools::Text_type<>>(opt_args.at({p+\"-implem\"}));\n+\n+ opt_args.erase({p+\"-implem\"});\n+\n+ opt_args.add(\n+ {p+\"-implem\"},\n+ tools::Text(tools::Example_set(\"FAST\", \"NAIVE\")),\n+ \"select the implementation of the algorithm to decode.\");\nopt_args.add(\n{p+\"-ite\", \"i\"},\n" } ]
C++
MIT License
aff3ct/aff3ct
In polar decoder factory, change dec-implem ranges from Including set into example set
8,483
06.02.2018 11:19:18
-3,600
c00630038a2da28199b6d135efcf2c47d2b69e36
Add a change type, change doc and add doc methods in Argument_Info structure; Use change type method to change the type of the dec-implem in deocder polar factory
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "new_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp", "diff": "@@ -78,12 +78,7 @@ void Decoder_polar::parameters\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"SC\", \"SCL\", \"SCL_MEM\", \"ASCL\", \"ASCL_MEM\", \"SCAN\");\n- opt_args.erase({p+\"-implem\"});\n-\n- opt_args.add(\n- {p+\"-implem\"},\n- tools::Text(tools::Example_set(\"FAST\", \"NAIVE\")),\n- \"select the implementation of the algorithm to decode.\");\n+ opt_args.at({p+\"-implem\"})->change_type(tools::Text(tools::Example_set(\"FAST\", \"NAIVE\")));\nopt_args.add(\n{p+\"-ite\", \"i\"},\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_map.cpp", "new_path": "src/Tools/Arguments/Argument_map.cpp", "diff": "@@ -31,6 +31,27 @@ void Argument_info\ntype = nullptr;\n}\n+void Argument_info\n+::change_type(Argument_type* new_type)\n+{\n+ if (type != nullptr)\n+ delete type;\n+\n+ type = new_type;\n+}\n+\n+void Argument_info\n+::change_doc(const std::string& new_doc)\n+{\n+ doc = new_doc;\n+}\n+\n+void Argument_info\n+::add_doc(const std::string& new_doc)\n+{\n+ doc += new_doc;\n+}\n+\nArgument_info* Argument_info\n::clone() const\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_map.hpp", "new_path": "src/Tools/Arguments/Argument_map.hpp", "diff": "@@ -26,6 +26,10 @@ struct Argument_info\nvirtual Argument_info* clone() const;\n+ void change_type(Argument_type* new_type);\n+ void change_doc (const std::string& new_doc);\n+ void add_doc (const std::string& new_doc);\n+\nArgument_type* type = nullptr;\nstd::string doc = \"\";\n};\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a change type, change doc and add doc methods in Argument_Info structure; Use change type method to change the type of the dec-implem in deocder polar factory
8,490
07.02.2018 11:26:25
-3,600
831c311c062c3ddce7318e68afab6c952e451498
Add the possibility to manage the frozen bits of the polar codec.
[ { "change_type": "MODIFY", "old_path": "src/Module/Codec/Polar/Codec_polar.cpp", "new_path": "src/Module/Codec/Polar/Codec_polar.cpp", "diff": "@@ -150,6 +150,18 @@ Codec_polar<B,Q>\nif (fb_generator != nullptr) { delete fb_generator; fb_generator = nullptr; }\n}\n+template <typename B, typename Q>\n+void Codec_polar<B,Q>\n+::notify_frozenbits_update()\n+{\n+ if (this->N_cw != this->N)\n+ puncturer_wangliu->gen_frozen_bits(frozen_bits);\n+ if (this->fb_decoder)\n+ this->fb_decoder->notify_frozenbits_update();\n+ if (this->fb_encoder)\n+ this->fb_encoder->notify_frozenbits_update();\n+}\n+\ntemplate <typename B, typename Q>\nvoid Codec_polar<B,Q>\n::set_sigma(const float sigma)\n@@ -162,14 +174,15 @@ void Codec_polar<B,Q>\nfb_generator->set_sigma(sigma);\nfb_generator->generate(frozen_bits);\n- if (this->N_cw != this->N)\n- puncturer_wangliu->gen_frozen_bits(frozen_bits);\n-\n- if (this->fb_decoder)\n- this->fb_decoder->notify_frozenbits_update();\n- if (this->fb_encoder)\n- this->fb_encoder->notify_frozenbits_update();\n+ this->notify_frozenbits_update();\n+ }\n}\n+\n+template <typename B, typename Q>\n+std::vector<bool>& Codec_polar<B,Q>\n+::get_frozen_bits()\n+{\n+ return this->frozen_bits;\n}\ntemplate <typename B, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Polar/Codec_polar.hpp", "new_path": "src/Module/Codec/Polar/Codec_polar.hpp", "diff": "@@ -18,7 +18,7 @@ namespace aff3ct\nnamespace module\n{\ntemplate <typename B = int, typename Q = float>\n-class Codec_polar : public Codec_SISO_SIHO<B,Q>\n+class Codec_polar : public Codec_SISO_SIHO<B,Q>, public tools::Frozenbits_notifier\n{\nprotected:\nconst bool adaptive_fb;\n@@ -39,6 +39,10 @@ public:\nvoid set_sigma(const float sigma);\n+ std::vector<bool>& get_frozen_bits();\n+\n+ virtual void notify_frozenbits_update();\n+\nprotected:\nvoid _extract_sys_par(const Q *Y_N, Q *sys, Q *par, const int frame_id);\nvoid _extract_sys_llr(const Q *Y_N, Q *sys, const int frame_id);\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the possibility to manage the frozen bits of the polar codec.
8,483
07.02.2018 17:13:55
-3,600
8208956e5e31d1c3e44c8087acb7a15fca2987bc
Cosmetics and fix the short 8/9 dvbs2 matrix values
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "@@ -45,7 +45,7 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\n- req_args[{p+\"-h-path\"}] =\n+ opt_args[{p+\"-h-path\"}] =\n{\"string\",\n\"path to the H matrix (AList or QC formated file).\"};\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp", "diff": "@@ -82,13 +82,6 @@ Codec_LDPC<B,Q>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (dec_params.H_path.empty())\n- {\n- std::stringstream message;\n- message << \"'dec_params.H_path' has to be set to a matrix file.\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n// ---------------------------------------------------------------------------------------------------------- tools\nbool is_info_bits_pos = false;\nif (enc_params.type == \"LDPC\")\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": "@@ -30,7 +30,7 @@ void Encoder_LDPC_DVBS2<B>\nstd::copy(U_K, U_K + this->K, X_N);\nstd::fill(X_N + this->K, X_N + this->N, 0 );\n- B* Px = &X_N[this->K];\n+ B* Px = X_N + this->K;\nconst int *p = dvbs2.EncValues.data();\nint xPos = 0;\n@@ -45,7 +45,8 @@ void Encoder_LDPC_DVBS2<B>\n{\nfor (int q = 0; q < nbPos; q++)\n{\n- int position = (p[q] + (xPos % 360) * dvbs2.Q) % dvbs2.NmK;\n+ // int position = (p[q] + (xPos % dvbs2.M) * dvbs2.Q) % dvbs2.NmK;\n+ int position = (p[q] + l * dvbs2.Q) % dvbs2.NmK;\nPx[position] ^= bit;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants.cpp", "new_path": "src/Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants.cpp", "diff": "-#include <assert.h>\n#include <sstream>\n#include <iostream>\n@@ -26,12 +25,11 @@ Sparse_matrix aff3ct::tools::build_H(const dvbs2_values& dvbs2)\nfor (int l = 0; l < dvbs2.M; l++)\n{\n+\nfor (int q = 0; q < nbPos; q++)\n{\n- yPos = (p[q] + (xPos % 360) * dvbs2.Q) % dvbs2.NmK;\n-\n- assert( xPos < dvbs2.N );\n- assert( yPos < dvbs2.NmK );\n+ // yPos = (p[q] + (xPos % dvbs2.M) * dvbs2.Q) % dvbs2.NmK;\n+ yPos = (p[q] + l * dvbs2.Q) % dvbs2.NmK;\nH.add_connection(xPos, yPos);\n}\n@@ -46,14 +44,11 @@ Sparse_matrix aff3ct::tools::build_H(const dvbs2_values& dvbs2)\nyPos = xPos - dvbs2.K;\nH.add_connection(xPos, yPos);\n-\nyPos++;\nif (yPos < dvbs2.NmK)\n- {\nH.add_connection(xPos, yPos);\n}\n- }\nreturn H;\n}\n@@ -151,7 +146,7 @@ dvbs2_values* aff3ct::tools::build_dvbs2(const int K, const int N)\nbreak;\n}\n- if (!dvbs2)\n+ if (dvbs2 == nullptr)\n{\nstd::stringstream message;\nmessage << \"The given format doesn't match any known generator matrix ('K' = \" << K << \", 'N' = \" << N << \").\";\n@@ -174,5 +169,21 @@ dvbs2_values* aff3ct::tools::build_dvbs2(const int K, const int N)\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (dvbs2->Q != (dvbs2->N - dvbs2->K)/dvbs2->M)\n+ {\n+ std::stringstream message;\n+ message << \"'Q' has to be equal to ('N' - 'K')/'M' ('Q' = \" << dvbs2->Q << \", 'N' = \" << dvbs2->N\n+ << \", 'K' = \" << dvbs2->K << \", 'M' = \" << dvbs2->M << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (dvbs2->K != (dvbs2->M * dvbs2->N_LINES))\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be equal to ('M' * 'N_LINES') ('K' = \" << dvbs2->K << \", 'M' = \" << dvbs2->M\n+ << \", 'N_LINES' = \" << dvbs2->N_LINES << \").\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\nreturn dvbs2;\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants_16200.hpp", "new_path": "src/Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants_16200.hpp", "diff": "@@ -13,11 +13,11 @@ struct dvbs2_values_16200_1800 : dvbs2_values // r=8/9 & K = 14400\ndvbs2_values_16200_1800()\n{\nthis->EncValues = std::vector<int>({\n- 3, 0, 1558, 712, 805,\n- 3, 1, 1450, 873, 1337,\n- 3, 2, 1741, 1129, 1184,\n- 3, 3, 294, 806, 1566,\n- 3, 4, 482, 605, 923,\n+ 4, 0, 1558, 712, 805,\n+ 4, 1, 1450, 873, 1337,\n+ 4, 2, 1741, 1129, 1184,\n+ 4, 3, 294, 806, 1566,\n+ 4, 4, 482, 605, 923,\n3, 0, 926, 1578,\n3, 1, 777, 1374,\n3, 2, 608, 151,\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants_64800.hpp", "new_path": "src/Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants_64800.hpp", "diff": "@@ -177,12 +177,12 @@ struct dvbs2_values_64800_6480 : dvbs2_values // r=9/10 & K = 58320\n3, 17, 3392, 1991\n});\n- N = 64800;\n- K = 58320;\n- NmK = 6480;\n- M = 360;\n- Q = 18;\n- N_LINES = 162;\n+ this->N = 64800;\n+ this->K = 58320;\n+ this->NmK = 6480;\n+ this->M = 360;\n+ this->Q = 18;\n+ this->N_LINES = 162;\n}\n};\n@@ -353,12 +353,12 @@ struct dvbs2_values_64800_7200 : dvbs2_values // r=8/9 & K = 57600\n3, 19, 1696, 1459\n});\n- N = 64800;\n- K = 57600;\n- NmK = 7200;\n- M = 360;\n- Q = 20;\n- N_LINES = 160;\n+ this->N = 64800;\n+ this->K = 57600;\n+ this->NmK = 7200;\n+ this->M = 360;\n+ this->Q = 20;\n+ this->N_LINES = 160;\n}\n};\n@@ -517,12 +517,12 @@ struct dvbs2_values_64800_10800 : dvbs2_values // r=5/6 & K = 54000\n3, 27, 3755, 9536\n});\n- N = 64800;\n- K = 54000;\n- NmK = 10800;\n- M = 360;\n- Q = 30;\n- N_LINES = 148;\n+ this->N = 64800;\n+ this->K = 54000;\n+ this->NmK = 10800;\n+ this->M = 360;\n+ this->Q = 30;\n+ this->N_LINES = 148;\n}\n};\n@@ -677,12 +677,12 @@ struct dvbs2_values_64800_12960 : dvbs2_values // r=4/5 & K = 51840\n3, 35, 7108, 5553\n});\n- N = 64800;\n- K = 51840;\n- NmK = 12960;\n- M = 360;\n- Q = 36;\n- N_LINES = 144;\n+ this->N = 64800;\n+ this->K = 51840;\n+ this->NmK = 12960;\n+ this->M = 360;\n+ this->Q = 36;\n+ this->N_LINES = 144;\n}\n};\n@@ -828,12 +828,12 @@ struct dvbs2_values_64800_16200 : dvbs2_values // r=3/4 & K = 48600\n3, 44, 2883, 14521\n});\n- N = 64800;\n- K = 48600;\n- NmK = 16200;\n- M = 360;\n- Q = 45;\n- N_LINES = 135;\n+ this->N = 64800;\n+ this->K = 48600;\n+ this->NmK = 16200;\n+ this->M = 360;\n+ this->Q = 45;\n+ this->N_LINES = 135;\n}\n};\n@@ -964,12 +964,12 @@ struct dvbs2_values_64800_21600 : dvbs2_values // r=2/3 & K = 43200\n3, 59, 3589, 14630\n});\n- N = 64800;\n- K = 43200;\n- NmK = 21600;\n- M = 360;\n- Q = 60;\n- N_LINES = 120;\n+ this->N = 64800;\n+ this->K = 43200;\n+ this->NmK = 21600;\n+ this->M = 360;\n+ this->Q = 60;\n+ this->N_LINES = 120;\n}\n};\n@@ -1088,12 +1088,12 @@ struct dvbs2_values_64800_25920 : dvbs2_values // r=3/5 & K = 38880\n3, 71, 3434, 7769\n});\n- N = 64800;\n- K = 38880;\n- NmK = 25920;\n- M = 360;\n- Q = 72;\n- N_LINES = 108;\n+ this->N = 64800;\n+ this->K = 38880;\n+ this->NmK = 25920;\n+ this->M = 360;\n+ this->Q = 72;\n+ this->N_LINES = 108;\n}\n};\n@@ -1194,12 +1194,12 @@ struct dvbs2_values_64800_32400 : dvbs2_values // r=1/2 & K = 32400\n3, 53, 19267, 20113\n});\n- N = 64800;\n- K = 32400;\n- NmK = 32400;\n- M = 360;\n- Q = 90;\n- N_LINES = 90;\n+ this->N = 64800;\n+ this->K = 32400;\n+ this->NmK = 32400;\n+ this->M = 360;\n+ this->Q = 90;\n+ this->N_LINES = 90;\n}\n};\n@@ -1282,12 +1282,12 @@ struct dvbs2_values_64800_38880 : dvbs2_values // r=2/5 & K = 25920\n3, 30672, 16927, 14800\n});\n- N = 64800;\n- K = 25920;\n- NmK = 38880;\n- M = 360;\n- Q = 108;\n- N_LINES = 72;\n+ this->N = 64800;\n+ this->K = 25920;\n+ this->NmK = 38880;\n+ this->M = 360;\n+ this->Q = 108;\n+ this->N_LINES = 72;\n}\n};\n@@ -1358,12 +1358,12 @@ struct dvbs2_values_64800_43200 : dvbs2_values // r=1/3 & K = 21600\n3, 25353, 4122, 39751\n});\n- N = 64800;\n- K = 21600;\n- NmK = 43200;\n- M = 360;\n- Q = 120;\n- N_LINES = 60;\n+ this->N = 64800;\n+ this->K = 21600;\n+ this->NmK = 43200;\n+ this->M = 360;\n+ this->Q = 120;\n+ this->N_LINES = 60;\n}\n};\n@@ -1419,12 +1419,12 @@ struct dvbs2_values_64800_48600 : dvbs2_values // r=1/4 & K = 16200\n3, 46685, 20622, 32806\n});\n- N = 64800;\n- K = 16200;\n- NmK = 48600;\n- M = 360;\n- Q = 135;\n- N_LINES = 45;\n+ this->N = 64800;\n+ this->K = 16200;\n+ this->NmK = 48600;\n+ this->M = 360;\n+ this->Q = 135;\n+ this->N_LINES = 45;\n}\n};\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Cosmetics and fix the short 8/9 dvbs2 matrix values
8,483
08.02.2018 09:39:17
-3,600
50c38f5b5698b6a37389097cc80866d916fefa36
Add comments; Compute the reliability only from the converged competitors after hard decoding
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -272,6 +272,7 @@ void Decoder_chase_pyndiah<B,R>\n{\nstd::fill(metrics.begin(), metrics.end(), (R)0);\n+ n_good_competitors = 0;\nfor (int c = 0; c < n_test_vectors; c++)\n{\nif (is_wrong[c])\n@@ -279,6 +280,7 @@ void Decoder_chase_pyndiah<B,R>\nmetrics[c] = std::numeric_limits<R>::max()/2;\ncontinue;\n}\n+ n_good_competitors++;\nint tv_off = c*this->N;\n@@ -297,31 +299,31 @@ void Decoder_chase_pyndiah<B,R>\nstd::sort(competitors.begin(), competitors.end(), [](const info& a, const info& b) { return a.metric < b.metric; });\n- // remove duplicated metrics\n- unsigned start_pos = 0;\n- while ((int)competitors.size() > n_competitors && start_pos < (competitors.size() -1))\n- {\n- auto it = competitors.begin();\n- std::advance(it, start_pos +1);\n+ // // remove duplicated metrics\n+ // unsigned start_pos = 0;\n+ // while ((int)competitors.size() > n_competitors && start_pos < (competitors.size() -1))\n+ // {\n+ // auto it = competitors.begin();\n+ // std::advance(it, start_pos +1);\n- // remove all duplications of the metric at position 'start_pos'\n- while (it != competitors.end())\n- {\n- if (it->metric == competitors[start_pos].metric)\n- {\n- it = competitors.erase(it);\n+ // // remove all duplications of the metric at position 'start_pos'\n+ // while (it != competitors.end())\n+ // {\n+ // if (it->metric == competitors[start_pos].metric)\n+ // {\n+ // it = competitors.erase(it);\n- if ((int)competitors.size() == n_competitors)\n- break;\n- }\n- else\n- it++;\n- }\n+ // if ((int)competitors.size() == n_competitors)\n+ // break;\n+ // }\n+ // else\n+ // it++;\n+ // }\n- start_pos++; // try with the next one\n- }\n+ // start_pos++; // try with the next one\n+ // }\n- competitors.resize(n_test_vectors);\n+ // competitors.resize(n_test_vectors);\n#ifndef NDEBUG\n@@ -351,7 +353,10 @@ void Decoder_chase_pyndiah<B,R>\nbeta -= DW.metric;\n- for (int j = 1; j < n_competitors; j++)\n+ n_good_competitors = std::min(n_good_competitors, n_competitors); // if there is less than 'n_competitors' good competitors\n+ // then take only them for reliability calculation\n+\n+ for (int j = 1; j < n_good_competitors; j++)\ncompetitors[j].metric -= DW.metric;\n@@ -360,13 +365,13 @@ void Decoder_chase_pyndiah<B,R>\nconst auto DB = test_vect[DW.pos + i]; // decided bit at the position i\nint j = 1;\n- for (; j < n_competitors; j++)\n+ for (; j < n_good_competitors; j++)\nif (test_vect[competitors[j].pos + i] != DB)\nbreak;\nR reliability;\n- if (j < n_competitors) // then there is a competitor with a different bit at the position i\n+ if (j < n_good_competitors) // then there is a competitor with a different bit at the position i\n{\nreliability = competitors[j].metric;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -29,10 +29,11 @@ protected:\nEncoder <B> &enc;\nconst int N_np; // N without the parity bit: can be equal to N if there is no parity bit in the code\n- const int n_least_reliable_positions;\n- const int n_test_vectors;\n- const int n_competitors;\n- const bool parity_extended;\n+ const int n_least_reliable_positions; // the number of least reliable positions to flip to create test vectors\n+ const int n_test_vectors; // the number of test vectors to really use from the 2^n_least_reliable_positions\n+ const int n_competitors; // the number of competitors to use from the test vectors\n+ int n_good_competitors; // the number of competitors whom test vectors converged at hard decoding step\n+ const bool parity_extended; // true if there is a parity bit\n// bool parity_diff;\nstd::vector<info> least_reliable_pos; // the list of least reliable positions\n" } ]
C++
MIT License
aff3ct/aff3ct
Add comments; Compute the reliability only from the converged competitors after hard decoding
8,490
08.02.2018 13:59:51
-3,600
1feed1dafb47a1e4803f152afe95ced406a464eb
Simplify the Monitor_reduction.
[ { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction.cpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction.cpp", "diff": "@@ -13,9 +13,10 @@ using namespace aff3ct::module;\ntemplate <typename B>\nMonitor_BFER_reduction<B>\n-::Monitor_BFER_reduction(const int size, const unsigned max_fe, std::vector<Monitor_BFER<B>*> monitors,\n- const int n_frames)\n-: Monitor_BFER<B> (size, max_fe, n_frames),\n+::Monitor_BFER_reduction(const std::vector<Monitor_BFER<B>*> &monitors)\n+: Monitor_BFER<B>((monitors.size() && monitors[0]) ? monitors[0]->get_size() : 1,\n+ (monitors.size() && monitors[0]) ? monitors[0]->get_fe_limit() : 1,\n+ (monitors.size() && monitors[0]) ? monitors[0]->get_n_frames() : 1),\nn_analyzed_frames_historic(0),\nmonitors(monitors)\n{\n@@ -29,9 +30,42 @@ Monitor_BFER_reduction<B>\nthrow tools::length_error(__FILE__, __LINE__, __func__, message.str());\n}\n- for (size_t i = 0; i < monitors.size(); ++i)\n- if (monitors[i] == nullptr)\n- throw tools::logic_error(__FILE__, __LINE__, __func__, \"'monitors[i]' can't be null.\");\n+ for (size_t m = 0; m < monitors.size(); m++)\n+ {\n+ if (monitors[m] == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'monitors[m]' can't be null ('m' = \" << m << \").\";\n+ throw tools::logic_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (monitors[0]->get_size() != monitors[m]->get_size())\n+ {\n+ std::stringstream message;\n+ message << \"'monitors[0]->get_size()' and 'monitors[m]->get_size()' have to be equal ('m' = \" << m\n+ << \", 'monitors[0]->get_size()' = \" << monitors[0]->get_size()\n+ << \", 'monitors[m]->get_size()' = \" << monitors[m]->get_size() << \").\";\n+ throw tools::logic_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (monitors[0]->get_fe_limit() != monitors[m]->get_fe_limit())\n+ {\n+ std::stringstream message;\n+ message << \"'monitors[0]->get_fe_limit()' and 'monitors[m]->get_fe_limit()' have to be equal ('m' = \" << m\n+ << \", 'monitors[0]->get_fe_limit()' = \" << monitors[0]->get_fe_limit()\n+ << \", 'monitors[m]->get_fe_limit()' = \" << monitors[m]->get_fe_limit() << \").\";\n+ throw tools::logic_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (monitors[0]->get_n_frames() != monitors[m]->get_n_frames())\n+ {\n+ std::stringstream message;\n+ message << \"'monitors[0]->get_n_frames()' and 'monitors[m]->get_n_frames()' have to be equal ('m' = \" << m\n+ << \", 'monitors[0]->get_n_frames()' = \" << monitors[0]->get_n_frames()\n+ << \", 'monitors[m]->get_n_frames()' = \" << monitors[m]->get_n_frames() << \").\";\n+ throw tools::logic_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n}\ntemplate <typename B>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction.hpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction.hpp", "diff": "@@ -18,8 +18,7 @@ private:\nstd::vector<Monitor_BFER<B>*> monitors;\npublic:\n- Monitor_BFER_reduction(const int size, const unsigned max_fe, std::vector<Monitor_BFER<B>*> monitors,\n- const int n_frames = 1);\n+ Monitor_BFER_reduction(const std::vector<Monitor_BFER<B>*> &monitors);\nvirtual ~Monitor_BFER_reduction();\nunsigned long long get_n_analyzed_fra_historic() const;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction_mpi.cpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction_mpi.cpp", "diff": "@@ -32,12 +32,10 @@ void MPI_SUM_monitor_vals_func(void *in, void *inout, int *len, MPI_Datatype *da\ntemplate <typename B>\nMonitor_BFER_reduction_mpi<B>\n-::Monitor_BFER_reduction_mpi(const int size, const unsigned max_fe,\n- std::vector<Monitor_BFER<B>*> monitors,\n+::Monitor_BFER_reduction_mpi(const std::vector<Monitor_BFER<B>*> &monitors,\nconst std::thread::id master_thread_id,\n- const std::chrono::nanoseconds d_mpi_comm_frequency,\n- const int n_frames)\n-: Monitor_BFER_reduction<B>(size, max_fe, monitors, n_frames),\n+ const std::chrono::nanoseconds d_mpi_comm_frequency)\n+: Monitor_BFER_reduction<B>(monitors),\nmaster_thread_id(master_thread_id),\nis_fe_limit_achieved(false),\nt_last_mpi_comm(std::chrono::steady_clock::now()),\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction_mpi.hpp", "new_path": "src/Module/Monitor/BFER/Monitor_BFER_reduction_mpi.hpp", "diff": "@@ -29,11 +29,9 @@ private:\nMPI_Op MPI_SUM_monitor_vals;\npublic:\n- Monitor_BFER_reduction_mpi(const int size, const unsigned max_fe,\n- std::vector<Monitor_BFER<B>*> monitors,\n+ Monitor_BFER_reduction_mpi(const std::vector<Monitor_BFER<B>*> &monitors,\nconst std::thread::id master_thread_id,\n- const std::chrono::nanoseconds d_mpi_comm_frequency = std::chrono::milliseconds(1000),\n- const int n_frames = 1);\n+ const std::chrono::nanoseconds d_mpi_comm_frequency = std::chrono::milliseconds(1000));\nvirtual ~Monitor_BFER_reduction_mpi();\nbool fe_limit_achieved();\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -75,18 +75,12 @@ BFER<B,R,Q>\n#ifdef ENABLE_MPI\n// build a monitor to compute BER/FER (reduce the other monitors)\n- this->monitor_red = new module::Monitor_BFER_reduction_mpi<B>(this->monitor[0]->get_size(),\n- this->monitor[0]->get_fe_limit(),\n- this->monitor,\n+ this->monitor_red = new module::Monitor_BFER_reduction_mpi<B>(this->monitor,\nstd::this_thread::get_id(),\n- params_BFER.mpi_comm_freq,\n- params_BFER.src->n_frames);\n+ params_BFER.mpi_comm_freq);\n#else\n// build a monitor to compute BER/FER (reduce the other monitors)\n- this->monitor_red = new module::Monitor_BFER_reduction<B>(this->monitor[0]->get_size(),\n- this->monitor[0]->get_fe_limit(),\n- this->monitor,\n- params_BFER.src->n_frames);\n+ this->monitor_red = new module::Monitor_BFER_reduction<B>(this->monitor);\n#endif\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Simplify the Monitor_reduction.
8,483
08.02.2018 15:05:02
-3,600
79b2bad1e72e0636001036ae9c67975a356f6523
Add an advanced argument type to not display them in the help when using -h, else need to use -H
[ { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -103,6 +103,11 @@ void factory::Launcher::parameters\ntools::None(),\n\"print this help.\");\n+ opt_args.add(\n+ {\"Help\", \"H\"},\n+ tools::None(),\n+ \"print this help with the advanced arguments.\");\n+\nopt_args.add(\n{\"version\", \"v\"},\ntools::None(),\n@@ -116,9 +121,20 @@ void factory::Launcher::parameters\nif(vals.exist({p+\"-cde-type\", \"C\"})) this->cde_type = vals.at({p+\"-cde-type\", \"C\"}); // required\nif(vals.exist({p+\"-type\" })) this->sim_type = vals.at({p+\"-type\" });\n- if(vals.exist({\"help\", \"h\"})) this->display_help = true;\nif(vals.exist({\"version\", \"v\"})) this->display_version = true;\n+ if(vals.exist({\"help\", \"h\"}))\n+ {\n+ this->display_help = true;\n+ this->display_adv_help = false;\n+ }\n+\n+ if(vals.exist({\"Help\", \"H\"}))\n+ {\n+ this->display_help = true;\n+ this->display_adv_help = true;\n+ }\n+\n#ifdef MULTI_PREC\nif(vals.exist({p+\"-prec\", \"p\"})) this->sim_prec = vals.to_int({p+\"-prec\", \"p\"});\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.hpp", "new_path": "src/Factory/Launcher/Launcher.hpp", "diff": "@@ -32,6 +32,7 @@ struct Launcher : public Factory\nstd::string sim_type = \"BFER\";\nint sim_prec = 32;\nbool display_help = false;\n+ bool display_adv_help = false;\nbool display_version = false;\n// ---------------------------------------------------------------------------------------------------- METHODS\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -83,7 +83,7 @@ int Launcher::read_arguments()\nif (params_common.display_help)\n{\nauto grps = factory::Factory::create_groups({&params_common});\n- ah.print_help(this->req_args, this->opt_args, grps);\n+ ah.print_help(this->req_args, this->opt_args, grps, params_common.display_adv_help);\n}\n// print usage\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_handler.cpp", "new_path": "src/Tools/Arguments/Argument_handler.cpp", "diff": "@@ -47,11 +47,18 @@ Argument_map_value Argument_handler\nfor (unsigned i = 0; i < req_found_pos.size(); ++i)\n{\n+ auto it_arg = req_args.begin();\n+ std::advance(it_arg, i);\n+\n+ if (it_arg->second->advanced_arg)\n+ {\n+ std::string message = \"The \\\"\" + print_tag(it_arg->first) + \"\\\" argument is required and advanced (can't be both)!\";\n+ warnings.push_back(message);\n+ }\n+\nif (req_found_pos[i])\ncontinue;\n- auto it_arg = req_args.begin();\n- std::advance(it_arg, i);\nstd::string message = \"The \\\"\" + print_tag(it_arg->first) + \"\\\" argument is required.\";\nerrors.push_back(message);\n}\n@@ -190,7 +197,7 @@ size_t Argument_handler\n}\nvoid Argument_handler\n-::print_help(const Argument_map_info &req_args, const Argument_map_info &opt_args) const\n+::print_help(const Argument_map_info &req_args, const Argument_map_info &opt_args, const bool print_advanced_args) const\n{\nthis->print_usage(req_args);\nstd::cout << std::endl;\n@@ -200,10 +207,10 @@ void Argument_handler\n// print arguments\nfor (auto it = req_args.begin(); it != req_args.end(); ++it)\n- this->print_help(it->first, *it->second, max_n_char_arg, true);\n+ this->print_help(it->first, *it->second, max_n_char_arg, true, print_advanced_args);\nfor (auto it = opt_args.begin(); it != opt_args.end(); ++it)\n- this->print_help(it->first, *it->second, max_n_char_arg, false);\n+ this->print_help(it->first, *it->second, max_n_char_arg, false, print_advanced_args);\nstd::cout << std::endl;\n}\n@@ -229,17 +236,24 @@ std::string split_doc(const std::string& line, const std::string& start_line, co\n}\nvoid Argument_handler\n-::print_help(const Argument_tag &tags, const Argument_info &info, const size_t max_n_char_arg, const bool required) const\n+::print_help(const Argument_tag &tags, const Argument_info &info, const size_t max_n_char_arg, const bool required,\n+ const bool print_advanced_args) const\n{\nFormat arg_format = 0;\n-\n- std::string tags_str = this->print_tag(tags);\n- tags_str.append(max_n_char_arg - tags_str.size(), ' ');\n-\nconst std::string tab = \" \";\n+\nstd::string tabr = tab;\n+\nif (required)\ntabr = format(\"{R} \", arg_format | Style::BOLD | FG::Color::ORANGE);\n+ else if (info.advanced_arg && print_advanced_args)\n+ tabr = format(\"{A} \", arg_format | Style::BOLD | FG::Color::BLUE);\n+ else if (info.advanced_arg && !print_advanced_args)\n+ return;\n+\n+\n+ std::string tags_str = this->print_tag(tags);\n+ tags_str.append(max_n_char_arg - tags_str.size(), ' ');\nstd::cout << tabr << format(tags_str, arg_format | Style::BOLD);\n@@ -260,7 +274,8 @@ void Argument_handler\n}\nvoid Argument_handler\n-::print_help(const Argument_map_info &req_args, const Argument_map_info &opt_args, const Argument_map_group& arg_groups) const\n+::print_help(const Argument_map_info &req_args, const Argument_map_info &opt_args, const Argument_map_group& arg_groups,\n+ const bool print_advanced_args) const\n{\nthis->print_usage(req_args);\nstd::cout << std::endl;\n@@ -296,7 +311,7 @@ void Argument_handler\nreq_args_print_pos[dist] = true;\n- this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, true);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, true, print_advanced_args);\n}\n}\n@@ -308,15 +323,18 @@ void Argument_handler\nif (tag.find(prefix) == 0 && !opt_args_print_pos[dist])\n{\n+ opt_args_print_pos[dist] = true;\n+\n+ if (it_arg->second->advanced_arg && !print_advanced_args)\n+ continue;\n+\nif (!title_displayed)\n{\nprint_help_title(it_grp->second);\ntitle_displayed = true;\n}\n- opt_args_print_pos[dist] = true;\n-\n- this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, false);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, false, print_advanced_args);\n}\n}\n@@ -354,7 +372,7 @@ void Argument_handler\ntitle_displayed = true;\n}\n- this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, true);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, true, print_advanced_args);\n}\n}\n@@ -386,7 +404,7 @@ void Argument_handler\ntitle_displayed = true;\n}\n- this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, false);\n+ this->print_help(it_arg->first, *it_arg->second, max_n_char_arg, false, print_advanced_args);\n}\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_handler.hpp", "new_path": "src/Tools/Arguments/Argument_handler.hpp", "diff": "@@ -76,7 +76,8 @@ public:\n/*!\n* \\brief Prints the traditional usage and the whole help.\n*/\n- void print_help(const Argument_map_info &req_args, const Argument_map_info &opt_args) const;\n+ void print_help(const Argument_map_info &req_args, const Argument_map_info &opt_args,\n+ const bool print_advanced_args = true) const;\n/*!\n* \\brief Prints the traditional usage and the whole help grouped by argument categories.\n@@ -84,7 +85,8 @@ public:\n* \\param arg_groups: group of argument based on a prefix,\n* arg_groups = {{\"prefix1\", \"Group name1\"}, {\"prefix2\", \"Group name2\"}, [...]}.\n*/\n- void print_help(const Argument_map_info &req_args, const Argument_map_info &opt_args, const Argument_map_group& arg_groups) const;\n+ void print_help(const Argument_map_info & req_args, const Argument_map_info &opt_args,\n+ const Argument_map_group& arg_groups, const bool print_advanced_args = true) const;\n/*\n* return the given tag with its command line argument format.\n@@ -120,7 +122,7 @@ private:\n* \\param required: true if this is a required parameter.\n*/\nvoid print_help(const Argument_tag &tags, const Argument_info &info, const size_t max_n_char_arg,\n- const bool required = false) const;\n+ const bool required = false,const bool print_advanced_args = true) const;\nvoid print_help_title(const std::string& title) const;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_map.cpp", "new_path": "src/Tools/Arguments/Argument_map.cpp", "diff": "@@ -11,8 +11,8 @@ Argument_info\n{ }\nArgument_info\n-::Argument_info(Argument_type* type, std::string doc)\n-: type(type), doc(doc)\n+::Argument_info(Argument_type* type, const std::string& doc, const bool advanced_arg)\n+: type(type), doc(doc), advanced_arg(advanced_arg)\n{}\n@@ -92,7 +92,7 @@ Argument_map_info& Argument_map_info\n}\nvoid Argument_map_info\n-::add(const Argument_tag& tags, Argument_type* arg_t, const std::string& doc)\n+::add(const Argument_tag& tags, Argument_type* arg_t, const std::string& doc, const bool advanced_arg)\n{\nif (tags.size() == 0)\nthrow std::invalid_argument(\"No tag has been given ('tag.size()' == 0).\");\n@@ -100,7 +100,7 @@ void Argument_map_info\nif (arg_t == nullptr)\nthrow std::invalid_argument(\"No argument type has been given ('arg_t' == 0).\");\n- (*this)[tags] = new Argument_info(arg_t, doc);\n+ (*this)[tags] = new Argument_info(arg_t, doc, advanced_arg);\n}\nvoid Argument_map_info\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_map.hpp", "new_path": "src/Tools/Arguments/Argument_map.hpp", "diff": "@@ -18,7 +18,7 @@ using Argument_tag = std::vector<std::string>;\nstruct Argument_info\n{\nArgument_info();\n- Argument_info(Argument_type* type, std::string doc);\n+ Argument_info(Argument_type* type, const std::string& doc, const bool advanced_arg = false);\nvirtual ~Argument_info();\n@@ -32,6 +32,7 @@ struct Argument_info\nArgument_type* type = nullptr;\nstd::string doc = \"\";\n+ bool advanced_arg = false;\n};\n@@ -49,7 +50,7 @@ public:\nArgument_map_info& operator=(const Argument_map_info& other);\n- void add(const Argument_tag& tags, Argument_type* arg_t, const std::string& doc);\n+ void add(const Argument_tag& tags, Argument_type* arg_t, const std::string& doc, const bool advanced_arg = false);\nvoid erase(const Argument_tag& tags);\n" } ]
C++
MIT License
aff3ct/aff3ct
Add an advanced argument type to not display them in the help when using -h, else need to use -H
8,483
08.02.2018 16:51:54
-3,600
ac1121371f345e4250eab56e107a74bd29b1783f
Add an argument to not display the backtrace or to not apply addr2line function. Use global variable to do so; Rewrite consequently try catch in main, Launcher and simulations classes
[ { "change_type": "MODIFY", "old_path": "src/Factory/Command_parser.cpp", "new_path": "src/Factory/Command_parser.cpp", "diff": "@@ -40,13 +40,12 @@ void Command_parser\n// write the parameters values in \"params\" from \"read_args\"\nFactory::store(params, read_args);\n}\n- catch(const aff3ct::tools::exception& e)\n- {\n- errors.push_back(e.what_no_bt());\n- }\ncatch(const std::exception& e)\n{\n- errors.push_back(tools::addr2line(e.what()));\n+ auto save = tools::exception::no_backtrace;\n+ tools::exception::no_backtrace = true;\n+ errors.push_back(e.what());\n+ tools::exception::no_backtrace = save;\n}\nif (read_args.exist(Command_parser::help_tag))\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -112,6 +112,18 @@ void factory::Launcher::parameters\n{\"version\", \"v\"},\ntools::None(),\n\"print informations about the version of the code.\");\n+\n+ opt_args.add(\n+ {\"except-no-bt\"},\n+ tools::None(),\n+ \"do not print the backtrace when displaying exception.\",\n+ true);\n+\n+ opt_args.add(\n+ {\"except-no-a2l\"},\n+ tools::None(),\n+ \"do not enhance the backtrace when displaying exception.\",\n+ true);\n}\nvoid factory::Launcher::parameters\n@@ -138,6 +150,9 @@ void factory::Launcher::parameters\n#ifdef MULTI_PREC\nif(vals.exist({p+\"-prec\", \"p\"})) this->sim_prec = vals.to_int({p+\"-prec\", \"p\"});\n#endif\n+\n+ if(vals.exist({\"except-no-bt\" })) tools::exception::no_backtrace = true;\n+ if(vals.exist({\"except-no-a2l\"})) tools::exception::no_addr2line = true;\n}\nvoid factory::Launcher::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -71,13 +71,12 @@ int Launcher::read_arguments()\n{\nthis->store_args();\n}\n- catch(const tools::exception& e)\n- {\n- cmd_error.push_back(e.what_no_bt());\n- }\ncatch(const std::exception& e)\n{\n- cmd_error.push_back(tools::addr2line(e.what()));\n+ auto save = tools::exception::no_backtrace;\n+ tools::exception::no_backtrace = true;\n+ cmd_error.push_back(e.what());\n+ tools::exception::no_backtrace = save;\n}\nif (params_common.display_help)\n@@ -171,9 +170,9 @@ void Launcher::launch()\n{\nsimu = this->build_simu();\n}\n- catch (std::exception const& e)\n+ catch(const std::exception& e)\n{\n- std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n}\nif (simu != nullptr)\n@@ -188,9 +187,9 @@ void Launcher::launch()\n{\nsimu->launch();\n}\n- catch (std::exception const& e)\n+ catch(const std::exception& e)\n{\n- std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -224,7 +224,7 @@ void BFER<B,R,Q>\nmodule::Monitor::stop();\nterminal->final_report(std::cout); // display final report to not lost last line overwritten by the error messages\n- std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\nsimu_error = true;\n}\n@@ -320,10 +320,15 @@ void BFER<B,R,Q>\nsimu->mutex_exception.lock();\n- if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n+ auto save = tools::exception::no_backtrace;\n+ tools::exception::no_backtrace = true;\n+ std::string msg = e.what(); // get only the function signature\n+ tools::exception::no_backtrace = save;\n+\n+ if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), msg) == simu->prev_err_messages.end())\n{\n- std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n- simu->prev_err_messages.push_back(e.what());\n+ std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl; // with backtrace if debug mode\n+ simu->prev_err_messages.push_back(msg); // save only the function signature\n}\nsimu->mutex_exception.unlock();\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.hpp", "new_path": "src/Simulation/BFER/BFER.hpp", "diff": "@@ -32,6 +32,7 @@ private:\nprotected:\nstd::mutex mutex_exception;\nstd::vector<std::string> prev_err_messages;\n+ std::vector<std::string> prev_err_messages_to_display;\n// a barrier to synchronize the threads\ntools::Barrier barrier;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp", "diff": "@@ -71,8 +71,18 @@ void BFER_ite_threads<B,R,Q>\nmodule::Monitor::stop();\nsimu->mutex_exception.lock();\n- if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n- simu->prev_err_messages.push_back(e.what());\n+\n+ auto save = tools::exception::no_backtrace;\n+ tools::exception::no_backtrace = true;\n+ std::string msg = e.what(); // get only the function signature\n+ tools::exception::no_backtrace = save;\n+\n+ if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), msg) == simu->prev_err_messages.end())\n+ {\n+ simu->prev_err_messages.push_back(msg); // save only the function signature\n+ simu->prev_err_messages_to_display.push_back(e.what()); // with backtrace if debug mode\n+ }\n+\nsimu->mutex_exception.unlock();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "new_path": "src/Simulation/BFER/Standard/Threads/BFER_std_threads.cpp", "diff": "@@ -53,8 +53,8 @@ void BFER_std_threads<B,R,Q>\nfor (auto tid = 1; tid < this->params_BFER_std.n_threads; tid++)\nthreads[tid -1].join();\n- if (!this->prev_err_messages.empty())\n- throw std::runtime_error(this->prev_err_messages.back());\n+ if (!this->prev_err_messages_to_display.empty())\n+ throw std::runtime_error(this->prev_err_messages_to_display.back());\n}\ntemplate <typename B, typename R, typename Q>\n@@ -71,8 +71,18 @@ void BFER_std_threads<B,R,Q>\nmodule::Monitor::stop();\nsimu->mutex_exception.lock();\n- if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n- simu->prev_err_messages.push_back(e.what());\n+\n+ auto save = tools::exception::no_backtrace;\n+ tools::exception::no_backtrace = true;\n+ std::string msg = e.what(); // get only the function signature\n+ tools::exception::no_backtrace = save;\n+\n+ if (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), msg) == simu->prev_err_messages.end())\n+ {\n+ simu->prev_err_messages.push_back(msg); // save only the function signature\n+ simu->prev_err_messages_to_display.push_back(e.what()); // with backtrace if debug mode\n+ }\n+\nsimu->mutex_exception.unlock();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Exception/exception.cpp", "new_path": "src/Tools/Exception/exception.cpp", "diff": "using namespace aff3ct::tools;\nconst std::string aff3ct::tools::exception::empty_string = \"\";\n+bool aff3ct::tools::exception::no_backtrace = false;\n+bool aff3ct::tools::exception::no_addr2line = false;\nexception\n::exception() throw()\n@@ -56,14 +58,18 @@ const char* exception\n::what() const throw()\n{\n#ifdef ENABLE_BACK_TRACE\n+ if (no_backtrace)\n+ return message.c_str();\n+ else if (no_addr2line)\nreturn backtrace.c_str();\n+\n+ std::string* bt_a2l = const_cast<std::string*>(&backtrace_a2l);\n+\n+ if (bt_a2l->empty())\n+ *bt_a2l = tools::addr2line(backtrace);\n+\n+ return bt_a2l->c_str();\n#else\nreturn message.c_str();\n#endif\n}\n\\ No newline at end of file\n-\n-const char* exception\n-::what_no_bt() const throw()\n-{\n- return message.c_str();\n-}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Exception/exception.hpp", "new_path": "src/Tools/Exception/exception.hpp", "diff": "@@ -10,6 +10,10 @@ namespace tools\n{\nclass exception : public std::exception\n{\n+public:\n+ static bool no_backtrace;\n+ static bool no_addr2line;\n+\nprotected:\nstatic const std::string empty_string;\n@@ -17,6 +21,7 @@ private:\nstd::string message; // the message only\n#ifdef ENABLE_BACK_TRACE\nstd::string backtrace; // the message + the backtrace\n+ std::string backtrace_a2l; // the message + the backtrace with addr2line conversion\n#endif\npublic:\n@@ -32,7 +37,6 @@ public:\nvirtual ~exception() throw();\nvirtual const char* what() const throw(); // return the message and the back trace if enabled\n- virtual const char* what_no_bt() const throw(); // return only the message\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/system_functions.cpp", "new_path": "src/Tools/system_functions.cpp", "diff": "@@ -115,7 +115,7 @@ std::string aff3ct::tools::runSystemCommand(std::string cmd)\nstd::string aff3ct::tools::addr2line(const std::string& backtrace)\n{\n-#ifdef DNDEBUG\n+#ifdef NDEBUG\nreturn backtrace;\n#elif (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n// TODO Bug: lines does not always match with the real line where are called the functions.\n" }, { "change_type": "MODIFY", "old_path": "src/main.cpp", "new_path": "src/main.cpp", "diff": "@@ -160,7 +160,7 @@ int sc_main(int argc, char **argv)\n}\ncatch(std::exception const& e)\n{\n- std::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ std::cerr << tools::apply_on_each_line(e.what(), &tools::format_error) << std::endl;\n}\n#ifdef ENABLE_MPI\n" } ]
C++
MIT License
aff3ct/aff3ct
Add an argument to not display the backtrace or to not apply addr2line function. Use global variable to do so; Rewrite consequently try catch in main, Launcher and simulations classes
8,483
08.02.2018 17:05:44
-3,600
3fc6d50fe42fe27649f96a08310b19110e04443f
Add an argument to not display any legend --sim-no-legend, only the simulation results to add them to an existing file
[ { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -124,6 +124,13 @@ void factory::Launcher::parameters\ntools::None(),\n\"do not enhance the backtrace when displaying exception.\",\ntrue);\n+\n+ opt_args.add(\n+ {p+\"-no-legend\"},\n+ tools::None(),\n+ \"Do not display any legend when launching the simulation.\",\n+ true);\n+\n}\nvoid factory::Launcher::parameters\n@@ -134,6 +141,7 @@ void factory::Launcher::parameters\nif(vals.exist({p+\"-cde-type\", \"C\"})) this->cde_type = vals.at({p+\"-cde-type\", \"C\"}); // required\nif(vals.exist({p+\"-type\" })) this->sim_type = vals.at({p+\"-type\" });\nif(vals.exist({\"version\", \"v\"})) this->display_version = true;\n+ if(vals.exist({p+\"-no-legend\" })) this->display_legend = false;\nif(vals.exist({\"help\", \"h\"}))\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.hpp", "new_path": "src/Factory/Launcher/Launcher.hpp", "diff": "@@ -34,6 +34,7 @@ struct Launcher : public Factory\nbool display_help = false;\nbool display_adv_help = false;\nbool display_version = false;\n+ bool display_legend = true;\n// ---------------------------------------------------------------------------------------------------- METHODS\nexplicit parameters(const std::string &p = Launcher_prefix);\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -154,6 +154,7 @@ void Launcher::launch()\nstream << this->params_common.pyber << std::endl;\n}\n+ if (this->params_common.display_legend)\n#ifdef ENABLE_MPI\nif (this->params_common.mpi_rank == 0)\n#endif\n@@ -178,6 +179,7 @@ void Launcher::launch()\nif (simu != nullptr)\n{\n// launch the simulation\n+ if (this->params_common.display_legend)\n#ifdef ENABLE_MPI\nif (this->params_common.mpi_rank == 0)\n#endif\n@@ -193,6 +195,7 @@ void Launcher::launch()\n}\n}\n+ if (this->params_common.display_legend)\n#ifdef ENABLE_MPI\nif (this->params_common.mpi_rank == 0)\n#endif\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -196,6 +196,7 @@ void BFER<B,R,Q>\n}\n}\n+ if (params_BFER.display_legend)\n#ifdef ENABLE_MPI\nif (((!params_BFER.ter->disabled && snr == params_BFER.snr_min && !params_BFER.debug) ||\n(params_BFER.statistics && !params_BFER.debug)) && params_BFER.mpi_rank == 0)\n" } ]
C++
MIT License
aff3ct/aff3ct
Add an argument to not display any legend --sim-no-legend, only the simulation results to add them to an existing file
8,490
09.02.2018 16:09:44
-3,600
a40a58dcaec99e1056bca781b1b0668401308a0f
Configure the new SonarQube server.
[ { "change_type": "MODIFY", "old_path": "ci/analysis-sonarqube.sh", "new_path": "ci/analysis-sonarqube.sh", "diff": "@@ -17,10 +17,10 @@ cppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --s\n# Create the sonar config file on the fly\nVERSION=$(git tag | tail -n 1 | cut -d $'v' -f2-)\n-echo \"sonar.projectKey=STORM:AFF3CT\" > sonar-project.properties\n+echo \"sonar.projectKey=storm:aff3ct:gitlab:master\" > sonar-project.properties\necho \"sonar.projectName=AFF3CT\" >> sonar-project.properties\necho \"sonar.projectVersion=$VERSION\" >> sonar-project.properties\n-echo \"sonar.login=b20709e3e9263173baa66e62d8c65a9e56b04aea\" >> sonar-project.properties\n+echo \"sonar.login=c6ab3ccd4dd7a8d9aa3e90d5766c74e0c9889947\" >> sonar-project.properties\necho \"sonar.sources=./src/\" >> sonar-project.properties\necho \"sonar.exclusions=**/date.h, **/dirent.h\" >> sonar-project.properties\necho \"sonar.links.homepage=https://aff3ct.github.io/\" >> sonar-project.properties\n" } ]
C++
MIT License
aff3ct/aff3ct
Configure the new SonarQube server.
8,483
09.02.2018 16:51:41
-3,600
1da5aac4165a4bf9b3d6b8eaf82271c5d3f8d669
Make the Chase Pyndiah works only on the BCH to improve speed; Add 4 parameters (a,b,c,d) to let the user add some weights in the Pyndiah; Add comments
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -92,7 +92,8 @@ void Decoder_turbo_product::parameters\nopt_args[{p+\"-alpha\"}] =\n{\"string\",\n- \"extrinsic coefficients, one by half iteration (so twice more than number of iterations). If only one, then automatically extended to all iterations.\"};\n+ \"extrinsic coefficients, one by half iteration (so twice more than number of iterations).\"\n+ \" If not enough, then automatically extended the last to all iterations.\"};\nopt_args[{p+\"-p\"}] =\n{\"strictly_positive_int\",\n@@ -110,6 +111,10 @@ void Decoder_turbo_product::parameters\n{\"\",\n\"extends decoder with a parity bits.\"};\n+ opt_args[{p+\"-abcd\"}] =\n+ {\"string\",\n+ \"Chase Pyndiah constant coefficients.\"};\n+\nsub->get_description(req_args, opt_args);\nauto ps = sub->get_prefix();\n@@ -126,8 +131,17 @@ void Decoder_turbo_product::parameters\nif(exist(vals, {p+\"-ite\", \"i\"})) this->n_ite = std::stoi(vals.at({p+\"-ite\", \"i\"}));\nif(exist(vals, {p+\"-p\" })) this->n_least_reliable_positions = std::stoi(vals.at({p+\"-p\" }));\n- if(exist(vals, {p+\"-t\" })) this->n_test_vectors = std::stoi(vals.at({p+\"-t\" }));\n- if(exist(vals, {p+\"-c\" })) this->n_competitors = std::stoi(vals.at({p+\"-c\" }));\n+\n+ if(exist(vals, {p+\"-t\"}))\n+ this->n_test_vectors = std::stoi(vals.at({p+\"-t\"}));\n+ else\n+ this->n_test_vectors = 1<<this->n_least_reliable_positions;\n+\n+ if(exist(vals, {p+\"-c\"}))\n+ this->n_competitors = std::stoi(vals.at({p+\"-c\"}));\n+ else\n+ this->n_competitors = this->n_test_vectors;\n+\nif(exist(vals, {p+\"-ext\" })) this->parity_extended = true;\nthis->alpha.resize(this->n_ite*2);\n@@ -136,29 +150,44 @@ void Decoder_turbo_product::parameters\n{\nauto alpha_list = tools::split(vals.at({p+\"-alpha\"}), ',');\n+ auto it = this->alpha.begin();\n+\n+ auto max = std::min(alpha_list.size(), this->alpha.size());\n+\n+ for (unsigned i = 0; i < max; i++, it++)\n+ *it = std::stof(alpha_list[i]);\n- if (alpha_list.size() == 1)\n+ std::fill(it, this->alpha.end(), std::stof(alpha_list.back()));\n+ }\n+ else\n{\n- std::fill(this->alpha.begin(), this->alpha.end(), std::stof(alpha_list.front()));\n+ std::fill(this->alpha.begin(), this->alpha.end(), 0.5f);\n}\n- else if (alpha_list.size() == this->alpha.size())\n+\n+\n+ this->cp_coef.resize(4);\n+ if(exist(vals, {p+\"-abcd\"}))\n{\n- for (unsigned i = 0; i < alpha_list.size(); i++)\n- this->alpha[i] = std::stof(alpha_list[i]);\n+ auto cp_coef_list = tools::split(vals.at({p+\"-abcd\"}), ',');\n+\n+ if (cp_coef_list.size() == this->cp_coef.size())\n+ {\n+ for (unsigned i = 0; i < cp_coef_list.size(); i++)\n+ this->cp_coef[i] = std::stof(cp_coef_list[i]);\n}\nelse\n{\nstd::stringstream message;\n- message << \"'\" << p << \"-alpha' argument has to be twice the length given in '\" << p << \"-ite'.\";\n+ message << \"'\" << p << \"-abcd' argument has to be of length 4.\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n-\n}\nelse\n{\n- std::fill(this->alpha.begin(), this->alpha.end(), 0.5f);\n+ std::fill(this->cp_coef.begin(), this->cp_coef.end(), 1.0f);\n}\n+\nthis->sub->n_frames = this->n_frames;\nsub->store(vals);\n@@ -201,12 +230,19 @@ void Decoder_turbo_product::parameters\nalpha_str << \"}\";\nheaders[p].push_back(std::make_pair(\"alpha\", alpha_str.str()));\n+\n+ std::stringstream cp_coeff_str;\n+ cp_coeff_str << \"{\";\n+ for (unsigned i = 0; i < this->cp_coef.size(); i++)\n+ cp_coeff_str << this->cp_coef[i] << (i == this->cp_coef.size()-1 ?\"\":\", \");\n+ cp_coeff_str << \"}\";\n+\n+ headers[p].push_back(std::make_pair(\"Chase Pyndiah coeff.\", cp_coeff_str.str()));\n+\nheaders[p].push_back(std::make_pair(\"Num. least reliable pos (p)\", std::to_string(n_least_reliable_positions)));\n- if (n_test_vectors != 0)\nheaders[p].push_back(std::make_pair(\"Num. test vectors (t)\", std::to_string(n_test_vectors)));\n- if (n_competitors != 0)\nheaders[p].push_back(std::make_pair(\"Num. competitors (c)\", std::to_string(n_competitors)));\nheaders[p].push_back(std::make_pair(\"Parity extended\", (this->parity_extended ? \"yes\" : \"no\")));\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.hpp", "diff": "@@ -30,6 +30,7 @@ struct Decoder_turbo_product : public Decoder\n// optional parameters\nint n_ite = 4;\nstd::vector<float> alpha;\n+ std::vector<float> cp_coef;\nint n_least_reliable_positions = 2;\nint n_test_vectors = 0;\nint n_competitors = 0;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "new_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "diff": "@@ -62,12 +62,16 @@ Codec_turbo_product<B,Q>\nenc_bch = factory::Encoder_BCH::build <B >(*enc_params.sub, GF_poly);\n- dec_bch = factory::Decoder_BCH::build_hiho<B,Q>(*dec_params.sub, GF_poly);\n+ dec_bch = dynamic_cast<Decoder_BCH<B,Q>*>(factory::Decoder_BCH::build_hiho<B,Q>(*dec_params.sub, GF_poly));\ncp = new Decoder_chase_pyndiah<B,Q>(dec_bch->get_K(), dec_bch->get_N() + (dec_params.parity_extended?1:0),\n*dec_bch, *enc_bch,\ndec_params.n_least_reliable_positions,\ndec_params.n_test_vectors,\n- dec_params.n_competitors);\n+ dec_params.n_competitors,\n+ dec_params.cp_coef[0],\n+ dec_params.cp_coef[1],\n+ dec_params.cp_coef[2],\n+ dec_params.cp_coef[3]);\nEncoder_turbo_product<B> *encoder_tpc = nullptr;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.hpp", "new_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.hpp", "diff": "@@ -23,9 +23,9 @@ class Codec_turbo_product : public Codec_SISO_SIHO<B,Q>\n{\nprotected:\nconst aff3ct::tools::BCH_polynomial_generator GF_poly;\n- aff3ct::module::Encoder_BCH <B>* enc_bch;\n- aff3ct::module::Decoder_HIHO<B>* dec_bch;\n- aff3ct::module::Decoder_chase_pyndiah<B,Q>* cp;\n+ Encoder_BCH<B >* enc_bch;\n+ Decoder_BCH<B,Q>* dec_bch;\n+ Decoder_chase_pyndiah<B,Q>* cp;\npublic:\nCodec_turbo_product(const factory::Encoder_turbo_product::parameters &enc_params,\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "diff": "@@ -60,6 +60,8 @@ void Decoder_BCH<B, R>\ns[i] = index_of[s[i]];\n}\n+ last_is_codeword = !syn_error;\n+\nif (syn_error)\n{ /* if there are errors, try to correct them */\n/*\n@@ -192,12 +194,16 @@ void Decoder_BCH<B, R>\n}\nif (count == l[u])\n+ {\n+ last_is_codeword = true;\n+\n/* no. roots = degree of elp hence <= t errors */\nfor (i = 0; i < l[u]; i++)\nY_N[loc[i]] ^= 1;\n}\n}\n}\n+}\ntemplate <typename B, typename R>\nvoid Decoder_BCH<B, R>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp", "new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp", "diff": "@@ -34,6 +34,8 @@ protected:\nstd::vector<B> YH_N; // hard decision input vector\npublic:\n+ bool last_is_codeword;\n+\nDecoder_BCH(const int& K, const int& N, const tools::BCH_polynomial_generator &GF, const int n_frames = 1);\nvirtual ~Decoder_BCH();\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -21,11 +21,15 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_chase_pyndiah<B,R>\n::Decoder_chase_pyndiah(const int K, const int N, // N includes the parity bit if any\n- Decoder_HIHO<B> &dec_,\n+ Decoder_BCH<B,R> &dec_,\nEncoder <B > &enc_,\nconst int n_least_reliable_positions_,\nconst int n_test_vectors_,\n- const int n_competitors_)\n+ const int n_competitors_,\n+ const float a,\n+ const float b,\n+ const float c,\n+ const float d)\n: Decoder (K, N, dec_.get_n_frames(), dec_.get_simd_inter_frame_level()),\nDecoder_SISO_SIHO<B,R>(K, N, dec_.get_n_frames(), dec_.get_simd_inter_frame_level()),\ndec (dec_ ),\n@@ -36,6 +40,11 @@ Decoder_chase_pyndiah<B,R>\nn_competitors (n_competitors_ ? n_competitors_ : n_test_vectors ),\nparity_extended (this->N == (N_np +1) ),\n+ a_((R)a),\n+ b_((R)b),\n+ c_((R)c),\n+ d_((R)d),\n+\nleast_reliable_pos (n_least_reliable_positions ),\ncompetitors (n_test_vectors ),\nhard_Y_N (this->N ),\n@@ -89,7 +98,7 @@ Decoder_chase_pyndiah<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- generate_bit_flipping_candidates(); // generate bit flipping patterns in 'tv_candidates'\n+ generate_bit_flipping_candidates(); // generate bit flipping patterns in 'test_patterns'\n}\ntemplate <typename B, typename R>\n@@ -195,8 +204,8 @@ void Decoder_chase_pyndiah<B,R>\n{\nstd::cerr << i << \". \" << metrics[i] << \" -> \";\n- for (unsigned j = 0; j < tv_candidates[i].size(); j++)\n- std::cerr << tv_candidates[i][j] << \" \";\n+ for (unsigned j = 0; j < test_patterns[i].size(); j++)\n+ std::cerr << test_patterns[i][j] << \" \";\nstd::cerr << std::endl;\n@@ -251,7 +260,8 @@ void Decoder_chase_pyndiah<B,R>\nbit_flipping(hard_Y_N.data(), c);\ndec.decode_hiho_cw(hard_Y_N.data(), test_vect.data() + c*this->N); // parity bit is ignored by the decoder\n- is_wrong[c] = !enc.is_codeword(test_vect.data() + c*this->N);\n+ //is_wrong[c] = !enc.is_codeword(test_vect.data() + c*this->N);\n+ is_wrong[c] = !dec.last_is_codeword;\nif (this->parity_extended)\ntest_vect[(c+1)*this->N -1] = tools::compute_parity(test_vect.data() + c*this->N, dec.get_N());\n@@ -344,20 +354,20 @@ void Decoder_chase_pyndiah<B,R>\n// compute beta, the sum of the least reliable position reliabilities in the decided word\nR beta = 0;\n- for (int i = 0; i < n_least_reliable_positions; i++)\n+ for (int i = 0; i < n_least_reliable_positions && i < 3; i++)\nbeta += least_reliable_pos[i].metric;\n+ beta -= c_ * DW.metric;\n+\n#ifndef NDEBUG\n- std::cerr << \"beta = \" << beta << \", alpha = \" << alpha<< \", DW.metric = \" << DW.metric << std::endl;\n+ std::cerr << \"beta = \" << beta << \", DW.metric = \" << DW.metric << std::endl;\n#endif\n- beta -= DW.metric;\n-\nn_good_competitors = std::min(n_good_competitors, n_competitors); // if there is less than 'n_competitors' good competitors\n// then take only them for reliability calculation\nfor (int j = 1; j < n_good_competitors; j++)\n- competitors[j].metric -= DW.metric;\n+ competitors[j].metric = (competitors[j].metric - DW.metric) * b_;\nfor (int i = 0; i < this->N; i++)\n@@ -377,7 +387,7 @@ void Decoder_chase_pyndiah<B,R>\n}\nelse // same bits for each candidates\n{\n- reliability = std::abs(Y_N1[i]) + beta;\n+ reliability = beta + d_ * std::abs(Y_N1[i]);\nif (reliability < 0)\nreliability = 0;\n}\n@@ -389,7 +399,7 @@ void Decoder_chase_pyndiah<B,R>\nstd::cerr << \"Rel: i = \" << i << \", Y_N1 = \" << Y_N1[i] << \", competitors[\" << j << \"].metric = \" << competitors[j].metric;\n#endif\n- Y_N2[i] = reliability - Y_N1[i];\n+ Y_N2[i] = reliability - a_ * Y_N1[i];\n#ifndef NDEBUG\nstd::cerr << \", reliability = \" << reliability << \", Y_N2 = \" << Y_N2[i] << std::endl;\n@@ -402,14 +412,14 @@ void Decoder_chase_pyndiah<B,R>\n::bit_flipping(B* hard_vect, const int c)\n{\nfor (int i = 0; i < n_least_reliable_positions; i++)\n- hard_vect[least_reliable_pos[i].pos] = tv_candidates[c][i] ? !hard_vect[least_reliable_pos[i].pos] : hard_vect[least_reliable_pos[i].pos];\n+ hard_vect[least_reliable_pos[i].pos] = test_patterns[c][i] ? !hard_vect[least_reliable_pos[i].pos] : hard_vect[least_reliable_pos[i].pos];\n}\ntemplate <typename B, typename R>\nvoid Decoder_chase_pyndiah<B,R>\n::generate_bit_flipping_candidates()\n{\n- tv_candidates.resize(n_test_vectors, std::vector<bool>(n_least_reliable_positions, false));\n+ test_patterns.resize(n_test_vectors, std::vector<bool>(n_least_reliable_positions, false));\nstd::vector<int> cand(n_test_vectors, 0);\n@@ -417,6 +427,25 @@ void Decoder_chase_pyndiah<B,R>\n{\nstd::iota(cand.begin(), cand.end(), 0);\n}\n+ else if (n_test_vectors == 16 && n_least_reliable_positions == 5)\n+ { // 3 among 5\n+ cand[ 0] = 0;\n+ cand[ 1] = 1 << 0;\n+ cand[ 2] = 1 << 1;\n+ cand[ 3] = 1 << 2;\n+ cand[ 4] = 1 << 3;\n+ cand[ 5] = 1 << 4;\n+ cand[ 6] = 1 + (1 << 1);\n+ cand[ 7] = 1 + (1 << 2);\n+ cand[ 8] = 1 + (1 << 3);\n+ cand[ 9] = 1 + (1 << 4);\n+ cand[10] = 3 + (1 << 2);\n+ cand[11] = 3 + (1 << 3);\n+ cand[12] = 3 + (1 << 4);\n+ cand[13] = 5 + (1 << 3);\n+ cand[14] = 5 + (1 << 4);\n+ cand[15] = 9 + (1 << 4);\n+ }\nelse if (n_test_vectors <= (n_least_reliable_positions * (n_least_reliable_positions + 1) / 2 + 1))\n{\n// (0) do not flip any bit -> 1 test vector\n@@ -452,12 +481,12 @@ void Decoder_chase_pyndiah<B,R>\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, \"unimplemented method\");\n- // one 'tv_candidates' element is the bit flipping pattern to apply on the least reliable positions\n+ // one 'test_patterns' element is the bit flipping pattern to apply on the least reliable positions\n// in this pattern, the first position is the instruction to flip or not the least reliable position\n// the second position is the instruction to flip the second least reliable position, and so on.\nfor (int i = 0; i < n_test_vectors; i++)\nfor (int j = 0; j < n_least_reliable_positions; j++)\n- tv_candidates[i][j] = ((cand[i] >> j) & (int)1) != 0;\n+ test_patterns[i][j] = ((cand[i] >> j) & (int)1) != 0;\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -14,6 +14,25 @@ namespace aff3ct\nnamespace module\n{\n+/*\n+ * Chase :\n+ * - take hard decision H on input R\n+ * - create test vectors from test patterns after selecting the p least reliable positions -> give a p metric set Pm\n+ * - hard decode with the HIHO decoder -> get the competitors C -> remove competitors that have not been corrected\n+ * - compute the metrics Cm: euclidean distance of each competitor m compared to H\n+ * - select the competitor with the smallest metric Dm -> get the decided word D\n+ * - if SIHO, return D, if SISO, compute reliabilities of each bit of D -> Pyndiah\n+ * Pyndiah :\n+ * - Compute extrinsic W as\n+ * W = F - a * R\n+ * - Compute the reliability F of D as, for each bit j of the word:\n+ * Fj = Dj * [Cm - Dm] * b when Cj /= Dj in the competitor with the smallest metric Cm\n+ * = Dj * [sum(Pm) - c * Dm + d * |Rj|] when there is no such competitor as described above\n+ * with Dj = 1 when Hj = 0\n+ * = -1 when Hj = 1\n+ * - a, b, c and d are simulation constants changeable by the user\n+ */\n+\ntemplate <typename B = int, typename R = float>\nclass Decoder_chase_pyndiah : public Decoder_SISO_SIHO<B,R>\n{\n@@ -25,7 +44,7 @@ protected:\nint pos;\n};\n- Decoder_HIHO<B> &dec;\n+ Decoder_BCH<B,R> &dec;\nEncoder <B > &enc;\nconst int N_np; // N without the parity bit: can be equal to N if there is no parity bit in the code\n@@ -36,22 +55,31 @@ protected:\nconst bool parity_extended; // true if there is a parity bit\n// bool parity_diff;\n+ const R a_;\n+ const R b_;\n+ const R c_;\n+ const R d_;\n+\nstd::vector<info> least_reliable_pos; // the list of least reliable positions\nstd::vector<info> competitors; // the competitors' metric and their related test vector position\nstd::vector<B> hard_Y_N; // the taken hard decision at the input of the chase\nstd::vector<B> test_vect; // the test vectors after being corrected by the decoder 'dec'\nstd::vector<R> metrics; // the metrics of each test vector\nstd::vector<bool> is_wrong; // if true then the matching test vector is not a codeword\n- std::vector<std::vector<bool>> tv_candidates; // the patterns of the least reliable position to flip\n+ std::vector<std::vector<bool>> test_patterns; // the patterns of the least reliable position to flip\npublic:\nDecoder_chase_pyndiah(const int K, const int N, // N with the parity bit if any\n- Decoder_HIHO<B> &dec,\n+ Decoder_BCH<B,R> &dec,\nEncoder <B > &enc,\nconst int n_least_reliable_positions = 2,\nconst int n_test_vectors = 0,\n- const int n_competitors = 0);\n+ const int n_competitors = 0,\n+ const float a = 1.f,\n+ const float b = 1.f,\n+ const float c = 1.f,\n+ const float d = 1.f);\nvoid decode_siso (const R *Y_N1, R *Y_N2); // size is length with parity bit if any\nvoid decode_siho (const R *Y_N, B *V_K );\n" } ]
C++
MIT License
aff3ct/aff3ct
Make the Chase Pyndiah works only on the BCH to improve speed; Add 4 parameters (a,b,c,d) to let the user add some weights in the Pyndiah; Add comments
8,483
09.02.2018 17:33:36
-3,600
c2cf2171d2d69c7584efc4f5d08018a6a3469b69
Change name of the Chase Pyndiah coefficients into --dec-cp-coef; Use directly the coef vector as argument of the Chase Pyndiah class; Add a fifth argument to control the number of least reliable bits used to calculate the beta
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "new_path": "src/Factory/Module/Decoder/Turbo_product/Decoder_turbo_product.cpp", "diff": "@@ -111,9 +111,9 @@ void Decoder_turbo_product::parameters\n{\"\",\n\"extends decoder with a parity bits.\"};\n- opt_args[{p+\"-abcd\"}] =\n+ opt_args[{p+\"-cp-coef\"}] =\n{\"string\",\n- \"Chase Pyndiah constant coefficients.\"};\n+ \"the 5 Chase Pyndiah constant coefficients \\\"a,b,c,d,e\\\".\"};\nsub->get_description(req_args, opt_args);\n@@ -165,10 +165,10 @@ void Decoder_turbo_product::parameters\n}\n- this->cp_coef.resize(4);\n- if(exist(vals, {p+\"-abcd\"}))\n+ this->cp_coef.resize(5);\n+ if(exist(vals, {p+\"-cp-coef\"}))\n{\n- auto cp_coef_list = tools::split(vals.at({p+\"-abcd\"}), ',');\n+ auto cp_coef_list = tools::split(vals.at({p+\"-cp-coef\"}), ',');\nif (cp_coef_list.size() == this->cp_coef.size())\n{\n@@ -178,13 +178,17 @@ void Decoder_turbo_product::parameters\nelse\n{\nstd::stringstream message;\n- message << \"'\" << p << \"-abcd' argument has to be of length 4.\";\n+ message << \"'\" << p << \"-cp-coef' argument has to be of length \" << this->cp_coef.size() << \".\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\nelse\n{\n- std::fill(this->cp_coef.begin(), this->cp_coef.end(), 1.0f);\n+ this->cp_coef[0] = 1.f;\n+ this->cp_coef[1] = 1.f;\n+ this->cp_coef[2] = 1.f;\n+ this->cp_coef[3] = 1.f;\n+ this->cp_coef[4] = 0;\n}\n@@ -346,7 +350,7 @@ template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_turbo\ntemplate aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_turbo_product::build<B_64,Q_64>(const aff3ct::factory::Decoder_turbo_product::parameters&, const aff3ct::module::Interleaver<Q_64>&, aff3ct::module::Decoder_chase_pyndiah<B_64,Q_64> &, aff3ct::module::Decoder_chase_pyndiah<B_64,Q_64> &, module::Encoder<B_64>*);\n#else\ntemplate aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product::parameters::build<B,Q>(const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_chase_pyndiah<B,Q> &, aff3ct::module::Decoder_chase_pyndiah<B,Q> &, module::Encoder<B>*) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product::build<B,Q>(const aff3ct::factory::Decoder_turbo_product::parameters&, aff3ct::module::Decoder_chase_pyndiah<B,Q> &, aff3ct::module::Decoder_chase_pyndiah<B,Q> &, module::Encoder<B>*);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_turbo_product::build<B,Q>(const aff3ct::factory::Decoder_turbo_product::parameters&, const aff3ct::module::Interleaver<Q>&, aff3ct::module::Decoder_chase_pyndiah<B,Q> &, aff3ct::module::Decoder_chase_pyndiah<B,Q> &, module::Encoder<B>*);\n#endif\n#ifdef MULTI_PREC\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "new_path": "src/Module/Codec/Turbo_product/Codec_turbo_product.cpp", "diff": "@@ -68,10 +68,7 @@ Codec_turbo_product<B,Q>\ndec_params.n_least_reliable_positions,\ndec_params.n_test_vectors,\ndec_params.n_competitors,\n- dec_params.cp_coef[0],\n- dec_params.cp_coef[1],\n- dec_params.cp_coef[2],\n- dec_params.cp_coef[3]);\n+ dec_params.cp_coef);\nEncoder_turbo_product<B> *encoder_tpc = nullptr;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.cpp", "diff": "@@ -26,10 +26,7 @@ Decoder_chase_pyndiah<B,R>\nconst int n_least_reliable_positions_,\nconst int n_test_vectors_,\nconst int n_competitors_,\n- const float a,\n- const float b,\n- const float c,\n- const float d)\n+ const std::vector<float>& cp_coef)\n: Decoder (K, N, dec_.get_n_frames(), dec_.get_simd_inter_frame_level()),\nDecoder_SISO_SIHO<B,R>(K, N, dec_.get_n_frames(), dec_.get_simd_inter_frame_level()),\ndec (dec_ ),\n@@ -39,12 +36,7 @@ Decoder_chase_pyndiah<B,R>\nn_test_vectors (n_test_vectors_ ? n_test_vectors_ : (int)1 << n_least_reliable_positions),\nn_competitors (n_competitors_ ? n_competitors_ : n_test_vectors ),\nparity_extended (this->N == (N_np +1) ),\n-\n- a_((R)a),\n- b_((R)b),\n- c_((R)c),\n- d_((R)d),\n-\n+ cp_coef (cp_coef ),\nleast_reliable_pos (n_least_reliable_positions ),\ncompetitors (n_test_vectors ),\nhard_Y_N (this->N ),\n@@ -98,6 +90,14 @@ Decoder_chase_pyndiah<B,R>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (cp_coef.size() != 5)\n+ {\n+ std::stringstream message;\n+ message << \"'cp_coef.size()' has to be equal to 5 (the 5 coef a, b, c, d and e of the Pyndiah)\"\n+ << \"('cp_coef.size()' = \" << cp_coef.size() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\ngenerate_bit_flipping_candidates(); // generate bit flipping patterns in 'test_patterns'\n}\n@@ -354,10 +354,11 @@ void Decoder_chase_pyndiah<B,R>\n// compute beta, the sum of the least reliable position reliabilities in the decided word\nR beta = 0;\n- for (int i = 0; i < n_least_reliable_positions && i < 3; i++)\n+ int max_sum = cp_coef[4] ? std::min((int)cp_coef[4], n_least_reliable_positions) : n_least_reliable_positions;\n+ for (int i = 0; i < max_sum; i++)\nbeta += least_reliable_pos[i].metric;\n- beta -= c_ * DW.metric;\n+ beta -= cp_coef[2] * DW.metric;\n#ifndef NDEBUG\nstd::cerr << \"beta = \" << beta << \", DW.metric = \" << DW.metric << std::endl;\n@@ -367,7 +368,7 @@ void Decoder_chase_pyndiah<B,R>\n// then take only them for reliability calculation\nfor (int j = 1; j < n_good_competitors; j++)\n- competitors[j].metric = (competitors[j].metric - DW.metric) * b_;\n+ competitors[j].metric = (competitors[j].metric - DW.metric) * cp_coef[1];\nfor (int i = 0; i < this->N; i++)\n@@ -387,7 +388,7 @@ void Decoder_chase_pyndiah<B,R>\n}\nelse // same bits for each candidates\n{\n- reliability = beta + d_ * std::abs(Y_N1[i]);\n+ reliability = beta + cp_coef[3] * std::abs(Y_N1[i]);\nif (reliability < 0)\nreliability = 0;\n}\n@@ -399,7 +400,7 @@ void Decoder_chase_pyndiah<B,R>\nstd::cerr << \"Rel: i = \" << i << \", Y_N1 = \" << Y_N1[i] << \", competitors[\" << j << \"].metric = \" << competitors[j].metric;\n#endif\n- Y_N2[i] = reliability - a_ * Y_N1[i];\n+ Y_N2[i] = reliability - cp_coef[0] * Y_N1[i];\n#ifndef NDEBUG\nstd::cerr << \", reliability = \" << reliability << \", Y_N2 = \" << Y_N2[i] << std::endl;\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "new_path": "src/Module/Decoder/Turbo_product/Chase_pyndiah/Decoder_chase_pyndiah.hpp", "diff": "@@ -27,10 +27,12 @@ namespace module\n* W = F - a * R\n* - Compute the reliability F of D as, for each bit j of the word:\n* Fj = Dj * [Cm - Dm] * b when Cj /= Dj in the competitor with the smallest metric Cm\n- * = Dj * [sum(Pm) - c * Dm + d * |Rj|] when there is no such competitor as described above\n+ * = Dj * [beta - c * Dm + d * |Rj|] when there is no such competitor as described above\n* with Dj = 1 when Hj = 0\n* = -1 when Hj = 1\n- * - a, b, c and d are simulation constants changeable by the user\n+ * with beta = sum from 0 to e of the Pm where 0 <= e < p\n+\n+ * - a, b, c, d and e are simulation constants changeable by the user\n*/\ntemplate <typename B = int, typename R = float>\n@@ -55,10 +57,7 @@ protected:\nconst bool parity_extended; // true if there is a parity bit\n// bool parity_diff;\n- const R a_;\n- const R b_;\n- const R c_;\n- const R d_;\n+ const std::vector<float> cp_coef; // the a, b, c, d and e coefficient described above in the class description\nstd::vector<info> least_reliable_pos; // the list of least reliable positions\nstd::vector<info> competitors; // the competitors' metric and their related test vector position\n@@ -76,10 +75,7 @@ public:\nconst int n_least_reliable_positions = 2,\nconst int n_test_vectors = 0,\nconst int n_competitors = 0,\n- const float a = 1.f,\n- const float b = 1.f,\n- const float c = 1.f,\n- const float d = 1.f);\n+ const std::vector<float>& cp_coef = {1,1,1,1,0});\nvoid decode_siso (const R *Y_N1, R *Y_N2); // size is length with parity bit if any\nvoid decode_siho (const R *Y_N, B *V_K );\n" } ]
C++
MIT License
aff3ct/aff3ct
Change name of the Chase Pyndiah coefficients --dec-abcd into --dec-cp-coef; Use directly the coef vector as argument of the Chase Pyndiah class; Add a fifth argument to control the number of least reliable bits used to calculate the beta
8,483
11.02.2018 14:42:25
-3,600
b54ac6a2c8c724c4b5ca34c8c50e1977c8cdad68
Inverse the exception no addr2line value from false to true by default. Inverse then the argument --except-a2l to enable the conversion when asked only; Complete the auto completion script with new arguments --excep-XXX and -H
[ { "change_type": "MODIFY", "old_path": "scripts/aff3ct_completion.sh", "new_path": "scripts/aff3ct_completion.sh", "diff": "@@ -26,7 +26,7 @@ _aff3ct() {\ndone\n# add base opts\n- opts=\"--sim-cde-type --sim-type -v --version -h --help\"\n+ opts=\"-C --sim-cde-type --sim-type -v --version -h --help -H --Help\"\n# add contents of Launcher.cpp\nif [[ ${codetype} == \"POLAR\" && ${simutype} == \"EXIT\" || \\\n@@ -57,7 +57,8 @@ _aff3ct() {\n--qnt-dec --qnt-bits --qnt-range --dec-type --dec-implem \\\n--ter-no --ter-freq --sim-seed --sim-mpi-comm --sim-pyber \\\n--sim-no-colors --sim-err-trk --sim-err-trk-rev \\\n- --sim-err-trk-path --sim-debug-prec\"\n+ --sim-err-trk-path --sim-debug-prec --sim-no-legend --except-a2l\\\n+ --except-no-bt\"\nfi\n# add contents of Launcher_BFER.cpp\n@@ -214,11 +215,12 @@ _aff3ct() {\n;;\n# awaiting nothing\n- -v | --version | -h | --help | --mdm-no-sig2 | --ter-no | \\\n- --sim-debug | --sim-debug-fe | --sim-stats | \\\n+ -v | --version | -h | --help | -H | --Help | --mdm-no-sig2 | \\\n+ --sim-debug | --sim-debug-fe | --sim-stats | --sim-no-legend | \\\n--sim-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n--crc-rate | --sim-err-trk | --sim-err-trk-rev | --itl-uni | \\\n- --dec-partial-adaptive | --dec-fnc | --dec-sc )\n+ --dec-partial-adaptive | --dec-fnc | --dec-sc | --except-a2l | \\\n+ --except-no-bt | --ter-no )\nCOMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n;;\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Launcher/Launcher.cpp", "new_path": "src/Factory/Launcher/Launcher.cpp", "diff": "@@ -121,9 +121,10 @@ void factory::Launcher::parameters\ntools::Argument_info::ADVANCED);\nargs.add(\n- {\"except-no-a2l\"},\n+ {\"except-a2l\"},\ntools::None(),\n- \"do not enhance the backtrace when displaying exception.\",\n+ \"enhance the backtrace when displaying exception by changing program addresses into \"\n+ \" file names and lines (may take some seconds).\",\ntools::Argument_info::ADVANCED);\nargs.add(\n@@ -160,8 +161,8 @@ void factory::Launcher::parameters\nif(vals.exist({p+\"-prec\", \"p\"})) this->sim_prec = vals.to_int({p+\"-prec\", \"p\"});\n#endif\n- if(vals.exist({\"except-no-bt\" })) tools::exception::no_backtrace = true;\n- if(vals.exist({\"except-no-a2l\"})) tools::exception::no_addr2line = true;\n+ tools::exception::no_backtrace = vals.exist({\"except-no-bt\"});\n+ tools::exception::no_addr2line = !vals.exist({\"except-a2l\" });\n}\nvoid factory::Launcher::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Exception/exception.cpp", "new_path": "src/Tools/Exception/exception.cpp", "diff": "@@ -13,7 +13,7 @@ using namespace aff3ct::tools;\nconst std::string aff3ct::tools::exception::empty_string = \"\";\nbool aff3ct::tools::exception::no_backtrace = false;\n-bool aff3ct::tools::exception::no_addr2line = false;\n+bool aff3ct::tools::exception::no_addr2line = true;\nexception\n::exception() throw()\n" } ]
C++
MIT License
aff3ct/aff3ct
Inverse the exception no addr2line value from false to true by default. Inverse then the argument --except-a2l to enable the conversion when asked only; Complete the auto completion script with new arguments --excep-XXX and -H
8,490
11.02.2018 15:17:28
-3,600
fd2a2a8145201be498bf72a21a86808670f5aca3
Add a new file to explain how to contribute in AFF3CT.
[ { "change_type": "ADD", "old_path": null, "new_path": "CONTRIBUTING.md", "diff": "+# How to contribute\n+\n+We're really glad you're reading this, because we need volunteer developers to expand this project.\n+\n+Here are some important resources to communicate:\n+\n+ * [The Official website](http://aff3ct.github.io/),\n+ * Send us an email to [aff3ct@googlegroups.com](mailto:aff3ct@googlegroups.com),\n+ * Join our [diffusion list](https://groups.google.com/d/forum/aff3ct),\n+ * Bugs? Report issues on [GitHub](https://github.com/aff3ct/aff3ct/issues).\n+\n+## Submitting changes\n+\n+Please send a [GitHub Pull Request to AFF3CT](https://github.com/aff3ct/aff3ct/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).\n+\n+Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:\n+\n+ $ git commit -m \"A brief summary of the commit\n+ >\n+ > A paragraph describing what changed and its impact.\"\n+\n+## Testing\n+\n+We try to maintain a database of BER/FER reference simulations. Please give us some new references which include your modifications.\n+We use those references in [an automated regression test script](https://github.com/aff3ct/aff3ct/blob/master/ci/test-regression.py).\n+To propose new references please use our [dedicated repository](https://github.com/aff3ct/error_rate_references) and send us a pull request on it.\n+\n+## Coding conventions\n+\n+Start reading our code and you'll get the hang of it. We optimize for readability:\n+\n+ * We indent using tabulation (hard tabs).\n+ * We ALWAYS put spaces after list items and method parameters (`[1, 2, 3]`, not `[1,2,3]`), around operators (`x += 1`, not `x+=1`), and around hash arrows.\n+ * We use the snake notation (`my_variable`, not `myVariable`), classes start with an upper case (`My_class`, not `My_class`) and variables/methods/function start with a lower case.\n+ * The number of characters is limited to 120 per line of code.\n+ * This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.\n+\n+## Documentation\n+\n+At this time, AFF3CT is not as documented as we would like. If you are interested in enrich the AFF3CT documentation, we are open to propositions.\n+You can also propose new pages for [the AFF3CT GitHub Wiki](https://github.com/aff3ct/aff3ct/wiki).\n+\n+Thanks,\n+The AFF3CT team\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a new file to explain how to contribute in AFF3CT.
8,490
11.02.2018 15:23:41
-3,600
d96e3892bf32cd85f652a728db55e28e09b899e6
Improve the contributing guide.
[ { "change_type": "MODIFY", "old_path": "CONTRIBUTING.md", "new_path": "CONTRIBUTING.md", "diff": "@@ -11,7 +11,7 @@ Here are some important resources to communicate:\n## Submitting changes\n-Please send a [GitHub Pull Request to AFF3CT](https://github.com/aff3ct/aff3ct/pull/new/master) with a clear list of what you've done (read more about [pull requests](http://help.github.com/pull-requests/)).\n+Please send a [GitHub Pull Request to AFF3CT](https://github.com/aff3ct/aff3ct/pull/new/master) with a clear list of what you've done (read more about [pull requests](https://help.github.com/articles/about-pull-requests/)).\nAlways write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:\n@@ -31,7 +31,7 @@ Start reading our code and you'll get the hang of it. We optimize for readabilit\n* We indent using tabulation (hard tabs).\n* We ALWAYS put spaces after list items and method parameters (`[1, 2, 3]`, not `[1,2,3]`), around operators (`x += 1`, not `x+=1`), and around hash arrows.\n- * We use the snake notation (`my_variable`, not `myVariable`), classes start with an upper case (`My_class`, not `My_class`) and variables/methods/function start with a lower case.\n+ * We use [the snake case](https://en.wikipedia.org/wiki/Snake_case) (`my_variable`, not `myVariable`), classes start with an upper case (`My_class`, not `my_class`) and variables/methods/function start with a lower case.\n* The number of characters is limited to 120 per line of code.\n* This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.\n@@ -41,4 +41,5 @@ At this time, AFF3CT is not as documented as we would like. If you are intereste\nYou can also propose new pages for [the AFF3CT GitHub Wiki](https://github.com/aff3ct/aff3ct/wiki).\nThanks,\n-The AFF3CT team\n\\ No newline at end of file\n+\n+the AFF3CT team\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the contributing guide.
8,490
11.02.2018 18:32:30
-3,600
14a36dc6a9b07aa09827fa4a51dc4475ec793b7a
Update the contrib doc.
[ { "change_type": "MODIFY", "old_path": "CONTRIBUTING.md", "new_path": "CONTRIBUTING.md", "diff": "We're really glad you're reading this, because we need volunteer developers to expand this project.\n-Here are some important resources to communicate:\n+Here are some important resources to communicate with us:\n- * [The Official website](http://aff3ct.github.io/),\n+ * [The official website](http://aff3ct.github.io/),\n* Send us an email to [aff3ct@googlegroups.com](mailto:aff3ct@googlegroups.com),\n* Join our [diffusion list](https://groups.google.com/d/forum/aff3ct),\n* Bugs? Report issues on [GitHub](https://github.com/aff3ct/aff3ct/issues).\n@@ -21,24 +21,27 @@ Always write a clear log message for your commits. One-line messages are fine fo\n## Testing\n-We try to maintain a database of BER/FER reference simulations. Please give us some new references which include your modifications.\n+We try to maintain a database of BER/FER reference simulations. Please give us some new references which solicit the code you added.\nWe use those references in [an automated regression test script](https://github.com/aff3ct/aff3ct/blob/master/ci/test-regression.py).\nTo propose new references please use our [dedicated repository](https://github.com/aff3ct/error_rate_references) and send us a pull request on it.\n## Coding conventions\n-Start reading our code and you'll get the hang of it. We optimize for readability:\n+Start reading our code and you'll get the hang of it.\n+For the readability, we apply some coding conventions:\n* We indent using tabulation (hard tabs).\n* We ALWAYS put spaces after list items and method parameters (`[1, 2, 3]`, not `[1,2,3]`), around operators (`x += 1`, not `x+=1`), and around hash arrows.\n- * We use [the snake case](https://en.wikipedia.org/wiki/Snake_case) (`my_variable`, not `myVariable`), classes start with an upper case (`My_class`, not `my_class`) and variables/methods/function start with a lower case.\n+ * We use the [snake case](https://en.wikipedia.org/wiki/Snake_case) (`my_variable`, not `myVariable`), classes start with an upper case (`My_class`, not `my_class`) and variables/methods/function start with a lower case.\n* The number of characters is limited to 120 per line of code.\n- * This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.\n+\n+This is open source software. Consider the people who will read your code, and make it look nice for them.\n+It's sort of like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as smooth as possible.\n## Documentation\n-At this time, AFF3CT is not as documented as we would like. If you are interested in enrich the AFF3CT documentation, we are open to propositions.\n-You can also propose new pages for [the AFF3CT GitHub Wiki](https://github.com/aff3ct/aff3ct/wiki).\n+At this time, AFF3CT is not as documented as we would like to be. If you are interested in enrich the AFF3CT documentation, We are open to receive suggestions.\n+You can also propose new pages for [the wiki](https://github.com/aff3ct/aff3ct/wiki).\nThanks,\n" } ]
C++
MIT License
aff3ct/aff3ct
Update the contrib doc.
8,490
12.02.2018 09:49:46
-3,600
163be902f2bd6a0c31b47a19cbc4b4773544b3f9
Add a link to the contributing guidelines in the readme.
[ { "change_type": "MODIFY", "old_path": "README.md", "new_path": "README.md", "diff": "@@ -80,3 +80,4 @@ A list of the AFF3CT related web pages:\n- [Official wiki](https://github.com/aff3ct/aff3ct/wiki)\n- [Official website](https://aff3ct.github.io/)\n- [Scientific publications](https://aff3ct.github.io/publications.html)\n+- [Contributing guidelines](https://github.com/aff3ct/aff3ct/blob/master/CONTRIBUTING.md)\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Add a link to the contributing guidelines in the readme.
8,483
12.02.2018 09:50:06
-3,600
377a118b7c8281ac49f0c2dc3f3b14ca66c19ca8
Add least common multiple and greatest common divisor functions; Display the fraction of the code rate and the bit rate; Use the Tools/Math/utils is_power_of_2 function in Factory/Encoder/BCH to check the validity of N instead of rewriting the function
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Codec.cpp", "new_path": "src/Factory/Module/Codec/Codec.cpp", "diff": "#include <algorithm>\n#include \"Tools/general_utils.h\"\n+#include \"Tools/Math/utils.h\"\n#include \"Codec.hpp\"\n@@ -86,7 +87,6 @@ void Codec::parameters\n::get_headers(std::map<std::string,header_list>& headers, const bool full) const\n{\nauto p = this->get_prefix();\n- const auto code_rate = (float)this->K / (float)this->N;\nauto v = tools::split(this->get_name(), ' ');\nauto name = v.size() >= 2 ? v[1] : \"UNKNOWN\";\nfor (size_t i = 2; i < v.size(); i++)\n@@ -97,7 +97,15 @@ void Codec::parameters\nheaders[p].push_back(std::make_pair(\"Info. bits (K)\", std::to_string(this->K )));\nheaders[p].push_back(std::make_pair(\"Codeword size (N_cw)\", std::to_string(this->N_cw )));\nheaders[p].push_back(std::make_pair(\"Frame size (N)\", std::to_string(this->N )));\n- headers[p].push_back(std::make_pair(\"Code rate\", std::to_string(code_rate )));\n+\n+\n+ const auto code_rate = (float)this->K / (float)this->N;\n+ // find the greatest common divisor of K and N\n+ auto gcd = tools::greatest_common_divisor(this->K, this->N);\n+ std::stringstream cr_str;\n+ cr_str << code_rate << \" (\" << this->K/gcd << \"/\" << this->N/gcd << \")\";\n+\n+ headers[p].push_back(std::make_pair(\"Code rate\", cr_str.str()));\n}\nvoid Codec::parameters\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "new_path": "src/Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.cpp", "diff": "@@ -76,8 +76,7 @@ void Codec_turbo_DB::parameters\nargs.erase({ppct+\"-fra\", \"F\"});\nargs.erase({ppct+\"-tail-length\" });\n- //opt_args[{ppct+\"-fra-size\", \"N\"}] = req_args[{ppct+\"-fra-size\", \"N\"}]->clone();\n- args.erase({ppct+\"-fra-size\", \"N\"});\n+ args[{ppct+\"-fra-size\", \"N\"}]->rank = tools::Argument_info::OPTIONAL;\n}\nenc->get_description(args);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.cpp", "new_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.cpp", "diff": "#include <cmath>\n#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Math/utils.h\"\n#include \"Module/Encoder/BCH/Encoder_BCH.hpp\"\n@@ -35,9 +36,7 @@ struct check_BCH_N\ntemplate <typename T>\nstatic void check(const T N)\n{\n- auto m = (int)std::ceil(std::log2(N));\n-\n- if (N != ((1 << m) -1))\n+ if (!tools::is_power_of_2(N+1))\n{\nstd::stringstream message;\nmessage << \"'N' has to be a power of 2 minus 1\";\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/BFER/BFER.cpp", "new_path": "src/Factory/Simulation/BFER/BFER.cpp", "diff": "#include <thread>\n#include \"BFER.hpp\"\n+#include \"Tools/Math/utils.h\"\nusing namespace aff3ct;\nusing namespace aff3ct::factory;\n@@ -191,7 +192,12 @@ void BFER::parameters\nif (this->src != nullptr && this->cdc != nullptr)\n{\nconst auto bit_rate = (float)this->src->K / (float)this->cdc->N;\n- headers[p].push_back(std::make_pair(\"Bit rate\", std::to_string(bit_rate)));\n+ // find the greatest common divisor of K and N\n+ auto gcd = tools::greatest_common_divisor(this->src->K, this->cdc->N);\n+ std::stringstream br_str;\n+ br_str << bit_rate << \" (\" << this->src->K/gcd << \"/\" << this->cdc->N/gcd << \")\";\n+\n+ headers[p].push_back(std::make_pair(\"Bit rate\", br_str.str()));\n}\nif (this->src != nullptr)\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Arguments/Argument_handler.cpp", "new_path": "src/Tools/Arguments/Argument_handler.cpp", "diff": "@@ -357,12 +357,12 @@ void Argument_handler\nif (it_arg->second->rank != Argument_info::REQUIRED)\ncontinue;\n- auto& tag = it_arg->first.front();\nbool found = false;\nif (args_print_pos[std::distance(args.begin(), it_arg)])\ncontinue; // already displayed\n+ // auto& tag = it_arg->first.front();\n// for (auto it_grp = arg_groups.begin(); it_grp != arg_groups.end(); it_grp++)\n// {\n// auto& prefix = it_grp->first;\n@@ -394,12 +394,12 @@ void Argument_handler\n|| (!print_advanced_args && it_arg->second->rank == Argument_info::ADVANCED))\ncontinue;\n- auto& tag = it_arg->first.front();\nbool found = false;\nif (args_print_pos[std::distance(args.begin(), it_arg)])\ncontinue; // already displayed\n+ // auto& tag = it_arg->first.front();\n// for (auto it_grp = arg_groups.begin(); it_grp != arg_groups.end(); it_grp++)\n// {\n// auto& prefix = it_grp->first;\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Math/utils.h", "new_path": "src/Tools/Math/utils.h", "diff": "@@ -100,6 +100,27 @@ inline R integral(function_type func, const R min, const R max, const int number\nreturn area;\n}\n+\n+template <typename T>\n+T greatest_common_divisor(T a, T b)\n+{\n+ T r;\n+\n+ while ((r = a % b))\n+ {\n+ a = b;\n+ b = r;\n+ }\n+\n+ return b;\n+}\n+\n+template <typename T>\n+T least_common_multiple(T a, T b)\n+{\n+ return (a * b) / greatest_common_divisor(a, b);\n+}\n+\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add least common multiple and greatest common divisor functions; Display the fraction of the code rate and the bit rate; Use the Tools/Math/utils is_power_of_2 function in Factory/Encoder/BCH to check the validity of N instead of rewriting the function
8,490
12.02.2018 11:56:15
-3,600
21ac6b0d577ade3ee0854e04bd22b4f23ecb4cab
Up the sonarqube script.
[ { "change_type": "MODIFY", "old_path": "ci/analysis-sonarqube.sh", "new_path": "ci/analysis-sonarqube.sh", "diff": "@@ -18,7 +18,7 @@ cppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --s\n# Create the sonar config file on the fly\nVERSION=$(git tag | tail -n 1 | cut -d $'v' -f2-)\necho \"sonar.projectKey=storm:aff3ct:gitlab:master\" > sonar-project.properties\n-echo \"sonar.projectName=AFF3CT\" >> sonar-project.properties\n+#echo \"sonar.projectName=AFF3CT\" >> sonar-project.properties\necho \"sonar.projectVersion=$VERSION\" >> sonar-project.properties\necho \"sonar.login=c6ab3ccd4dd7a8d9aa3e90d5766c74e0c9889947\" >> sonar-project.properties\necho \"sonar.sources=./src/\" >> sonar-project.properties\n" } ]
C++
MIT License
aff3ct/aff3ct
Up the sonarqube script.
8,490
12.02.2018 20:51:15
-3,600
5a4f684b0980a941b5a77893cb47ee01571b7640
Improve the exit codes management.
[ { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.cpp", "new_path": "src/Launcher/Launcher.cpp", "diff": "@@ -118,8 +118,10 @@ void Launcher::print_header()\nthis->stream << \"#\" << std::endl;\n}\n-void Launcher::launch()\n+int Launcher::launch()\n{\n+ int exit_code = EXIT_SUCCESS;\n+\nstd::srand(this->params_common.global_seed);\n// in case of the user call launch multiple times\n@@ -137,7 +139,7 @@ void Launcher::launch()\n#endif\nfor (unsigned w = 0; w < cmd_warn.size(); w++)\nstd::clog << tools::format_warning(cmd_warn[w]) << std::endl;\n- return;\n+ return EXIT_FAILURE;\n}\n// write the command and he curve name in the PyBER format\n@@ -172,6 +174,7 @@ void Launcher::launch()\ncatch (std::exception const& e)\n{\nstd::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ exit_code = EXIT_FAILURE;\n}\nif (simu != nullptr)\n@@ -185,10 +188,13 @@ void Launcher::launch()\ntry\n{\nsimu->launch();\n+ if (simu->is_error())\n+ exit_code = EXIT_FAILURE;\n}\ncatch (std::exception const& e)\n{\nstd::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ exit_code = EXIT_FAILURE;\n}\n}\n@@ -202,4 +208,6 @@ void Launcher::launch()\ndelete simu;\nsimu = nullptr;\n}\n+\n+ return exit_code;\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Launcher/Launcher.hpp", "new_path": "src/Launcher/Launcher.hpp", "diff": "@@ -69,7 +69,7 @@ public:\n/*!\n* \\brief Launch the simulation.\n*/\n- void launch();\n+ int launch();\nprotected:\n/*!\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -208,7 +208,6 @@ void BFER<B,R,Q>\n#endif\nterminal->start_temp_report(params_BFER.ter->frequency);\n- auto simu_error = false;\ntry\n{\nthis->_launch();\n@@ -219,13 +218,13 @@ void BFER<B,R,Q>\nterminal->final_report(std::cout); // display final report to not lost last line overwritten by the error messages\nstd::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n- simu_error = true;\n+ this->simu_error = true;\n}\n#ifdef ENABLE_MPI\n- if (!params_BFER.ter->disabled && terminal != nullptr && !simu_error && params_BFER.mpi_rank == 0)\n+ if (!params_BFER.ter->disabled && terminal != nullptr && !this->simu_error && params_BFER.mpi_rank == 0)\n#else\n- if (!params_BFER.ter->disabled && terminal != nullptr && !simu_error)\n+ if (!params_BFER.ter->disabled && terminal != nullptr && !this->simu_error)\n#endif\n{\nif (params_BFER.debug)\n@@ -250,7 +249,7 @@ void BFER<B,R,Q>\n}\n}\n- if (this->dumper_red != nullptr && !simu_error)\n+ if (this->dumper_red != nullptr && !this->simu_error)\n{\nstd::stringstream s_snr_b;\ns_snr_b << std::setprecision(2) << std::fixed << snr_b;\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.cpp", "new_path": "src/Simulation/Simulation.cpp", "diff": "@@ -5,7 +5,7 @@ using namespace aff3ct::simulation;\nSimulation\n::Simulation(const factory::Simulation::parameters& simu_params)\n-: params(simu_params)\n+: params(simu_params), simu_error(false)\n{\n}\n@@ -14,6 +14,12 @@ Simulation\n{\n}\n+bool Simulation\n+::is_error() const\n+{\n+ return this->simu_error;\n+}\n+\nvoid Simulation\n::build_communication_chain()\n{\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.hpp", "new_path": "src/Simulation/Simulation.hpp", "diff": "@@ -30,6 +30,8 @@ protected:\n// map of Modules\nstd::map<std::string, std::vector<module::Module*>> modules;\n+ bool simu_error;\n+\npublic:\n/*!\n* \\brief Constructor.\n@@ -41,6 +43,8 @@ public:\n*/\nvirtual ~Simulation();\n+ bool is_error() const;\n+\n/*!\n* \\brief This method has to be overloaded, this is the start point of the Simulation.\n*/\n" }, { "change_type": "MODIFY", "old_path": "src/main.cpp", "new_path": "src/main.cpp", "diff": "@@ -119,6 +119,7 @@ int main(int argc, char **argv)\nint sc_main(int argc, char **argv)\n#endif\n{\n+ int exit_code = EXIT_SUCCESS;\n#ifdef ENABLE_MPI\nMPI_Init(nullptr, nullptr);\n#endif\n@@ -145,18 +146,19 @@ int sc_main(int argc, char **argv)\n#endif\nif (launcher != nullptr)\n{\n- launcher->launch();\n+ exit_code = launcher->launch();\ndelete launcher;\n}\n}\ncatch(std::exception const& e)\n{\nstd::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n+ exit_code = EXIT_FAILURE;\n}\n#ifdef ENABLE_MPI\nMPI_Finalize();\n#endif\n- return EXIT_SUCCESS;\n+ return exit_code;\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the exit codes management.
8,490
12.02.2018 20:52:20
-3,600
3e5c3d2ae2108a572b5e0ff038b3fa750f5db7f4
Use the AFF3CT exit codes + fix a bug when an AFF3CT error occurs.
[ { "change_type": "MODIFY", "old_path": "ci/test-regression.py", "new_path": "ci/test-regression.py", "diff": "@@ -206,19 +206,22 @@ for fn in fileNames:\nprocessAFFECT = subprocess.Popen(argsAFFECT, stdout=subprocess.PIPE,\nstderr=subprocess.PIPE)\n(stdoutAFFECT, stderrAFFECT) = processAFFECT.communicate()\n+ returnCode = processAFFECT.returncode\nelapsedTime = time.time() - startTime\n- err = stderrAFFECT.decode(encoding='UTF-8')\n- if err:\n+ errAndWarnMessages = stderrAFFECT.decode(encoding='UTF-8')\n+\n+ os.chdir(PathOrigin)\n+\n+ if returnCode:\nprint(\" - ABORTED.\", end=\"\\n\");\n- print(\"Error message:\", end=\"\\n\");\n- print(err)\n+ if errAndWarnMessages:\n+ print(\"---- Error message(s):\", end=\"\\n\");\n+ print(errAndWarnMessages)\nnErrors = nErrors +1\nfailIds.append(testId +1)\nelse:\n# begin to write the results into a file\n- os.chdir(PathOrigin)\n-\nfRes = open(args.resultsPath + \"/\" + fn, 'w+')\n# parse the results\n@@ -318,6 +321,10 @@ for fn in fileNames:\nel = el + 1\nprint(\"].\", end=\"\\n\")\n+ if errAndWarnMessages:\n+ print(\"---- Warning message(s):\", end=\"\\n\");\n+ print(errAndWarnMessages)\n+\nfRes.write(\"# End of the simulation.\\n\")\nfRes.close();\n" } ]
C++
MIT License
aff3ct/aff3ct
Use the AFF3CT exit codes + fix a bug when an AFF3CT error occurs.
8,490
13.02.2018 09:23:32
-3,600
7f1fc19b0fe5ede943e8ca839655d608b6ec78f6
Fix error code return in the BFER 'build_communication_chain()' method.
[ { "change_type": "MODIFY", "old_path": "src/Simulation/BFER/BFER.cpp", "new_path": "src/Simulation/BFER/BFER.cpp", "diff": "@@ -310,9 +310,9 @@ void BFER<B,R,Q>\ncatch (std::exception const& e)\n{\nmodule::Monitor::stop();\n+ simu->simu_error = true;\nsimu->mutex_exception.lock();\n-\nif (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n{\nstd::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix error code return in the BFER 'build_communication_chain()' method.
8,489
14.02.2018 10:26:40
-3,600
d4134c09593ac96341b72784ec56b811b82ac821
Fix bad includes in 'my_project_with_aff3ct'.
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp", "new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp", "diff": "#include \"Tools/Algo/Sort/LC_sorter.hpp\"\n#include \"Tools/Code/Polar/decoder_polar_functions.h\"\n#include \"Tools/Code/Polar/Frozenbits_notifier.hpp\"\n+#include \"Tools/Code/Polar/Pattern_polar_parser.hpp\"\n#include \"../../Decoder_SIHO.hpp\"\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_scan.hpp", "new_path": "src/Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_scan.hpp", "diff": "#include <vector>\n#include <mipp.h>\n+#include \"Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq.hpp\"\n+\n#include \"Tools/Math/max.h\"\nnamespace aff3ct\n" }, { "change_type": "MODIFY", "old_path": "src/aff3ct.hpp", "new_path": "src/aff3ct.hpp", "diff": "#ifndef AFF3CT_HPP\n#define AFF3CT_HPP\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/system_functions.h>\n-#include <Tools/version.h>\n+#include <Tools/Perf/Transpose/transpose_SSE.h>\n+#include <Tools/Perf/Transpose/transpose_NEON.h>\n+#include <Tools/Perf/Transpose/transpose_AVX.h>\n+#include <Tools/Perf/Transpose/transpose_selector.h>\n+#include <Tools/Perf/hard_decision.h>\n#include <Tools/Code/Polar/nodes_parser.h>\n+#include <Tools/Code/Polar/fb_extract.h>\n+#include <Tools/Code/Polar/API/functions_polar_intra_16bit.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/Code/Polar/API/functions_polar_intra_32bit.h>\n+#include <Tools/Code/Polar/API/functions_polar_inter.h>\n#include <Tools/Code/Polar/API/functions_polar_intra_8bit.h>\n+#include <Tools/Code/Polar/API/functions_polar_intra.h>\n#include <Tools/Code/Polar/API/functions_polar_seq.h>\n#include <Tools/Code/Polar/API/functions_polar_inter_8bit_bitpacking.h>\n-#include <Tools/Code/Polar/API/functions_polar_intra_16bit.h>\n-#include <Tools/Code/Polar/API/functions_polar_inter.h>\n-#include <Tools/Code/Polar/API/functions_polar_intra_32bit.h>\n#include <Tools/Code/Polar/decoder_polar_functions.h>\n-#include <Tools/Code/Polar/fb_extract.h>\n-#include <Tools/Perf/Transpose/transpose_AVX.h>\n-#include <Tools/Perf/Transpose/transpose_SSE.h>\n-#include <Tools/Perf/Transpose/transpose_selector.h>\n-#include <Tools/Perf/Transpose/transpose_NEON.h>\n-#include <Tools/Perf/hard_decision.h>\n+#include <Tools/general_utils.h>\n+#include <Tools/system_functions.h>\n#include <Tools/Display/bash_tools.h>\n+#include <Tools/version.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/Interleaver/Random/Interleaver_core_random.hpp>\n-#include <Tools/Interleaver/Interleaver_core.hpp>\n-#include <Tools/Interleaver/Golden/Interleaver_core_golden.hpp>\n-#include <Tools/Interleaver/Row_column/Interleaver_core_row_column.hpp>\n-#include <Tools/Interleaver/User/Interleaver_core_user.hpp>\n-#include <Tools/Interleaver/Random_column/Interleaver_core_random_column.hpp>\n-#include <Tools/Interleaver/NO/Interleaver_core_NO.hpp>\n-#include <Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS1.hpp>\n-#include <Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS2.hpp>\n-#include <Tools/Interleaver/CCSDS/Interleaver_core_CCSDS.hpp>\n-#include <Tools/Interleaver/Column_row/Interleaver_core_column_row.hpp>\n-#include <Tools/Interleaver/LTE/Interleaver_core_LTE.hpp>\n-#include <Tools/Threads/Barrier.hpp>\n-#include <Tools/Math/Galois.hpp>\n-#include <Tools/Algo/Sort/LC_sorter.hpp>\n-#include <Tools/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/Algo/Predicate_ite.hpp>\n-#include <Tools/Algo/Bit_packer.hpp>\n-#include <Tools/Algo/Gaussian_noise_generator/Fast/Gaussian_noise_generator_fast.hpp>\n-#include <Tools/Algo/Gaussian_noise_generator/Standard/Gaussian_noise_generator_std.hpp>\n-#include <Tools/Algo/Gaussian_noise_generator/MKL/Gaussian_noise_generator_MKL.hpp>\n-#include <Tools/Algo/Gaussian_noise_generator/Gaussian_noise_generator.hpp>\n-#include <Tools/Algo/Gaussian_noise_generator/GSL/Gaussian_noise_generator_GSL.hpp>\n-#include <Tools/SystemC/SC_Funnel.hpp>\n-#include <Tools/SystemC/SC_Router.hpp>\n-#include <Tools/SystemC/SC_Dummy.hpp>\n-#include <Tools/SystemC/SC_Predicate.hpp>\n-#include <Tools/SystemC/SC_Debug.hpp>\n-#include <Tools/SystemC/SC_Duplicator.hpp>\n-#include <Tools/Code/Polar/API/API_polar_static_intra_32bit.hpp>\n-#include <Tools/Code/Polar/API/API_polar_dynamic_seq.hpp>\n-#include <Tools/Code/Polar/API/API_polar.hpp>\n-#include <Tools/Code/Polar/API/API_polar_static_inter.hpp>\n-#include <Tools/Code/Polar/API/API_polar_static_inter_8bit_bitpacking.hpp>\n-#include <Tools/Code/Polar/API/API_polar_static_seq.hpp>\n-#include <Tools/Code/Polar/API/API_polar_dynamic_inter.hpp>\n-#include <Tools/Code/Polar/API/API_polar_static_intra_8bit.hpp>\n-#include <Tools/Code/Polar/API/API_polar_static_intra_16bit.hpp>\n-#include <Tools/Code/Polar/API/API_polar_dynamic_inter_8bit_bitpacking.hpp>\n-#include <Tools/Code/Polar/API/API_polar_dynamic_intra.hpp>\n-#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_GA.hpp>\n-#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.hpp>\n-#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_file.hpp>\n-#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_TV.hpp>\n-#include <Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp>\n-#include <Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp>\n-#include <Tools/Code/Polar/Patterns/Pattern_polar_std.hpp>\n-#include <Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp>\n-#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/Pattern_polar_r0.hpp>\n-#include <Tools/Code/Polar/Pattern_polar_parser.hpp>\n-#include <Tools/Code/Polar/Frozenbits_notifier.hpp>\n-#include <Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp>\n-#include <Tools/Code/LDPC/QC/QC.hpp>\n-#include <Tools/Code/LDPC/AList/AList.hpp>\n-#include <Tools/Code/BCH/BCH_polynomial_generator.hpp>\n-#include <Tools/Code/SCMA/modem_SCMA_functions.hpp>\n-#include <Tools/Code/Turbo/Post_processing_SISO/Post_processing_SISO.hpp>\n-#include <Tools/Code/Turbo/Post_processing_SISO/Self_corrected/Self_corrected.hpp>\n-#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor_constant.hpp>\n-#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/Display/Frame_trace/Frame_trace.hpp>\n-#include <Tools/Display/Dumper/Dumper.hpp>\n-#include <Tools/Display/Dumper/Dumper_reduction.hpp>\n-#include <Tools/Display/Statistics/Statistics.hpp>\n-#include <Tools/Display/Terminal/Terminal.hpp>\n-#include <Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n-#include <Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n-#include <Tools/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/Interleaver.hpp>\n+#include <Factory/Module/Puncturer/Polar/Puncturer_polar.hpp>\n+#include <Factory/Module/Puncturer/LDPC/Puncturer_LDPC.hpp>\n+#include <Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n+#include <Factory/Module/Puncturer/Puncturer.hpp>\n+#include <Factory/Module/Puncturer/Turbo_DB/Puncturer_turbo_DB.hpp>\n+#include <Factory/Module/Codec/RSC/Codec_RSC.hpp>\n+#include <Factory/Module/Codec/RA/Codec_RA.hpp>\n+#include <Factory/Module/Codec/Polar/Codec_polar.hpp>\n+#include <Factory/Module/Codec/Codec_SISO.hpp>\n+#include <Factory/Module/Codec/LDPC/Codec_LDPC.hpp>\n+#include <Factory/Module/Codec/Turbo/Codec_turbo.hpp>\n+#include <Factory/Module/Codec/RSC_DB/Codec_RSC_DB.hpp>\n+#include <Factory/Module/Codec/Codec_SIHO.hpp>\n+#include <Factory/Module/Codec/Codec.hpp>\n+#include <Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp>\n+#include <Factory/Module/Codec/Codec_SISO_SIHO.hpp>\n+#include <Factory/Module/Codec/Repetition/Codec_repetition.hpp>\n+#include <Factory/Module/Codec/BCH/Codec_BCH.hpp>\n+#include <Factory/Module/Codec/Uncoded/Codec_uncoded.hpp>\n+#include <Factory/Module/Source/Source.hpp>\n+#include <Factory/Module/Quantizer/Quantizer.hpp>\n+#include <Factory/Module/Monitor/Monitor.hpp>\n+#include <Factory/Module/Monitor/BFER/Monitor_BFER.hpp>\n+#include <Factory/Module/Monitor/EXIT/Monitor_EXIT.hpp>\n+#include <Factory/Module/Interleaver/Interleaver.hpp>\n+#include <Factory/Module/Decoder/RSC/Decoder_RSC.hpp>\n+#include <Factory/Module/Decoder/RA/Decoder_RA.hpp>\n+#include <Factory/Module/Decoder/Polar/Decoder_polar.hpp>\n+#include <Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp>\n+#include <Factory/Module/Decoder/Turbo/Decoder_turbo.hpp>\n+#include <Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.hpp>\n+#include <Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp>\n+#include <Factory/Module/Decoder/Repetition/Decoder_repetition.hpp>\n+#include <Factory/Module/Decoder/Decoder.hpp>\n+#include <Factory/Module/Decoder/BCH/Decoder_BCH.hpp>\n+#include <Factory/Module/Decoder/NO/Decoder_NO.hpp>\n+#include <Factory/Module/Encoder/RSC/Encoder_RSC.hpp>\n+#include <Factory/Module/Encoder/RA/Encoder_RA.hpp>\n+#include <Factory/Module/Encoder/Polar/Encoder_polar.hpp>\n+#include <Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp>\n+#include <Factory/Module/Encoder/Turbo/Encoder_turbo.hpp>\n+#include <Factory/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp>\n+#include <Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp>\n+#include <Factory/Module/Encoder/Repetition/Encoder_repetition.hpp>\n+#include <Factory/Module/Encoder/Encoder.hpp>\n+#include <Factory/Module/Encoder/BCH/Encoder_BCH.hpp>\n+#include <Factory/Module/Modem/Modem.hpp>\n+#include <Factory/Module/Channel/Channel.hpp>\n+#include <Factory/Module/CRC/CRC.hpp>\n+#include <Factory/Module/Coset/Coset.hpp>\n+#include <Factory/Simulation/Simulation.hpp>\n+#include <Factory/Simulation/BFER/BFER_ite.hpp>\n+#include <Factory/Simulation/BFER/BFER_std.hpp>\n+#include <Factory/Simulation/BFER/BFER.hpp>\n+#include <Factory/Simulation/EXIT/EXIT.hpp>\n+#include <Factory/Factory.hpp>\n+#include <Factory/Launcher/Launcher.hpp>\n+#include <Factory/Tools/Code/Polar/Frozenbits_generator.hpp>\n+#include <Factory/Tools/Code/Turbo/Flip_and_check_DB.hpp>\n+#include <Factory/Tools/Code/Turbo/Scaling_factor.hpp>\n+#include <Factory/Tools/Code/Turbo/Flip_and_check.hpp>\n+#include <Factory/Tools/Interleaver/Interleaver_core.hpp>\n+#include <Factory/Tools/Display/Terminal/Terminal.hpp>\n+#include <Factory/Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n+#include <Factory/Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n#include <Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp>\n+#include <Module/Puncturer/LDPC/Puncturer_LDPC.hpp>\n+#include <Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n#include <Module/Puncturer/Puncturer.hpp>\n#include <Module/Puncturer/Turbo_DB/Puncturer_turbo_DB.hpp>\n-#include <Module/Puncturer/LDPC/Puncturer_LDPC.hpp>\n#include <Module/Puncturer/NO/Puncturer_NO.hpp>\n-#include <Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n-#include <Module/Encoder/Polar/Encoder_polar.hpp>\n-#include <Module/Encoder/Polar/Encoder_polar_sys.hpp>\n-#include <Module/Encoder/AZCW/Encoder_AZCW.hpp>\n-#include <Module/Encoder/RSC/Encoder_RSC_generic_json_sys.hpp>\n-#include <Module/Encoder/RSC/Encoder_RSC_sys.hpp>\n-#include <Module/Encoder/RSC/Encoder_RSC_generic_sys.hpp>\n-#include <Module/Encoder/RSC/Encoder_RSC3_CPE_sys.hpp>\n-#include <Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp>\n-#include <Module/Encoder/Repetition/Encoder_repetition_sys.hpp>\n-#include <Module/Encoder/LDPC/Encoder_LDPC.hpp>\n-#include <Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp>\n-#include <Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.hpp>\n-#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp>\n-#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2_constants_64800.hpp>\n-#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2_constants.hpp>\n-#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2_constants_16200.hpp>\n-#include <Module/Encoder/Coset/Encoder_coset.hpp>\n-#include <Module/Encoder/User/Encoder_user.hpp>\n-#include <Module/Encoder/BCH/Encoder_BCH.hpp>\n-#include <Module/Encoder/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/Task.hpp>\n-#include <Module/Channel/Channel.hpp>\n-#include <Module/Channel/AWGN/Channel_AWGN_LLR.hpp>\n-#include <Module/Channel/User/Channel_user.hpp>\n-#include <Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.hpp>\n-#include <Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp>\n-#include <Module/Channel/NO/Channel_NO.hpp>\n-#include <Module/Decoder/Decoder_SISO_SIHO.hpp>\n-#include <Module/Decoder/Decoder.hpp>\n-#include <Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp>\n-#include <Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp>\n-#include <Module/Decoder/Polar/SC/Decoder_polar_SC_naive.hpp>\n-#include <Module/Decoder/Polar/SC/Decoder_polar_SC_naive_sys.hpp>\n-#include <Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.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/Decoder_polar_SCL_naive.hpp>\n-#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp>\n-#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA_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/Decoder_polar_SCL_MEM_fast_sys.hpp>\n-#include <Module/Decoder/Decoder_SIHO_HIHO.hpp>\n-#include <Module/Decoder/Decoder_HIHO.hpp>\n+#include <Module/Codec/RSC/Codec_RSC.hpp>\n+#include <Module/Codec/RA/Codec_RA.hpp>\n+#include <Module/Codec/Polar/Codec_polar.hpp>\n+#include <Module/Codec/Codec_SISO.hpp>\n+#include <Module/Codec/LDPC/Codec_LDPC.hpp>\n+#include <Module/Codec/Turbo/Codec_turbo.hpp>\n+#include <Module/Codec/RSC_DB/Codec_RSC_DB.hpp>\n+#include <Module/Codec/Codec_SIHO.hpp>\n+#include <Module/Codec/Codec.hpp>\n+#include <Module/Codec/Turbo_DB/Codec_turbo_DB.hpp>\n+#include <Module/Codec/Codec_SISO_SIHO.hpp>\n+#include <Module/Codec/Repetition/Codec_repetition.hpp>\n+#include <Module/Codec/BCH/Codec_BCH.hpp>\n+#include <Module/Codec/Uncoded/Codec_uncoded.hpp>\n+#include <Module/Source/Source.hpp>\n+#include <Module/Source/AZCW/Source_AZCW.hpp>\n+#include <Module/Source/Random/Source_random_fast.hpp>\n+#include <Module/Source/Random/Source_random.hpp>\n+#include <Module/Source/User/Source_user.hpp>\n+#include <Module/Quantizer/Fast/Quantizer_fast.hpp>\n+#include <Module/Quantizer/Tricky/Quantizer_tricky.hpp>\n+#include <Module/Quantizer/Quantizer.hpp>\n+#include <Module/Quantizer/Standard/Quantizer_standard.hpp>\n+#include <Module/Quantizer/NO/Quantizer_NO.hpp>\n+#include <Module/Monitor/Monitor.hpp>\n+#include <Module/Monitor/BFER/Monitor_BFER_reduction.hpp>\n+#include <Module/Monitor/BFER/Monitor_BFER_reduction_mpi.hpp>\n+#include <Module/Monitor/BFER/Monitor_BFER.hpp>\n+#include <Module/Monitor/EXIT/Monitor_EXIT.hpp>\n+#include <Module/SC_Module.hpp>\n+#include <Module/Interleaver/Interleaver.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x4_AVX.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.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_SSE.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std_json.hpp>\n-#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic.hpp>\n-#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra.hpp>\n-#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_std.hpp>\n-#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_fast.hpp>\n-#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_very_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_std.hpp>\n-#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter.hpp>\n#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_fast.hpp>\n-#include <Module/Decoder/RSC/BCJR/Decoder_RSC_BCJR.hpp>\n-#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_very_fast.hpp>\n-#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_very_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_std.hpp>\n+#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_scan.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_very_fast.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_fast.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_std.hpp>\n-#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x4_AVX.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/Repetition/Decoder_repetition_fast.hpp>\n-#include <Module/Decoder/Repetition/Decoder_repetition_std.hpp>\n-#include <Module/Decoder/Repetition/Decoder_repetition.hpp>\n-#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp>\n-#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp>\n-#include <Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp>\n-#include <Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp>\n-#include <Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp>\n-#include <Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp>\n+#include <Module/Decoder/RSC/BCJR/Decoder_RSC_BCJR.hpp>\n+#include <Module/Decoder/RA/Decoder_RA.hpp>\n+#include <Module/Decoder/Decoder_SISO_SIHO.hpp>\n+#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp>\n+#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive_sys.hpp>\n+#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp>\n+#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive.hpp>\n+#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA_sys.hpp>\n+#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.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/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_fast_sys.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/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/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/ONMS/Decoder_LDPC_BP_flooding_offset_normalize_min_sum.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp>\n-#include <Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.hpp>\n-#include <Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.hpp>\n+#include <Module/Decoder/LDPC/BP/Flooding/AMS/Decoder_LDPC_BP_flooding_approximate_min_star.hpp>\n+#include <Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp>\n#include <Module/Decoder/LDPC/BP/Decoder_LDPC_BP.hpp>\n-#include <Module/Decoder/Decoder_SIHO.hpp>\n-#include <Module/Decoder/BCH/Decoder_BCH.hpp>\n-#include <Module/Decoder/Generic/Chase/Decoder_chase_std.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp>\n+#include <Module/Decoder/Turbo/Decoder_turbo.hpp>\n+#include <Module/Decoder/Turbo/Decoder_turbo_fast.hpp>\n+#include <Module/Decoder/Turbo/Decoder_turbo_std.hpp>\n+#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS1.hpp>\n+#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR.hpp>\n+#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS2.hpp>\n+#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_generic.hpp>\n+#include <Module/Decoder/Generic/ML/Decoder_maximum_likelihood_std.hpp>\n#include <Module/Decoder/Generic/ML/Decoder_maximum_likelihood.hpp>\n#include <Module/Decoder/Generic/ML/Decoder_maximum_likelihood_naive.hpp>\n-#include <Module/Decoder/Generic/ML/Decoder_maximum_likelihood_std.hpp>\n+#include <Module/Decoder/Generic/Chase/Decoder_chase_std.hpp>\n#include <Module/Decoder/Decoder_SISO.hpp>\n+#include <Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp>\n+#include <Module/Decoder/Decoder_SIHO_HIHO.hpp>\n+#include <Module/Decoder/Decoder_SIHO.hpp>\n+#include <Module/Decoder/Decoder_HIHO.hpp>\n+#include <Module/Decoder/Repetition/Decoder_repetition.hpp>\n+#include <Module/Decoder/Repetition/Decoder_repetition_fast.hpp>\n+#include <Module/Decoder/Repetition/Decoder_repetition_std.hpp>\n+#include <Module/Decoder/Decoder.hpp>\n+#include <Module/Decoder/BCH/Decoder_BCH.hpp>\n#include <Module/Decoder/NO/Decoder_NO.hpp>\n-#include <Module/Decoder/RA/Decoder_RA.hpp>\n-#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_generic.hpp>\n-#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS2.hpp>\n-#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR.hpp>\n-#include <Module/Decoder/RSC_DB/BCJR/Decoder_RSC_DB_BCJR_DVB_RCS1.hpp>\n-#include <Module/Decoder/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/Socket.hpp>\n-#include <Module/Coset/Real/Coset_real.hpp>\n-#include <Module/Coset/Coset.hpp>\n-#include <Module/Coset/Bit/Coset_bit.hpp>\n-#include <Module/Source/Random/Source_random_fast.hpp>\n-#include <Module/Source/Random/Source_random.hpp>\n-#include <Module/Source/AZCW/Source_AZCW.hpp>\n-#include <Module/Source/Source.hpp>\n-#include <Module/Source/User/Source_user.hpp>\n-#include <Module/Monitor/EXIT/Monitor_EXIT.hpp>\n-#include <Module/Monitor/Monitor.hpp>\n-#include <Module/Monitor/BFER/Monitor_BFER.hpp>\n-#include <Module/Monitor/BFER/Monitor_BFER_reduction.hpp>\n-#include <Module/Monitor/BFER/Monitor_BFER_reduction_mpi.hpp>\n-#include <Module/Quantizer/Fast/Quantizer_fast.hpp>\n-#include <Module/Quantizer/Standard/Quantizer_standard.hpp>\n-#include <Module/Quantizer/Quantizer.hpp>\n-#include <Module/Quantizer/Tricky/Quantizer_tricky.hpp>\n-#include <Module/Quantizer/NO/Quantizer_NO.hpp>\n-#include <Module/CRC/Polynomial/CRC_polynomial.hpp>\n-#include <Module/CRC/Polynomial/CRC_polynomial_fast.hpp>\n-#include <Module/CRC/Polynomial/CRC_polynomial_inter.hpp>\n-#include <Module/CRC/NO/CRC_NO.hpp>\n-#include <Module/CRC/CRC.hpp>\n-#include <Module/Modem/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/Encoder/RSC/Encoder_RSC3_CPE_sys.hpp>\n+#include <Module/Encoder/RSC/Encoder_RSC_generic_sys.hpp>\n+#include <Module/Encoder/RSC/Encoder_RSC_sys.hpp>\n+#include <Module/Encoder/RSC/Encoder_RSC_generic_json_sys.hpp>\n+#include <Module/Encoder/RA/Encoder_RA.hpp>\n+#include <Module/Encoder/Polar/Encoder_polar_sys.hpp>\n+#include <Module/Encoder/Polar/Encoder_polar.hpp>\n+#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp>\n+#include <Module/Encoder/LDPC/From_QC/Encoder_LDPC_from_QC.hpp>\n+#include <Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp>\n+#include <Module/Encoder/LDPC/Encoder_LDPC.hpp>\n+#include <Module/Encoder/Turbo/Encoder_turbo_legacy.hpp>\n+#include <Module/Encoder/Turbo/Encoder_turbo.hpp>\n+#include <Module/Encoder/AZCW/Encoder_AZCW.hpp>\n+#include <Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp>\n+#include <Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp>\n+#include <Module/Encoder/Repetition/Encoder_repetition_sys.hpp>\n+#include <Module/Encoder/User/Encoder_user.hpp>\n+#include <Module/Encoder/Encoder.hpp>\n+#include <Module/Encoder/BCH/Encoder_BCH.hpp>\n+#include <Module/Encoder/Coset/Encoder_coset.hpp>\n+#include <Module/Encoder/NO/Encoder_NO.hpp>\n+#include <Module/Modem/SCMA/Modem_SCMA.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/CPM_parameters.hpp>\n+#include <Module/Modem/CPM/Modem_CPM.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/PSK/Modem_PSK.hpp>\n#include <Module/Modem/OOK/Modem_OOK.hpp>\n-#include <Module/Modem/SCMA/Modem_SCMA.hpp>\n-#include <Module/SC_Module.hpp>\n+#include <Module/Modem/Modem.hpp>\n+#include <Module/Modem/User/Modem_user.hpp>\n+#include <Module/Modem/BPSK/Modem_BPSK.hpp>\n+#include <Module/Modem/BPSK/Modem_BPSK_fast.hpp>\n+#include <Module/Socket.hpp>\n+#include <Module/Task.hpp>\n+#include <Module/Channel/AWGN/Channel_AWGN_LLR.hpp>\n+#include <Module/Channel/Channel.hpp>\n+#include <Module/Channel/User/Channel_user.hpp>\n+#include <Module/Channel/Rayleigh/Channel_Rayleigh_LLR_user.hpp>\n+#include <Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp>\n+#include <Module/Channel/NO/Channel_NO.hpp>\n+#include <Module/CRC/Polynomial/CRC_polynomial_fast.hpp>\n+#include <Module/CRC/Polynomial/CRC_polynomial_inter.hpp>\n+#include <Module/CRC/Polynomial/CRC_polynomial.hpp>\n+#include <Module/CRC/CRC.hpp>\n+#include <Module/CRC/NO/CRC_NO.hpp>\n+#include <Module/Coset/Real/Coset_real.hpp>\n+#include <Module/Coset/Bit/Coset_bit.hpp>\n+#include <Module/Coset/Coset.hpp>\n#include <Module/Module.hpp>\n-#include <Module/Codec/Codec_SIHO.hpp>\n-#include <Module/Codec/Polar/Codec_polar.hpp>\n-#include <Module/Codec/Codec_SISO.hpp>\n-#include <Module/Codec/Codec_SISO_SIHO.hpp>\n-#include <Module/Codec/RSC/Codec_RSC.hpp>\n-#include <Module/Codec/Turbo_DB/Codec_turbo_DB.hpp>\n-#include <Module/Codec/Codec.hpp>\n-#include <Module/Codec/Repetition/Codec_repetition.hpp>\n-#include <Module/Codec/LDPC/Codec_LDPC.hpp>\n-#include <Module/Codec/Uncoded/Codec_uncoded.hpp>\n-#include <Module/Codec/BCH/Codec_BCH.hpp>\n-#include <Module/Codec/RA/Codec_RA.hpp>\n-#include <Module/Codec/RSC_DB/Codec_RSC_DB.hpp>\n-#include <Module/Codec/Turbo/Codec_turbo.hpp>\n-#include <Factory/Tools/Interleaver/Interleaver_core.hpp>\n-#include <Factory/Tools/Code/Polar/Frozenbits_generator.hpp>\n-#include <Factory/Tools/Code/Turbo/Flip_and_check.hpp>\n-#include <Factory/Tools/Code/Turbo/Scaling_factor.hpp>\n-#include <Factory/Tools/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/Factory.hpp>\n-#include <Factory/Module/Interleaver/Interleaver.hpp>\n-#include <Factory/Module/Puncturer/Polar/Puncturer_polar.hpp>\n-#include <Factory/Module/Puncturer/Puncturer.hpp>\n-#include <Factory/Module/Puncturer/Turbo_DB/Puncturer_turbo_DB.hpp>\n-#include <Factory/Module/Puncturer/LDPC/Puncturer_LDPC.hpp>\n-#include <Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n-#include <Factory/Module/Encoder/Polar/Encoder_polar.hpp>\n-#include <Factory/Module/Encoder/RSC/Encoder_RSC.hpp>\n-#include <Factory/Module/Encoder/Turbo_DB/Encoder_turbo_DB.hpp>\n-#include <Factory/Module/Encoder/Repetition/Encoder_repetition.hpp>\n-#include <Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp>\n-#include <Factory/Module/Encoder/BCH/Encoder_BCH.hpp>\n-#include <Factory/Module/Encoder/Encoder.hpp>\n-#include <Factory/Module/Encoder/RA/Encoder_RA.hpp>\n-#include <Factory/Module/Encoder/RSC_DB/Encoder_RSC_DB.hpp>\n-#include <Factory/Module/Encoder/Turbo/Encoder_turbo.hpp>\n-#include <Factory/Module/Channel/Channel.hpp>\n-#include <Factory/Module/Decoder/Decoder.hpp>\n-#include <Factory/Module/Decoder/Polar/Decoder_polar.hpp>\n-#include <Factory/Module/Decoder/RSC/Decoder_RSC.hpp>\n-#include <Factory/Module/Decoder/Turbo_DB/Decoder_turbo_DB.hpp>\n-#include <Factory/Module/Decoder/Repetition/Decoder_repetition.hpp>\n-#include <Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp>\n-#include <Factory/Module/Decoder/BCH/Decoder_BCH.hpp>\n-#include <Factory/Module/Decoder/NO/Decoder_NO.hpp>\n-#include <Factory/Module/Decoder/RA/Decoder_RA.hpp>\n-#include <Factory/Module/Decoder/RSC_DB/Decoder_RSC_DB.hpp>\n-#include <Factory/Module/Decoder/Turbo/Decoder_turbo.hpp>\n-#include <Factory/Module/Coset/Coset.hpp>\n-#include <Factory/Module/Source/Source.hpp>\n-#include <Factory/Module/Monitor/EXIT/Monitor_EXIT.hpp>\n-#include <Factory/Module/Monitor/Monitor.hpp>\n-#include <Factory/Module/Monitor/BFER/Monitor_BFER.hpp>\n-#include <Factory/Module/Quantizer/Quantizer.hpp>\n-#include <Factory/Module/CRC/CRC.hpp>\n-#include <Factory/Module/Modem/Modem.hpp>\n-#include <Factory/Module/Codec/Codec_SIHO.hpp>\n-#include <Factory/Module/Codec/Polar/Codec_polar.hpp>\n-#include <Factory/Module/Codec/Codec_SISO.hpp>\n-#include <Factory/Module/Codec/Codec_SISO_SIHO.hpp>\n-#include <Factory/Module/Codec/RSC/Codec_RSC.hpp>\n-#include <Factory/Module/Codec/Turbo_DB/Codec_turbo_DB.hpp>\n-#include <Factory/Module/Codec/Codec.hpp>\n-#include <Factory/Module/Codec/Repetition/Codec_repetition.hpp>\n-#include <Factory/Module/Codec/LDPC/Codec_LDPC.hpp>\n-#include <Factory/Module/Codec/Uncoded/Codec_uncoded.hpp>\n-#include <Factory/Module/Codec/BCH/Codec_BCH.hpp>\n-#include <Factory/Module/Codec/RA/Codec_RA.hpp>\n-#include <Factory/Module/Codec/RSC_DB/Codec_RSC_DB.hpp>\n-#include <Factory/Module/Codec/Turbo/Codec_turbo.hpp>\n-#include <Factory/Launcher/Launcher.hpp>\n-#include <Factory/Simulation/Simulation.hpp>\n-#include <Factory/Simulation/EXIT/EXIT.hpp>\n-#include <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 <Simulation/Simulation.hpp>\n+#include <Simulation/BFER/Iterative/BFER_ite.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/BFER.hpp>\n+#include <Simulation/BFER/Standard/BFER_std.hpp>\n+#include <Simulation/BFER/Standard/Threads/BFER_std_threads.hpp>\n+#include <Simulation/BFER/Standard/SystemC/SC_BFER_std.hpp>\n+#include <Simulation/EXIT/EXIT.hpp>\n#include <Launcher/Code/RSC/RSC.hpp>\n+#include <Launcher/Code/RA/RA.hpp>\n+#include <Launcher/Code/Polar/Polar.hpp>\n+#include <Launcher/Code/LDPC/LDPC.hpp>\n+#include <Launcher/Code/Turbo/Turbo.hpp>\n+#include <Launcher/Code/RSC_DB/RSC_DB.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/Code/Uncoded/Uncoded.hpp>\n+#include <Launcher/Launcher.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/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/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 <Launcher/Simulation/BFER_std.hpp>\n+#include <Tools/Perf/Reorderer/Reorderer.hpp>\n+#include <Tools/Code/Polar/Frozenbits_notifier.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_i.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_rep.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_r0.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_r1.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_std.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_r0_left.hpp>\n+#include <Tools/Code/Polar/Patterns/Pattern_polar_rep_left.hpp>\n+#include <Tools/Code/Polar/Pattern_polar_parser.hpp>\n+#include <Tools/Code/Polar/API/API_polar_dynamic_inter.hpp>\n+#include <Tools/Code/Polar/API/API_polar.hpp>\n+#include <Tools/Code/Polar/API/API_polar_static_seq.hpp>\n+#include <Tools/Code/Polar/API/API_polar_static_intra_8bit.hpp>\n+#include <Tools/Code/Polar/API/API_polar_dynamic_inter_8bit_bitpacking.hpp>\n+#include <Tools/Code/Polar/API/API_polar_dynamic_intra.hpp>\n+#include <Tools/Code/Polar/API/API_polar_dynamic_seq.hpp>\n+#include <Tools/Code/Polar/API/API_polar_static_inter_8bit_bitpacking.hpp>\n+#include <Tools/Code/Polar/API/API_polar_static_intra_16bit.hpp>\n+#include <Tools/Code/Polar/API/API_polar_static_intra_32bit.hpp>\n+#include <Tools/Code/Polar/API/API_polar_static_inter.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_TV.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_GA.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_file.hpp>\n+#include <Tools/Code/LDPC/QC/QC.hpp>\n+#include <Tools/Code/LDPC/AList/AList.hpp>\n+#include <Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp>\n+#include <Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants_64800.hpp>\n+#include <Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants_16200.hpp>\n+#include <Tools/Code/LDPC/Standard/DVBS2/DVBS2_constants.hpp>\n+#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_adaptive.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor_constant.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/Scaling_factor/Scaling_factor_vec.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.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/Flip_and_check/Flip_and_check.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/Post_processing_SISO.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/Self_corrected/Self_corrected.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker.hpp>\n+#include <Tools/Code/Turbo/Post_processing_SISO/CRC/CRC_checker_DB.hpp>\n+#include <Tools/Code/SCMA/modem_SCMA_functions.hpp>\n+#include <Tools/Code/BCH/BCH_polynomial_generator.hpp>\n+#include <Tools/Exception/cannot_allocate/cannot_allocate.hpp>\n+#include <Tools/Exception/unimplemented_error/unimplemented_error.hpp>\n+#include <Tools/Exception/runtime_error/runtime_error.hpp>\n+#include <Tools/Exception/logic_error/logic_error.hpp>\n+#include <Tools/Exception/overflow_error/overflow_error.hpp>\n+#include <Tools/Exception/length_error/length_error.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/underflow_error/underflow_error.hpp>\n+#include <Tools/Exception/domain_error/domain_error.hpp>\n+#include <Tools/Exception/invalid_argument/invalid_argument.hpp>\n+#include <Tools/Exception/exception.hpp>\n+#include <Tools/Threads/Barrier.hpp>\n+#include <Tools/Algo/Predicate_ite.hpp>\n+#include <Tools/Algo/Predicate.hpp>\n+#include <Tools/Algo/Tree/Binary_tree_metric.hpp>\n+#include <Tools/Algo/Tree/Binary_tree.hpp>\n+#include <Tools/Algo/Tree/Binary_node.hpp>\n+#include <Tools/Algo/Sparse_matrix/Sparse_matrix.hpp>\n+#include <Tools/Algo/PRNG/PRNG_MT19937.hpp>\n+#include <Tools/Algo/PRNG/PRNG_MT19937_simd.hpp>\n+#include <Tools/Algo/Bit_packer.hpp>\n+#include <Tools/Algo/Sort/LC_sorter.hpp>\n+#include <Tools/Algo/Sort/LC_sorter_simd.hpp>\n+#include <Tools/Algo/Gaussian_noise_generator/MKL/Gaussian_noise_generator_MKL.hpp>\n+#include <Tools/Algo/Gaussian_noise_generator/Fast/Gaussian_noise_generator_fast.hpp>\n+#include <Tools/Algo/Gaussian_noise_generator/Gaussian_noise_generator.hpp>\n+#include <Tools/Algo/Gaussian_noise_generator/GSL/Gaussian_noise_generator_GSL.hpp>\n+#include <Tools/Algo/Gaussian_noise_generator/Standard/Gaussian_noise_generator_std.hpp>\n+#include <Tools/Interleaver/Row_column/Interleaver_core_row_column.hpp>\n+#include <Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS1.hpp>\n+#include <Tools/Interleaver/ARP/Interleaver_core_ARP_DVB_RCS2.hpp>\n+#include <Tools/Interleaver/Random_column/Interleaver_core_random_column.hpp>\n+#include <Tools/Interleaver/Random/Interleaver_core_random.hpp>\n+#include <Tools/Interleaver/Golden/Interleaver_core_golden.hpp>\n+#include <Tools/Interleaver/CCSDS/Interleaver_core_CCSDS.hpp>\n+#include <Tools/Interleaver/User/Interleaver_core_user.hpp>\n+#include <Tools/Interleaver/Column_row/Interleaver_core_column_row.hpp>\n+#include <Tools/Interleaver/LTE/Interleaver_core_LTE.hpp>\n+#include <Tools/Interleaver/Interleaver_core.hpp>\n+#include <Tools/Interleaver/NO/Interleaver_core_NO.hpp>\n+#include <Tools/Arguments_reader.hpp>\n+#include <Tools/Display/Terminal/Terminal.hpp>\n+#include <Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n+#include <Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n+#include <Tools/Display/Statistics/Statistics.hpp>\n+#include <Tools/Display/Frame_trace/Frame_trace.hpp>\n+#include <Tools/Display/Dumper/Dumper_reduction.hpp>\n+#include <Tools/Display/Dumper/Dumper.hpp>\n+#include <Tools/SystemC/SC_Dummy.hpp>\n+#include <Tools/SystemC/SC_Debug.hpp>\n+#include <Tools/SystemC/SC_Duplicator.hpp>\n+#include <Tools/SystemC/SC_Funnel.hpp>\n+#include <Tools/SystemC/SC_Predicate.hpp>\n+#include <Tools/SystemC/SC_Router.hpp>\n+#include <Tools/Math/Galois.hpp>\n#endif\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix bad includes in 'my_project_with_aff3ct'.
8,490
14.02.2018 21:59:36
-3,600
b12dd4c7c43211591e352586ff8d663da444bbc9
Fix SC compilation.
[ { "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": "@@ -133,7 +133,7 @@ void SC_BFER_ite<B,R,Q>\nthis->router = new tools::SC_Router (p, \"Router\" );\n- this->funnel = new tools::SC_Funnel (p, \"Funnel\" );\n+ this->funnel = new tools::SC_Funnel ( \"Funnel\" );\nthis->predicate = new tools::SC_Predicate(p, \"Predicate\");\nthis->bind_sockets();\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/SystemC/SC_Debug.hpp", "new_path": "src/Tools/SystemC/SC_Debug.hpp", "diff": "@@ -30,7 +30,8 @@ private:\nconst int debug_limit;\npublic:\n- SC_Debug(std::string &message = std::string(\"Debug:\\n\"), const int debug_limit = 0, sc_core::sc_module_name name = \"SC_Debug\")\n+ SC_Debug(const std::string &message = std::string(\"Debug:\\n\"), const int debug_limit = 0,\n+ sc_core::sc_module_name name = \"SC_Debug\")\n: sc_module(name), s_in(\"s_in\"), s_out(\"s_out\"), message(message), debug_limit(debug_limit)\n{\ns_in.register_b_transport(this, &SC_Debug::b_transport);\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/SystemC/SC_Funnel.hpp", "new_path": "src/Tools/SystemC/SC_Funnel.hpp", "diff": "@@ -25,12 +25,9 @@ public:\ntlm_utils::simple_target_socket <SC_Funnel> s_in2;\ntlm_utils::simple_initiator_socket<SC_Funnel> s_out;\n-private:\n- Predicate &p;\n-\npublic:\n- SC_Funnel(Predicate &p, sc_core::sc_module_name name = \"SC_Double_input\")\n- : sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"), s_out(\"s_out\"), p(p)\n+ SC_Funnel(sc_core::sc_module_name name = \"SC_Double_input\")\n+ : sc_module(name), s_in1(\"s_in1\"), s_in2(\"s_in2\"), s_out(\"s_out\")\n{\ns_in1.register_b_transport(this, &SC_Funnel::b_transport);\ns_in2.register_b_transport(this, &SC_Funnel::b_transport);\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix SC compilation.
8,490
15.02.2018 09:21:36
-3,600
7fd59224fe854303c11df5ad706d9fc9c90e72e9
A new compilation tests (8-bit, MPI and SystemC) in the CI.
[ { "change_type": "MODIFY", "old_path": ".gitlab-ci.yml", "new_path": ".gitlab-ci.yml", "diff": "@@ -38,6 +38,27 @@ build-linux-gcc:\nscript:\n- ./ci/build-linux-gcc.sh\n+build-linux-gcc-8-bit:\n+ stage: build\n+ tags:\n+ - linux\n+ script:\n+ - ./ci/build-linux-gcc-8-bit.sh\n+\n+build-linux-gcc-mpi:\n+ stage: build\n+ tags:\n+ - linux\n+ script:\n+ - ./ci/build-linux-gcc-mpi.sh\n+\n+build-linux-gcc-systemc:\n+ stage: build\n+ tags:\n+ - linux\n+ script:\n+ - ./ci/build-linux-gcc-systemc.sh\n+\nbuild-linux-clang:\nstage: build\ntags:\n" }, { "change_type": "ADD", "old_path": null, "new_path": "ci/build-linux-gcc-8-bit.sh", "diff": "+#!/bin/bash\n+set -x\n+\n+mkdir build\n+cd build\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DPREC_8_BIT\"\n+THREADS=$(grep -c ^processor /proc/cpuinfo)\n+make -j $THREADS\n+\n+./bin/aff3ct --version\n+./bin/aff3ct -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL --ter-freq 0\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "ci/build-linux-gcc-mpi.sh", "diff": "+#!/bin/bash\n+set -x\n+\n+mkdir build\n+cd build\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DENABLE_MPI=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+THREADS=$(grep -c ^processor /proc/cpuinfo)\n+make -j $THREADS\n+\n+./bin/aff3ct --version\n+mpirun -np $THREADS ./bin/aff3ct -t 1 -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL --ter-freq 0\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "ci/build-linux-gcc-systemc.sh", "diff": "+#!/bin/bash\n+set -x\n+\n+mkdir build\n+cd build\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_SYSTEMC=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+THREADS=$(grep -c ^processor /proc/cpuinfo)\n+make -j $THREADS\n+\n+./bin/aff3ct --version\n+./bin/aff3ct -t 1 -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL --ter-freq 0\n\\ No newline at end of file\n" } ]
C++
MIT License
aff3ct/aff3ct
A new compilation tests (8-bit, MPI and SystemC) in the CI.
8,490
15.02.2018 10:01:50
-3,600
c241a9070a31a4542261e6b08854d0f0e9ac33db
Fix the SystemC build test script.
[ { "change_type": "MODIFY", "old_path": "ci/build-linux-gcc-systemc.sh", "new_path": "ci/build-linux-gcc-systemc.sh", "diff": "#!/bin/bash\nset -x\n+cp $SYSTEMC_HOME/FindSystemC.cmake cmake/Modules/\n+cp $SYSTEMC_HOME/FindTLM.cmake cmake/Modules/\n+\nmkdir build\ncd build\ncmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_SYSTEMC=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix the SystemC build test script.
8,490
15.02.2018 10:37:20
-3,600
3adc086c07e73a4f5184707fd98d5746a93cc4c5
Modify the copyright date.
[ { "change_type": "MODIFY", "old_path": "src/main.cpp", "new_path": "src/main.cpp", "diff": "@@ -73,7 +73,7 @@ void print_version()\nstd::cout << \"aff3ct (\" << os << prec << \", \" << compiler << \" \" << compiler_version << \", \"\n<< mipp::InstructionFullType << \") \" << affect_version << std::endl;\n- std::cout << \"Copyright (c) 2016-2017 - MIT license.\" << std::endl;\n+ std::cout << \"Copyright (c) 2016-2018 - 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;\nexit(EXIT_SUCCESS);\n" } ]
C++
MIT License
aff3ct/aff3ct
Modify the copyright date.
8,490
15.02.2018 10:37:51
-3,600
c431455dfff0a008567ebc57d054fb2671f7a487
Do not show deprecated warnings.
[ { "change_type": "MODIFY", "old_path": "ci/build-linux-gcc-systemc.sh", "new_path": "ci/build-linux-gcc-systemc.sh", "diff": "@@ -6,7 +6,7 @@ cp $SYSTEMC_HOME/FindTLM.cmake cmake/Modules/\nmkdir build\ncd build\n-cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_SYSTEMC=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DENABLE_SYSTEMC=ON -DCMAKE_CXX_FLAGS=\"-Wall -Wno-deprecated-declarations -funroll-loops -march=native -DMULTI_PREC\"\nTHREADS=$(grep -c ^processor /proc/cpuinfo)\nmake -j $THREADS\n" } ]
C++
MIT License
aff3ct/aff3ct
Do not show deprecated warnings.
8,490
22.02.2018 18:35:50
-3,600
81a2a1bd7fbcf4464b7abde3a6a18efececdba5b
Improve the SC_FAST stores to support AVX512.
[ { "change_type": "MODIFY", "old_path": "lib/MIPP", "new_path": "lib/MIPP", "diff": "-Subproject commit 54cb5c4f7bbb2622d9c8a9b842f668f20e414382\n+Subproject commit 53cb460776b6eb64feaa41f672cc708409989607\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx", "diff": "@@ -413,16 +413,9 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n#if defined(ENABLE_BIT_PACKING)\nif (typeid(B) == typeid(signed char))\n{\n- if (!(fast_deinterleave = tools::char_itranspose((signed char*)s.data(),\n+ fast_deinterleave = tools::char_itranspose((signed char*)s.data(),\n(signed char*)s_bis.data(),\n- (int)this->N)))\n- {\n- std::stringstream message;\n- message << \"Unsupported 'N' value for itransposition: 'N' has to be greater or equal to 128 for \"\n- << \"SSE/NEON or to 256 for AVX ('N' = \" << this->N << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- else\n+ (int)this->N);\ntools::Bit_packer<B>::unpack(this->s_bis.data(), this->s.data(), this->N, n_frames);\n}\n#endif\n@@ -458,16 +451,9 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n#if defined(ENABLE_BIT_PACKING)\nif (typeid(B) == typeid(signed char))\n{\n- if (!(fast_deinterleave = tools::char_itranspose((signed char*)s.data(),\n+ fast_deinterleave = tools::char_itranspose((signed char*)s.data(),\n(signed char*)s_bis.data(),\n- (int)this->N)))\n- {\n- std::stringstream message;\n- message << \"Unsupported 'N' value for itransposition: 'N' has to be greater or equal to 128 for \"\n- << \"SSE/NEON or to 256 for AVX ('N' = \" << this->N << \").\";\n- throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n- }\n- else\n+ (int)this->N);\ntools::Bit_packer<B>::unpack(this->s_bis.data(), V_N, this->N, n_frames);\n}\n#endif\n" } ]
C++
MIT License
aff3ct/aff3ct
Improve the SC_FAST stores to support AVX512.
8,490
03.03.2018 12:58:32
-3,600
7d4023991008ee5951a168cc8feed4f3eff33466
Fix minor issues in the doc + add a readme for the doc generation.
[ { "change_type": "ADD", "old_path": null, "new_path": "doc/README.md", "diff": "+# AFF3CT Documentation Generation\n+\n+**AFF3CT** uses [Doxygen](http://www.doxygen.org) to generate automatically the documentation.\n+\n+Doxygen can easily be installed on Ubuntu/Debian systems like this:\n+\n+ $ sudo apt-get install doxygen\n+\n+To generates the documentation, you simply have to do:\n+\n+ $ doxygen config.txt\n+\n+The last command will create two folders: `html` and `latex`.\n+In the `html` folder you just have to open the `index.html` file to read the generated documentation.\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "doc/pages/Main.md", "new_path": "doc/pages/Main.md", "diff": "@@ -11,24 +11,25 @@ You can get the code source from the **GitHub repository**: [https://github.com/\nIn **AFF3CT** it is all about Simulation and Module. A Simulation object links a set of Module objects together.\nHere is the list of available type of Simulation:\n-- Simulation_BFER: dedicated to the [Bit Error Rate](https://en.wikipedia.org/wiki/Bit_error_rate) (BER) and Frame Error Rate (FER) performances,\n-- Simulation_BFERI: dedicated to the BER/FER performances with turbo-demodulation between the demodulator and the decoder,\n-- Simulation_EXIT: dedicated to the [EXtrinsic Information Transfer](https://en.wikipedia.org/wiki/EXIT_chart) (EXIT) chart.\n+- Simulation BER/FER (aff3ct::simulation::BFER_std): dedicated to the [Bit Error Rate](https://en.wikipedia.org/wiki/Bit_error_rate) (BER) and Frame Error Rate (FER) performances,\n+- Simulation BER/FER iterative (aff3ct::simulation::BFER_ite): dedicated to the BER/FER performances with turbo-demodulation between the demodulator and the decoder,\n+- Simulation EXIT Chart (aff3ct::simulation::EXIT): dedicated to the [EXtrinsic Information Transfer](https://en.wikipedia.org/wiki/EXIT_chart) (EXIT) chart.\n<img title=\"Communication chain\" src=\"../images/bfer_bferi_prod.svg\" style=\"width:95%\"/>\nMany Module objects can be used in a Simulation (aff3ct::simulation::Simulation):\n-- aff3ct::module::Source_i,\n-- aff3ct::module::CRC_i,\n-- aff3ct::module::Encoder_i,\n-- aff3ct::module::Puncturer_i,\n-- aff3ct::module::Interleaver_i,\n-- aff3ct::module::Modulator_i,\n-- aff3ct::module::Channel_i,\n-- aff3ct::module::Quantizer_i,\n-- aff3ct::module::Coset_i,\n-- aff3ct::module::Decoder_i,\n-- aff3ct::module::Monitor_i.\n+- aff3ct::module::Source,\n+- aff3ct::module::CRC,\n+- aff3ct::module::Codec,\n+- aff3ct::module::Puncturer,\n+- aff3ct::module::Encoder,\n+- aff3ct::module::Decoder,\n+- aff3ct::module::Interleaver,\n+- aff3ct::module::Modem,\n+- aff3ct::module::Channel,\n+- aff3ct::module::Quantizer,\n+- aff3ct::module::Coset,\n+- aff3ct::module::Monitor.\n## Related pages\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/Decoder_HIHO.hpp", "new_path": "src/Module/Decoder/Decoder_HIHO.hpp", "diff": "@@ -22,12 +22,11 @@ namespace aff3ct\nnamespace module\n{\n/*!\n- * \\class Decoder_SIHO_i\n+ * \\class Decoder_HIHO\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).\n" }, { "change_type": "MODIFY", "old_path": "src/Simulation/Simulation.hpp", "new_path": "src/Simulation/Simulation.hpp", "diff": "@@ -17,7 +17,7 @@ namespace aff3ct\nnamespace simulation\n{\n/*!\n- * \\class Launcher\n+ * \\class Simulation\n*\n* \\brief The Simulation is an abstract and generic container.\n*/\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp", "new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp", "diff": "@@ -23,7 +23,7 @@ namespace aff3ct\nnamespace tools\n{\n/*!\n- * \\class Pattern_parser_polar\n+ * \\class Pattern_polar_parser\n* \\brief Parses a polar code (represented as a tree) and returns a simplified tree with specialized nodes and tree\n* cuts when possible.\n*/\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix minor issues in the doc + add a readme for the doc generation.
8,483
06.03.2018 10:31:02
-3,600
428f3052f9c9fef3c04d27a74666a76f48539de3
Set argument --dec-h-path as optinal
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp", "diff": "@@ -45,7 +45,7 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\n- req_args.add(\n+ opt_args.add(\n{p+\"-h-path\"},\ntools::File(tools::openmode::read),\n\"path to the H matrix (AList or QC formated file).\");\n" } ]
C++
MIT License
aff3ct/aff3ct
Set argument --dec-h-path as optinal
8,483
06.03.2018 11:45:15
-3,600
693248fc3b7d3ad3681901c2b04f9837148345bc
Fix 8 bits compilation in poncturer turbo. Didn't have a link to the aff3ct::module::Puncturer_turbo<> class
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp", "new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp", "diff": "#include \"Puncturer_turbo.hpp\"\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+using PT = aff3ct::module::Puncturer_turbo<B_32,Q_32>;\n+#else\n+using PT = aff3ct::module::Puncturer_turbo<B,Q>;\n+#endif\n+\nusing namespace aff3ct;\nusing namespace aff3ct::factory;\n-using PT = aff3ct::module::Puncturer_turbo<>;\nconst std::string aff3ct::factory::Puncturer_turbo_name = \"Puncturer Turbo\";\nconst std::string aff3ct::factory::Puncturer_turbo_prefix = \"pct\";\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix 8 bits compilation in poncturer turbo. Didn't have a link to the aff3ct::module::Puncturer_turbo<> class
8,483
06.03.2018 12:01:53
-3,600
2b9d190f93c338e6a70b5942ae8f47522fdd9cb3
Fix MPI argument storing
[ { "change_type": "MODIFY", "old_path": "src/Factory/Simulation/Simulation.cpp", "new_path": "src/Factory/Simulation/Simulation.cpp", "diff": "@@ -149,7 +149,7 @@ void Simulation::parameters\nMPI_Comm_size(MPI_COMM_WORLD, &this->mpi_size);\nMPI_Comm_rank(MPI_COMM_WORLD, &this->mpi_rank);\n- if(exist(vals, {p+\"-mpi-comm\"})) this->mpi_comm_freq = milliseconds(vals.to_int({p+\"-mpi-comm\"}));\n+ if(vals.exist({p+\"-mpi-comm\"})) this->mpi_comm_freq = milliseconds(vals.to_int({p+\"-mpi-comm\"}));\nint max_n_threads_global;\nint max_n_threads_local = this->n_threads;\n" } ]
C++
MIT License
aff3ct/aff3ct
Fix MPI argument storing
8,483
08.03.2018 16:59:23
-3,600
74620d28a18062aa2d9aaf6b2558544085206c24
Create Codec HIHO and Codec SIHO_HIHO in Module and Factory; Associate Codec BCH to thoses new Codec HIHO SIHO in factories and modules
[ { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/BCH/Codec_BCH.cpp", "new_path": "src/Factory/Module/Codec/BCH/Codec_BCH.cpp", "diff": "@@ -9,7 +9,7 @@ const std::string aff3ct::factory::Codec_BCH_prefix = \"cdc\";\nCodec_BCH::parameters\n::parameters(const std::string &prefix)\n: Codec ::parameters(Codec_BCH_name, prefix),\n- Codec_SIHO::parameters(Codec_BCH_name, prefix),\n+ Codec_SIHO_HIHO::parameters(Codec_BCH_name, prefix),\nenc(new Encoder_BCH::parameters(\"enc\")),\ndec(new Decoder_BCH::parameters(\"dec\"))\n{\n@@ -44,7 +44,7 @@ Codec_BCH::parameters* Codec_BCH::parameters\nvoid Codec_BCH::parameters\n::get_description(tools::Argument_map_info &args) const\n{\n- Codec_SIHO::parameters::get_description(args);\n+ Codec_SIHO_HIHO::parameters::get_description(args);\nenc->get_description(args);\ndec->get_description(args);\n@@ -60,7 +60,7 @@ void Codec_BCH::parameters\nvoid Codec_BCH::parameters\n::store(const tools::Argument_map_value &vals)\n{\n- Codec_SIHO::parameters::store(vals);\n+ Codec_SIHO_HIHO::parameters::store(vals);\nenc->store(vals);\n@@ -78,7 +78,7 @@ void Codec_BCH::parameters\nvoid Codec_BCH::parameters\n::get_headers(std::map<std::string,header_list>& headers, const bool full) const\n{\n- Codec_SIHO::parameters::get_headers(headers, full);\n+ Codec_SIHO_HIHO::parameters::get_headers(headers, full);\nenc->get_headers(headers, full);\ndec->get_headers(headers, full);\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Codec/BCH/Codec_BCH.hpp", "new_path": "src/Factory/Module/Codec/BCH/Codec_BCH.hpp", "diff": "#include \"Module/Codec/BCH/Codec_BCH.hpp\"\n-#include \"../Codec_SIHO.hpp\"\n+#include \"../Codec_SIHO_HIHO.hpp\"\nnamespace aff3ct\n{\n@@ -17,9 +17,9 @@ namespace factory\n{\nextern const std::string Codec_BCH_name;\nextern const std::string Codec_BCH_prefix;\n-struct Codec_BCH : public Codec_SIHO\n+struct Codec_BCH : public Codec_SIHO_HIHO\n{\n- class parameters : public Codec_SIHO::parameters\n+ class parameters : public Codec_SIHO_HIHO::parameters\n{\npublic:\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Codec/Codec_HIHO.cpp", "diff": "+#include \"BCH/Codec_BCH.hpp\"\n+\n+#include \"Codec_HIHO.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::factory;\n+\n+const std::string aff3ct::factory::Codec_HIHO_name = \"Codec HIHO\";\n+const std::string aff3ct::factory::Codec_HIHO_prefix = \"cdc\";\n+\n+Codec_HIHO::parameters\n+::parameters(const std::string &prefix)\n+: Codec::parameters(Codec_HIHO_name, prefix)\n+{\n+}\n+\n+Codec_HIHO::parameters\n+::parameters(const std::string &name, const std::string &prefix)\n+: Codec::parameters(name, prefix)\n+{\n+}\n+\n+Codec_HIHO::parameters\n+::~parameters()\n+{\n+}\n+\n+template <typename B, typename Q>\n+module::Codec_HIHO<B,Q>* Codec_HIHO::parameters\n+::build(module::CRC<B>* crc) const\n+{\n+ if (get_name() == \"Codec BCH\" ) return dynamic_cast<const Codec_BCH ::parameters&>(*this).template build<B,Q>(crc);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+template <typename B, typename Q>\n+module::Codec_HIHO<B,Q>* Codec_HIHO\n+::build(const parameters &params, module::CRC<B> *crc)\n+{\n+ return params.template build<B,Q>(crc);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Codec_HIHO<B_8 ,Q_8 >* aff3ct::factory::Codec_HIHO::parameters::build<B_8 ,Q_8 >(aff3ct::module::CRC<B_8 >*) const;\n+template aff3ct::module::Codec_HIHO<B_16,Q_16>* aff3ct::factory::Codec_HIHO::parameters::build<B_16,Q_16>(aff3ct::module::CRC<B_16>*) const;\n+template aff3ct::module::Codec_HIHO<B_32,Q_32>* aff3ct::factory::Codec_HIHO::parameters::build<B_32,Q_32>(aff3ct::module::CRC<B_32>*) const;\n+template aff3ct::module::Codec_HIHO<B_64,Q_64>* aff3ct::factory::Codec_HIHO::parameters::build<B_64,Q_64>(aff3ct::module::CRC<B_64>*) const;\n+template aff3ct::module::Codec_HIHO<B_8 ,Q_8 >* aff3ct::factory::Codec_HIHO::build<B_8 ,Q_8 >(const aff3ct::factory::Codec_HIHO::parameters&, aff3ct::module::CRC<B_8 >*);\n+template aff3ct::module::Codec_HIHO<B_16,Q_16>* aff3ct::factory::Codec_HIHO::build<B_16,Q_16>(const aff3ct::factory::Codec_HIHO::parameters&, aff3ct::module::CRC<B_16>*);\n+template aff3ct::module::Codec_HIHO<B_32,Q_32>* aff3ct::factory::Codec_HIHO::build<B_32,Q_32>(const aff3ct::factory::Codec_HIHO::parameters&, aff3ct::module::CRC<B_32>*);\n+template aff3ct::module::Codec_HIHO<B_64,Q_64>* aff3ct::factory::Codec_HIHO::build<B_64,Q_64>(const aff3ct::factory::Codec_HIHO::parameters&, aff3ct::module::CRC<B_64>*);\n+#else\n+template aff3ct::module::Codec_HIHO<B,Q>* aff3ct::factory::Codec_HIHO::parameters::build<B,Q>(aff3ct::module::CRC<B>*) const;\n+template aff3ct::module::Codec_HIHO<B,Q>* aff3ct::factory::Codec_HIHO::build<B,Q>(const aff3ct::factory::Codec_HIHO::parameters&, aff3ct::module::CRC<B>*);\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Codec/Codec_HIHO.hpp", "diff": "+#ifndef FACTORY_CODEC_HIHO_HPP_\n+#define FACTORY_CODEC_HIHO_HPP_\n+\n+#include <string>\n+\n+#include \"Module/Codec/Codec_HIHO.hpp\"\n+#include \"Module/CRC/CRC.hpp\"\n+\n+#include \"Codec.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace factory\n+{\n+extern const std::string Codec_HIHO_name;\n+extern const std::string Codec_HIHO_prefix;\n+struct Codec_HIHO : Codec\n+{\n+ class parameters : virtual public Codec::parameters\n+ {\n+ public:\n+ // ------------------------------------------------------------------------------------------------- PARAMETERS\n+ // empty\n+\n+ // ---------------------------------------------------------------------------------------------------- METHODS\n+ explicit parameters(const std::string &p = Codec_HIHO_prefix);\n+ virtual ~parameters();\n+ // The following line is commented to prevent Visual C++ to incorrectly report ambiguity when covariance is\n+ // used with virtual inheritance.\n+ // See more about this MSVC bug:\n+ // - https://stackoverflow.com/questions/6933061/c-ambiguous-inheritance-error-in-vs-2010\n+ // - https://connect.microsoft.com/VisualStudio/feedback/details/590625/visual-c-incorrectly-reports-ambiguity-when-covariance-is-used-with-virtual-inheritance\n+ // - https://docs.microsoft.com/fr-fr/cpp/error-messages/compiler-errors-1/compiler-error-c2250\n+// virtual Codec_HIHO::parameters* clone() const = 0;\n+\n+ // builder\n+ template <typename B = int, typename Q = float>\n+ module::Codec_HIHO<B,Q>* build(module::CRC<B>* crc = nullptr) const;\n+\n+ protected:\n+ parameters(const std::string &n, const std::string &p);\n+ };\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Codec_HIHO<B,Q>* build(const parameters &params, module::CRC<B> *crc = nullptr);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_CODEC_HIHO_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Codec/Codec_SIHO_HIHO.cpp", "diff": "+#include \"BCH/Codec_BCH.hpp\"\n+\n+#include \"Codec_SIHO_HIHO.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::factory;\n+\n+const std::string aff3ct::factory::Codec_SIHO_HIHO_name = \"Codec SIHO/HIHO\";\n+const std::string aff3ct::factory::Codec_SIHO_HIHO_prefix = \"cdc\";\n+\n+Codec_SIHO_HIHO::parameters\n+::parameters(const std::string &prefix)\n+: Codec ::parameters(Codec_SIHO_HIHO_name, prefix),\n+ Codec_SIHO::parameters(Codec_SIHO_HIHO_name, prefix),\n+ Codec_HIHO::parameters(Codec_SIHO_HIHO_name, prefix)\n+{\n+}\n+\n+Codec_SIHO_HIHO::parameters\n+::parameters(const std::string &name, const std::string &prefix)\n+: Codec::parameters(name, prefix)\n+{\n+}\n+\n+Codec_SIHO_HIHO::parameters\n+::~parameters()\n+{\n+}\n+\n+template <typename B, typename Q>\n+module::Codec_SIHO_HIHO<B,Q>* Codec_SIHO_HIHO::parameters\n+::build(module::CRC<B>* crc) const\n+{\n+ if (get_name() == \"Codec BCH\" ) return dynamic_cast<const Codec_BCH ::parameters&>(*this).template build<B,Q>(crc);\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+template <typename B, typename Q>\n+module::Codec_SIHO_HIHO<B,Q>* Codec_SIHO_HIHO\n+::build(const parameters &params, module::CRC<B> *crc)\n+{\n+ return params.template build<B,Q>(crc);\n+}\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Codec_SIHO_HIHO<B_8 ,Q_8 >* aff3ct::factory::Codec_SIHO_HIHO::parameters::build<B_8 ,Q_8 >(aff3ct::module::CRC<B_8 >*) const;\n+template aff3ct::module::Codec_SIHO_HIHO<B_16,Q_16>* aff3ct::factory::Codec_SIHO_HIHO::parameters::build<B_16,Q_16>(aff3ct::module::CRC<B_16>*) const;\n+template aff3ct::module::Codec_SIHO_HIHO<B_32,Q_32>* aff3ct::factory::Codec_SIHO_HIHO::parameters::build<B_32,Q_32>(aff3ct::module::CRC<B_32>*) const;\n+template aff3ct::module::Codec_SIHO_HIHO<B_64,Q_64>* aff3ct::factory::Codec_SIHO_HIHO::parameters::build<B_64,Q_64>(aff3ct::module::CRC<B_64>*) const;\n+template aff3ct::module::Codec_SIHO_HIHO<B_8 ,Q_8 >* aff3ct::factory::Codec_SIHO_HIHO::build<B_8 ,Q_8 >(const aff3ct::factory::Codec_SIHO_HIHO::parameters&, aff3ct::module::CRC<B_8 >*);\n+template aff3ct::module::Codec_SIHO_HIHO<B_16,Q_16>* aff3ct::factory::Codec_SIHO_HIHO::build<B_16,Q_16>(const aff3ct::factory::Codec_SIHO_HIHO::parameters&, aff3ct::module::CRC<B_16>*);\n+template aff3ct::module::Codec_SIHO_HIHO<B_32,Q_32>* aff3ct::factory::Codec_SIHO_HIHO::build<B_32,Q_32>(const aff3ct::factory::Codec_SIHO_HIHO::parameters&, aff3ct::module::CRC<B_32>*);\n+template aff3ct::module::Codec_SIHO_HIHO<B_64,Q_64>* aff3ct::factory::Codec_SIHO_HIHO::build<B_64,Q_64>(const aff3ct::factory::Codec_SIHO_HIHO::parameters&, aff3ct::module::CRC<B_64>*);\n+#else\n+template aff3ct::module::Codec_SIHO_HIHO<B,Q>* aff3ct::factory::Codec_SIHO_HIHO::parameters::build<B,Q>(aff3ct::module::CRC<B>*) const;\n+template aff3ct::module::Codec_SIHO_HIHO<B,Q>* aff3ct::factory::Codec_SIHO_HIHO::build<B,Q>(const aff3ct::factory::Codec_SIHO_HIHO::parameters&, aff3ct::module::CRC<B>*);\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Factory/Module/Codec/Codec_SIHO_HIHO.hpp", "diff": "+#ifndef FACTORY_CODEC_SIHO_HIHO_HPP_\n+#define FACTORY_CODEC_SIHO_HIHO_HPP_\n+\n+#include <string>\n+\n+#include \"Module/Codec/Codec_SIHO_HIHO.hpp\"\n+#include \"Module/CRC/CRC.hpp\"\n+\n+#include \"Codec_SIHO.hpp\"\n+#include \"Codec_HIHO.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace factory\n+{\n+extern const std::string Codec_SIHO_HIHO_name;\n+extern const std::string Codec_SIHO_HIHO_prefix;\n+struct Codec_SIHO_HIHO : Codec\n+{\n+ class parameters : virtual public Codec_SIHO::parameters, virtual public Codec_HIHO::parameters\n+ {\n+ public:\n+ // ------------------------------------------------------------------------------------------------- PARAMETERS\n+ // empty\n+\n+ // ---------------------------------------------------------------------------------------------------- METHODS\n+ explicit parameters(const std::string &p = Codec_SIHO_HIHO_prefix);\n+ virtual ~parameters();\n+ virtual Codec_SIHO_HIHO::parameters* clone() const = 0;\n+\n+ // builder\n+ template <typename B = int, typename Q = float>\n+ module::Codec_SIHO_HIHO<B,Q>* build(module::CRC<B>* crc = nullptr) const;\n+\n+ protected:\n+ parameters(const std::string &n, const std::string &p);\n+ };\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Codec_SIHO_HIHO<B,Q>* build(const parameters &params, module::CRC<B> *crc = nullptr);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_CODEC_SIHO_HIHO_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp", "new_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp", "diff": "@@ -91,10 +91,7 @@ module::Decoder_SIHO<B,Q>* Decoder_BCH::parameters\n}\ncatch (tools::cannot_allocate const&)\n{\n- if (this->type == \"ALGEBRAIC\")\n- {\n- if (this->implem == \"STD\") return new module::Decoder_BCH<B,Q>(this->K, this->N_cw, GF, this->n_frames);\n- }\n+ return build_hiho<B,Q>(GF, encoder);\n}\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n@@ -107,6 +104,25 @@ module::Decoder_SIHO<B,Q>* Decoder_BCH\nreturn params.template build<B,Q>(GF, encoder);\n}\n+template <typename B, typename Q>\n+module::Decoder_SIHO_HIHO<B,Q>* Decoder_BCH::parameters\n+::build_hiho(const tools::BCH_polynomial_generator &GF, module::Encoder<B> *encoder) const\n+{\n+ if (this->type == \"ALGEBRAIC\")\n+ {\n+ if (this->implem == \"STD\") return new module::Decoder_BCH<B,Q>(this->K, this->N_cw, GF, this->n_frames);\n+ }\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\n+template <typename B, typename Q>\n+module::Decoder_SIHO_HIHO<B,Q>* Decoder_BCH\n+::build_hiho(const parameters &params, const tools::BCH_polynomial_generator &GF, module::Encoder<B> *encoder)\n+{\n+ return params.template build_hiho<B,Q>(GF, encoder);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n@@ -124,3 +140,21 @@ template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::build<\n#endif\n// ==================================================================================== explicit template instantiation\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template aff3ct::module::Decoder_SIHO_HIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::parameters::build_hiho<B_8 ,Q_8 >(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO_HIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::parameters::build_hiho<B_16,Q_16>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO_HIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::parameters::build_hiho<B_32,Q_32>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO_HIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::parameters::build_hiho<B_64,Q_64>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO_HIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::build_hiho<B_8 ,Q_8 >(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_8 >*);\n+template aff3ct::module::Decoder_SIHO_HIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::build_hiho<B_16,Q_16>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_16>*);\n+template aff3ct::module::Decoder_SIHO_HIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::build_hiho<B_32,Q_32>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_32>*);\n+template aff3ct::module::Decoder_SIHO_HIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::build_hiho<B_64,Q_64>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B_64>*);\n+#else\n+template aff3ct::module::Decoder_SIHO_HIHO<B,Q>* aff3ct::factory::Decoder_BCH::parameters::build_hiho<B>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B>*) const;\n+template aff3ct::module::Decoder_SIHO_HIHO<B,Q>* aff3ct::factory::Decoder_BCH::build_hiho<B>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder<B>*);\n+#endif\n+// ==================================================================================== explicit template instantiation\n+\n" }, { "change_type": "MODIFY", "old_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.hpp", "new_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.hpp", "diff": "#include <cmath>\n#include \"Module/Decoder/Decoder_SIHO.hpp\"\n-#include \"Module/Decoder/Decoder_SISO.hpp\"\n+#include \"Module/Decoder/Decoder_SIHO_HIHO.hpp\"\n#include \"Module/Encoder/Encoder.hpp\"\n#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n@@ -43,11 +43,19 @@ struct Decoder_BCH : public Decoder\ntemplate <typename B = int, typename Q = float>\nmodule::Decoder_SIHO<B,Q>* build(const tools::BCH_polynomial_generator &GF,\nmodule::Encoder<B> *encoder = nullptr) const;\n+\n+ template <typename B = int, typename Q = float>\n+ module::Decoder_SIHO_HIHO<B,Q>* build_hiho(const tools::BCH_polynomial_generator &GF,\n+ module::Encoder<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float>\nstatic module::Decoder_SIHO<B,Q>* build(const parameters &params, const tools::BCH_polynomial_generator &GF,\nmodule::Encoder<B> *encoder = nullptr);\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Decoder_SIHO_HIHO<B,Q>* build_hiho(const parameters &params, const tools::BCH_polynomial_generator &GF,\n+ module::Encoder<B> *encoder = nullptr);\n};\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/BCH/Codec_BCH.cpp", "new_path": "src/Module/Codec/BCH/Codec_BCH.cpp", "diff": "@@ -14,7 +14,7 @@ Codec_BCH<B,Q>\n::Codec_BCH(const factory::Encoder_BCH::parameters &enc_params,\nconst factory::Decoder_BCH::parameters &dec_params)\n: Codec <B,Q>(enc_params.K, enc_params.N_cw, enc_params.N_cw, enc_params.tail_length, enc_params.n_frames),\n- Codec_SIHO<B,Q>(enc_params.K, enc_params.N_cw, enc_params.N_cw, enc_params.tail_length, enc_params.n_frames),\n+ Codec_SIHO_HIHO<B,Q>(enc_params.K, enc_params.N_cw, enc_params.N_cw, enc_params.tail_length, enc_params.n_frames),\nGF_poly(dec_params.K, dec_params.N_cw, dec_params.t)\n{\nconst std::string name = \"Codec_BCH\";\n@@ -64,7 +64,9 @@ Codec_BCH<B,Q>\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n- this->set_decoder_siho(factory::Decoder_BCH::build<B,Q>(dec_params, GF_poly, this->get_encoder()));\n+ auto decoder_hiho_siho = factory::Decoder_BCH::build_hiho<B,Q>(dec_params, GF_poly, this->get_encoder());\n+ this->set_decoder_siho(decoder_hiho_siho);\n+ this->set_decoder_hiho(decoder_hiho_siho);\n}\ntemplate <typename B, typename Q>\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Codec/BCH/Codec_BCH.hpp", "new_path": "src/Module/Codec/BCH/Codec_BCH.hpp", "diff": "#include \"Factory/Module/Encoder/BCH/Encoder_BCH.hpp\"\n#include \"Factory/Module/Decoder/BCH/Decoder_BCH.hpp\"\n-#include \"../Codec_SIHO.hpp\"\n+#include \"../Codec_SIHO_HIHO.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename Q = float>\n-class Codec_BCH : public Codec_SIHO<B,Q>\n+class Codec_BCH : public Codec_SIHO_HIHO<B,Q>\n{\nprotected:\nconst tools::BCH_polynomial_generator GF_poly;\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Codec/Codec_HIHO.hpp", "diff": "+#ifndef CODEC_HIHO_HPP_\n+#define CODEC_HIHO_HPP_\n+\n+#include \"Module/Decoder/Decoder_HIHO.hpp\"\n+\n+#include \"Codec.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename Q = float>\n+class Codec_HIHO : virtual public Codec<B,Q>\n+{\n+private:\n+ Decoder_HIHO<B>* decoder_hiho;\n+\n+public:\n+ Codec_HIHO(const int K, const int N_cw, const int N, const int tail_length = 0, const int n_frames = 1)\n+ : Codec<B,Q>(K, N_cw, N, tail_length, n_frames), decoder_hiho(nullptr)\n+ {\n+ const std::string name = \"Codec_HIHO\";\n+ this->set_name(name);\n+ }\n+\n+ virtual ~Codec_HIHO()\n+ {\n+ if (decoder_hiho != nullptr) { delete decoder_hiho; decoder_hiho = nullptr; }\n+ }\n+\n+ Decoder_HIHO<B>* get_decoder_hiho()\n+ {\n+ if (this->decoder_hiho == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'decoder_hiho' is NULL.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ return this->decoder_hiho;\n+ }\n+\n+ virtual void reset()\n+ {\n+ if (this->decoder_hiho == nullptr)\n+ {\n+ std::stringstream message;\n+ message << \"'decoder_hiho' is NULL.\";\n+ throw tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ this->decoder_hiho->reset();\n+ }\n+\n+protected:\n+ void set_decoder_hiho(Decoder_HIHO<B>* dec)\n+ {\n+ this->decoder_hiho = dec;\n+ }\n+};\n+}\n+}\n+\n+#endif /* CODEC_HIHO_HPP_ */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Codec/Codec_SIHO_HIHO.hpp", "diff": "+#ifndef CODEC_SIHO_HIHO_HPP_\n+#define CODEC_SIHO_HIHO_HPP_\n+\n+#include \"Module/Decoder/Decoder_SISO.hpp\"\n+\n+#include \"Codec_HIHO.hpp\"\n+#include \"Codec_SIHO.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename Q = float>\n+class Codec_SIHO_HIHO : public Codec_SIHO<B,Q>, public Codec_HIHO<B,Q>\n+{\n+public:\n+ Codec_SIHO_HIHO(const int K, const int N_cw, const int N, const int tail_length = 0, const int n_frames = 1)\n+ : Codec <B,Q>(K, N_cw, N, tail_length, n_frames),\n+ Codec_SIHO<B,Q>(K, N_cw, N, tail_length, n_frames),\n+ Codec_HIHO<B,Q>(K, N_cw, N, tail_length, n_frames)\n+ {\n+ const std::string name = \"Codec_SIHO_HIHO\";\n+ this->set_name(name);\n+ }\n+\n+ virtual ~Codec_SIHO_HIHO()\n+ {\n+ Decoder_HIHO<B > *hiho = nullptr;\n+ Decoder_SIHO<B,Q> *siho = nullptr;\n+\n+ try\n+ {\n+ siho = this->get_decoder_siho();\n+ } catch (const std::exception&)\n+ {\n+ }\n+\n+ try\n+ {\n+ hiho = this->get_decoder_hiho();\n+ } catch (const std::exception&)\n+ {\n+ }\n+\n+ if (siho == nullptr && hiho != nullptr) { delete hiho; this->set_decoder_hiho(nullptr); }\n+ else if (hiho == nullptr && siho != nullptr) { delete siho; this->set_decoder_siho(nullptr); }\n+ else if (siho != nullptr && hiho != nullptr)\n+ {\n+ // do not delete the hiho if the siho and the hiho are the same pointers\n+ if (dynamic_cast<module::Decoder*>(hiho) != dynamic_cast<module::Decoder*>(siho))\n+ delete hiho;\n+ delete siho;\n+ this->set_decoder_siho(nullptr);\n+ this->set_decoder_hiho(nullptr);\n+ }\n+ }\n+\n+ virtual void reset()\n+ {\n+ this->get_decoder_siho()->reset();\n+ }\n+};\n+}\n+}\n+\n+#endif /* CODEC_SIHO_HIHO_HPP_ */\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp", "new_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp", "diff": "@@ -10,20 +10,20 @@ using namespace aff3ct::module;\ntemplate <typename B>\nEncoder_BCH<B>\n::Encoder_BCH(const int& K, const int& N, const tools::BCH_polynomial_generator& GF_poly, const int n_frames)\n- : Encoder<B>(K, N, n_frames), g(GF_poly.get_g()), bb(N - K)\n+ : Encoder<B>(K, N, n_frames), n_rdncy(GF_poly.get_n_rdncy()), g(GF_poly.get_g()), bb(n_rdncy)\n{\nconst std::string name = \"Encoder_BCH\";\nthis->set_name(name);\n- if ((this->N - this->K) != GF_poly.get_n_rdncy())\n+ if ((this->N - this->K) != n_rdncy)\n{\nstd::stringstream message;\n- message << \"'N - K' is different than 'n_rdncy' ('K' = \" << K << \", 'N' = \" << N << \", 'n_rdncy' = \"\n- << GF_poly.get_n_rdncy() << \").\";\n+ message << \"'N - K' is different than 'n_rdncy' ('K' = \" << K << \", 'N' = \" << N\n+ << \", 'n_rdncy' = \" << n_rdncy << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- std::iota(this->info_bits_pos.begin(), this->info_bits_pos.end(), this->N - this->K);\n+ std::iota(this->info_bits_pos.begin(), this->info_bits_pos.end(), n_rdncy); // redundancy on the first 'n_rdncy' bits\n}\ntemplate <typename B>\n@@ -34,27 +34,27 @@ Encoder_BCH<B>\ntemplate <typename B>\nvoid Encoder_BCH<B>\n-::__encode(const B *U_K, B *bb)\n+::__encode(const B *U_K, B *par)\n{\n- for (auto i = 0; i < this->N - this->K; i++)\n- bb[i] = (B)0;\n+ std::fill(par, par + n_rdncy, (B)0);\n+\nfor (auto i = this->K - 1; i >= 0; i--)\n{\n- const auto feedback = U_K[i] ^ bb[this->N - this->K - 1];\n+ const auto feedback = U_K[i] ^ par[n_rdncy - 1];\nif (feedback != 0)\n{\n- for (auto j = this->N - this->K - 1; j > 0; j--)\n+ for (auto j = n_rdncy - 1; j > 0; j--)\nif (g[j] != 0)\n- bb[j] = bb[j - 1] ^ feedback;\n+ par[j] = par[j - 1] ^ feedback;\nelse\n- bb[j] = bb[j - 1];\n- bb[0] = g[0] && feedback;\n+ par[j] = par[j - 1];\n+ par[0] = g[0] && feedback;\n}\nelse\n{\n- for (auto j = this->N - this->K - 1; j > 0; j--)\n- bb[j] = bb[j - 1];\n- bb[0] = 0;\n+ for (auto j = n_rdncy - 1; j > 0; j--)\n+ par[j] = par[j - 1];\n+ par[0] = 0;\n}\n}\n}\n@@ -67,20 +67,19 @@ void Encoder_BCH<B>\nthis->__encode(U_K, X_N);\n// copy the sys bits at the end of the codeword\n- std::copy(U_K, U_K + this->K, X_N + this->N - this->K);\n+ std::copy(U_K, U_K + this->K, X_N + n_rdncy);\n}\ntemplate <typename B>\nbool Encoder_BCH<B>\n::is_codeword(const B *X_N)\n{\n- this->__encode(X_N + this->N - this->K, this->bb.data());\n+ this->__encode(X_N + n_rdncy, this->bb.data());\n- auto par_size = this->N - this->K;\nauto p = 0;\n- while (p < par_size && (X_N[p] == this->bb[p])) p++;\n+ while (p < n_rdncy && (X_N[p] == this->bb[p])) p++;\n- return p == par_size;\n+ return p == n_rdncy;\n}\n// ==================================================================================== explicit template instantiation\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "new_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "diff": "@@ -15,6 +15,7 @@ class Encoder_BCH : public Encoder<B>\n{\nprotected:\n+ const int n_rdncy; // number redundancy bits\nconst std::vector<int>& g; // coefficients of the generator polynomial, g(x)\nstd::vector<B> bb; // coefficients of redundancy polynomial x^(length-k) i(x) modulo g(x)\n" }, { "change_type": "MODIFY", "old_path": "src/Tools/Math/Galois.cpp", "new_path": "src/Tools/Math/Galois.cpp", "diff": "@@ -34,13 +34,6 @@ Galois\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (N >= 1048576) // 2^20\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- }\n-\nif (m != (int)std::ceil(std::log2(N +1)))\n{\nstd::stringstream message;\n" } ]
C++
MIT License
aff3ct/aff3ct
Create Codec HIHO and Codec SIHO_HIHO in Module and Factory; Associate Codec BCH to thoses new Codec HIHO SIHO in factories and modules
8,483
14.03.2018 08:50:45
-3,600
fb9d8890957da64a2401d79d7cc48b0c2b63f63c
Add the frame_id argument in the BCH decoder end encoder
[ { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp", "diff": "@@ -37,7 +37,7 @@ Decoder_BCH<B, R>\ntemplate <typename B, typename R>\nvoid Decoder_BCH<B, R>\n-::_decode(B *Y_N)\n+::_decode(B *Y_N, const int frame_id)\n{\nint i, j, t2, syn_error = 0;\n@@ -208,7 +208,7 @@ void Decoder_BCH<B, R>\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(YH_N.data());\n+ this->_decode(YH_N.data(), frame_id);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -229,7 +229,7 @@ void Decoder_BCH<B, R>\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(YH_N.data());\n+ this->_decode(YH_N.data(), frame_id);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -250,7 +250,7 @@ void Decoder_BCH<B, R>\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(YH_N.data());\n+ this->_decode(YH_N.data(), frame_id);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n@@ -271,7 +271,7 @@ void Decoder_BCH<B, R>\n// auto d_load = std::chrono::steady_clock::now() - t_load;\n// auto t_decod = std::chrono::steady_clock::now(); // -------------------------------------------------------- DECODE\n- this->_decode(YH_N.data());\n+ this->_decode(YH_N.data(), frame_id);\n// auto d_decod = std::chrono::steady_clock::now() - t_decod;\n// auto t_store = std::chrono::steady_clock::now(); // --------------------------------------------------------- STORE\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp", "new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp", "diff": "@@ -38,7 +38,7 @@ public:\nvirtual ~Decoder_BCH();\nprotected:\n- void _decode ( B *Y_N );\n+ virtual void _decode( B *Y_N, const int frame_id);\nvoid _decode_hiho (const B *Y_N, B *V_K, const int frame_id);\nvoid _decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id);\nvoid _decode_siho (const R *Y_N, B *V_K, const int frame_id);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "new_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp", "diff": "@@ -27,8 +27,8 @@ public:\nbool is_codeword(const B *X_N);\nprotected:\n- void _encode(const B *U_K, B *X_N, const int frame_id);\n- void __encode(const B *U_K, B *bb);\n+ virtual void _encode(const B *U_K, B *X_N, const int frame_id);\n+ virtual void __encode(const B *U_K, B *bb);\n};\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the frame_id argument in the BCH decoder end encoder
8,483
14.03.2018 08:51:40
-3,600
37532e1d0db0e4c090732c979fc3931f6dfd5841
Add the decodeur BCH genius and the encoder BCH adaptative
[ { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/BCH/Genius/Decoder_BCH_genius.cpp", "diff": "+#include <chrono>\n+#include <sstream>\n+\n+#include \"Tools/Perf/hard_decision.h\"\n+#include \"Tools/Exception/exception.hpp\"\n+\n+#include \"Decoder_BCH_genius.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B, typename R>\n+Decoder_BCH_genius<B, R>\n+::Decoder_BCH_genius(const int& K, const int& N, const tools::BCH_polynomial_generator &GF_poly, Encoder<B> &encoder, const int n_frames)\n+: Decoder (K, N, n_frames, 1),\n+ Decoder_BCH<B,R>(K, N, GF_poly, n_frames),\n+ encoder(encoder),\n+ error_pos(this->t)\n+{\n+ const std::string name = \"Decoder_BCH_genius\";\n+ this->set_name(name);\n+}\n+\n+template <typename B, typename R>\n+Decoder_BCH_genius<B, R>\n+::~Decoder_BCH_genius()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_BCH_genius<B, R>\n+::_decode(B *Y_N, const int frame_id)\n+{\n+ auto& X_N = encoder.get_X_N(frame_id);\n+\n+ int n_error = 0;\n+ for(int i = 0; i < this->N; i++)\n+ {\n+ if (X_N[i] != Y_N[i])\n+ {\n+ error_pos[n_error] = i;\n+ n_error ++;\n+ }\n+\n+ if (n_error > this->t)\n+ break;\n+ }\n+\n+ if (n_error <= this->t)\n+ {\n+ for(int i = 0; i < n_error; i++)\n+ Y_N[error_pos[i]] = !Y_N[error_pos[i]];\n+ }\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_BCH_genius<B_8,Q_8>;\n+template class aff3ct::module::Decoder_BCH_genius<B_16,Q_16>;\n+template class aff3ct::module::Decoder_BCH_genius<B_32,Q_32>;\n+template class aff3ct::module::Decoder_BCH_genius<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_BCH_genius<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Decoder/BCH/Genius/Decoder_BCH_genius.hpp", "diff": "+#ifndef DECODER_BCH_GENIUS\n+#define DECODER_BCH_GENIUS\n+\n+#include <vector>\n+\n+#include \"Module/Encoder/Encoder.hpp\"\n+#include \"../Decoder_BCH.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_BCH_genius : public Decoder_BCH<B,R>\n+{\n+protected:\n+ Encoder<B> &encoder;\n+\n+ std::vector<unsigned> error_pos;\n+\n+public:\n+ Decoder_BCH_genius(const int& K, const int& N, const tools::BCH_polynomial_generator &GF, Encoder<B> &encoder, const int n_frames = 1);\n+ virtual ~Decoder_BCH_genius();\n+\n+protected:\n+ virtual void _decode(B *Y_N, const int frame_id);\n+};\n+}\n+}\n+\n+#endif /* DECODER_BCH_GENIUS */\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Encoder/BCH/Adaptative/Encoder_BCH_adaptative.cpp", "diff": "+#include <vector>\n+#include <cmath>\n+#include <iostream>\n+#include <cmath>\n+\n+#include \"Encoder_BCH_adaptative.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <typename B>\n+Encoder_BCH_adaptative<B>\n+::Encoder_BCH_adaptative(const int& K, const int& N, const tools::BCH_polynomial_generator& GF_poly, const int n_frames)\n+ : Encoder_BCH<B>(K, N, GF_poly, n_frames), K_adap(K), N_adap(N)\n+{\n+ const std::string name = \"Encoder_BCH_adaptative\";\n+ this->set_name(name);\n+\n+}\n+\n+template <typename B>\n+Encoder_BCH_adaptative<B>\n+::~Encoder_BCH_adaptative()\n+{\n+}\n+\n+template <typename B>\n+void Encoder_BCH_adaptative<B>\n+::__encode(const B *U_K, B *bb)\n+{\n+}\n+\n+template <typename B>\n+void Encoder_BCH_adaptative<B>\n+::_encode(const B *U_K, B *X_N, const int frame_id)\n+{\n+ // generate the parity bits\n+ this->__encode(U_K, X_N);\n+\n+ // copy the sys bits at the end of the codeword\n+ std::copy(U_K, U_K + this->K, X_N + this->N - this->K);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Encoder_BCH_adaptative<B_8>;\n+template class aff3ct::module::Encoder_BCH_adaptative<B_16>;\n+template class aff3ct::module::Encoder_BCH_adaptative<B_32>;\n+template class aff3ct::module::Encoder_BCH_adaptative<B_64>;\n+#else\n+template class aff3ct::module::Encoder_BCH_adaptative<B>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n" }, { "change_type": "ADD", "old_path": null, "new_path": "src/Module/Encoder/BCH/Adaptative/Encoder_BCH_adaptative.hpp", "diff": "+#ifndef ENCODER_BCH_ADAPTATIVE_HPP_\n+#define ENCODER_BCH_ADAPTATIVE_HPP_\n+\n+#include <vector>\n+\n+#include \"../Encoder_BCH.hpp\"\n+#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int>\n+class Encoder_BCH_adaptative : public Encoder_BCH<B>\n+{\n+protected:\n+ const int K_adap;\n+ const int N_adap;\n+\n+public:\n+ Encoder_BCH_adaptative(const int& K, const int& N, const tools::BCH_polynomial_generator& GF, const int n_frames = 1);\n+\n+ virtual ~Encoder_BCH_adaptative();\n+\n+protected:\n+ virtual void _encode(const B *U_K, B *X_N, const int frame_id);\n+ virtual void __encode(const B *U_K, B *bb);\n+};\n+}\n+}\n+\n+#endif // ENCODER_BCH_ADAPTATIVE_HPP_\n" } ]
C++
MIT License
aff3ct/aff3ct
Add the decodeur BCH genius and the encoder BCH adaptative
8,486
11.03.2018 12:00:14
-3,600
8d80a6dd6e630880809f45ca8fbc46dda86e9cd1
Some cosmetics modifications.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/User/Modem_user.hxx", "new_path": "src/Module/Modem/User/Modem_user.hxx", "diff": "@@ -144,7 +144,6 @@ void Modem_user<B,R,Q,MAX>\n{\nauto L0 = -std::numeric_limits<Q>::infinity();\nauto L1 = -std::numeric_limits<Q>::infinity();\n-\nauto b = n % this->bits_per_symbol; // bit position in the symbol\nauto k = n / this->bits_per_symbol; // symbol position\n@@ -182,7 +181,6 @@ void Modem_user<B,R,Q,MAX>\n{\nauto L0 = -std::numeric_limits<Q>::infinity();\nauto L1 = -std::numeric_limits<Q>::infinity();\n-\nauto b = n % this->bits_per_symbol; // bit position in the symbol\nauto k = n / this->bits_per_symbol; // symbol position\n@@ -309,7 +307,6 @@ void Modem_user<B,R,Q,MAX>\nY_N3[n] = (L0 - L1);\n}\n}\n-\n/*\n* \\brief Soft Mapper\n*/\n@@ -362,6 +359,5 @@ void Modem_user<B, R, Q, MAX>\n}\n}\n}\n-\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Some cosmetics modifications.
8,486
11.03.2018 12:01:59
-3,600
087ac1d1b65ae7bdb1e4ab4678e4c06b7430ee77
Bug correction in QAM demodulate/tdeodulate, addition of QAM tmodulate.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/QAM/Modem_QAM.hpp", "new_path": "src/Module/Modem/QAM/Modem_QAM.hpp", "diff": "@@ -38,6 +38,7 @@ public:\n}\nprotected:\n+ void _tmodulate ( const Q *X_N1, R *X_N2, const int frame_id);\nvoid _modulate ( const B *X_N1, R *X_N2, const int frame_id);\nvoid _filter ( const R *Y_N1, R *Y_N2, const int frame_id);\nvoid _demodulate ( const Q *Y_N1, Q *Y_N2, const int frame_id);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/QAM/Modem_QAM.hxx", "new_path": "src/Module/Modem/QAM/Modem_QAM.hxx", "diff": "@@ -151,7 +151,7 @@ void Modem_QAM<B,R,Q,MAX>\nauto complex_Yk = std::complex<Q>(Y_N1[2*k], Y_N1[2*k+1]);\nfor (auto j = 0; j < this->nbr_symbols; j++)\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -std::norm(complex_Yk - std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\nelse\n@@ -189,7 +189,7 @@ void Modem_QAM<B,R,Q,MAX>\nauto complex_Hk = std::complex<Q>((Q)H_N [2*k], (Q)H_N [2*k+1]);\nfor (auto j = 0; j < this->nbr_symbols; j++)\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -std::norm(complex_Yk -\ncomplex_Hk * std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\n@@ -229,13 +229,23 @@ void Modem_QAM<B,R,Q,MAX>\nauto tempL = (Q)(std::norm(complex_Yk - std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\n- for (auto l = 0; l < b; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ for (auto l = 0; l < this->bits_per_symbol; l++)\n+ {\n+ if (l == b)\n+ continue;\n+\n+ if (( (j>>l) & 1 ) == 1)\n+ {\n+ if (k * this->bits_per_symbol +l < size)\n+ tempL += Y_N2[k * this->bits_per_symbol +l];\n+ else\n+ tempL += std::numeric_limits<Q>::infinity();\n+ }\n- for (auto l = b +1; l < this->bits_per_symbol; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ }\n+ tempL = std::isnan((R)tempL) ? (Q)0.0 : tempL;\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -tempL);\nelse\nL1 = MAX(L1, -tempL);\n@@ -274,13 +284,22 @@ void Modem_QAM<B,R,Q,MAX>\ncomplex_Hk * std::complex<Q>((Q)this->constellation[j].real(),\n(Q)this->constellation[j].imag())) * inv_sigma2);\n- for (auto l = 0; l < b; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ for (auto l = 0; l < this->bits_per_symbol; l++)\n+ {\n+ if (l == b)\n+ continue;\n- for (auto l = b +1; l < this->bits_per_symbol; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ if (( (j>>l) & 1 ) == 1)\n+ {\n+ if (k * this->bits_per_symbol +l < size)\n+ tempL += Y_N2[k * this->bits_per_symbol +l];\n+ else\n+ tempL += std::numeric_limits<Q>::infinity();\n+ }\n+ }\n+ tempL = std::isnan((R)tempL) ? (Q)0.0 : tempL;\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -tempL);\nelse\nL1 = MAX(L1, -tempL);\n@@ -289,5 +308,57 @@ void Modem_QAM<B,R,Q,MAX>\nY_N3[n] = (L0 - L1);\n}\n}\n+/*\n+* \\brief Soft Mapper\n+*/\n+template <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\n+void Modem_QAM<B, R, Q, MAX>\n+::_tmodulate(const Q *X_N1, R *X_N2, const int frame_id)\n+{\n+ auto size_in = this->N;\n+ auto size_out = this->N_mod;\n+\n+ auto loop_size = size_in / this->bits_per_symbol;\n+\n+ for (auto i = 0; i < loop_size; i++)\n+ {\n+ X_N2[2*i+0] = (R)0.0;\n+ X_N2[2*i+1] = (R)0.0;\n+\n+ for (auto m = 0; m < this->nbr_symbols; m++)\n+ {\n+ std::complex<R> soft_symbol = this->constellation[m];\n+ auto p = (R)1.0;\n+ for (auto j = 0; j < this->bits_per_symbol; j++)\n+ {\n+ auto p0 = (R)1.0/((R)1.0 + std::exp(-(R)(X_N1[i*this->bits_per_symbol + j])));\n+ p *= ((m >> j) & 1) == 0 ? p0 : (R)1.0 - p0;\n+ }\n+ X_N2[2*i] += p * soft_symbol.real();\n+ X_N2[2*i+1] += p * soft_symbol.imag();\n+ }\n+ }\n+\n+ // last elements if \"size_in\" is not a multiple of the number of bits per symbol\n+ if (loop_size * this->bits_per_symbol < size_in)\n+ {\n+ auto r = size_in - (loop_size * this->bits_per_symbol);\n+ X_N2[size_out - 2] = (R)0.0;\n+ X_N2[size_out - 1] = (R)0.0;\n+\n+ for (auto m = 0; m < (1<<r); m++)\n+ {\n+ std::complex<R> soft_symbol = this->constellation[m];\n+ auto p = (R)1.0;\n+ for (auto j = 0; j < r; j++)\n+ {\n+ auto p0 = (R)1.0/((R)1.0 + std::exp(-(R)X_N1[loop_size*this->bits_per_symbol + j]));\n+ p *= ((m >> j) & 1) == 0 ? p0 : 1 - p0;\n+ }\n+ X_N2[size_out - 2] += p*soft_symbol.real();\n+ X_N2[size_out - 1] += p*soft_symbol.imag();\n+ }\n+ }\n+}\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Bug correction in QAM demodulate/tdeodulate, addition of QAM tmodulate.
8,486
12.03.2018 10:40:15
-3,600
f548af9b4d6a83a9c3da33b118402ed87ec2c10a
Cosmetics again.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/User/Modem_user.hxx", "new_path": "src/Module/Modem/User/Modem_user.hxx", "diff": "@@ -254,6 +254,9 @@ void Modem_user<B,R,Q,MAX>\n}\n}\n+/*\n+ * Demodulator\n+ */\ntemplate <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\nvoid Modem_user<B,R,Q,MAX>\n::_tdemodulate_wg(const R *H_N, const Q *Y_N1, const Q *Y_N2, Q *Y_N3, const int frame_id)\n@@ -307,6 +310,7 @@ void Modem_user<B,R,Q,MAX>\nY_N3[n] = (L0 - L1);\n}\n}\n+\n/*\n* \\brief Soft Mapper\n*/\n@@ -352,7 +356,7 @@ void Modem_user<B, R, Q, MAX>\nfor (auto j = 0; j < r; j++)\n{\nauto p0 = (R)1.0/((R)1.0 + std::exp(-(R)X_N1[loop_size*this->bits_per_symbol + j]));\n- p *= ((m >> j) & 1) == 0 ? p0 : 1 - p0;\n+ p *= ((m >> j) & 1) == 0 ? p0 : (R)1.0 - p0;\n}\nX_N2[size_out - 2] += p*soft_symbol.real();\nX_N2[size_out - 1] += p*soft_symbol.imag();\n" } ]
C++
MIT License
aff3ct/aff3ct
Cosmetics again.
8,486
12.03.2018 14:43:50
-3,600
e21405586c9bdcd26cd43bdaf06f6f342ac95006
Modification of the handling of the bits of the las symbol for PAM modulation.
[ { "change_type": "MODIFY", "old_path": "src/Module/Modem/PAM/Modem_PAM.hpp", "new_path": "src/Module/Modem/PAM/Modem_PAM.hpp", "diff": "@@ -37,6 +37,7 @@ public:\n}\nprotected:\n+ void _tmodulate ( const Q *X_N1, R *X_N2, const int frame_id);\nvoid _modulate ( const B *X_N1, R *X_N2, const int frame_id);\nvoid _filter ( const R *Y_N1, R *Y_N2, const int frame_id);\nvoid _demodulate ( const Q *Y_N1, Q *Y_N2, const int frame_id);\n" }, { "change_type": "MODIFY", "old_path": "src/Module/Modem/PAM/Modem_PAM.hxx", "new_path": "src/Module/Modem/PAM/Modem_PAM.hxx", "diff": "@@ -134,7 +134,7 @@ void Modem_PAM<B,R,Q,MAX>\nauto k = n / this->bits_per_symbol; // symbol position\nfor (auto j = 0; j < this->nbr_symbols; j++)\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -(Y_N1[k] - (Q)this->constellation[j]) *\n(Y_N1[k] - (Q)this->constellation[j]) * inv_sigma2);\nelse\n@@ -169,7 +169,7 @@ void Modem_PAM<B,R,Q,MAX>\nauto k = n / this->bits_per_symbol; // symbol position\nfor (auto j = 0; j < this->nbr_symbols; j++)\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -(Y_N1[k] - (Q)H_N[k] * (Q)this->constellation[j]) *\n(Y_N1[k] - (Q)H_N[k] * (Q)this->constellation[j]) * inv_sigma2);\nelse\n@@ -205,13 +205,23 @@ void Modem_PAM<B,R,Q,MAX>\nauto tempL = (Q)((Y_N1[k] - this->constellation[j]) *\n(Y_N1[k] - this->constellation[j]) * inv_sigma2);\n- for (auto l = 0; l < b; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ for (auto l = 0; l < this->bits_per_symbol; l++)\n+ {\n+ if (l == b)\n+ continue;\n+\n+ if (((j>>l) & 1) == 1)\n+ {\n+ if (k * this->bits_per_symbol +l < size)\n+ tempL += Y_N2[k * this->bits_per_symbol +l];\n+ else\n+ tempL += std::numeric_limits<Q>::infinity();\n+ }\n- for (auto l = b +1; l < this->bits_per_symbol; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ }\n+ tempL = std::isnan((R)tempL) ? (Q)0.0 : tempL;\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -tempL);\nelse\nL1 = MAX(L1, -tempL);\n@@ -246,13 +256,22 @@ void Modem_PAM<B,R,Q,MAX>\nauto tempL = (Q)((Y_N1[k] - (Q)H_N[k] * this->constellation[j]) *\n(Y_N1[k] - (Q)H_N[k] * this->constellation[j]) * inv_sigma2);\n- for (auto l = 0; l < b; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ for (auto l = 0; l < this->bits_per_symbol; l++)\n+ {\n+ if (l == b)\n+ continue;\n- for (auto l = b +1; l < this->bits_per_symbol; l++)\n- tempL += (j & (1 << l)) * Y_N2[k * this->bits_per_symbol +l];\n+ if (((j>>l) & 1) == 1)\n+ {\n+ if (k * this->bits_per_symbol +l < size)\n+ tempL += Y_N2[k * this->bits_per_symbol +l];\n+ else\n+ tempL += std::numeric_limits<Q>::infinity();\n+ }\n+ }\n+ tempL = std::isnan((R)tempL) ? (Q)0.0 : tempL;\n- if ((j & (1 << b)) == 0)\n+ if (((j>>b) & 1) == 0)\nL0 = MAX(L0, -tempL);\nelse\nL1 = MAX(L1, -tempL);\n@@ -261,5 +280,54 @@ void Modem_PAM<B,R,Q,MAX>\nY_N3[n] = (L0 - L1);\n}\n}\n+\n+/*\n+* \\brief Soft Mapper\n+*/\n+template <typename B, typename R, typename Q, tools::proto_max<Q> MAX>\n+void Modem_PAM<B, R, Q, MAX>\n+::_tmodulate(const Q *X_N1, R *X_N2, const int frame_id)\n+{\n+ auto size_in = this->N;\n+ auto size_out = this->N_mod;\n+\n+ auto loop_size = size_in / this->bits_per_symbol;\n+\n+ for (auto i = 0; i < loop_size; i++)\n+ {\n+ X_N2[i] = (R)0.0;\n+\n+ for (auto m = 0; m < this->nbr_symbols; m++)\n+ {\n+ R soft_symbol = this->constellation[m];\n+ R p = 1.0;\n+ for (auto j = 0; j < this->bits_per_symbol; j++)\n+ {\n+ R p0 = (R)1.0/((R)1.0 + std::exp(-(R)(X_N1[i*this->bits_per_symbol + j])));\n+ p *= ((m >> j) & 1) == 0 ? p0 : (R)1.0 - p0;\n+ }\n+ X_N2[i] += p * soft_symbol;\n+ }\n+ }\n+\n+ // last elements if \"size_in\" is not a multiple of the number of bits per symbol\n+ if (loop_size * this->bits_per_symbol < size_in)\n+ {\n+ auto r = size_in - (loop_size * this->bits_per_symbol);\n+ X_N2[size_out - 1] = (R)0.0;\n+\n+ for (auto m = 0; m < (1<<r); m++)\n+ {\n+ R soft_symbol = this->constellation[m];\n+ auto p = (R)1.0;\n+ for (auto j = 0; j < r; j++)\n+ {\n+ auto p0 = (R)1.0/((R)1.0 + std::exp(-(R)X_N1[loop_size*this->bits_per_symbol + j]));\n+ p *= ((m >> j) & 1) == 0 ? p0 : (R)1.0 - p0;\n+ }\n+ X_N2[size_out - 1] += p*soft_symbol;\n+ }\n+ }\n+}\n}\n}\n" } ]
C++
MIT License
aff3ct/aff3ct
Modification of the handling of the bits of the las symbol for PAM modulation.