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 |
13.12.2017 14:15:54
| -3,600 |
02f0e19dfb9de876b41b8b6bb7550cca1069e46d
|
Fix info bit pos in the LDPC codec.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -141,24 +141,12 @@ Codec_LDPC<B,Q>\nstd::ifstream file_H(dec_params.H_path, std::ifstream::in);\nH = tools::AList::read(file_H);\n- if (!is_info_bits_pos)\n- {\ntry\n{\n- if (enc_params.type == \"LDPC_H\")\n- {\n- auto encoder_LDPC = factory::Encoder_LDPC::build<B>(enc_params, G, H);\n- encoder_LDPC->get_info_bits_pos(info_bits_pos);\n- delete encoder_LDPC;\n- }\n- else\ninfo_bits_pos = tools::AList::read_info_bits_pos(file_H, enc_params.K, enc_params.N_cw);\n+ is_info_bits_pos = true;\n}\n- catch (std::exception const&)\n- {\n- std::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n- }\n- }\n+ catch (std::exception const&) { }\nfile_H.close();\n}\n@@ -169,6 +157,20 @@ Codec_LDPC<B,Q>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (!is_info_bits_pos)\n+ {\n+ if (enc_params.type == \"LDPC_H\")\n+ {\n+ auto encoder_LDPC = factory::Encoder_LDPC::build<B>(enc_params, G, H);\n+ encoder_LDPC->get_info_bits_pos(info_bits_pos);\n+ delete encoder_LDPC;\n+ }\n+ else\n+ {\n+ std::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n+ }\n+ }\n+\n// ---------------------------------------------------------------------------------------------------- allocations\nif (!pct_params)\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix info bit pos in the LDPC codec.
|
8,490 |
13.12.2017 16:30:44
| -3,600 |
dfe73340cee20b287da86681c097a60711f74423
|
Autoset the LDPC puncturer to NO when it is not needing.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.cpp",
"new_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.cpp",
"diff": "@@ -86,6 +86,9 @@ void Puncturer_LDPC::parameters\n}\nif(exist(vals, {p+\"-cw-size\", \"N_cw\"})) this->N_cw = std::stoi(vals.at({p+\"-cw-size\", \"N_cw\"}));\n+\n+ if (this->N == this->N_cw)\n+ this->type = \"NO\";\n}\nvoid Puncturer_LDPC::parameters\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Autoset the LDPC puncturer to NO when it is not needing.
|
8,490 |
13.12.2017 18:37:33
| -3,600 |
a3333b4feaaac0765ab6fd020fd0309dc84df0a3
|
Fix bad puncturer factory.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -112,11 +112,10 @@ void Codec_LDPC::parameters\nif (this->pct)\n{\nthis->pct->K = this->enc->K;\n+ this->pct->N_cw = this->enc->N_cw;\nthis->pct->n_frames = this->enc->n_frames;\npct->store(vals);\n-\n- this->pct->N_cw = this->enc->N_cw;\n}\nthis->dec->K = this->enc->K;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.cpp",
"new_path": "src/Factory/Module/Puncturer/LDPC/Puncturer_LDPC.cpp",
"diff": "@@ -74,7 +74,10 @@ std::vector<bool> generate_punct_vector(const std::string pattern)\nvoid Puncturer_LDPC::parameters\n::store(const arg_val_map &vals)\n{\n+ auto save_N_cw = this->N_cw;\nPuncturer::parameters::store(vals);\n+ if (save_N_cw > 0)\n+ this->N_cw = save_N_cw;\nauto p = this->get_prefix();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -129,11 +129,8 @@ Codec_LDPC<B,Q>\n{\nstd::ifstream file_H(dec_params.H_path, std::ifstream::in);\nH = tools::QC::read(file_H);\n- if (pct_params)\n+ if (pct_params && pct_params->pattern.empty())\npct_params->pattern = tools::QC::read_pct_pattern(file_H);\n-\n- std::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n-\nfile_H.close();\n}\nelse if (H_format == \"ALIST\")\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad puncturer factory.
|
8,490 |
13.12.2017 22:11:58
| -3,600 |
8c7f5c1518b8eb2345c501b9280aad2816f43207
|
Update the AFF3CT headers.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Code/Polar/Frozenbits_notifier.hpp>\n#include <Tools/Code/LDPC/Matrix_handler/LDPC_matrix_handler.hpp>\n#include <Tools/Code/LDPC/AList/AList.hpp>\n+#include <Tools/Code/LDPC/QC/QC.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 <Module/Puncturer/Turbo_DB/Puncturer_turbo_DB.hpp>\n#include <Module/Puncturer/NO/Puncturer_NO.hpp>\n#include <Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n+#include <Module/Puncturer/LDPC/Puncturer_LDPC.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/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/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/SPA/Decoder_LDPC_BP_flooding_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/Decoder_LDPC_BP_flooding.hpp>\n#include <Module/Decoder/Decoder_SIHO.hpp>\n#include <Module/Decoder/BCH/Decoder_BCH.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/LDPC/Puncturer_LDPC.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"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the AFF3CT headers.
|
8,483 |
15.12.2017 10:55:11
| -3,600 |
0a010dee4743e5872f8af6b9d124fed4140709a3
|
Change name BCH_polynomial_generator into lower case name
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "@@ -76,7 +76,7 @@ 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) const\n+::build(const tools::BCH_polynomial_generator &GF) const\n{\nif (this->type == \"ALGEBRAIC\")\n{\n@@ -88,7 +88,7 @@ module::Decoder_SIHO<B,Q>* Decoder_BCH::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_BCH\n-::build(const parameters ¶ms, const tools::BCH_Polynomial_Generator &GF)\n+::build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF)\n{\nreturn params.template build<B,Q>(GF);\n}\n@@ -96,17 +96,17 @@ module::Decoder_SIHO<B,Q>* Decoder_BCH\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::parameters::build<B_8 ,Q_8 >(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::parameters::build<B_16,Q_16>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::parameters::build<B_32,Q_32>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::parameters::build<B_64,Q_64>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::build<B_16,Q_16>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::build<B_32,Q_32>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::build<B_64,Q_64>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::parameters::build<B_8 ,Q_8 >(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::parameters::build<B_16,Q_16>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::parameters::build<B_32,Q_32>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::parameters::build<B_64,Q_64>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::build<B_16,Q_16>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::build<B_32,Q_32>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::build<B_64,Q_64>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::parameters::build<B,Q>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::build<B,Q>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::parameters::build<B,Q>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::build<B,Q>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.hpp",
"new_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.hpp",
"diff": "#include \"Module/Decoder/Decoder_SIHO.hpp\"\n#include \"Module/Decoder/Decoder_SISO.hpp\"\n-#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n+#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n#include \"../Decoder.hpp\"\n@@ -41,11 +41,11 @@ struct Decoder_BCH : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SIHO<B,Q>* build(const tools::BCH_Polynomial_Generator &GF) const;\n+ module::Decoder_SIHO<B,Q>* build(const tools::BCH_polynomial_generator &GF) const;\n};\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms, const tools::BCH_Polynomial_Generator &GF);\n+ static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF);\n};\n}\n}\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": "@@ -52,7 +52,7 @@ void Encoder_BCH::parameters\ntemplate <typename B>\nmodule::Encoder<B>* Encoder_BCH::parameters\n-::build(const tools::BCH_Polynomial_Generator &GF) const\n+::build(const tools::BCH_polynomial_generator &GF) const\n{\nif (this->type == \"BCH\") return new module::Encoder_BCH<B>(this->K, this->N_cw, GF, this->n_frames);\n@@ -61,7 +61,7 @@ module::Encoder<B>* Encoder_BCH::parameters\ntemplate <typename B>\nmodule::Encoder<B>* Encoder_BCH\n-::build(const parameters ¶ms, const tools::BCH_Polynomial_Generator &GF)\n+::build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF)\n{\nreturn params.template build<B>(GF);\n}\n@@ -69,16 +69,16 @@ module::Encoder<B>* Encoder_BCH\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::parameters::build<B_8 >(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::parameters::build<B_16>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::parameters::build<B_32>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::parameters::build<B_64>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::build<B_8 >(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::build<B_16>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::build<B_32>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::build<B_64>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::parameters::build<B_8 >(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::parameters::build<B_16>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::parameters::build<B_32>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::parameters::build<B_64>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::build<B_8 >(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::build<B_16>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::build<B_32>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::build<B_64>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n#else\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::parameters::build<B>(const aff3ct::tools::BCH_Polynomial_Generator&) const;\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::build<B>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_Polynomial_Generator&);\n+template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::parameters::build<B>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::build<B>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.hpp",
"new_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.hpp",
"diff": "#include <string>\n#include \"Module/Encoder/Encoder.hpp\"\n-#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n+#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n#include \"../Encoder.hpp\"\n@@ -35,11 +35,11 @@ struct Encoder_BCH : public Encoder\n// builder\ntemplate <typename B = int>\n- module::Encoder<B>* build(const tools::BCH_Polynomial_Generator &GF) const;\n+ module::Encoder<B>* build(const tools::BCH_polynomial_generator &GF) const;\n};\ntemplate <typename B = int>\n- static module::Encoder<B>* build(const parameters ¶ms, const tools::BCH_Polynomial_Generator &GF);\n+ static module::Encoder<B>* build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/BCH/Codec_BCH.hpp",
"new_path": "src/Module/Codec/BCH/Codec_BCH.hpp",
"diff": "#ifndef CODEC_BCH_HPP_\n#define CODEC_BCH_HPP_\n-#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n+#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n#include \"Factory/Module/Encoder/BCH/Encoder_BCH.hpp\"\n#include \"Factory/Module/Decoder/BCH/Decoder_BCH.hpp\"\n@@ -16,7 +16,7 @@ template <typename B = int, typename Q = float>\nclass Codec_BCH : public Codec_SIHO<B,Q>\n{\nprotected:\n- const tools::BCH_Polynomial_Generator GF_poly;\n+ const tools::BCH_polynomial_generator GF_poly;\npublic:\nCodec_BCH(const factory::Encoder_BCH::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": "@@ -11,7 +11,7 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_BCH<B, R>\n-::Decoder_BCH(const int& K, const int& N, const tools::BCH_Polynomial_Generator &GF_poly, const int n_frames, const std::string name)\n+::Decoder_BCH(const int& K, const int& N, const tools::BCH_polynomial_generator &GF_poly, const int n_frames, const std::string name)\n: Decoder (K, N, n_frames, 1, name),\nDecoder_SIHO_HIHO<B,R>(K, N, n_frames, 1, name),\nelp(N+2, std::vector<int>(N)), discrepancy(N+2), l(N+2), u_lu(N+2), s(N+1), loc(200), reg(201),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"diff": "#include <vector>\n-#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n+#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n#include \"../Decoder_SIHO_HIHO.hpp\"\n@@ -34,7 +34,7 @@ protected:\nstd::vector<B> YH_N; // hard decision input vector\npublic:\n- Decoder_BCH(const int& K, const int& N, const tools::BCH_Polynomial_Generator &GF, const int n_frames = 1,\n+ Decoder_BCH(const int& K, const int& N, const tools::BCH_polynomial_generator &GF, const int n_frames = 1,\nconst std::string name = \"Decoder_BCH\");\nvirtual ~Decoder_BCH();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"new_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"diff": "@@ -9,7 +9,7 @@ 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_BCH(const int& K, const int& N, const tools::BCH_polynomial_generator& GF_poly, const int n_frames,\nconst std::string name)\n: Encoder<B>(K, N, n_frames, name), g(GF_poly.get_g()), bb(N - K)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp",
"new_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp",
"diff": "#include <vector>\n#include \"../Encoder.hpp\"\n-#include \"Tools/Code/BCH/BCH_Polynomial_Generator.hpp\"\n+#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\nnamespace aff3ct\n{\n@@ -19,7 +19,7 @@ protected:\nstd::vector<B> bb; // coefficients of redundancy polynomial x^(length-k) i(x) modulo g(x)\npublic:\n- Encoder_BCH(const int& K, const int& N, const tools::BCH_Polynomial_Generator& GF, const int n_frames = 1,\n+ Encoder_BCH(const int& K, const int& N, const tools::BCH_polynomial_generator& GF, const int n_frames = 1,\nconst std::string name = \"Encoder_BCH\");\nvirtual ~Encoder_BCH();\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Code/BCH/BCH_Polynomial_Generator.cpp",
"new_path": "src/Tools/Code/BCH/BCH_polynomial_generator.cpp",
"diff": "#include <sstream>\n-#include \"BCH_Polynomial_Generator.hpp\"\n+#include \"BCH_polynomial_generator.hpp\"\n#include \"Tools/Exception/exception.hpp\"\nusing namespace aff3ct::tools;\n-BCH_Polynomial_Generator\n-::BCH_Polynomial_Generator(const int& K, const int& N, const int& t)\n+BCH_polynomial_generator\n+::BCH_polynomial_generator(const int& K, const int& N, const int& t)\n: Galois(K, N), t(t), d(2 * t + 1)\n{\nif (t < 1)\n@@ -20,37 +20,37 @@ BCH_Polynomial_Generator\ncompute_polynomial();\n}\n-BCH_Polynomial_Generator\n-::~BCH_Polynomial_Generator()\n+BCH_polynomial_generator\n+::~BCH_polynomial_generator()\n{\n}\n-int BCH_Polynomial_Generator\n+int BCH_polynomial_generator\n::get_d() const\n{\nreturn d;\n}\n-int BCH_Polynomial_Generator\n+int BCH_polynomial_generator\n::get_t() const\n{\nreturn t;\n}\n-int BCH_Polynomial_Generator\n+int BCH_polynomial_generator\n::get_n_rdncy() const\n{\nreturn g.size() -1;\n}\n-const std::vector<int>& BCH_Polynomial_Generator\n+const std::vector<int>& BCH_polynomial_generator\n::get_g() const\n{\nreturn g;\n}\n-void BCH_Polynomial_Generator\n+void BCH_polynomial_generator\n::compute_polynomial()\n{\nint rdncy = 0;\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Code/BCH/BCH_Polynomial_Generator.hpp",
"new_path": "src/Tools/Code/BCH/BCH_polynomial_generator.hpp",
"diff": "-#ifndef BCH_Polynomial_Generator_HPP\n-#define BCH_Polynomial_Generator_HPP\n+#ifndef BCH_POLYNOMIAL_GENERATOR_HPP\n+#define BCH_POLYNOMIAL_GENERATOR_HPP\n#include <vector>\n@@ -9,7 +9,7 @@ namespace aff3ct\n{\nnamespace tools\n{\n-class BCH_Polynomial_Generator : public Galois\n+class BCH_polynomial_generator : public Galois\n{\nprotected:\nconst int t;\n@@ -18,8 +18,8 @@ protected:\nstd::vector<int> g; // coefficients of the generator polynomial, g(x)\npublic:\n- BCH_Polynomial_Generator(const int& K, const int& N, const int& t);\n- virtual ~BCH_Polynomial_Generator();\n+ BCH_polynomial_generator(const int& K, const int& N, const int& t);\n+ virtual ~BCH_polynomial_generator();\nint get_d () const;\nint get_t () const; // get the correction power\n@@ -33,4 +33,4 @@ private:\n}\n}\n-#endif /* GALOIS_HPP */\n+#endif /* BCH_POLYNOMIAL_GENERATOR_HPP */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Algo/Tree/Binary_tree.hpp>\n#include <Tools/Algo/Tree/Binary_tree_metric.hpp>\n#include <Tools/Arguments_reader.hpp>\n-#include <Tools/Code/BCH/BCH_Polynomial_Generator.hpp>\n+#include <Tools/Code/BCH/BCH_polynomial_generator.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/QC/QC.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change name BCH_polynomial_generator into lower case name
|
8,483 |
20.12.2017 15:10:12
| -3,600 |
424c41dc581ff8165af1110d37c68e701858a183
|
Add argument type return short title method; Seperate argument type and range implementations in different files
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_handler.cpp",
"new_path": "src/Tools/Arguments/Argument_handler.cpp",
"diff": "@@ -155,7 +155,7 @@ void Argument_handler\nif (std::find(existing_flags.begin(), existing_flags.end(), it->first.back()) == existing_flags.end())\n{\nif(it->second->type->get_title() != \"\")\n- std::cout << \" \" + print_tag(it->first.back()) << \" <\" << it->second->type->get_title() << \">\";\n+ std::cout << \" \" + print_tag(it->first.back()) << \" <\" << it->second->type->get_short_title() << \">\";\nelse\nstd::cout << \" \" + print_tag(it->first.back());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_map.hpp",
"new_path": "src/Tools/Arguments/Argument_map.hpp",
"diff": "#include <stdexcept>\n#include <map>\n-#include \"Argument_type.hpp\"\n-#include \"Argument_range.hpp\"\n+#include \"Argument_type/Argument_type.hpp\"\n+#include \"Argument_range/Argument_range.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Arguments/Argument_range.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp",
"diff": "@@ -197,4 +197,8 @@ public:\n}\n}\n+#include \"Non_zero.hpp\"\n+#include \"Negative.hpp\"\n+#include \"Positive.hpp\"\n+\n#endif /* ARGUMENT_RANGE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_range/Negative.hpp",
"diff": "+#ifndef ARGUMENT_RANGE_NEGATIVE_HPP_\n+#define ARGUMENT_RANGE_NEGATIVE_HPP_\n+\n+#include <string>\n+\n+#include \"Argument_range.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Negative : public Max<T>\n+{\n+public:\n+ Negative()\n+ : Max<T>(0)\n+ { }\n+\n+ virtual ~Negative() {};\n+\n+ virtual Negative* clone() const\n+ {\n+ return new Negative(*this);\n+ }\n+\n+ virtual std::string get_title() const\n+ {\n+ return \"negative\";\n+ }\n+};\n+\n+}\n+}\n+\n+#endif /* ARGUMENT_RANGE_NEGATIVE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_range/Non_zero.hpp",
"diff": "+#ifndef ARGUMENT_RANGE_NON_ZERO_HPP_\n+#define ARGUMENT_RANGE_NON_ZERO_HPP_\n+\n+#include <string>\n+\n+#include \"Argument_range.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Non_zero : public Excluding_set<T>\n+{\n+public:\n+ Non_zero()\n+ : Excluding_set<T>({0})\n+ { }\n+\n+ virtual ~Non_zero() {};\n+\n+ virtual Non_zero* clone() const\n+ {\n+ return new Non_zero(*this);\n+ }\n+\n+ virtual std::string get_title() const\n+ {\n+ return \"non-zero\";\n+ }\n+};\n+\n+}\n+}\n+\n+#endif /* ARGUMENT_RANGE_NON_ZERO_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_range/Positive.hpp",
"diff": "+#ifndef ARGUMENT_RANGE_POSITIVE_HPP_\n+#define ARGUMENT_RANGE_POSITIVE_HPP_\n+\n+#include <string>\n+\n+#include \"Argument_range.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Positive : public Min<T>\n+{\n+public:\n+ Positive()\n+ : Min<T>(0)\n+ { }\n+\n+ virtual ~Positive() {};\n+\n+ virtual Positive* clone() const\n+ {\n+ return new Positive(*this);\n+ }\n+\n+ virtual std::string get_title() const\n+ {\n+ return \"positive\";\n+ }\n+};\n+\n+}\n+}\n+\n+#endif /* ARGUMENT_RANGE_POSITIVE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/Arguments/Argument_range_basics.hpp",
"new_path": null,
"diff": "-#ifndef ARGUMENT_RANGE_BASICS_HPP_\n-#define ARGUMENT_RANGE_BASICS_HPP_\n-\n-#include <string>\n-#include <sstream>\n-#include <vector>\n-#include <stdexcept>\n-#include <algorithm>\n-\n-#include \"Argument_range.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-\n-template <typename T>\n-class Positive : public Min<T>\n-{\n-public:\n- Positive()\n- : Min<T>(0)\n- { }\n-\n- virtual ~Positive() {};\n-\n- virtual Positive* clone() const\n- {\n- return new Positive(*this);\n- }\n-\n- virtual std::string get_title() const\n- {\n- return \"positive\";\n- }\n-};\n-\n-template <typename T>\n-class Negative : public Max<T>\n-{\n-public:\n- Negative()\n- : Max<T>(0)\n- { }\n-\n- virtual ~Negative() {};\n-\n- virtual Negative* clone() const\n- {\n- return new Negative(*this);\n- }\n-\n- virtual std::string get_title() const\n- {\n- return \"negative\";\n- }\n-};\n-\n-template <typename T>\n-class Non_zero : public Excluding_set<T>\n-{\n-public:\n- Non_zero()\n- : Excluding_set<T>({0})\n- { }\n-\n- virtual ~Non_zero() {};\n-\n- virtual Non_zero* clone() const\n- {\n- return new Non_zero(*this);\n- }\n-\n- virtual std::string get_title() const\n- {\n- return \"non-zero\";\n- }\n-};\n-\n-}\n-}\n-\n-#endif /* ARGUMENT_RANGE_BASICS_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_tools.hpp",
"new_path": "src/Tools/Arguments/Argument_tools.hpp",
"diff": "#include <typeinfo>\n#include <stdexcept>\n#include \"Argument_map.hpp\"\n-#include \"Argument_type_basics.hpp\"\n-#include \"Argument_range_basics.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.cpp",
"diff": "+#include \"Argument_type.hpp\"\n+\n+const std::string aff3ct::tools::Argument_type::title_description_separator = \":\";\n+\n+aff3ct::tools::Argument_type\n+::Argument_type(const std::string& title)\n+: title(title)\n+{ }\n+\n+const std::string aff3ct::tools::Argument_type\n+::get_title() const\n+{\n+ return title;\n+}\n+\n+const std::string aff3ct::tools::Argument_type\n+::get_short_title() const\n+{\n+ auto pos = title.find(title_description_separator);\n+\n+ if (pos == std::string::npos)\n+ return title;\n+\n+ return title.substr(0, pos);\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Arguments/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "#include <string>\n#include <stdexcept>\n-#include \"Argument_range.hpp\"\n+#include \"../Argument_range/Argument_range.hpp\"\nnamespace aff3ct\n{\n@@ -13,23 +13,23 @@ namespace tools\nclass Argument_type\n{\n+public:\n+ static const std::string title_description_separator;\n+\nprotected:\nstd::string title;\npublic:\n- Argument_type(const std::string& title)\n- : title(title)\n- { }\n+ Argument_type(const std::string& title);\nvirtual ~Argument_type() {};\nvirtual void check(const std::string&) const = 0;\nvirtual Argument_type* clone() const = 0;\n- virtual const std::string get_title() const\n- {\n- return title;\n- }\n+ virtual const std::string get_title() const;\n+\n+ virtual const std::string get_short_title() const;\n};\ntemplate <typename T>\n@@ -76,7 +76,7 @@ public:\nauto t = this->title;\nif (ranges.size()) // then add ranges titles to the argument title\n{\n- t += \":\";\n+ t += Argument_type::title_description_separator;\nfor (unsigned i = 0; i < ranges.size(); i++)\n{\nt += ranges[i]->get_title();\n@@ -108,4 +108,10 @@ protected:\n}\n}\n+\n+#include \"None.hpp\"\n+#include \"Text.hpp\"\n+#include \"Real.hpp\"\n+#include \"Integer.hpp\"\n+\n#endif /* ARGUMENT_TYPE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_INTEGER_HPP_\n+#define ARGUMENT_TYPE_INTEGER_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+\n+#include \"Argument_type.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = int>\n+class Integer : public Argument_type_limited<T>\n+{\n+public:\n+ Integer(const std::vector<Argument_range<T>*>& ranges = {})\n+ : Argument_type_limited<T>(\"integer\", ranges)\n+ { }\n+\n+ virtual ~Integer() {};\n+\n+ virtual Integer<T>* clone() const\n+ {\n+ auto clone = new Integer<T>(*this);\n+\n+ return dynamic_cast<Integer<T>*>(this->clone_ranges(clone));\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ int int_num;\n+\n+ try\n+ {\n+ int_num = std::stoi(val);\n+ }\n+ catch(std::exception&)\n+ {\n+ throw std::runtime_error(\"shall be an integer\");\n+ }\n+\n+ this->check_ranges(int_num);\n+ }\n+};\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_INTEGER_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/None.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_NONE_HPP_\n+#define ARGUMENT_TYPE_NONE_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+\n+#include \"Argument_type.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+class None : public Argument_type\n+{\n+public:\n+ None()\n+ : Argument_type(\"\")\n+ { }\n+\n+ virtual ~None() {};\n+\n+ virtual None* clone() const\n+ {\n+ return new None(*this);\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ }\n+};\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_NONE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_REAL_HPP_\n+#define ARGUMENT_TYPE_REAL_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+\n+#include \"Argument_type.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = float>\n+class Real : public Argument_type_limited<T>\n+{\n+public:\n+ Real(const std::vector<Argument_range<T>*>& ranges = {})\n+ : Argument_type_limited<T>(\"real number\", ranges)\n+ { }\n+\n+ virtual ~Real() {};\n+\n+ virtual Real<T>* clone() const\n+ {\n+ auto clone = new Real<T>(*this);\n+\n+ return dynamic_cast<Real<T>*>(this->clone_ranges(clone));\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ float real_num;\n+\n+ try\n+ {\n+ real_num = std::stof(val);\n+ }\n+ catch(std::exception&)\n+ {\n+ throw std::runtime_error(\"shall be a real number\");\n+ }\n+\n+ this->check_ranges(real_num);\n+ }\n+};\n+\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_REAL_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_TEXT_HPP_\n+#define ARGUMENT_TYPE_TEXT_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+\n+#include \"Argument_type.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = std::string>\n+class Text : public Argument_type_limited<T>\n+{\n+public:\n+ Text(const std::vector<Argument_range<T>*>& ranges = {})\n+ : Argument_type_limited<T>(\"text\", ranges)\n+ { }\n+\n+ virtual ~Text() {};\n+\n+ virtual Text<T>* clone() const\n+ {\n+ auto clone = new Text<T>(*this);\n+\n+ return dynamic_cast<Text<T>*>(this->clone_ranges(clone));\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ if (val.empty())\n+ throw std::runtime_error(\"shall be a text\");\n+\n+ this->check_ranges(val);\n+ }\n+};\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_TEXT_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/Arguments/Argument_type_basics.hpp",
"new_path": null,
"diff": "-#ifndef ARGUMENT_TYPE_BASICS_HPP_\n-#define ARGUMENT_TYPE_BASICS_HPP_\n-\n-#include <string>\n-#include <stdexcept>\n-\n-#include \"Argument_type.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-\n-class None : public Argument_type\n-{\n-public:\n- None()\n- : Argument_type(\"\")\n- { }\n-\n- virtual ~None() {};\n-\n- virtual None* clone() const\n- {\n- return new None(*this);\n- }\n-\n- virtual void check(const std::string& val) const\n- {\n- }\n-};\n-\n-template <typename T = std::string>\n-class Text : public Argument_type_limited<T>\n-{\n-public:\n- Text(const std::vector<Argument_range<T>*>& ranges = {})\n- : Argument_type_limited<T>(\"text\", ranges)\n- { }\n-\n- virtual ~Text() {};\n-\n- virtual Text<T>* clone() const\n- {\n- auto clone = new Text<T>(*this);\n-\n- return dynamic_cast<Text<T>*>(this->clone_ranges(clone));\n- }\n-\n- virtual void check(const std::string& val) const\n- {\n- if (val.empty())\n- throw std::runtime_error(\"shall be a text\");\n-\n- this->check_ranges(val);\n- }\n-};\n-\n-template <typename T = int>\n-class Integer : public Argument_type_limited<T>\n-{\n-public:\n- Integer(const std::vector<Argument_range<T>*>& ranges = {})\n- : Argument_type_limited<T>(\"integer\", ranges)\n- { }\n-\n- virtual ~Integer() {};\n-\n- virtual Integer<T>* clone() const\n- {\n- auto clone = new Integer<T>(*this);\n-\n- return dynamic_cast<Integer<T>*>(this->clone_ranges(clone));\n- }\n-\n- virtual void check(const std::string& val) const\n- {\n- int int_num;\n-\n- try\n- {\n- int_num = std::stoi(val);\n- }\n- catch(std::exception&)\n- {\n- throw std::runtime_error(\"shall be an integer\");\n- }\n-\n- this->check_ranges(int_num);\n- }\n-};\n-\n-template <typename T = float>\n-class Real : public Argument_type_limited<T>\n-{\n-public:\n- Real(const std::vector<Argument_range<T>*>& ranges = {})\n- : Argument_type_limited<T>(\"real number\", ranges)\n- { }\n-\n- virtual ~Real() {};\n-\n- virtual Real<T>* clone() const\n- {\n- auto clone = new Real<T>(*this);\n-\n- return dynamic_cast<Real<T>*>(this->clone_ranges(clone));\n- }\n-\n- virtual void check(const std::string& val) const\n- {\n- float real_num;\n-\n- try\n- {\n- real_num = std::stof(val);\n- }\n- catch(std::exception&)\n- {\n- throw std::runtime_error(\"shall be a real number\");\n- }\n-\n- this->check_ranges(real_num);\n- }\n-};\n-\n-\n-}\n-}\n-#endif /* ARGUMENT_TYPE_BASICS_HPP_ */\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add argument type return short title method; Seperate argument type and range implementations in different files
|
8,490 |
20.12.2017 15:32:14
| -3,600 |
69a899c518d8d94e9283eb69221f5a4182c94ff8
|
Fix include issue.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/API/functions_polar_inter.h",
"new_path": "src/Tools/Code/Polar/API/functions_polar_inter.h",
"diff": "#include \"Tools/Math/utils.h\"\n#include \"Tools/Code/Polar/decoder_polar_functions.h\"\n+#include \"functions_polar_inter_intra.h\"\n+\nnamespace aff3ct\n{\nnamespace tools\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/API/functions_polar_intra.h",
"new_path": "src/Tools/Code/Polar/API/functions_polar_intra.h",
"diff": "#include \"Tools/Math/utils.h\"\n#include \"Tools/Code/Polar/decoder_polar_functions.h\"\n+#include \"functions_polar_inter_intra.h\"\n+\nnamespace aff3ct\n{\nnamespace tools\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix include issue.
|
8,483 |
20.12.2017 16:19:55
| -3,600 |
00e141f277982d56c5469be5aa44c2ef6c133e19
|
Add the management of the position of the argument in the command to favor the last ones
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_handler.cpp",
"new_path": "src/Tools/Arguments/Argument_handler.cpp",
"diff": "@@ -72,6 +72,8 @@ std::vector<bool> Argument_handler\n::sub_parse_arguments(const Argument_map_info &args, Argument_map_value& arg_v, std::vector<bool>& command_found_pos,\nstd::vector<std::string>& messages)\n{\n+ std::map<Argument_tag, size_t> tag_found_pos;\n+\nstd::vector<bool> args_found_pos(args.size(), false);\nif (this->command.size() != command_found_pos.size())\n@@ -93,6 +95,17 @@ std::vector<bool> Argument_handler\n{\nif (cur_tag == this->command[ix_arg_val]) // the tag has been found\n{\n+ // check if the tag has already been found in the command\n+ auto it_prev_pos = tag_found_pos.find(it_arg_info->first);\n+\n+ if (it_prev_pos == tag_found_pos.end())\n+ tag_found_pos[it_arg_info->first] = ix_arg_val; // not yet found then set the found position\n+\n+ else if (it_prev_pos->second >= ix_arg_val) // the tag is set further in the command so ignore this one\n+ continue;\n+ // else the tag is set previously in the command so overwrite it\n+\n+\nif(it_arg_info->second->type->get_title() == \"\") // do not wait for a value after the tag\n{\nauto it = arg_v.find(it_arg_info->first);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the management of the position of the argument in the command to favor the last ones
|
8,490 |
20.12.2017 17:27:17
| -3,600 |
25ab9d61348681c6c4c7c0377485799244a96e4e
|
Split the doc lines.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_handler.cpp",
"new_path": "src/Tools/Arguments/Argument_handler.cpp",
"diff": "#include <algorithm>\n#include <type_traits>\n+#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/general_utils.h\"\n#include \"Argument_handler.hpp\"\n-#include \"Tools/Display/bash_tools.h\"\nusing namespace aff3ct::tools;\n@@ -206,26 +207,48 @@ void Argument_handler\nstd::cout << std::endl;\n}\n+std::string split_doc(const std::string& line, const std::string start_line, const unsigned max_char)\n+{\n+ auto words = split(line);\n+ unsigned cur_char = start_line.length();\n+ std::string splitted_lines = start_line;\n+ for (auto &w : words)\n+ {\n+ if (cur_char + (unsigned)w.size() > max_char)\n+ {\n+ splitted_lines += \"\\n\" + start_line;\n+ cur_char = start_line.length();\n+ }\n+ splitted_lines += w + \" \";\n+\n+ cur_char += w.length() +1;\n+ }\n+\n+ return splitted_lines;\n+}\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{\nFormat arg_format = 0;\n- const auto tab = \" \";\n-\nstd::string tags_str = this->print_tag(tags);\ntags_str.append(max_n_char_arg - tags_str.size(), ' ');\n- std::cout << tab << format(tags_str, arg_format | Style::BOLD);\n+ const std::string tab = \" \";\n+ std::string tabr = tab;\n+ if (required)\n+ tabr = format(\"{R} \", arg_format | Style::BOLD | FG::Color::ORANGE);\n+\n+ std::cout << tabr << format(tags_str, arg_format | Style::BOLD);\nif (info.type->get_title().size())\nstd::cout << format(\" <\" + info.type->get_title() + \">\", arg_format | FG::GRAY);\n- if (required)\n- std::cout << format(\" {REQUIRED}\", arg_format | Style::BOLD | FG::Color::ORANGE);\n-\nstd::cout << std::endl;\n- std::cout << format(tab + info.doc, arg_format) << std::endl;\n+ auto splitted_doc = split_doc(info.doc, tab + \" \", 80);\n+ // std::cout << format(tab + info.doc, arg_format) << std::endl;\n+ std::cout << format(splitted_doc, arg_format) << std::endl;\n}\nvoid Argument_handler\n@@ -360,9 +383,10 @@ std::string Argument_handler\nstd::string Argument_handler\n::print_tag(const Argument_tag &tags)\n{\n- std::string txt = \"\\\"\";\n+ std::string txt;\n+ // txt += \"\\\"\";\nfor (unsigned i = 0; i < tags.size(); i++)\ntxt += print_tag(tags[i]) + ((i < tags.size()-1)?\", \":\"\");\n- txt += \"\\\"\";\n+ // txt += \"\\\"\";\nreturn txt;\n}\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Split the doc lines.
|
8,490 |
20.12.2017 17:27:47
| -3,600 |
3a74da7481d63deb591e49f78cbea678f876ff9c
|
Rm dead code.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_handler.cpp",
"new_path": "src/Tools/Arguments/Argument_handler.cpp",
"diff": "@@ -247,7 +247,6 @@ void Argument_handler\nstd::cout << std::endl;\nauto splitted_doc = split_doc(info.doc, tab + \" \", 80);\n- // std::cout << format(tab + info.doc, arg_format) << std::endl;\nstd::cout << format(splitted_doc, arg_format) << std::endl;\n}\n@@ -384,9 +383,7 @@ std::string Argument_handler\n::print_tag(const Argument_tag &tags)\n{\nstd::string txt;\n- // txt += \"\\\"\";\nfor (unsigned i = 0; i < tags.size(); i++)\ntxt += print_tag(tags[i]) + ((i < tags.size()-1)?\", \":\"\");\n- // txt += \"\\\"\";\nreturn txt;\n}\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rm dead code.
|
8,483 |
21.12.2017 11:56:00
| -3,600 |
62db61905bcb3b6b0eee25df553cd45ff039aafa
|
Add an argument list type
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -43,9 +43,24 @@ void Puncturer_turbo::parameters\nopt_args.add(\n{p+\"-pattern\"},\n- new tools::Text<>(),\n+ new tools::List<>(new tools::Text<>()),\n\"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n+ // opt_args.add(\n+ // {p+\"-pattern\"},\n+ // new tools::List<>(new tools::Text<>({new tools::Including_set<std::string>({\"00\", \"01\", \"10\", \"11\"})})),\n+ // \"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n+\n+ // opt_args.add(\n+ // {p+\"-pattern\"},\n+ // new tools::List<>(new tools::List<>(new tools::Boolean<>())),\n+ // \"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n+\n+ // opt_args.add(\n+ // {p+\"-pattern\"},\n+ // new tools::Text<>(),\n+ // \"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n+\nopt_args.add(\n{p+\"-tail-length\"},\nnew tools::Integer<>({new tools::Positive<int>()}),\n@@ -57,7 +72,32 @@ void Puncturer_turbo::parameters\n\"does not suppose a buffered encoding.\");\n}\n-int compute_N(const int K, const int tail_bits, const std::string pattern)\n+template <typename T>\n+std::string display_pattern(std::vector<T> pattern)\n+{\n+ std::string m;\n+\n+ for(auto &v : pattern)\n+ m += std::to_string(v) + \",\";\n+\n+ m.erase(m.size() -1);\n+\n+ return m;\n+}\n+\n+std::string display_pattern(std::vector<std::string> pattern)\n+{\n+ std::string m;\n+\n+ for(auto &v : pattern)\n+ m += v + \",\";\n+\n+ m.erase(m.size() -1);\n+\n+ return m;\n+}\n+\n+int compute_N(const int K, const int tail_bits, const std::vector<std::string> pattern)\n{\nstd::vector<std::vector<bool>> pattern_bits(3);\n@@ -68,34 +108,35 @@ int compute_N(const int K, const int tail_bits, const std::string pattern)\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- auto str_array = tools::split(pattern, ',');\n+ // auto str_array = tools::split(pattern, ',');\n- if (str_array.size() != 3)\n+ if (pattern.size() != 3)\n{\nstd::stringstream message;\n- message << \"'pattern' should give 3 different set delimited by a comma ('pattern' = \" << pattern\n- << \", 'str_array.size()' = \" << str_array.size() << \").\";\n+ message << \"'pattern' should give 3 different sets ('pattern' = \" << display_pattern(pattern)\n+ << \", 'pattern.size()' = \" << pattern.size() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- if (str_array[0].size() != str_array[1].size() || str_array[0].size() != str_array[2].size())\n+ if (pattern[0].size() != pattern[1].size() || pattern[0].size() != pattern[2].size())\n{\nstd::stringstream message;\n- message << \"'pattern' sets have to contains an equal number of bits ('pattern' = \" << pattern\n- << \", 'str_array[0].size()' = \" << str_array[0].size()\n- << \", 'str_array[1].size()' = \" << str_array[1].size()\n- << \", 'str_array[2].size()' = \" << str_array[2].size() << \").\";\n+ message << \"'pattern' sets have to contains an equal number of bits ('pattern' = \" << display_pattern(pattern)\n+ << \", 'pattern[0].size()' = \" << pattern[0].size()\n+ << \", 'pattern[1].size()' = \" << pattern[1].size()\n+ << \", 'pattern[2].size()' = \" << pattern[2].size() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\nauto all_one = true;\nfor (auto i = 0; i < 3; i++)\n- for (auto j = 0; j < (int)str_array[i].size(); j++)\n- all_one = str_array[i][j] != '1' ? false : all_one;\n+ for (auto j = 0; j < (int)pattern[i].size(); j++)\n+ all_one = pattern[i][j] != '1' ? false : all_one;\n+\nif (all_one)\nreturn 3 * K + tail_bits;\n- auto period = (int)str_array[0].size();\n+ auto period = (int)pattern[0].size();\nif (K % period)\n{\n@@ -111,7 +152,7 @@ int compute_N(const int K, const int tail_bits, const std::string pattern)\nfor (auto i = 0; i < 3; i++)\nfor (auto j = 0; j < period; j++)\n{\n- char c[2] = {str_array[i][j], '\\0'};\n+ char c[2] = {pattern[i][j], '\\0'};\npattern_bits[i][j] = std::stoi(std::string(c)) ? true : false;\n}\n@@ -126,6 +167,11 @@ int compute_N(const int K, const int tail_bits, const std::string pattern)\nreturn N;\n}\n+int compute_N(const int K, const int tail_bits, const std::string pattern)\n+{\n+ return compute_N(K, tail_bits, tools::List<>::get_list(pattern));\n+}\n+\nvoid Puncturer_turbo::parameters\n::store(const tools::Argument_map_value &vals)\n{\n@@ -134,11 +180,12 @@ void Puncturer_turbo::parameters\nauto p = this->get_prefix();\nif(vals.exist({p+\"-pattern\" })) this->pattern = vals.at ({p+\"-pattern\" });\n+ if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.to_list<tools::Generic_splitter, std::string>({p+\"-pattern\" });\nif(vals.exist({p+\"-tail-length\"})) this->tail_length = vals.to_int({p+\"-tail-length\"});\nif(vals.exist({p+\"-no-buff\" })) this->buffered = false;\nthis->N_cw = 3 * this->K + this->tail_length;\n- this->N = compute_N(this->K, this->tail_length, this->pattern);\n+ this->N = compute_N(this->K, this->tail_length, this->pattern2);\nif (this->N == this->N_cw)\nthis->type = \"NO\";\n@@ -153,7 +200,8 @@ void Puncturer_turbo::parameters\nif (this->type != \"NO\")\n{\n- headers[p].push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + this->pattern) + \"}\"));\n+ headers[p].push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + this->pattern + \"}\")));\n+ headers[p].push_back(std::make_pair(std::string(\"Pattern list\"), std::string(\"{\" + display_pattern(this->pattern2) + \"}\")));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Tail length\"), std::to_string(this->tail_length)));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Buffered\"), this->buffered ? \"on\" : \"off\"));\n}\n@@ -163,7 +211,7 @@ template <typename B, typename Q>\nmodule::Puncturer<B,Q>* Puncturer_turbo::parameters\n::build() const\n{\n- if (this->type == \"TURBO\") return new module::Puncturer_turbo<B,Q>(this->K, this->N, this->tail_length, this->pattern, this->buffered, this->n_frames);\n+ if (this->type == \"TURBO\") return new module::Puncturer_turbo<B,Q>(this->K, this->N, this->tail_length, display_pattern(this->pattern2), this->buffered, this->n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "#define FACTORY_PUNCTURER_TURBO_HPP\n#include <string>\n+#include <vector>\n#include \"Module/Puncturer/Puncturer.hpp\"\n@@ -22,6 +23,7 @@ struct Puncturer_turbo : public Puncturer\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// optional parameters\nstd::string pattern = \"111,111,111\";\n+ std::vector<std::string> pattern2;\nbool buffered = true;\nint tail_length = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -70,9 +70,9 @@ int Launcher::read_arguments()\n{\nthis->store_args();\n}\n- catch(std::exception&)\n+ catch(std::exception& e)\n{\n- this->params.display_help = true;\n+ cmd_error.push_back(e.what());\n}\nif (this->params.display_help)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_map.cpp",
"new_path": "src/Tools/Arguments/Argument_map.cpp",
"diff": "@@ -105,9 +105,6 @@ void Argument_map_info\nmother_t::clear();\n}\n-/* \\brief: clone itself in the 'other' map\n- * \\return a pointer to the clone map\n- */\nArgument_map_info* Argument_map_info\n::clone() const\n{\n@@ -119,9 +116,6 @@ Argument_map_info* Argument_map_info\nreturn other;\n}\n-/* \\brief: clone itself in the 'other' map\n- * \\param 'other' is the other map in which this class will be cloned. Clear it first of all\n- */\nvoid Argument_map_info\n::clone(Argument_map_info& other) const\n{\n@@ -147,13 +141,6 @@ bool Argument_map_value\nreturn (this->find(tags) != this->end());\n}\n-/*!\n- * \\brief Returns the value for an argument.\n- *\n- * \\param tags: list of tags associated to an argument, tags = {\"Key1\", \"Key2\", [...]}\n- *\n- * \\return the integer value of an argument with its tags (to use after the parse_arguments method).\n- */\nint Argument_map_value\n::to_int(const Argument_tag &tags) const\n{\n@@ -167,13 +154,6 @@ int Argument_map_value\n}\n}\n-/*!\n- * \\brief Returns the value for an argument.\n- *\n- * \\param tags: list of tags associated to an argument, tags = {\"Key1\", \"Key2\", [...]}.\n- *\n- * \\return the floating-point value of an argument with its tags (to use after the parse_arguments method).\n- */\nfloat Argument_map_value\n::to_float(const Argument_tag &tags) const\n{\n@@ -187,7 +167,6 @@ float Argument_map_value\n}\n}\n-\n/***********************************\n* Argument_map_group class\n***********************************/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_map.hpp",
"new_path": "src/Tools/Arguments/Argument_map.hpp",
"diff": "@@ -92,6 +92,26 @@ public:\n* \\return the floating-point value of an argument with its tags (to use after the parse_arguments method).\n*/\nfloat to_float(const Argument_tag &tags) const;\n+\n+ /*!\n+ * \\brief Returns the list of values for an argument.\n+ *\n+ * \\param tags: list of tags associated to an argument, tags = {\"Key1\", \"Key2\", [...]}.\n+ *\n+ * \\return the value of an argument with its tags (to use after the parse_arguments method).\n+ */\n+ template <class S, typename T>\n+ std::vector<T> to_list(const Argument_tag &tags) const\n+ {\n+ try\n+ {\n+ return List<S,T>::get_list(this->at(tags));\n+ }\n+ catch (std::exception&)\n+ {\n+ return std::vector<T>();\n+ }\n+ }\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp",
"diff": "@@ -109,7 +109,7 @@ public:\nvoid add_options(const std::vector<T>& new_options)\n{\n- for (auto& o : new_options)\n+ for (const auto& o : new_options)\nadd_option(o);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.cpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.cpp",
"diff": "@@ -16,10 +16,11 @@ const std::string aff3ct::tools::Argument_type\nconst std::string aff3ct::tools::Argument_type\n::get_short_title() const\n{\n- auto pos = title.find(title_description_separator);\n-\n- if (pos == std::string::npos)\nreturn title;\n-\n- return title.substr(0, pos);\n}\n+\n+// void* aff3ct::tools::Argument_type\n+// ::get_val(const std::string& val) const\n+// {\n+// return nullptr;\n+// }\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "@@ -27,9 +27,11 @@ public:\nvirtual void check(const std::string&) const = 0;\nvirtual Argument_type* clone() const = 0;\n+ // virtual void* get_val(const std::string& val) const;\n+\nvirtual const std::string get_title() const;\n- virtual const std::string get_short_title() const;\n+ const std::string get_short_title() const;\n};\ntemplate <typename T>\n@@ -71,23 +73,47 @@ public:\nreturn ranges;\n}\n- virtual const std::string get_title() const\n- {\n- auto t = this->title;\n- if (ranges.size()) // then add ranges titles to the argument title\n+ const std::string get_ranges_title() const\n{\n- t += Argument_type::title_description_separator;\n+ std::string t;\n+\n+ // add ranges titles\nfor (unsigned i = 0; i < ranges.size(); i++)\n{\nt += ranges[i]->get_title();\nif (i < (ranges.size()-1))\nt += \", \";\n}\n+\n+ return t;\n+ }\n+\n+ virtual const std::string get_title() const\n+ {\n+ auto t = this->title;\n+\n+ if (ranges.size()) // then add ranges titles to the argument title\n+ {\n+ t += Argument_type::title_description_separator;\n+ t += this->get_ranges_title();\n}\nreturn t;\n}\n+ // virtual T convert(const std::string& val) const\n+ // {\n+ // throw std::runtime_error(\"This method has not been instantiated for this class.\");\n+ // }\n+\n+ // virtual void* get_val(const std::string& val) const\n+ // {\n+ // T* p_val = new T(this->convert(val));\n+\n+ // return (void*)p_val;\n+ // }\n+\n+\nprotected:\nvirtual void check_ranges(const T& val) const\n{\n@@ -113,5 +139,7 @@ protected:\n#include \"Text.hpp\"\n#include \"Real.hpp\"\n#include \"Integer.hpp\"\n+#include \"Boolean.hpp\"\n+#include \"List.hpp\"\n#endif /* ARGUMENT_TYPE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"diff": "@@ -28,13 +28,18 @@ public:\nreturn dynamic_cast<Integer<T>*>(this->clone_ranges(clone));\n}\n+ virtual T convert(const std::string& val) const\n+ {\n+ return (T)std::stoi(val);\n+ }\n+\nvirtual void check(const std::string& val) const\n{\n- int int_num;\n+ T int_num;\ntry\n{\n- int_num = std::stoi(val);\n+ int_num = this->convert(val);\n}\ncatch(std::exception&)\n{\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_LIST_HPP_\n+#define ARGUMENT_TYPE_LIST_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+#include <iostream>\n+#include <type_traits>\n+\n+#include \"Argument_type.hpp\"\n+#include \"../Splitter/Splitter.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <class S = Generic_splitter, typename T = std::string>\n+class List : public Argument_type_limited<std::vector<T>>\n+{\n+protected:\n+ Argument_type* val_type;\n+\n+public:\n+ List(Argument_type* val_type, const std::vector<Argument_range<std::vector<T>>*>& ranges = {})\n+ : Argument_type_limited<std::vector<T>>(\"list of \" + val_type->get_short_title(), ranges), val_type(val_type)\n+ { }\n+\n+ virtual ~List()\n+ {\n+ if (val_type != nullptr) delete val_type;\n+ };\n+\n+ virtual List<S, T>* clone() const\n+ {\n+ return new List(val_type->clone());\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ // seperate values:\n+ auto list_vals = this->get_list(val);\n+\n+ for (const auto& v : list_vals)\n+ val_type->check(v);\n+\n+ this->check_ranges(list_vals);\n+ }\n+\n+ virtual const std::string get_title() const\n+ {\n+ auto t = \"list of (\" + val_type->get_title() + \")\";\n+\n+ auto rt = this->get_ranges_title();\n+ if (rt.size()) // then add ranges titles to the argument title\n+ {\n+ t += Argument_type::title_description_separator;\n+ t += rt;\n+ }\n+\n+ return t;\n+ }\n+\n+ // static std::vector<std::string> seperate(const std::string& val)\n+ // {\n+ // std::vector<std::string> list_vals;\n+\n+ // const std::string head = \"{([\";\n+ // const std::string queue = \"})]\";\n+ // const std::string separator = \";,.|\";\n+\n+ // // try first to find a head\n+ // size_t pos = val.find_first_of(head);\n+\n+ // if (pos == std::string::npos)\n+ // pos = 0;\n+ // else\n+ // pos++;\n+\n+ // while (pos < val.size())\n+ // {\n+ // // try to find any separator to get values\n+ // size_t found_pos = val.find_first_of(separator, pos);\n+\n+ // if (found_pos == std::string::npos)\n+ // {\n+ // // try find a queue character\n+ // found_pos = val.find_first_of(queue, pos);\n+\n+ // if (found_pos != std::string::npos)\n+ // list_vals.push_back(val.substr(pos, found_pos - pos));\n+ // else\n+ // list_vals.push_back(val.substr(pos));\n+\n+ // break;\n+ // }\n+\n+ // list_vals.push_back(val.substr(pos, found_pos - pos));\n+\n+\n+ // pos = found_pos + 1;\n+ // }\n+\n+ // return list_vals;\n+ // }\n+\n+ // virtual void* get_val(const std::string& val) const\n+ // {\n+ // auto* p_v = new std::vector<T>();\n+\n+ // auto v = get_list(val);\n+\n+ // p_v->swap(v);\n+\n+ // return (void*)p_v;\n+ // }\n+\n+ static std::vector<T> get_list(const std::string& val)\n+ {\n+ static_assert(std::is_same<T, std::string>::value || std::is_same<T, float>::value || std::is_same<T, int>::value || std::is_same<T, bool>::value,\n+ \"The get_list function is available only with a std::string, a float, a int or a bool type.\");\n+\n+ auto list = S::split(val);\n+\n+ std::vector<T> list_T(list.size());\n+\n+ void * p_val = nullptr;\n+\n+ for(unsigned i = 0; i < list.size(); i++)\n+ {\n+ if (std::is_same<T, float>::value)\n+ p_val = (void*)(new float(std::stof(list[i])));\n+\n+ else if (std::is_same<T, int>::value)\n+ p_val = (void*)(new int(std::stoi(list[i])));\n+\n+ else if (std::is_same<T, bool>::value)\n+ p_val = (void*)(new bool(std::stoi(list[i])));\n+\n+ else if (std::is_same<T, std::string>::value)\n+ p_val = (void*)(new std::string(list[i]));\n+\n+ else\n+ p_val = nullptr;\n+\n+\n+ if (p_val == nullptr)\n+ throw std::runtime_error(\"Couldn't convert value.\");\n+\n+ list_T[i] = *(T*)p_val;\n+\n+ delete (T*)p_val;\n+ }\n+\n+ return list_T;\n+ }\n+\n+};\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_LIST_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"diff": "@@ -28,13 +28,18 @@ public:\nreturn dynamic_cast<Real<T>*>(this->clone_ranges(clone));\n}\n+ virtual T convert(const std::string& val) const\n+ {\n+ return (T)std::stof(val);\n+ }\n+\nvirtual void check(const std::string& val) const\n{\n- float real_num;\n+ T real_num;\ntry\n{\n- real_num = std::stof(val);\n+ real_num = this->convert(val);\n}\ncatch(std::exception&)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"diff": "@@ -28,12 +28,20 @@ public:\nreturn dynamic_cast<Text<T>*>(this->clone_ranges(clone));\n}\n+ virtual T convert(const std::string& val) const\n+ {\n+ return val;\n+ }\n+\n+\nvirtual void check(const std::string& val) const\n{\n+ auto str_val = this->convert(val);\n+\nif (val.empty())\nthrow std::runtime_error(\"shall be a text\");\n- this->check_ranges(val);\n+ this->check_ranges(str_val);\n}\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Splitter/Splitter.hpp",
"diff": "+#ifndef ARGUMENT_SPLITTER_HPP_\n+#define ARGUMENT_SPLITTER_HPP_\n+\n+#include <string>\n+#include <vector>\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+struct Splitter\n+{\n+ static std::vector<std::string> split(const std::string& val,\n+ const std::string& head,\n+ const std::string& queue,\n+ const std::string& separator)\n+ {\n+ std::vector<std::string> list_vals;\n+\n+ // try first to find a head\n+ size_t pos = val.find_first_of(head);\n+\n+ if (pos == std::string::npos)\n+ pos = 0;\n+ else\n+ pos++;\n+\n+ while (pos < val.size())\n+ {\n+ // try to find any separator to get values\n+ size_t found_pos = val.find_first_of(separator, pos);\n+\n+ if (found_pos == std::string::npos)\n+ {\n+ // try find a queue character\n+ found_pos = val.find_first_of(queue, pos);\n+\n+ if (found_pos != std::string::npos)\n+ list_vals.push_back(val.substr(pos, found_pos - pos));\n+ else\n+ list_vals.push_back(val.substr(pos));\n+\n+ break;\n+ }\n+\n+ list_vals.push_back(val.substr(pos, found_pos - pos));\n+\n+\n+ pos = found_pos + 1;\n+ }\n+\n+ return list_vals;\n+ }\n+};\n+\n+struct Generic_splitter : Splitter\n+{\n+ static std::vector<std::string> split(const std::string& val)\n+ {\n+ const std::string head = \"{([\";\n+ const std::string queue = \"})]\";\n+ const std::string separator = \";,.|\";\n+\n+ return Splitter::split(val, head, queue, separator);\n+ }\n+};\n+\n+\n+\n+\n+\n+// static std::vector<T> get_list(const std::string& val)\n+// {\n+// static_assert(std::is_same<T, std::string>::value || std::is_same<T, float>::value || std::is_same<T, int>::value || std::is_same<T, bool>::value,\n+// \"The get_list function is available only with a std::string, a float, a int or a bool type.\");\n+\n+// auto list = seperate(val);\n+\n+// std::vector<T> list_T(list.size());\n+\n+// void * p_val = nullptr;\n+\n+// for(unsigned i = 0; i < list.size(); i++)\n+// {\n+// if (std::is_same<T, float>::value)\n+// p_val = (void*)(new float(std::stof(list[i])));\n+\n+// else if (std::is_same<T, int>::value)\n+// p_val = (void*)(new int(std::stoi(list[i])));\n+\n+// else if (std::is_same<T, bool>::value)\n+// p_val = (void*)(new bool(std::stoi(list[i])));\n+\n+// else if (std::is_same<T, std::string>::value)\n+// p_val = (void*)(new std::string(list[i]));\n+\n+// else\n+// p_val = nullptr;\n+\n+\n+// if (p_val == nullptr)\n+// throw std::runtime_error(\"Couldn't convert value.\");\n+\n+// list_T[i] = *(T*)p_val;\n+\n+// delete (T*)p_val;\n+// }\n+\n+// return list_T;\n+// }\n+\n+}\n+}\n+#endif /* ARGUMENT_SPLITTER_HPP_ */\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add an argument list type
|
8,483 |
21.12.2017 14:28:19
| -3,600 |
2768bbe0e50bc1460d670ea0d4f6d3d6399ddd41
|
Add Boolean argument type; Make turbo pattern argument works with a 2D list argument type
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_BOOLEAN_HPP_\n+#define ARGUMENT_TYPE_BOOLEAN_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+#include <iostream>\n+\n+#include \"Argument_type.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = bool>\n+class Boolean : public Argument_type_limited<T>\n+{\n+public:\n+ Boolean()\n+ : Argument_type_limited<T>(\"boolean\", {new Including_set<bool>({(bool)0, (bool)1})})\n+ { }\n+\n+ virtual ~Boolean() {};\n+\n+ virtual Boolean<T>* clone() const\n+ {\n+ auto clone = new Boolean<T>(*this);\n+\n+ return dynamic_cast<Boolean<T>*>(this->clone_ranges(clone));\n+ }\n+\n+ virtual int convert(const std::string& val) const\n+ {\n+ return std::stoi(val);\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ int bool_num;\n+\n+ try\n+ {\n+ bool_num = this->convert(val);\n+ }\n+ catch(std::exception&)\n+ {\n+ throw std::runtime_error(\"shall be a boolean\");\n+ }\n+\n+ if (bool_num != 1 && bool_num != 0)\n+ throw std::runtime_error(\"shall be a boolean\");\n+\n+ this->check_ranges((bool)bool_num);\n+ }\n+};\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_BOOLEAN_HPP_ */\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add Boolean argument type; Make turbo pattern argument works with a 2D list argument type
|
8,483 |
21.12.2017 15:40:27
| -3,600 |
8e03c4d580deff6713636b2287ca5499fa5a717b
|
Add the Length argument range; Add length constraint in the turbo poncturer pattern
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -43,24 +43,11 @@ void Puncturer_turbo::parameters\nopt_args.add(\n{p+\"-pattern\"},\n- new tools::List<>(new tools::Text<>()),\n+ new tools::List<>(new tools::List<tools::String_splitter>(new tools::Boolean<>(), // list of list of boolean\n+ {new tools::Length<std::vector<std::string>>(2, 3)}), // std::vector<std::string> is the container of each element after being splitted\n+ {new tools::Length<std::vector<std::string>>(3, 3)}), // std::vector<std::string> is the container of each element after being splitted\n\"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n- // opt_args.add(\n- // {p+\"-pattern\"},\n- // new tools::List<>(new tools::Text<>({new tools::Including_set<std::string>({\"00\", \"01\", \"10\", \"11\"})})),\n- // \"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n-\n- // opt_args.add(\n- // {p+\"-pattern\"},\n- // new tools::List<>(new tools::List<>(new tools::Boolean<>())),\n- // \"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n-\n- // opt_args.add(\n- // {p+\"-pattern\"},\n- // new tools::Text<>(),\n- // \"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n-\nopt_args.add(\n{p+\"-tail-length\"},\nnew tools::Integer<>({new tools::Positive<int>()}),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_map.hpp",
"new_path": "src/Tools/Arguments/Argument_map.hpp",
"diff": "#include <map>\n#include \"Argument_type/Argument_type.hpp\"\n-#include \"Argument_range/Argument_range.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp",
"diff": "@@ -200,5 +200,6 @@ public:\n#include \"Non_zero.hpp\"\n#include \"Negative.hpp\"\n#include \"Positive.hpp\"\n+#include \"Length.hpp\"\n#endif /* ARGUMENT_RANGE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_range/Length.hpp",
"diff": "+#ifndef ARGUMENT_RANGE_LENGTH_HPP_\n+#define ARGUMENT_RANGE_LENGTH_HPP_\n+\n+#include <string>\n+#include <sstream>\n+#include <stdexcept>\n+\n+#include \"Argument_range.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = std::string>\n+class Length : public Argument_range<T>\n+{\n+ const size_t min_size;\n+ const size_t max_size;\n+\n+public:\n+ /*\n+ * min_size is the minimal size must have the checked container (0 means no minimum)\n+ * max_size is the maximal size must have the checked container (0 means infinite)\n+ */\n+ Length(size_t min_size = 0, size_t max_size = 0)\n+ : Argument_range<T>(\"limited length [\" + std::to_string(min_size) + \";\" + (max_size?std::to_string(max_size):\"inf\") + \"]\"),\n+ min_size(min_size), max_size(max_size)\n+ { }\n+\n+ virtual ~Length() {};\n+\n+ virtual Length<T>* clone() const\n+ {\n+ return new Length(*this);\n+ }\n+\n+ virtual void check(const T& val) const\n+ {\n+ size_t container_size = val.size();\n+\n+ if (min_size > container_size || (max_size < container_size && max_size != 0))\n+ {\n+ std::stringstream message;\n+ message << \"shall have a length \";\n+\n+ if (min_size == max_size)\n+ message << \"of \" << max_size;\n+ else if (min_size == 0)\n+ message << \"of maximum \" << max_size;\n+ else if (max_size != 0)\n+ message << \"of minimum \" << min_size << \" and maximum \" << max_size;\n+ else\n+ message << \"of minimum \" << min_size;\n+\n+ message << \" elements (given \" << container_size << \" elements)\";\n+\n+ throw std::runtime_error(message.str());\n+ }\n+ }\n+};\n+\n+}\n+}\n+\n+#endif /* ARGUMENT_RANGE_LENGTH_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"diff": "#include <string>\n#include <stdexcept>\n-#include <iostream>\n+#include <sstream>\n#include \"Argument_type.hpp\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "#define ARGUMENT_TYPE_LIST_HPP_\n#include <string>\n+#include <sstream>\n#include <stdexcept>\n-#include <iostream>\n#include <type_traits>\n#include \"Argument_type.hpp\"\n@@ -40,10 +40,22 @@ public:\n// seperate values:\nauto list_vals = this->get_list(val);\n- for (const auto& v : list_vals)\n- val_type->check(v);\n-\nthis->check_ranges(list_vals);\n+\n+ unsigned i = 0;\n+\n+ try\n+ {\n+ for (; i < list_vals.size(); i++)\n+ val_type->check(list_vals[i]);\n+ }\n+ catch(std::exception& e)\n+ {\n+ std::stringstream message;\n+ message << \"has the element \" << i << \" (\" << list_vals[i] << \") not respecting the rules: \" << e.what();\n+\n+ throw std::runtime_error(message.str());\n+ }\n}\nvirtual const std::string get_title() const\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Splitter/Splitter.hpp",
"new_path": "src/Tools/Arguments/Splitter/Splitter.hpp",
"diff": "@@ -66,6 +66,19 @@ struct Generic_splitter : Splitter\n}\n};\n+struct String_splitter\n+{\n+ static std::vector<std::string> split(const std::string& val)\n+ {\n+ std::vector<std::string> list_vals(val.size());\n+\n+ for (unsigned i = 0; i < val.size(); i++)\n+ list_vals[i].append(1, val[i]);\n+\n+ return list_vals;\n+ }\n+};\n+\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the Length argument range; Add length constraint in the turbo poncturer pattern
|
8,483 |
21.12.2017 16:58:42
| -3,600 |
c8df93dd66e08c68781b05eafba07bf15f86781d
|
Argument map val can now return a list with good values; Argument map val takes as second argument the type matching with the argument
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -43,9 +43,9 @@ void Puncturer_turbo::parameters\nopt_args.add(\n{p+\"-pattern\"},\n- new tools::List<>(new tools::List<tools::String_splitter>(new tools::Boolean<>(), // list of list of boolean\n- {new tools::Length<std::vector<std::string>>(2, 3)}), // std::vector<std::string> is the container of each element after being splitted\n- {new tools::Length<std::vector<std::string>>(3, 3)}), // std::vector<std::string> is the container of each element after being splitted\n+ new tools::List<tools::Generic_splitter, std::vector<bool>>(new tools::List<tools::String_splitter, bool>(new tools::Boolean<>(), // list of list of boolean\n+ {new tools::Length<std::vector<bool>>(2, 3)}), // std::vector<std::string> is the container of each element after being splitted\n+ {new tools::Length<std::vector<std::vector<bool>>>(3, 3)}), // std::vector<std::string> is the container of each element after being splitted\n\"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\nopt_args.add(\n@@ -84,10 +84,25 @@ std::string display_pattern(std::vector<std::string> pattern)\nreturn m;\n}\n-int compute_N(const int K, const int tail_bits, const std::vector<std::string> pattern)\n+std::string display_pattern(std::vector<std::vector<bool>> pattern)\n{\n- std::vector<std::vector<bool>> pattern_bits(3);\n+ std::string m;\n+\n+ for(auto &v : pattern)\n+ {\n+ for(const auto &vb : v)\n+ m += std::to_string(vb);\n+\n+ m += \",\";\n+ }\n+\n+ m.erase(m.size() -1);\n+\n+ return m;\n+}\n+int compute_N(const int K, const int tail_bits, const std::vector<std::vector<bool>> pattern)\n+{\nif (tail_bits < 0)\n{\nstd::stringstream message;\n@@ -108,7 +123,7 @@ int compute_N(const int K, const int tail_bits, const std::vector<std::string>\nif (pattern[0].size() != pattern[1].size() || pattern[0].size() != pattern[2].size())\n{\nstd::stringstream message;\n- message << \"'pattern' sets have to contains an equal number of bits ('pattern' = \" << display_pattern(pattern)\n+ message << \"'pattern' sets have to contain an equal number of bits ('pattern' = \" << display_pattern(pattern)\n<< \", 'pattern[0].size()' = \" << pattern[0].size()\n<< \", 'pattern[1].size()' = \" << pattern[1].size()\n<< \", 'pattern[2].size()' = \" << pattern[2].size() << \").\";\n@@ -118,12 +133,12 @@ int compute_N(const int K, const int tail_bits, const std::vector<std::string>\nauto all_one = true;\nfor (auto i = 0; i < 3; i++)\nfor (auto j = 0; j < (int)pattern[i].size(); j++)\n- all_one = pattern[i][j] != '1' ? false : all_one;\n+ all_one = pattern[i][j] != 1 ? false : all_one;\nif (all_one)\nreturn 3 * K + tail_bits;\n- auto period = (int)pattern[0].size();\n+ auto period = (int)pattern.front().size();\nif (K % period)\n{\n@@ -132,20 +147,9 @@ int compute_N(const int K, const int tail_bits, const std::vector<std::string>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- pattern_bits[0].resize(period);\n- pattern_bits[1].resize(period);\n- pattern_bits[2].resize(period);\n-\n- for (auto i = 0; i < 3; i++)\n- for (auto j = 0; j < period; j++)\n- {\n- char c[2] = {pattern[i][j], '\\0'};\n- pattern_bits[i][j] = std::stoi(std::string(c)) ? true : false;\n- }\n-\n- auto bit_sys_count = 0; for (auto j = 0; j < period; j++) bit_sys_count += pattern_bits[0][j] ? 1 : 0;\n- auto bit_pa1_count = 0; for (auto j = 0; j < period; j++) bit_pa1_count += pattern_bits[1][j] ? 1 : 0;\n- auto bit_pa2_count = 0; for (auto j = 0; j < period; j++) bit_pa2_count += pattern_bits[2][j] ? 1 : 0;\n+ auto bit_sys_count = 0; for (auto j = 0; j < period; j++) bit_sys_count += pattern[0][j] ? 1 : 0;\n+ auto bit_pa1_count = 0; for (auto j = 0; j < period; j++) bit_pa1_count += pattern[1][j] ? 1 : 0;\n+ auto bit_pa2_count = 0; for (auto j = 0; j < period; j++) bit_pa2_count += pattern[2][j] ? 1 : 0;\nauto bit_count = bit_sys_count + bit_pa1_count + bit_pa2_count;\n@@ -154,11 +158,6 @@ int compute_N(const int K, const int tail_bits, const std::vector<std::string>\nreturn N;\n}\n-int compute_N(const int K, const int tail_bits, const std::string pattern)\n-{\n- return compute_N(K, tail_bits, tools::List<>::get_list(pattern));\n-}\n-\nvoid Puncturer_turbo::parameters\n::store(const tools::Argument_map_value &vals)\n{\n@@ -167,7 +166,7 @@ void Puncturer_turbo::parameters\nauto p = this->get_prefix();\nif(vals.exist({p+\"-pattern\" })) this->pattern = vals.at ({p+\"-pattern\" });\n- if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.to_list<tools::Generic_splitter, std::string>({p+\"-pattern\" });\n+ if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.to_list<std::vector<bool>>({p+\"-pattern\" });\nif(vals.exist({p+\"-tail-length\"})) this->tail_length = vals.to_int({p+\"-tail-length\"});\nif(vals.exist({p+\"-no-buff\" })) this->buffered = false;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "@@ -23,7 +23,7 @@ struct Puncturer_turbo : public Puncturer\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// optional parameters\nstd::string pattern = \"111,111,111\";\n- std::vector<std::string> pattern2;\n+ std::vector<std::vector<bool>> pattern2;\nbool buffered = true;\nint tail_length = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_handler.cpp",
"new_path": "src/Tools/Arguments/Argument_handler.cpp",
"diff": "@@ -113,7 +113,7 @@ std::vector<bool> Argument_handler\nif (it == arg_v.end())\nfound_arg_count++;\n- arg_v[it_arg_info->first] = \"\";\n+ arg_v[it_arg_info->first] = std::make_pair(\"\", it_arg_info->second);\ncommand_found_pos[ix_arg_val] = true;\nargs_found_pos[std::distance(args.begin(), it_arg_info)] = true;\n@@ -126,7 +126,7 @@ std::vector<bool> Argument_handler\nif (it == arg_v.end())\nfound_arg_count++;\n- arg_v[it_arg_info->first] = this->command[ix_arg_val +1];\n+ arg_v[it_arg_info->first] = std::make_pair(this->command[ix_arg_val +1], it_arg_info->second);\ncommand_found_pos[ix_arg_val ] = true;\ncommand_found_pos[ix_arg_val +1] = true;\nargs_found_pos[std::distance(args.begin(), it_arg_info)] = true;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_map.hpp",
"new_path": "src/Tools/Arguments/Argument_map.hpp",
"diff": "@@ -65,10 +65,10 @@ public:\n};\n-class Argument_map_value : public std::map<Argument_tag, std::string>\n+class Argument_map_value : public std::map<Argument_tag, std::pair<std::string, Argument_info*>>\n{\npublic:\n- using mother_t = std::map<Argument_tag, std::string>;\n+ using mother_t = std::map<Argument_tag, std::pair<std::string, Argument_info*>>;\npublic:\n@@ -99,17 +99,33 @@ public:\n*\n* \\return the value of an argument with its tags (to use after the parse_arguments method).\n*/\n- template <class S, typename T>\n+ template <typename T>\nstd::vector<T> to_list(const Argument_tag &tags) const\n{\n+ std::vector<T> list;\n+\ntry\n{\n- return List<S,T>::get_list(this->at(tags));\n+ auto& val_info_pair = mother_t::at(tags);\n+\n+ auto* p_list = (std::vector<T>*)val_info_pair.second->type->get_val(val_info_pair.first);\n+\n+ if (p_list != nullptr)\n+ {\n+ list.swap(*p_list);\n+ delete p_list;\n+ }\n}\ncatch (std::exception&)\n{\n- return std::vector<T>();\n}\n+\n+ return list;\n+ }\n+\n+ std::string at(const Argument_tag &tags) const\n+ {\n+ return mother_t::at(tags).first;\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.cpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.cpp",
"diff": "@@ -19,8 +19,8 @@ const std::string aff3ct::tools::Argument_type\nreturn title;\n}\n-// void* aff3ct::tools::Argument_type\n-// ::get_val(const std::string& val) const\n-// {\n-// return nullptr;\n-// }\n\\ No newline at end of file\n+void* aff3ct::tools::Argument_type\n+::get_val(const std::string& val) const\n+{\n+ return nullptr;\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "@@ -27,7 +27,7 @@ public:\nvirtual void check(const std::string&) const = 0;\nvirtual Argument_type* clone() const = 0;\n- // virtual void* get_val(const std::string& val) const;\n+ virtual void* get_val(const std::string& val) const;\nvirtual const std::string get_title() const;\n@@ -40,6 +40,9 @@ class Argument_type_limited : public Argument_type\nprivate:\nstd::vector<Argument_range<T>*> ranges;\n+public:\n+ using type = T;\n+\npublic:\nArgument_type_limited(const std::string& title, const std::vector<Argument_range<T>*>& new_ranges = {})\n: Argument_type(title)\n@@ -101,17 +104,17 @@ public:\nreturn t;\n}\n- // virtual T convert(const std::string& val) const\n- // {\n- // throw std::runtime_error(\"This method has not been instantiated for this class.\");\n- // }\n+ virtual T convert(const std::string& val) const\n+ {\n+ throw std::runtime_error(\"This method has not been instantiated for this class.\");\n+ }\n- // virtual void* get_val(const std::string& val) const\n- // {\n- // T* p_val = new T(this->convert(val));\n+ virtual void* get_val(const std::string& val) const\n+ {\n+ T* p_val = new T(this->convert(val));\n- // return (void*)p_val;\n- // }\n+ return (void*)p_val;\n+ }\nprotected:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"diff": "@@ -12,12 +12,13 @@ namespace aff3ct\nnamespace tools\n{\n-template <typename T = bool>\n+template <typename T = int> // shall not be of type \"bool\" because a val of (int 5) would be converted\n+ // to (bool 1) and then can't be checked correctly as a boolean value 0 or 1\nclass Boolean : public Argument_type_limited<T>\n{\npublic:\nBoolean()\n- : Argument_type_limited<T>(\"boolean\", {new Including_set<bool>({(bool)0, (bool)1})})\n+ : Argument_type_limited<T>(\"boolean\", {new Including_set<int>({0, 1})})\n{ }\nvirtual ~Boolean() {};\n@@ -47,10 +48,7 @@ public:\nthrow std::runtime_error(\"shall be a boolean\");\n}\n- if (bool_num != 1 && bool_num != 0)\n- throw std::runtime_error(\"shall be a boolean\");\n-\n- this->check_ranges((bool)bool_num);\n+ this->check_ranges(bool_num);\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "@@ -14,15 +14,15 @@ namespace aff3ct\nnamespace tools\n{\n-template <class S = Generic_splitter, typename T = std::string>\n-class List : public Argument_type_limited<std::vector<T>>\n+template <class S = Generic_splitter, typename List_element_type = std::string>\n+class List : public Argument_type_limited<std::vector<List_element_type>>\n{\nprotected:\nArgument_type* val_type;\npublic:\n- List(Argument_type* val_type, const std::vector<Argument_range<std::vector<T>>*>& ranges = {})\n- : Argument_type_limited<std::vector<T>>(\"list of \" + val_type->get_short_title(), ranges), val_type(val_type)\n+ List(Argument_type* val_type, const std::vector<Argument_range<std::vector<List_element_type>>*>& ranges = {})\n+ : Argument_type_limited<std::vector<List_element_type>>(\"list of \" + val_type->get_short_title(), ranges), val_type(val_type)\n{ }\nvirtual ~List()\n@@ -30,15 +30,16 @@ public:\nif (val_type != nullptr) delete val_type;\n};\n- virtual List<S, T>* clone() const\n+ virtual List<S, List_element_type>* clone() const\n{\nreturn new List(val_type->clone());\n}\nvirtual void check(const std::string& val) const\n{\n- // seperate values:\n- auto list_vals = this->get_list(val);\n+ // separate values:\n+ auto list = S::split(val);\n+ auto list_vals = this->convert(list);\nthis->check_ranges(list_vals);\n@@ -46,13 +47,13 @@ public:\ntry\n{\n- for (; i < list_vals.size(); i++)\n- val_type->check(list_vals[i]);\n+ for (; i < list.size(); i++)\n+ val_type->check(list[i]);\n}\ncatch(std::exception& e)\n{\nstd::stringstream message;\n- message << \"has the element \" << i << \" (\" << list_vals[i] << \") not respecting the rules: \" << e.what();\n+ message << \"has the element \" << i << \" (\" << list[i] << \") not respecting the rules: \" << e.what();\nthrow std::runtime_error(message.str());\n}\n@@ -72,95 +73,27 @@ public:\nreturn t;\n}\n- // static std::vector<std::string> seperate(const std::string& val)\n- // {\n- // std::vector<std::string> list_vals;\n-\n- // const std::string head = \"{([\";\n- // const std::string queue = \"})]\";\n- // const std::string separator = \";,.|\";\n-\n- // // try first to find a head\n- // size_t pos = val.find_first_of(head);\n-\n- // if (pos == std::string::npos)\n- // pos = 0;\n- // else\n- // pos++;\n-\n- // while (pos < val.size())\n- // {\n- // // try to find any separator to get values\n- // size_t found_pos = val.find_first_of(separator, pos);\n-\n- // if (found_pos == std::string::npos)\n- // {\n- // // try find a queue character\n- // found_pos = val.find_first_of(queue, pos);\n-\n- // if (found_pos != std::string::npos)\n- // list_vals.push_back(val.substr(pos, found_pos - pos));\n- // else\n- // list_vals.push_back(val.substr(pos));\n-\n- // break;\n- // }\n-\n- // list_vals.push_back(val.substr(pos, found_pos - pos));\n-\n-\n- // pos = found_pos + 1;\n- // }\n-\n- // return list_vals;\n- // }\n-\n- // virtual void* get_val(const std::string& val) const\n- // {\n- // auto* p_v = new std::vector<T>();\n-\n- // auto v = get_list(val);\n-\n- // p_v->swap(v);\n-\n- // return (void*)p_v;\n- // }\n-\n- static std::vector<T> get_list(const std::string& val)\n+ virtual std::vector<List_element_type> convert(const std::string& val) const\n{\n- static_assert(std::is_same<T, std::string>::value || std::is_same<T, float>::value || std::is_same<T, int>::value || std::is_same<T, bool>::value,\n- \"The get_list function is available only with a std::string, a float, a int or a bool type.\");\n-\n- auto list = S::split(val);\n+ return this->convert(S::split(val));\n+ }\n- std::vector<T> list_T(list.size());\n+ virtual std::vector<List_element_type> convert(const std::vector<std::string>& list) const\n+ {\n+ std::vector<List_element_type> list_T(list.size());\nvoid * p_val = nullptr;\nfor(unsigned i = 0; i < list.size(); i++)\n{\n- if (std::is_same<T, float>::value)\n- p_val = (void*)(new float(std::stof(list[i])));\n-\n- else if (std::is_same<T, int>::value)\n- p_val = (void*)(new int(std::stoi(list[i])));\n-\n- else if (std::is_same<T, bool>::value)\n- p_val = (void*)(new bool(std::stoi(list[i])));\n-\n- else if (std::is_same<T, std::string>::value)\n- p_val = (void*)(new std::string(list[i]));\n-\n- else\n- p_val = nullptr;\n-\n+ p_val = val_type->get_val(list[i]);\nif (p_val == nullptr)\nthrow std::runtime_error(\"Couldn't convert value.\");\n- list_T[i] = *(T*)p_val;\n+ list_T[i] = *(List_element_type*)p_val;\n- delete (T*)p_val;\n+ delete (List_element_type*)p_val;\n}\nreturn list_T;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Argument map val can now return a list with good values; Argument map val takes as second argument the type matching with the argument
|
8,483 |
22.12.2017 16:01:51
| -3,600 |
c395811d34e690832f3d2b2fc38906ed93032ebe
|
Check first elements before list ranges
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "@@ -39,12 +39,8 @@ public:\n{\n// separate values:\nauto list = S::split(val);\n- auto list_vals = this->convert(list);\n-\n- this->check_ranges(list_vals);\nunsigned i = 0;\n-\ntry\n{\nfor (; i < list.size(); i++)\n@@ -57,6 +53,11 @@ public:\nthrow std::runtime_error(message.str());\n}\n+\n+ auto list_vals = this->convert(list);\n+\n+ this->check_ranges(list_vals);\n+\n}\nvirtual const std::string get_title() const\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Check first elements before list ranges
|
8,483 |
03.01.2018 09:46:11
| -3,600 |
500e6b0c18f5ecf5ef1a3381f2bcf5ca334f20de
|
Move compute N and pattern functions into poncturer turbo module instead of factory then can reuse it in the module itself. Add Splitter functions in PT module
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "using namespace aff3ct;\nusing namespace aff3ct::factory;\n+using PT = aff3ct::module::Puncturer_turbo<>;\n+\nconst std::string aff3ct::factory::Puncturer_turbo::name = \"Puncturer Turbo\";\nconst std::string aff3ct::factory::Puncturer_turbo::prefix = \"pct\";\n+\nPuncturer_turbo::parameters\n::parameters(const std::string prefix)\n: Puncturer::parameters(Puncturer_turbo::name, prefix)\n@@ -43,7 +46,7 @@ void Puncturer_turbo::parameters\nopt_args.add(\n{p+\"-pattern\"},\n- new tools::List<tools::Generic_splitter, std::vector<bool>>(new tools::List<tools::String_splitter, bool>(new tools::Boolean<>(), // list of list of boolean\n+ new tools::List<PT::Splitter_D1, std::vector<bool>>(new tools::List<PT::Splitter_D2, bool>(new tools::Boolean<>(), // list of list of boolean\n{new tools::Length<std::vector<bool>>(2, 3)}), // std::vector<std::string> is the container of each element after being splitted\n{new tools::Length<std::vector<std::vector<bool>>>(3, 3)}), // std::vector<std::string> is the container of each element after being splitted\n\"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n@@ -59,105 +62,6 @@ void Puncturer_turbo::parameters\n\"does not suppose a buffered encoding.\");\n}\n-template <typename T>\n-std::string display_pattern(std::vector<T> pattern)\n-{\n- std::string m;\n-\n- for(auto &v : pattern)\n- m += std::to_string(v) + \",\";\n-\n- m.erase(m.size() -1);\n-\n- return m;\n-}\n-\n-std::string display_pattern(std::vector<std::string> pattern)\n-{\n- std::string m;\n-\n- for(auto &v : pattern)\n- m += v + \",\";\n-\n- m.erase(m.size() -1);\n-\n- return m;\n-}\n-\n-std::string display_pattern(std::vector<std::vector<bool>> pattern)\n-{\n- std::string m;\n-\n- for(auto &v : pattern)\n- {\n- for(const auto &vb : v)\n- m += std::to_string(vb);\n-\n- m += \",\";\n- }\n-\n- m.erase(m.size() -1);\n-\n- return m;\n-}\n-\n-int compute_N(const int K, const int tail_bits, const std::vector<std::vector<bool>> pattern)\n-{\n- if (tail_bits < 0)\n- {\n- std::stringstream message;\n- message << \"'tail_bits' has to be positive ('tail_bits' = \" << tail_bits << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- // auto str_array = tools::split(pattern, ',');\n-\n- if (pattern.size() != 3)\n- {\n- std::stringstream message;\n- message << \"'pattern' should give 3 different sets ('pattern' = \" << display_pattern(pattern)\n- << \", 'pattern.size()' = \" << pattern.size() << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- if (pattern[0].size() != pattern[1].size() || pattern[0].size() != pattern[2].size())\n- {\n- std::stringstream message;\n- message << \"'pattern' sets have to contain an equal number of bits ('pattern' = \" << display_pattern(pattern)\n- << \", 'pattern[0].size()' = \" << pattern[0].size()\n- << \", 'pattern[1].size()' = \" << pattern[1].size()\n- << \", 'pattern[2].size()' = \" << pattern[2].size() << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- auto all_one = true;\n- for (auto i = 0; i < 3; i++)\n- for (auto j = 0; j < (int)pattern[i].size(); j++)\n- all_one = pattern[i][j] != 1 ? false : all_one;\n-\n- if (all_one)\n- return 3 * K + tail_bits;\n-\n- auto period = (int)pattern.front().size();\n-\n- if (K % period)\n- {\n- std::stringstream message;\n- message << \"'period' has to be a multiple of 'K' ('period' = \" << period << \", 'K' = \" << K << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- auto bit_sys_count = 0; for (auto j = 0; j < period; j++) bit_sys_count += pattern[0][j] ? 1 : 0;\n- auto bit_pa1_count = 0; for (auto j = 0; j < period; j++) bit_pa1_count += pattern[1][j] ? 1 : 0;\n- auto bit_pa2_count = 0; for (auto j = 0; j < period; j++) bit_pa2_count += pattern[2][j] ? 1 : 0;\n-\n- auto bit_count = bit_sys_count + bit_pa1_count + bit_pa2_count;\n-\n- auto N = (K / period) * bit_count + tail_bits;\n-\n- return N;\n-}\n-\nvoid Puncturer_turbo::parameters\n::store(const tools::Argument_map_value &vals)\n{\n@@ -165,13 +69,13 @@ void Puncturer_turbo::parameters\nauto p = this->get_prefix();\n- if(vals.exist({p+\"-pattern\" })) this->pattern = vals.at ({p+\"-pattern\" });\n- if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.to_list<std::vector<bool>>({p+\"-pattern\" });\n+ if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.at ({p+\"-pattern\" });\n+ if(vals.exist({p+\"-pattern\" })) this->pattern = vals.to_list<std::vector<bool>>({p+\"-pattern\" });\nif(vals.exist({p+\"-tail-length\"})) this->tail_length = vals.to_int({p+\"-tail-length\"});\nif(vals.exist({p+\"-no-buff\" })) this->buffered = false;\nthis->N_cw = 3 * this->K + this->tail_length;\n- this->N = compute_N(this->K, this->tail_length, this->pattern2);\n+ this->N = PT::compute_N(this->K, this->tail_length, this->pattern);\nif (this->N == this->N_cw)\nthis->type = \"NO\";\n@@ -186,8 +90,8 @@ void Puncturer_turbo::parameters\nif (this->type != \"NO\")\n{\n- headers[p].push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + this->pattern + \"}\")));\n- headers[p].push_back(std::make_pair(std::string(\"Pattern list\"), std::string(\"{\" + display_pattern(this->pattern2) + \"}\")));\n+ headers[p].push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + PT::display_pattern(this->pattern) + \"}\")));\n+ headers[p].push_back(std::make_pair(std::string(\"Pattern cmd\"), std::string(\"{\" + this->pattern2 + \"}\")));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Tail length\"), std::to_string(this->tail_length)));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Buffered\"), this->buffered ? \"on\" : \"off\"));\n}\n@@ -197,7 +101,7 @@ template <typename B, typename Q>\nmodule::Puncturer<B,Q>* Puncturer_turbo::parameters\n::build() const\n{\n- if (this->type == \"TURBO\") return new module::Puncturer_turbo<B,Q>(this->K, this->N, this->tail_length, display_pattern(this->pattern2), this->buffered, this->n_frames);\n+ if (this->type == \"TURBO\") return new module::Puncturer_turbo<B,Q>(this->K, this->N, this->tail_length, this->pattern, this->buffered, this->n_frames);\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "@@ -22,8 +22,8 @@ struct Puncturer_turbo : public Puncturer\npublic:\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// optional parameters\n- std::string pattern = \"111,111,111\";\n- std::vector<std::vector<bool>> pattern2;\n+ std::string pattern2 = \"111,111,111\";\n+ std::vector<std::vector<bool>> pattern = {{1,1,1},{1,1,1},{1,1,1}};\nbool buffered = true;\nint tail_length = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "#include \"Tools/general_utils.h\"\n#include \"Puncturer_turbo.hpp\"\n+#include \"Tools/Arguments/Splitter/Splitter.hpp\"\nusing namespace aff3ct;\nusing namespace aff3ct::module;\n@@ -17,68 +18,35 @@ Puncturer_turbo<B,Q>\nconst bool buff_enc,\nconst int n_frames,\nconst std::string name)\n-: Puncturer<B,Q>(K, N, K * 3 + tail_bits, n_frames, name),\n- pattern_bits(3), buff_enc(buff_enc), tail_bits(tail_bits)\n-{\n- if (tail_bits < 0)\n+: Puncturer_turbo<B,Q>(K, N, tail_bits, convert_pattern(pattern), buff_enc, n_frames, name)\n{\n- std::stringstream message;\n- message << \"'tail_bits' has to be positive ('tail_bits' = \" << tail_bits << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- auto str_array = tools::split(pattern, ',');\n-\n- if (str_array.size() != 3)\n- {\n- std::stringstream message;\n- message << \"'pattern' should give 3 different set delimited by a comma ('pattern' = \" << pattern\n- << \", 'str_array.size()' = \" << str_array.size() << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- if (str_array[0].size() != str_array[1].size() || str_array[0].size() != str_array[2].size())\n+template <typename B, typename Q>\n+Puncturer_turbo<B,Q>\n+::Puncturer_turbo(const int &K,\n+ const int &N,\n+ const int &tail_bits,\n+ const std::vector<std::vector<bool>>& pattern_bits,\n+ const bool buff_enc,\n+ const int n_frames,\n+ const std::string name)\n+: Puncturer<B,Q>(K, N, K * 3 + tail_bits, n_frames, name),\n+ pattern_bits(pattern_bits), buff_enc(buff_enc), tail_bits(tail_bits)\n{\n- std::stringstream message;\n- message << \"'pattern' sets have to contains an equal number of bits ('pattern' = \" << pattern\n- << \", 'str_array[0].size()' = \" << str_array[0].size()\n- << \", 'str_array[1].size()' = \" << str_array[1].size()\n- << \", 'str_array[2].size()' = \" << str_array[2].size() << \").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n- }\n-\n- auto period = (int)str_array[0].size();\n-\n- if (this->K % period)\n+ if (tail_bits < 0)\n{\nstd::stringstream message;\n- message << \"'period' has to be a multiple of 'K' ('period' = \" << period << \", 'K' = \" << this->K << \").\";\n+ message << \"'tail_bits' has to be positive ('tail_bits' = \" << tail_bits << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- pattern_bits[0].resize(period);\n- pattern_bits[1].resize(period);\n- pattern_bits[2].resize(period);\n-\n- for (auto i = 0; i < 3; i++)\n- for (auto j = 0; j < period; j++)\n- {\n- char c[2] = {str_array[i][j], '\\0'};\n- pattern_bits[i][j] = std::stoi(std::string(c)) ? true : false;\n- }\n-\n- auto bit_sys_count = 0; for (auto j = 0; j < period; j++) bit_sys_count += pattern_bits[0][j] ? 1 : 0;\n- auto bit_pa1_count = 0; for (auto j = 0; j < period; j++) bit_pa1_count += pattern_bits[1][j] ? 1 : 0;\n- auto bit_pa2_count = 0; for (auto j = 0; j < period; j++) bit_pa2_count += pattern_bits[2][j] ? 1 : 0;\n-\n- auto bit_count = bit_sys_count + bit_pa1_count + bit_pa2_count;\n-\n- if ((this->N - tail_bits) != (K / period) * bit_count)\n+ if (this->N != compute_N(K, tail_bits, pattern_bits))\n{\nstd::stringstream message;\n- message << \"'N' - 'tail_bits' has to be equal to ('K' / 'period') * 'bit_count' ('N' = \" << this->N\n- << \", 'tail_bits' = \" << tail_bits << \", 'K' = \" << K << \", 'period' = \" << period\n- << \", 'bit_count' = \" << bit_count << \").\";\n+ message << \"'N' has to be equal to ('K' / 'period') * 'bit_count' + 'tail_bits' ('N' = \" << N\n+ << \", 'tail_bits' = \" << tail_bits << \", 'K' = \" << K << \", 'period' = \" << get_period(pattern_bits)\n+ << \", 'pattern' = \" << display_pattern(pattern_bits) << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n@@ -93,7 +61,7 @@ template <typename B, typename Q>\nvoid Puncturer_turbo<B,Q>\n::_puncture(const B *X_N1, B *X_N2, const int frame_id) const\n{\n- const auto period = pattern_bits[0].size();\n+ const auto period = get_period(pattern_bits);\nauto k = 0;\nif (this->buff_enc)\n@@ -147,7 +115,7 @@ template <typename B, typename Q>\nvoid Puncturer_turbo<B,Q>\n::_depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const\n{\n- const auto period = pattern_bits[0].size();\n+ const auto period = get_period(pattern_bits);\nauto k = 0;\nif (this->buff_enc)\n@@ -196,6 +164,138 @@ void Puncturer_turbo<B,Q>\n}\n}\n+template <typename B, typename Q>\n+std::vector<std::vector<bool>> Puncturer_turbo<B,Q>\n+::convert_pattern(const std::string& pattern)\n+{\n+ auto str_array = Splitter_D1::split(pattern);\n+\n+ std::vector<std::vector<std::string>> pattern_str;\n+\n+ for(auto& s : str_array)\n+ pattern_str.push_back(Splitter_D2::split(s));\n+\n+ std::vector<std::vector<bool>> pattern_bits(pattern_str.size());\n+\n+ for (unsigned i = 0; i < pattern_str.size(); i++)\n+ {\n+ pattern_bits[i].resize(pattern_str[i].size());\n+\n+ for (unsigned j = 0; j < pattern_str[i].size(); j++)\n+ {\n+ if (pattern_str[i][j] == \"0\")\n+ pattern_bits[i][j] = false;\n+\n+ else if (pattern_str[i][j] == \"1\")\n+ pattern_bits[i][j] = true;\n+\n+ else\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Pattern elements must be boolean (0 or 1).\");\n+ }\n+ }\n+ return pattern_bits;\n+}\n+\n+template <typename B, typename Q>\n+std::string Puncturer_turbo<B,Q>\n+::display_pattern(const std::vector<std::vector<bool>>& pattern)\n+{\n+ std::string m;\n+\n+ for(auto &v : pattern)\n+ {\n+ for(const auto &vb : v)\n+ m += std::to_string(vb);\n+\n+ m += \",\";\n+ }\n+\n+ if (m.size())\n+ m.erase(m.size() -1);\n+\n+ return m;\n+}\n+\n+template <typename B, typename Q>\n+unsigned Puncturer_turbo<B,Q>\n+::get_period(const std::vector<std::vector<bool>>& pattern_bits)\n+{\n+ if (pattern_bits.size() == 0)\n+ return 0;\n+\n+ return pattern_bits.front().size();\n+}\n+\n+template <typename B, typename Q>\n+void Puncturer_turbo<B,Q>\n+::check_pattern(const int K, const std::vector<std::vector<bool>>& pattern_bits)\n+{\n+ if (pattern_bits.size() != 3) // pattern_bits[0] == bit systematic, pattern_bits[1] == parity 1, pattern_bits[2] == bit parity 2\n+ {\n+ std::stringstream message;\n+ message << \"'pattern' should give 3 different set delimited by a comma ('pattern' = \"\n+ << display_pattern(pattern_bits) << \", 'pattern_bits.size()' = \" << pattern_bits.size() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (pattern_bits[0].size() != pattern_bits[1].size() || pattern_bits[0].size() != pattern_bits[2].size())\n+ {\n+ std::stringstream message;\n+ message << \"'pattern' sets have to contains an equal number of bits ('pattern' = \" << display_pattern(pattern_bits)\n+ << \", 'pattern_bits[0].size()' = \" << pattern_bits[0].size()\n+ << \", 'pattern_bits[1].size()' = \" << pattern_bits[1].size()\n+ << \", 'pattern_bits[2].size()' = \" << pattern_bits[2].size() << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ auto period = get_period(pattern_bits);\n+\n+ if (K % period)\n+ {\n+ std::stringstream message;\n+ message << \"'period' has to be a multiple of 'K' ('period' = \" << period << \", 'K' = \" << K << \", 'pattern' = \"\n+ << display_pattern(pattern_bits) << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n+template <typename B, typename Q>\n+int Puncturer_turbo<B,Q>\n+::compute_N(const int K, const int tail_bits, const std::vector<std::vector<bool>>& pattern_bits)\n+{\n+ check_pattern(K, pattern_bits);\n+\n+ auto period = get_period(pattern_bits);\n+\n+ auto bit_count = 0;\n+ for (unsigned i = 0; i < pattern_bits.size(); i++)\n+ for (unsigned j = 0; j < pattern_bits[i].size(); j++)\n+ bit_count += pattern_bits[i][j] ? 1 : 0;\n+\n+ if (period)\n+ return (K / period) * bit_count + tail_bits;\n+ else\n+ return 0;\n+}\n+\n+template <typename B, typename Q>\n+std::vector<std::string> Puncturer_turbo<B,Q>::Splitter_D1\n+::split(const std::string& val)\n+{\n+ const std::string head = \"{([\";\n+ const std::string queue = \"})]\";\n+ const std::string separator = \";,.|\";\n+\n+ return tools::Splitter::split(val, head, queue, separator);\n+}\n+\n+template <typename B, typename Q>\n+std::vector<std::string> Puncturer_turbo<B,Q>::Splitter_D2\n+::split(const std::string& val)\n+{\n+ return tools::String_splitter::split(val);\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "@@ -13,7 +13,7 @@ template <typename B = int, typename Q = float>\nclass Puncturer_turbo : public Puncturer<B,Q>\n{\nprotected:\n- std::vector<std::vector<bool>> pattern_bits;\n+ const std::vector<std::vector<bool>> pattern_bits;\nconst bool buff_enc;\nconst int tail_bits;\n@@ -25,8 +25,33 @@ public:\nconst bool buff_enc = true,\nconst int n_frames = 1,\nconst std::string name = \"Puncturer_turbo\");\n+\n+ Puncturer_turbo(const int &K,\n+ const int &N,\n+ const int &tail_bits,\n+ const std::vector<std::vector<bool>> &pattern_bits,\n+ const bool buff_enc = true,\n+ const int n_frames = 1,\n+ const std::string name = \"Puncturer_turbo\");\n+\nvirtual ~Puncturer_turbo();\n+ static unsigned get_period(const std::vector<std::vector<bool>>& pattern);\n+ static std::string display_pattern(const std::vector<std::vector<bool>>& pattern);\n+ static std::vector<std::vector<bool>> convert_pattern(const std::string& pattern);\n+ static void check_pattern(const int K, const std::vector<std::vector<bool>>& pattern_bits);\n+ static int compute_N(const int K, const int tail_bits, const std::vector<std::vector<bool>>& pattern_bits);\n+\n+ struct Splitter_D1\n+ {\n+ static std::vector<std::string> split(const std::string& val); // split first dimension of the pattern\n+ };\n+\n+ struct Splitter_D2\n+ {\n+ static std::vector<std::string> split(const std::string& val); // split second dimension of the pattern\n+ };\n+\nprotected:\nvoid _puncture(const B *X_N1, B *X_N2, const int frame_id) const;\nvoid _depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move compute N and pattern functions into poncturer turbo module instead of factory then can reuse it in the module itself. Add Splitter functions in PT module
|
8,483 |
03.01.2018 16:38:38
| -3,600 |
b4770951d025562a6d7f96c8b55c18dc087b3d5a
|
Add already displayed checker to not displayed several times the same parameter in different sub-parameter group
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_handler.cpp",
"new_path": "src/Tools/Arguments/Argument_handler.cpp",
"diff": "@@ -269,6 +269,10 @@ void Argument_handler\nsize_t max_n_char_arg = std::max(find_longest_tags(req_args), find_longest_tags(opt_args));\nbool title_displayed = false;\n+ // the already displayed positions then it can't be displayed several times in different sub parameters\n+ std::vector<bool> req_args_print_pos(req_args.size(), false);\n+ std::vector<bool> opt_args_print_pos(opt_args.size(), false);\n+\n// display each group\nfor (auto it_grp = arg_groups.begin(); it_grp != arg_groups.end(); it_grp++)\n{\n@@ -280,8 +284,9 @@ void Argument_handler\nfor (auto it_arg = req_args.begin(); it_arg != req_args.end(); it_arg++)\n{\nauto& tag = it_arg->first.front();\n+ auto dist = std::distance(req_args.begin(), it_arg);\n- if (tag.find(prefix) == 0)\n+ if (tag.find(prefix) == 0 && !req_args_print_pos[dist])\n{\nif (!title_displayed)\n{\n@@ -289,6 +294,8 @@ void Argument_handler\ntitle_displayed = true;\n}\n+ req_args_print_pos[dist] = true;\n+\nthis->print_help(it_arg->first, *it_arg->second, max_n_char_arg, true);\n}\n}\n@@ -297,8 +304,9 @@ void Argument_handler\nfor (auto it_arg = opt_args.begin(); it_arg != opt_args.end(); it_arg++)\n{\nauto& tag = it_arg->first.front();\n+ auto dist = std::distance(opt_args.begin(), it_arg);\n- if (tag.find(prefix) == 0)\n+ if (tag.find(prefix) == 0 && !opt_args_print_pos[dist])\n{\nif (!title_displayed)\n{\n@@ -306,6 +314,8 @@ void Argument_handler\ntitle_displayed = true;\n}\n+ opt_args_print_pos[dist] = true;\n+\nthis->print_help(it_arg->first, *it_arg->second, max_n_char_arg, false);\n}\n}\n@@ -322,6 +332,9 @@ void Argument_handler\nauto& tag = it_arg->first.front();\nbool found = false;\n+ if (req_args_print_pos[std::distance(req_args.begin(), it_arg)])\n+ continue; // already displayed\n+\nfor (auto it_grp = arg_groups.begin(); it_grp != arg_groups.end(); it_grp++)\n{\nauto& prefix = it_grp->first;\n@@ -351,6 +364,9 @@ void Argument_handler\nauto& tag = it_arg->first.front();\nbool found = false;\n+ if (opt_args_print_pos[std::distance(opt_args.begin(), it_arg)])\n+ continue; // already displayed\n+\nfor (auto it_grp = arg_groups.begin(); it_grp != arg_groups.end(); it_grp++)\n{\nauto& prefix = it_grp->first;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add already displayed checker to not displayed several times the same parameter in different sub-parameter group
|
8,483 |
03.01.2018 16:40:53
| -3,600 |
4fbc95e9fe62b8a829c07a84dd6e2bd83ade445d
|
Invert template names Splitter and element type
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -15,6 +15,26 @@ const std::string aff3ct::factory::Puncturer_turbo::name = \"Puncturer Turbo\";\nconst std::string aff3ct::factory::Puncturer_turbo::prefix = \"pct\";\n+struct Splitter_D1\n+{\n+ static std::vector<std::string> split(const std::string& val) // split first dimension of the pattern\n+ {\n+ const std::string head = \"{([\";\n+ const std::string queue = \"})]\";\n+ const std::string separator = \";,.|\";\n+\n+ return tools::Splitter::split(val, head, queue, separator);\n+ }\n+};\n+\n+struct Splitter_D2\n+{\n+ static std::vector<std::string> split(const std::string& val) // split second dimension of the pattern\n+ {\n+ return tools::String_splitter::split(val);\n+ }\n+};\n+\nPuncturer_turbo::parameters\n::parameters(const std::string prefix)\n: Puncturer::parameters(Puncturer_turbo::name, prefix)\n@@ -46,7 +66,7 @@ void Puncturer_turbo::parameters\nopt_args.add(\n{p+\"-pattern\"},\n- new tools::List<PT::Splitter_D1, std::vector<bool>>(new tools::List<PT::Splitter_D2, bool>(new tools::Boolean<>(), // list of list of boolean\n+ new tools::List<std::vector<bool>, Splitter_D1>(new tools::List<bool, Splitter_D2>(new tools::Boolean<>(), // list of list of boolean\n{new tools::Length<std::vector<bool>>(2, 3)}), // std::vector<std::string> is the container of each element after being splitted\n{new tools::Length<std::vector<std::vector<bool>>>(3, 3)}), // std::vector<std::string> is the container of each element after being splitted\n\"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\n@@ -69,7 +89,7 @@ void Puncturer_turbo::parameters\nauto p = this->get_prefix();\n- if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.at ({p+\"-pattern\" });\n+ // if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.at ({p+\"-pattern\" });\nif(vals.exist({p+\"-pattern\" })) this->pattern = vals.to_list<std::vector<bool>>({p+\"-pattern\" });\nif(vals.exist({p+\"-tail-length\"})) this->tail_length = vals.to_int({p+\"-tail-length\"});\nif(vals.exist({p+\"-no-buff\" })) this->buffered = false;\n@@ -91,7 +111,7 @@ void Puncturer_turbo::parameters\nif (this->type != \"NO\")\n{\nheaders[p].push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + PT::display_pattern(this->pattern) + \"}\")));\n- headers[p].push_back(std::make_pair(std::string(\"Pattern cmd\"), std::string(\"{\" + this->pattern2 + \"}\")));\n+ // headers[p].push_back(std::make_pair(std::string(\"Pattern cmd\"), std::string(\"{\" + this->pattern2 + \"}\")));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Tail length\"), std::to_string(this->tail_length)));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Buffered\"), this->buffered ? \"on\" : \"off\"));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "@@ -14,7 +14,7 @@ namespace aff3ct\nnamespace tools\n{\n-template <class S = Generic_splitter, typename List_element_type = std::string>\n+template <typename List_element_type = std::string, class S = Generic_splitter>\nclass List : public Argument_type_limited<std::vector<List_element_type>>\n{\nprotected:\n@@ -30,7 +30,7 @@ public:\nif (val_type != nullptr) delete val_type;\n};\n- virtual List<S, List_element_type>* clone() const\n+ virtual List<List_element_type, S>* clone() const\n{\nreturn new List(val_type->clone());\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Invert template names Splitter and element type
|
8,483 |
03.01.2018 16:41:31
| -3,600 |
cda5bd054acfeb14ccb99c22bd8f2517c4e956f4
|
Remove constructor with pattern as string
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "#include \"Tools/general_utils.h\"\n#include \"Puncturer_turbo.hpp\"\n-#include \"Tools/Arguments/Splitter/Splitter.hpp\"\nusing namespace aff3ct;\nusing namespace aff3ct::module;\n-template <typename B, typename Q>\n-Puncturer_turbo<B,Q>\n-::Puncturer_turbo(const int &K,\n- const int &N,\n- const int &tail_bits,\n- const std::string &pattern,\n- const bool buff_enc,\n- const int n_frames,\n- const std::string name)\n-: Puncturer_turbo<B,Q>(K, N, tail_bits, convert_pattern(pattern), buff_enc, n_frames, name)\n-{\n-}\n-\ntemplate <typename B, typename Q>\nPuncturer_turbo<B,Q>\n::Puncturer_turbo(const int &K,\n@@ -164,37 +150,37 @@ void Puncturer_turbo<B,Q>\n}\n}\n-template <typename B, typename Q>\n-std::vector<std::vector<bool>> Puncturer_turbo<B,Q>\n-::convert_pattern(const std::string& pattern)\n-{\n- auto str_array = Splitter_D1::split(pattern);\n+// template <typename B, typename Q>\n+// std::vector<std::vector<bool>> Puncturer_turbo<B,Q>\n+// ::convert_pattern(const std::string& pattern)\n+// {\n+// auto str_array = Splitter_D1::split(pattern);\n- std::vector<std::vector<std::string>> pattern_str;\n+// std::vector<std::vector<std::string>> pattern_str;\n- for(auto& s : str_array)\n- pattern_str.push_back(Splitter_D2::split(s));\n+// for(auto& s : str_array)\n+// pattern_str.push_back(Splitter_D2::split(s));\n- std::vector<std::vector<bool>> pattern_bits(pattern_str.size());\n+// std::vector<std::vector<bool>> pattern_bits(pattern_str.size());\n- for (unsigned i = 0; i < pattern_str.size(); i++)\n- {\n- pattern_bits[i].resize(pattern_str[i].size());\n+// for (unsigned i = 0; i < pattern_str.size(); i++)\n+// {\n+// pattern_bits[i].resize(pattern_str[i].size());\n- for (unsigned j = 0; j < pattern_str[i].size(); j++)\n- {\n- if (pattern_str[i][j] == \"0\")\n- pattern_bits[i][j] = false;\n+// for (unsigned j = 0; j < pattern_str[i].size(); j++)\n+// {\n+// if (pattern_str[i][j] == \"0\")\n+// pattern_bits[i][j] = false;\n- else if (pattern_str[i][j] == \"1\")\n- pattern_bits[i][j] = true;\n+// else if (pattern_str[i][j] == \"1\")\n+// pattern_bits[i][j] = true;\n- else\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Pattern elements must be boolean (0 or 1).\");\n- }\n- }\n- return pattern_bits;\n-}\n+// else\n+// throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Pattern elements must be boolean (0 or 1).\");\n+// }\n+// }\n+// return pattern_bits;\n+// }\ntemplate <typename B, typename Q>\nstd::string Puncturer_turbo<B,Q>\n@@ -273,29 +259,11 @@ int Puncturer_turbo<B,Q>\nbit_count += pattern_bits[i][j] ? 1 : 0;\nif (period)\n- return (K / period) * bit_count + tail_bits;\n+ return K * bit_count / period + tail_bits;\nelse\nreturn 0;\n}\n-template <typename B, typename Q>\n-std::vector<std::string> Puncturer_turbo<B,Q>::Splitter_D1\n-::split(const std::string& val)\n-{\n- const std::string head = \"{([\";\n- const std::string queue = \"})]\";\n- const std::string separator = \";,.|\";\n-\n- return tools::Splitter::split(val, head, queue, separator);\n-}\n-\n-template <typename B, typename Q>\n-std::vector<std::string> Puncturer_turbo<B,Q>::Splitter_D2\n-::split(const std::string& val)\n-{\n- return tools::String_splitter::split(val);\n-}\n-\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "@@ -18,14 +18,6 @@ protected:\nconst int tail_bits;\npublic:\n- Puncturer_turbo(const int &K,\n- const int &N,\n- const int &tail_bits,\n- const std::string &pattern,\n- const bool buff_enc = true,\n- const int n_frames = 1,\n- const std::string name = \"Puncturer_turbo\");\n-\nPuncturer_turbo(const int &K,\nconst int &N,\nconst int &tail_bits,\n@@ -38,20 +30,9 @@ public:\nstatic unsigned get_period(const std::vector<std::vector<bool>>& pattern);\nstatic std::string display_pattern(const std::vector<std::vector<bool>>& pattern);\n- static std::vector<std::vector<bool>> convert_pattern(const std::string& pattern);\nstatic void check_pattern(const int K, const std::vector<std::vector<bool>>& pattern_bits);\nstatic int compute_N(const int K, const int tail_bits, const std::vector<std::vector<bool>>& pattern_bits);\n- struct Splitter_D1\n- {\n- static std::vector<std::string> split(const std::string& val); // split first dimension of the pattern\n- };\n-\n- struct Splitter_D2\n- {\n- static std::vector<std::string> split(const std::string& val); // split second dimension of the pattern\n- };\n-\nprotected:\nvoid _puncture(const B *X_N1, B *X_N2, const int frame_id) const;\nvoid _depuncture(const Q *Y_N1, Q *Y_N2, const int frame_id) const;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove constructor with pattern as string
|
8,483 |
04.01.2018 09:25:48
| -3,600 |
4bfa0e9493efd35179c66d7b6ae0801814318544
|
Create a 2D List class inhereting from List class; Add a get_bit_count function in Poncturer to check if all bits are at one when checking pattern and not throwing exception if K%period != 0
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -15,26 +15,6 @@ const std::string aff3ct::factory::Puncturer_turbo::name = \"Puncturer Turbo\";\nconst std::string aff3ct::factory::Puncturer_turbo::prefix = \"pct\";\n-struct Splitter_D1\n-{\n- static std::vector<std::string> split(const std::string& val) // split first dimension of the pattern\n- {\n- const std::string head = \"{([\";\n- const std::string queue = \"})]\";\n- const std::string separator = \";,.|\";\n-\n- return tools::Splitter::split(val, head, queue, separator);\n- }\n-};\n-\n-struct Splitter_D2\n-{\n- static std::vector<std::string> split(const std::string& val) // split second dimension of the pattern\n- {\n- return tools::String_splitter::split(val);\n- }\n-};\n-\nPuncturer_turbo::parameters\n::parameters(const std::string prefix)\n: Puncturer::parameters(Puncturer_turbo::name, prefix)\n@@ -66,9 +46,7 @@ void Puncturer_turbo::parameters\nopt_args.add(\n{p+\"-pattern\"},\n- new tools::List<std::vector<bool>, Splitter_D1>(new tools::List<bool, Splitter_D2>(new tools::Boolean<>(), // list of list of boolean\n- {new tools::Length<std::vector<bool>>(2, 3)}), // std::vector<std::string> is the container of each element after being splitted\n- {new tools::Length<std::vector<std::vector<bool>>>(3, 3)}), // std::vector<std::string> is the container of each element after being splitted\n+ new tools::List2D<bool>(new tools::Boolean<>(), {new tools::Length<std::vector<std::vector<bool>>>(3, 3)}, {new tools::Length<std::vector<bool>>(2, 3)}),\n\"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\nopt_args.add(\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -184,11 +184,11 @@ void Puncturer_turbo<B,Q>\ntemplate <typename B, typename Q>\nstd::string Puncturer_turbo<B,Q>\n-::display_pattern(const std::vector<std::vector<bool>>& pattern)\n+::display_pattern(const std::vector<std::vector<bool>>& pattern_bits)\n{\nstd::string m;\n- for(auto &v : pattern)\n+ for(auto &v : pattern_bits)\n{\nfor(const auto &vb : v)\nm += std::to_string(vb);\n@@ -212,6 +212,18 @@ unsigned Puncturer_turbo<B,Q>\nreturn pattern_bits.front().size();\n}\n+template <typename B, typename Q>\n+unsigned Puncturer_turbo<B,Q>\n+::get_bit_count(const std::vector<std::vector<bool>>& pattern_bits)\n+{\n+ unsigned bit_count = 0;\n+ for (unsigned i = 0; i < pattern_bits.size(); i++)\n+ for (unsigned j = 0; j < pattern_bits[i].size(); j++)\n+ bit_count += pattern_bits[i][j] ? 1 : 0;\n+\n+ return bit_count;\n+}\n+\ntemplate <typename B, typename Q>\nvoid Puncturer_turbo<B,Q>\n::check_pattern(const int K, const std::vector<std::vector<bool>>& pattern_bits)\n@@ -235,12 +247,13 @@ void Puncturer_turbo<B,Q>\n}\nauto period = get_period (pattern_bits);\n+ bool allone = get_bit_count(pattern_bits) == period * pattern_bits.size();\n- if (K % period)\n+ if (!allone && (K % period != 0))\n{\nstd::stringstream message;\n- message << \"'period' has to be a multiple of 'K' ('period' = \" << period << \", 'K' = \" << K << \", 'pattern' = \"\n- << display_pattern(pattern_bits) << \").\";\n+ message << \"'period' has to be a multiple of 'K' or all bits must be at '1' ('period' = \" << period\n+ << \", 'K' = \" << K << \", 'pattern' = \" << display_pattern(pattern_bits) << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n}\n@@ -252,11 +265,7 @@ int Puncturer_turbo<B,Q>\ncheck_pattern(K, pattern_bits);\nauto period = get_period (pattern_bits);\n-\n- auto bit_count = 0;\n- for (unsigned i = 0; i < pattern_bits.size(); i++)\n- for (unsigned j = 0; j < pattern_bits[i].size(); j++)\n- bit_count += pattern_bits[i][j] ? 1 : 0;\n+ auto bit_count = get_bit_count(pattern_bits);\nif (period)\nreturn K * bit_count / period + tail_bits;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "@@ -28,8 +28,10 @@ public:\nvirtual ~Puncturer_turbo();\n- static unsigned get_period(const std::vector<std::vector<bool>>& pattern);\n- static std::string display_pattern(const std::vector<std::vector<bool>>& pattern);\n+ static unsigned get_period (const std::vector<std::vector<bool>>& pattern_bits);\n+ static unsigned get_bit_count (const std::vector<std::vector<bool>>& pattern_bits);\n+ static std::string display_pattern(const std::vector<std::vector<bool>>& pattern_bits);\n+\nstatic void check_pattern(const int K, const std::vector<std::vector<bool>>& pattern_bits);\nstatic int compute_N (const int K, const int tail_bits, const std::vector<std::vector<bool>>& pattern_bits);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "@@ -102,6 +102,44 @@ public:\n};\n+template <typename List_element_type = std::string, class S1 = Generic_splitter, class S2 = String_splitter>\n+class List2D : public List<std::vector<List_element_type>, S1>\n+{\n+public:\n+ List2D(Argument_type* val_type, const std::vector<Argument_range<std::vector<std::vector<List_element_type>>>*>& ranges1 = {}, const std::vector<Argument_range<std::vector<List_element_type>>*>& ranges2 = {})\n+ : List<std::vector<List_element_type>, S1>(new List<List_element_type, S2>(val_type, ranges2), ranges1)\n+ {\n+ }\n+};\n+\n+\n+// template <typename List_element_type, class S, class... MD_S>\n+// struct unpack2vectors\n+// {\n+// using type = std::vector<typename std::conditional<sizeof...(MD_S) == 0,\n+// List_element_type,\n+// unpack2vectors<List_element_type, MD_S...>\n+// >::type\n+// >;\n+// };\n+\n+// template <typename List_element_type = std::string, class S = Generic_splitter, class... MD_S>\n+// class MD_List : public List<typename unpack2vectors<List_element_type, S, MD_S...>::type>\n+// {\n+// public:\n+// MD_List(Argument_type* val_type, const std::vector<Argument_range<std::vector<List_element_type>>*>& ranges = {})\n+// : List<List_element_type, S>(val_type, ranges)\n+// {\n+// }\n+\n+// template <class... MD_Argument_ranges>\n+// MD_List(Argument_type* val_type, const std::vector<Argument_range<std::vector<List_element_type>>*>&& ranges, const MD_Argument_ranges&&... MD_ranges)\n+// : List<typename unpack2vectors<List_element_type, S, MD_S...>::type, S>(new MD_List<List_element_type, MD_S...>(val_type, MD_ranges...), ranges)\n+// {\n+// static_assert(sizeof...(MD_S) == sizeof...(MD_Argument_ranges), \"There shall be the same number of ranges elements than Splitter\");\n+// }\n+// };\n+\n}\n}\n#endif /* ARGUMENT_TYPE_LIST_HPP_ */\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Create a 2D List class inhereting from List class; Add a get_bit_count function in Poncturer to check if all bits are at one when checking pattern and not throwing exception if K%period != 0
|
8,483 |
04.01.2018 18:02:25
| -3,600 |
c8bb2be6e05fe7a91eaa86f296e13638e0ce6c1e
|
Add a start id argument to the test script to allow the user to ignore the previous ones
|
[
{
"change_type": "MODIFY",
"old_path": "tests/tests.py",
"new_path": "tests/tests.py",
"diff": "PathTests = \"refs\" # can be overrided by arg1 from the cmd line\nPathResults = \"results\" # can be overrided by arg2 from the cmd line\n+StartId = 0 # can be overrided by arg3 from the cmd line, starting id to not do previous one again\n+\nPathBuild = \"../build\"\nSensibility = 1.0\nNthreads = 0 # if 0 then AFF3CT takes all the available threads\n@@ -61,6 +63,9 @@ if len(sys.argv) >= 2:\nif len(sys.argv) >= 3:\nPathResults = sys.argv[2]\n+if len(sys.argv) >= 4:\n+ StartId = int(sys.argv[3])\n+\nPathOrigin = os.getcwd()\n# get the filenames to test\n@@ -78,6 +83,10 @@ print(\"Starting the test script...\")\ntestId = 0\nfor fn in fileNames:\n+ if testId < StartId:\n+ testId = testId + 1\n+ continue\n+\nif pathlib.Path(fn).suffix != \".txt\" and pathlib.Path(fn).suffix != \".perf\" and pathlib.Path(fn).suffix != \".data\" and pathlib.Path(fn).suffix != \".dat\":\ncontinue\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a start id argument to the test script to allow the user to ignore the previous ones
|
8,483 |
08.01.2018 08:54:12
| -3,600 |
ecfc064241752ee2f2584626bf0889605867d94c
|
Move tuples utilities into a new file utilities in Arguments folder
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "#include <tuple>\n#include \"Argument_type.hpp\"\n+#include \"../utilities.hpp\"\n#include \"../Splitter/Splitter.hpp\"\nnamespace aff3ct\n@@ -111,55 +112,13 @@ List_type<T,S,Ranges...>* List(Argument_type* val_type, Ranges*... ranges)\nreturn new List_type<T,S,Ranges...>(val_type, ranges...);\n}\n-template<int...> struct index_tuple{};\n-\n-template<int I, typename IndexTuple, typename... Types>\n-struct make_indexes_impl;\n-\n-template<int I, int... Indexes, typename T, typename ... Types>\n-struct make_indexes_impl<I, index_tuple<Indexes...>, T, Types...>\n-{\n- typedef typename make_indexes_impl<I + 1, index_tuple<Indexes..., I>, Types...>::type type;\n-};\n-\n-template<int I, int... Indexes>\n-struct make_indexes_impl<I, index_tuple<Indexes...> >\n-{\n- typedef index_tuple<Indexes...> type;\n-};\n-\n-template<typename ... Types>\n-struct make_indexes : make_indexes_impl<0, index_tuple<>, Types...>\n-{};\n-\n-\n-template<class Ret, class... Args, int... Indexes >\n-Ret apply_helper( Ret (*pf)(Args...), index_tuple< Indexes... >, std::tuple<Args...>&& tup)\n-{\n- return pf( std::forward<Args>( std::get<Indexes>(tup))... );\n-}\n-\n-template<class Ret, class ... Args>\n-Ret apply(Ret (*pf)(Args...), const std::tuple<Args...>& tup)\n-{\n- return apply_helper(pf, typename make_indexes<Args...>::type(), std::tuple<Args...>(tup));\n-}\n-\n-template<class Ret, class ... Args>\n-Ret apply(Ret (*pf)(Args...), std::tuple<Args...>&& tup)\n-{\n- return apply_helper(pf, typename make_indexes<Args...>::type(), std::forward<std::tuple<Args...>>(tup));\n-}\n-\n-\n-\ntemplate <typename T = std::string,\nclass S1 = Generic_splitter, class S2 = String_splitter,\ntypename... Ranges1, typename... Ranges2>\nList_type<std::vector<T>,S1,Ranges1...>* List2D(Argument_type* val_type, std::tuple<Ranges1*...>&& ranges1, std::tuple<Ranges2*...>&& ranges2)\n{\n- Argument_type* listD2 = apply(List<T,S2,Ranges2...>, std::tuple_cat(std::make_tuple(val_type), ranges2));\n- return apply(List<std::vector<T>,S1,Ranges1...>, std::tuple_cat(std::make_tuple(listD2), ranges1));\n+ Argument_type* listD2 = apply_tuple(List<T,S2,Ranges2...>, std::tuple_cat(std::make_tuple(val_type), ranges2));\n+ return apply_tuple(List<std::vector<T>,S1,Ranges1...>, std::tuple_cat(std::make_tuple(listD2), ranges1));\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/utilities.hpp",
"diff": "+#ifndef ARGUMENT_UTILITIES_HPP\n+#define ARGUMENT_UTILITIES_HPP\n+\n+#include <tuple>\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+/******************************************************************************\n+ TUPLE UTILITIES\n+ ******************************************************************************/\n+\n+template<int...> struct index_tuple{};\n+\n+template<int I, typename IndexTuple, typename... Types>\n+struct make_indexes_impl;\n+\n+template<int I, int... Indexes, typename T, typename ... Types>\n+struct make_indexes_impl<I, index_tuple<Indexes...>, T, Types...>\n+{\n+ typedef typename make_indexes_impl<I + 1, index_tuple<Indexes..., I>, Types...>::type type;\n+};\n+\n+template<int I, int... Indexes>\n+struct make_indexes_impl<I, index_tuple<Indexes...> >\n+{\n+ typedef index_tuple<Indexes...> type;\n+};\n+\n+template<typename ... Types>\n+struct make_indexes : make_indexes_impl<0, index_tuple<>, Types...>\n+{};\n+\n+\n+template<class Ret, class... Args, int... Indexes >\n+Ret apply_tuple_helper( Ret (*pf)(Args...), index_tuple< Indexes... >, std::tuple<Args...>&& tup)\n+{\n+ return pf( std::forward<Args>( std::get<Indexes>(tup))... );\n+}\n+\n+template<class Ret, class ... Args>\n+Ret apply_tuple(Ret (*pf)(Args...), const std::tuple<Args...>& tup)\n+{\n+ return apply_tuple_helper(pf, typename make_indexes<Args...>::type(), std::tuple<Args...>(tup));\n+}\n+\n+template<class Ret, class ... Args>\n+Ret apply_tuple(Ret (*pf)(Args...), std::tuple<Args...>&& tup)\n+{\n+ return apply_tuple_helper(pf, typename make_indexes<Args...>::type(), std::forward<std::tuple<Args...>>(tup));\n+}\n+\n+}\n+}\n+\n+#endif /* ARGUMENT_UTILITIES_HPP */\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move tuples utilities into a new file utilities in Arguments folder
|
8,483 |
08.01.2018 12:01:56
| -3,600 |
ae5dbec325ae25a339843be26b68b2544a5c1f79
|
Add the Function range to let the user define its own check function easily
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Argument_range.hpp",
"diff": "@@ -42,5 +42,6 @@ public:\n#include \"Negative.hpp\"\n#include \"Positive.hpp\"\n#include \"Length.hpp\"\n+#include \"Function.hpp\"\n#endif /* ARGUMENT_RANGE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_range/Function.hpp",
"diff": "+#ifndef ARGUMENT_FUNCTION_RANGE_HPP_\n+#define ARGUMENT_FUNCTION_RANGE_HPP_\n+\n+#include \"Argument_range.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T, typename F>\n+class Function_range : public Argument_range\n+{\n+ F f;\n+\n+public:\n+ Function_range(const std::string& title, F f)\n+ : Argument_range(title), f(f)\n+ { }\n+\n+ virtual ~Function_range() {};\n+\n+ virtual Function_range<T,F>* clone() const\n+ {\n+ return new Function_range<T,F>(*this);\n+ }\n+\n+ template <typename V>\n+ void check(const V& val) const\n+ {\n+ f((T)val);\n+ }\n+};\n+\n+template <typename T, typename F>\n+Function_range<T,F>* Function(const std::string& title, F f)\n+{\n+ return new Function_range<T,F>(title, f);\n+}\n+\n+}\n+}\n+\n+#endif\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Min.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Min.hpp",
"diff": "@@ -8,7 +8,6 @@ namespace aff3ct\nnamespace tools\n{\n-\ntemplate <typename T>\nclass Min_range : public Argument_range\n{\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": "@@ -10,7 +10,7 @@ namespace aff3ct\nnamespace tools\n{\n-template <typename T>\n+template <typename T = float>\nclass Non_zero_range : public Excluding_set_range<T>\n{\npublic:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Positive.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Positive.hpp",
"diff": "@@ -10,7 +10,7 @@ namespace aff3ct\nnamespace tools\n{\n-template <typename T>\n+template <typename T = float>\nclass Positive_range : public Min_range<T>\n{\npublic:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the Function range to let the user define its own check function easily
|
8,483 |
08.01.2018 12:02:34
| -3,600 |
c6dfcbfa813d03bc54d17621934107799405ad21
|
Add a add_range function to be able to add dynamically new ranges to a argument type
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.cpp",
"new_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.cpp",
"diff": "@@ -28,6 +28,19 @@ Encoder_BCH::parameters* Encoder_BCH::parameters\nreturn new Encoder_BCH::parameters(*this);\n}\n+#include <cmath>\n+void check_BCH_N(const int N)\n+{\n+ auto m = (int)std::ceil(std::log2(N));\n+\n+ if (N != ((1 << m) -1))\n+ {\n+ std::stringstream message;\n+ message << \"'N' has to be a power of 2 minus 1\";\n+ throw std::runtime_error(message.str());\n+ }\n+}\n+\nvoid Encoder_BCH::parameters\n::get_description(tools::Argument_map_info &req_args, tools::Argument_map_info &opt_args) const\n{\n@@ -35,6 +48,9 @@ void Encoder_BCH::parameters\nauto p = this->get_prefix();\n+ tools::add_ranges<tools::Integer_type<int, tools::Positive_range<>, tools::Non_zero_range<>>>\n+ (req_args.at({p+\"-cw-size\", \"N\"}), tools::Function<int>(\"power of 2 minus 1\", check_BCH_N));\n+\ntools::add_options(opt_args.at({p+\"-type\"}), 0, \"BCH\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_tools.hpp",
"new_path": "src/Tools/Arguments/Argument_tools.hpp",
"diff": "@@ -11,6 +11,49 @@ namespace aff3ct\n{\nnamespace tools\n{\n+\n+/*******************************************************************************\n+ * ADD RANGE TO AN ARGUMENT TYPE\n+ ******************************************************************************/\n+\n+ template <typename CurrentType, typename... Ranges>\n+ void add_ranges(Argument_type** at, Ranges*... new_ranges)\n+ {\n+ CurrentType* old_arg_type;\n+\n+ try\n+ {\n+ old_arg_type = dynamic_cast<CurrentType*>(*at);\n+ }\n+ catch(std::exception& e)\n+ {\n+ std::string message = \"The Argument type object '\" + (*at)->get_title() + \"' is not parent of \"\n+ + \" the given CurrentType \\\"\" + typeid(CurrentType).name() + \"\\\"\";\n+ throw std::runtime_error(message);\n+ }\n+\n+ *at = old_arg_type->clone(new_ranges...);\n+\n+ delete old_arg_type;\n+ }\n+\n+ template <typename CurrentType, typename... Ranges>\n+ void add_ranges(Argument_info& ai, Ranges*... new_ranges)\n+ {\n+ add_ranges<CurrentType>(&(ai.type), new_ranges...);\n+ }\n+\n+ template <typename CurrentType, typename... Ranges>\n+ void add_ranges(Argument_info* ai, Ranges*... new_ranges)\n+ {\n+ add_ranges<CurrentType>(&(ai->type), new_ranges...);\n+ }\n+\n+\n+/*******************************************************************************\n+ * ADD OPTIONS TO A SET RANGE\n+ ******************************************************************************/\n+\ntemplate <typename T, typename... Options>\nvoid add_options(tools::Argument_type_limited_T<T>& atl, const size_t set_pos, Options... new_options)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "@@ -53,7 +53,7 @@ public:\nreturn ranges.at(pos);\n}\n- const std::vector<void*>& get_ranges() const\n+ std::vector<void*>& get_ranges()\n{\nreturn ranges;\n}\n@@ -71,7 +71,7 @@ public:\n}\nprotected:\n- std::vector<void*>& get_ranges()\n+ const std::vector<void*>& get_ranges() const\n{\nreturn ranges;\n}\n@@ -92,6 +92,12 @@ public:\nadd_ranges(new_ranges...);\n}\n+protected:\n+ Argument_type_limited(const std::string& title)\n+ : Argument_type_limited_T<T>(title)\n+ { }\n+\n+public:\nvirtual ~Argument_type_limited()\n{\n_clear<Ranges...>();\n@@ -110,6 +116,12 @@ public:\nreturn t;\n}\n+ template <typename... NewRanges>\n+ void add_ranges(NewRanges*... new_ranges)\n+ {\n+ _add_ranges<NewRanges...>(new_ranges...);\n+ }\n+\nprotected:\nvoid check_ranges(const T& val) const\n{\n@@ -117,11 +129,13 @@ protected:\n_check<Ranges...>(val);\n}\n- virtual Argument_type_limited<T,Ranges...>* clone_ranges(Argument_type_limited<T,Ranges...>* clone) const\n+ template <typename... OtherRanges>\n+ Argument_type_limited<T,Ranges...,OtherRanges...>*\n+ clone_ranges(Argument_type_limited<T,Ranges...,OtherRanges...>* clone) const\n{\nclone->get_ranges().clear();\n- _clone<Ranges...>(clone);\n+ _clone<Argument_type_limited<T,Ranges...,OtherRanges...>,Ranges...>(clone);\nreturn clone;\n}\n@@ -136,9 +150,10 @@ private:\nvoid _clear(size_t pos = 0)\n{\nif (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range : \")\n+ throw std::out_of_range(std::string(\"Given position out of range when clearing : \")\n+ std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements.\");\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\nauto* ptr = static_cast<r*>(this->get_ranges()[pos]);\nif (ptr != nullptr)\n@@ -157,9 +172,10 @@ private:\nvoid _check(const T& val, size_t pos = 0) const\n{\nif (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range : \")\n+ throw std::out_of_range(std::string(\"Given position out of range when checking : \")\n+ std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements.\");\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\nstatic_cast<r*>(this->get_ranges()[pos])->check(val);\n}\n@@ -171,31 +187,33 @@ private:\n_check<R...>(val, ++pos);\n}\n- template <typename r>\n- void _clone(Argument_type_limited<T,Ranges...>* clone, size_t pos = 0) const\n+ template <typename C, typename r>\n+ void _clone(C* clone, size_t pos = 0) const\n{\nif (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range : \")\n+ throw std::out_of_range(std::string(\"Given position out of range when cloning : \")\n+ std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements.\");\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\nclone->add_ranges(static_cast<r*>(this->get_ranges()[pos])->clone());\n}\n- template <typename r, typename... R>\n- typename std::enable_if<sizeof...(R) != 0,void>::type _clone(Argument_type_limited<T,Ranges...>* clone, size_t pos = 0) const\n+ template <typename C, typename r, typename... R>\n+ typename std::enable_if<sizeof...(R) != 0,void>::type _clone(C* clone, size_t pos = 0) const\n{\n- _clone<r >(clone, pos);\n- _clone<R...>(clone, ++pos);\n+ _clone<C,r >(clone, pos);\n+ _clone<C,R...>(clone, ++pos);\n}\ntemplate <typename r>\nvoid _get_ranges_title(std::string& t, size_t pos = 0) const\n{\nif (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range : \")\n+ throw std::out_of_range(std::string(\"Given position out of range when getting title : \")\n+ std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements.\");\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\nt += static_cast<r*>(this->get_ranges()[pos])->get_title();\n}\n@@ -211,20 +229,28 @@ private:\n}\ntemplate <typename r>\n- void add_ranges(const r* new_range)\n+ void _add_ranges(r* new_range)\n{\nif (new_range == nullptr)\nthrow std::invalid_argument(\"The given argument range is a nullptr.\");\n+ if (this->get_ranges().size() >= sizeof...(Ranges))\n+ throw std::out_of_range(std::string(\"Try to add a range but already at its maximum : \")\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\n+\nthis->get_ranges().push_back((void*)new_range);\n}\ntemplate <typename r, typename... R>\n- typename std::enable_if<sizeof...(R) != 0,void>::type add_ranges(const r* new_range, const R*... new_ranges)\n+ typename std::enable_if<sizeof...(R) != 0,void>::type _add_ranges(r* new_range, R*... new_ranges)\n{\n- add_ranges(new_range );\n- add_ranges(new_ranges...);\n+ _add_ranges(new_range );\n+ _add_ranges(new_ranges...);\n}\n+\n+ template <typename Friend, typename... FriendRange>\n+ friend class Argument_type_limited;\n};\ntemplate <typename T>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"diff": "@@ -19,6 +19,11 @@ public:\n: Argument_type_limited<T,Ranges...>(\"integer\", ranges...)\n{ }\n+ Integer_type()\n+ : Argument_type_limited<T,Ranges...>(\"integer\")\n+ { }\n+\n+public:\nvirtual ~Integer_type() {};\nvirtual Integer_type<T,Ranges...>* clone() const\n@@ -28,6 +33,19 @@ public:\nreturn dynamic_cast<Integer_type<T,Ranges...>*>(this->clone_ranges(clone));\n}\n+ template <typename... NewRanges>\n+ Integer_type<T, Ranges..., NewRanges...>*\n+ clone(NewRanges*... new_ranges)\n+ {\n+ auto clone = new Integer_type<T, Ranges..., NewRanges...>();\n+\n+ this->clone_ranges(clone);\n+\n+ clone->template add_ranges<NewRanges...>(new_ranges...);\n+\n+ return clone;\n+ }\n+\nvirtual T convert(const std::string& val) const\n{\nreturn (T)std::stoi(val);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a add_range function to be able to add dynamically new ranges to a argument type
|
8,483 |
08.01.2018 12:41:48
| -3,600 |
8a9dc59c3ead62f942b0e277e3390e56af1bb168
|
Add cloning with new range for List Real and Text type; Fix Integer type cloning
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"diff": "@@ -15,8 +15,9 @@ template <typename T = int, typename... Ranges>\nclass Integer_type : public Argument_type_limited<T,Ranges...>\n{\npublic:\n- Integer_type(const Ranges*... ranges)\n- : Argument_type_limited<T,Ranges...>(\"integer\", ranges...)\n+ template <typename r, typename... R>\n+ Integer_type(const r* range, const R*... ranges)\n+ : Argument_type_limited<T,Ranges...>(\"integer\", range, ranges...)\n{ }\nInteger_type()\n@@ -28,7 +29,7 @@ public:\nvirtual Integer_type<T,Ranges...>* clone() const\n{\n- auto clone = new Integer_type<T,Ranges...>(*this);\n+ auto clone = new Integer_type<T,Ranges...>();\nreturn dynamic_cast<Integer_type<T,Ranges...>*>(this->clone_ranges(clone));\n}\n@@ -41,7 +42,7 @@ public:\nthis->clone_ranges(clone);\n- clone->template add_ranges<NewRanges...>(new_ranges...);\n+ clone->template add_ranges(new_ranges...);\nreturn clone;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "@@ -16,15 +16,20 @@ namespace aff3ct\nnamespace tools\n{\n-template <typename List_element_type = std::string, class S = Generic_splitter, typename... Ranges>\n-class List_type : public Argument_type_limited<std::vector<List_element_type>,Ranges...>\n+template <typename T = std::string, class S = Generic_splitter, typename... Ranges>\n+class List_type : public Argument_type_limited<std::vector<T>,Ranges...>\n{\nprotected:\nArgument_type* val_type;\npublic:\n- List_type(Argument_type* val_type, const Ranges*... ranges)\n- : Argument_type_limited<std::vector<List_element_type>,Ranges...>(\"list of \" + val_type->get_short_title(), ranges...), val_type(val_type)\n+ template <typename r, typename... R>\n+ List_type(Argument_type* val_type, const r* range, const R*... ranges)\n+ : Argument_type_limited<std::vector<T>,Ranges...>(\"list of \" + val_type->get_short_title(), range, ranges...), val_type(val_type)\n+ { }\n+\n+ List_type(Argument_type* val_type)\n+ : Argument_type_limited<std::vector<T>,Ranges...>(\"list of \" + val_type->get_short_title()), val_type(val_type)\n{ }\nvirtual ~List_type()\n@@ -32,13 +37,26 @@ public:\nif (val_type != nullptr) delete val_type;\n};\n- virtual List_type<List_element_type, S, Ranges...>* clone() const\n+ virtual List_type<T, S, Ranges...>* clone() const\n{\n- auto clone = new List_type<List_element_type, S, Ranges...>(*this);\n+ auto clone = new List_type<T, S, Ranges...>(val_type);\nclone->val_type = val_type->clone();\n- return dynamic_cast<List_type<List_element_type, S, Ranges...>*>(this->clone_ranges(clone));\n+ return dynamic_cast<List_type<T, S, Ranges...>*>(this->clone_ranges(clone));\n+ }\n+\n+ template <typename... NewRanges>\n+ Integer_type<T, S, Ranges..., NewRanges...>*\n+ clone(NewRanges*... new_ranges)\n+ {\n+ auto clone = new List_type<T, S, Ranges..., NewRanges...>(val_type);\n+\n+ this->clone_ranges(clone);\n+\n+ clone->template add_ranges(new_ranges...);\n+\n+ return clone;\n}\nvirtual void check(const std::string& val) const\n@@ -79,14 +97,14 @@ public:\nreturn t;\n}\n- virtual std::vector<List_element_type> convert(const std::string& val) const\n+ virtual std::vector<T> convert(const std::string& val) const\n{\nreturn this->convert(S::split(val));\n}\n- virtual std::vector<List_element_type> convert(const std::vector<std::string>& list) const\n+ virtual std::vector<T> convert(const std::vector<std::string>& list) const\n{\n- std::vector<List_element_type> list_T(list.size());\n+ std::vector<T> list_T(list.size());\nvoid * p_val = nullptr;\n@@ -97,9 +115,9 @@ public:\nif (p_val == nullptr)\nthrow std::runtime_error(\"Couldn't convert value.\");\n- list_T[i] = *(List_element_type*)p_val;\n+ list_T[i] = *(T*)p_val;\n- delete (List_element_type*)p_val;\n+ delete (T*)p_val;\n}\nreturn list_T;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"diff": "@@ -15,19 +15,37 @@ template <typename T = float, typename... Ranges>\nclass Real_type : public Argument_type_limited<T,Ranges...>\n{\npublic:\n- Real_type(const Ranges*... ranges)\n- : Argument_type_limited<T,Ranges...>(\"real number\", ranges...)\n+ template <typename r, typename... R>\n+ Real_type(const r* range, const R*... ranges)\n+ : Argument_type_limited<T,Ranges...>(\"real number\", range, ranges...)\n+ { }\n+\n+ Real_type()\n+ : Argument_type_limited<T,Ranges...>(\"real number\")\n{ }\nvirtual ~Real_type() {};\nvirtual Real_type<T,Ranges...>* clone() const\n{\n- auto clone = new Real_type<T,Ranges...>(*this);\n+ auto clone = new Real_type<T,Ranges...>();\nreturn dynamic_cast<Real_type<T,Ranges...>*>(this->clone_ranges(clone));\n}\n+ template <typename... NewRanges>\n+ Real_type<T, Ranges..., NewRanges...>*\n+ clone(NewRanges*... new_ranges)\n+ {\n+ auto clone = new Real_type<T, Ranges..., NewRanges...>();\n+\n+ this->clone_ranges(clone);\n+\n+ clone->template add_ranges(new_ranges...);\n+\n+ return clone;\n+ }\n+\nvirtual T convert(const std::string& val) const\n{\nreturn (T)std::stof(val);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"diff": "#include <string>\n#include <stdexcept>\n+#include <type_traits>\n#include \"Argument_type.hpp\"\n@@ -15,25 +16,42 @@ template <typename T = std::string, typename... Ranges>\nclass Text_type : public Argument_type_limited<T,Ranges...>\n{\npublic:\n- Text_type(const Ranges*... ranges)\n- : Argument_type_limited<T,Ranges...>(\"text\", ranges...)\n+ template <typename r, typename... R>\n+ Text_type(const r* range, const R*... ranges)\n+ : Argument_type_limited<T,Ranges...>(\"text\", range, ranges...)\n+ { }\n+\n+ Text_type()\n+ : Argument_type_limited<T,Ranges...>(\"text\")\n{ }\nvirtual ~Text_type() {};\nvirtual Text_type<T,Ranges...>* clone() const\n{\n- auto clone = new Text_type<T,Ranges...>(*this);\n+ auto clone = new Text_type<T,Ranges...>();\nreturn dynamic_cast<Text_type<T,Ranges...>*>(this->clone_ranges(clone));\n}\n+ template <typename... NewRanges>\n+ Text_type<T, Ranges..., NewRanges...>*\n+ clone(NewRanges*... new_ranges)\n+ {\n+ auto clone = new Text_type<T, Ranges..., NewRanges...>();\n+\n+ this->clone_ranges(clone);\n+\n+ clone->template add_ranges(new_ranges...);\n+\n+ return clone;\n+ }\n+\nvirtual T convert(const std::string& val) const\n{\nreturn val;\n}\n-\nvirtual void check(const std::string& val) const\n{\nauto str_val = this->convert(val);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add cloning with new range for List Real and Text type; Fix Integer type cloning
|
8,483 |
08.01.2018 15:49:00
| -3,600 |
c992982343471aad17cda8c7f3f0dfebc8f0d976
|
Integrate the check N function in the description function
|
[
{
"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+\n#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Encoder/BCH/Encoder_BCH.hpp\"\n@@ -28,8 +30,14 @@ Encoder_BCH::parameters* Encoder_BCH::parameters\nreturn new Encoder_BCH::parameters(*this);\n}\n-#include <cmath>\n-void check_BCH_N(const int N)\n+void Encoder_BCH::parameters\n+::get_description(tools::Argument_map_info &req_args, tools::Argument_map_info &opt_args) const\n+{\n+ Encoder::parameters::get_description(req_args, opt_args);\n+\n+ auto p = this->get_prefix();\n+\n+ auto check_BCH_N = [](const int N)\n{\nauto m = (int)std::ceil(std::log2(N));\n@@ -39,14 +47,7 @@ void check_BCH_N(const int N)\nmessage << \"'N' has to be a power of 2 minus 1\";\nthrow std::runtime_error(message.str());\n}\n-}\n-\n-void Encoder_BCH::parameters\n-::get_description(tools::Argument_map_info &req_args, tools::Argument_map_info &opt_args) const\n-{\n- Encoder::parameters::get_description(req_args, opt_args);\n-\n- auto p = this->get_prefix();\n+ };\ntools::add_ranges<tools::Integer_type<int, tools::Positive_range<>, tools::Non_zero_range<>>>\n(req_args.at({p+\"-cw-size\", \"N\"}), tools::Function<int>(\"power of 2 minus 1\", check_BCH_N));\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Integrate the check N function in the description function
|
8,483 |
08.01.2018 16:24:53
| -3,600 |
cbbce5ba4354e0c03bc06263d3b163a8a9f307fe
|
Fix Noise MKL algo specialized generate functions
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.cpp",
"new_path": "src/Tools/Algo/Noise/MKL/Noise_MKL.cpp",
"diff": "@@ -47,7 +47,7 @@ namespace tools\n{\ntemplate <>\nvoid Noise_MKL<float>\n-::generate(float *noise, const unsigned length, const float sigma, const R mu)\n+::generate(float *noise, const unsigned length, const float sigma, const float mu)\n{\nvsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\nstream_state,\n@@ -73,7 +73,7 @@ namespace tools\n{\ntemplate <>\nvoid Noise_MKL<double>\n-::generate(double *noise, const unsigned length, const double sigma, const R mu)\n+::generate(double *noise, const unsigned length, const double sigma, const double mu)\n{\nvdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER2,\nstream_state,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix Noise MKL algo specialized generate functions
|
8,483 |
09.01.2018 12:43:44
| -3,600 |
0f81e7da5ff2c4e9c2a522e774c7a3ce8224b9a2
|
Fix not joined Terminal thread when throwing exception; Fix the checking of the error messages in simulations
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/BFER.cpp",
"new_path": "src/Simulation/BFER/BFER.cpp",
"diff": "@@ -222,6 +222,8 @@ void BFER<B,R,Q>\ncatch (std::exception const& e)\n{\nmodule::Monitor::stop();\n+ terminal->final_report(std::cout); // display final report to not lost last line overwritten by the error messages\n+\nstd::cerr << tools::apply_on_each_line(tools::addr2line(e.what()), &tools::format_error) << std::endl;\nsimu_error = true;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp",
"new_path": "src/Simulation/BFER/Iterative/Threads/BFER_ite_threads.cpp",
"diff": "@@ -72,7 +72,6 @@ void BFER_ite_threads<B,R,Q>\nsimu->mutex_exception.lock();\nif (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n- if (simu->prev_err_messages.size() && std::strlen(e.what()) > simu->prev_err_messages.back().size())\nsimu->prev_err_messages.push_back(e.what());\nsimu->mutex_exception.unlock();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/BFER_std.cpp",
"new_path": "src/Simulation/BFER/Standard/BFER_std.cpp",
"diff": "@@ -82,7 +82,7 @@ void BFER_std<B,R,Q>\nif (this->params.err_track_enable && interleaver->is_uniform())\nthis->dumper[tid]->register_data(interleaver->get_lut(), this->params.err_track_threshold, \"itl\", false, this->params.src->n_frames, {});\n}\n- catch (const std::exception&) { /* do nothing if the is no interleaver */ }\n+ catch (const std::exception&) { /* do nothing if there is no interleaver */ }\nif (this->params.err_track_enable)\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": "@@ -72,7 +72,6 @@ void BFER_std_threads<B,R,Q>\nsimu->mutex_exception.lock();\nif (std::find(simu->prev_err_messages.begin(), simu->prev_err_messages.end(), e.what()) == simu->prev_err_messages.end())\n- if (simu->prev_err_messages.size() && std::strlen(e.what()) > simu->prev_err_messages.back().size())\nsimu->prev_err_messages.push_back(e.what());\nsimu->mutex_exception.unlock();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/Terminal.cpp",
"new_path": "src/Tools/Display/Terminal/Terminal.cpp",
"diff": "@@ -12,6 +12,7 @@ Terminal\nTerminal\n::~Terminal()\n{\n+ stop_temp_report(); // try to join the thread if this is not been done by the user\n}\nvoid Terminal\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix not joined Terminal thread when throwing exception; Fix the checking of the error messages in simulations
|
8,483 |
09.01.2018 12:56:26
| -3,600 |
2ac0034c009a8a6be06cb2733e2ee7a3803cbda0
|
Add a method to get the exception message without the backtrace
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -70,7 +70,11 @@ int Launcher::read_arguments()\n{\nthis->store_args();\n}\n- catch(std::exception& e)\n+ catch(const tools::exception& e)\n+ {\n+ cmd_error.push_back(e.what_no_bt());\n+ }\n+ catch(const std::exception& e)\n{\ncmd_error.push_back(tools::addr2line(e.what()));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Exception/exception.cpp",
"new_path": "src/Tools/Exception/exception.cpp",
"diff": "#include \"exception.hpp\"\n-#define ENABLE_BACK_TRACE\n-\nusing namespace aff3ct::tools;\nexception\n@@ -22,8 +20,8 @@ exception\n::exception(const std::string message) throw()\n: message(message)\n{\n-#if defined(ENABLE_BACK_TRACE)\n- this->message += get_back_trace(3);\n+#ifdef ENABLE_BACK_TRACE\n+ backtrace = message + \"\\n\" + get_back_trace(3);\n#endif\n}\n@@ -42,8 +40,8 @@ exception\nthis->message += \": \";\nthis->message += \"\\\"\" + message + \"\\\"\";\n-#if defined(ENABLE_BACK_TRACE)\n- this->message += get_back_trace(3);\n+#ifdef ENABLE_BACK_TRACE\n+ backtrace = message + \"\\n\" + get_back_trace(3);\n#endif\n}\n@@ -54,6 +52,16 @@ exception\nconst char* exception\n::what() const throw()\n+{\n+#ifdef ENABLE_BACK_TRACE\n+ return backtrace.c_str();\n+#else\n+ return message.c_str();\n+#endif\n+}\n+\n+const char* exception\n+::what_no_bt() const throw()\n{\nreturn message.c_str();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Exception/exception.hpp",
"new_path": "src/Tools/Exception/exception.hpp",
"diff": "@@ -12,6 +12,9 @@ class exception : public std::exception\n{\nprivate:\nstd::string message;\n+#ifdef ENABLE_BACK_TRACE\n+ std::string backtrace;\n+#endif\npublic:\nexception() throw();\n@@ -25,7 +28,8 @@ public:\nvirtual ~exception() throw();\n- virtual const char* what() const throw();\n+ virtual 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": "@@ -25,7 +25,7 @@ std::string aff3ct::tools::get_back_trace(int first_call)\nchar** bt_symbs = backtrace_symbols(bt_array, size);\n- bt_str += \"\\nBacktrace:\";\n+ bt_str += \"Backtrace:\";\nfor (size_t i = first_call; i < size; i++)\n{\nstd::string symbol = bt_symbs[i];\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a method to get the exception message without the backtrace
|
8,483 |
09.01.2018 12:57:46
| -3,600 |
41d354485968e9e001ff32569f54b378798fd51b
|
Change the Function Range to take a struct with a static check method that is then called; Add default arguments to the List2D helper function; Change the poncturer turbo pattern conditions
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.cpp",
"new_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.cpp",
"diff": "@@ -30,14 +30,10 @@ Encoder_BCH::parameters* Encoder_BCH::parameters\nreturn new Encoder_BCH::parameters(*this);\n}\n-void Encoder_BCH::parameters\n-::get_description(tools::Argument_map_info &req_args, tools::Argument_map_info &opt_args) const\n+struct check_BCH_N\n{\n- Encoder::parameters::get_description(req_args, opt_args);\n-\n- auto p = this->get_prefix();\n-\n- auto check_BCH_N = [](const int N)\n+ template <typename T>\n+ static void check(const T N)\n{\nauto m = (int)std::ceil(std::log2(N));\n@@ -47,10 +43,18 @@ void Encoder_BCH::parameters\nmessage << \"'N' has to be a power of 2 minus 1\";\nthrow std::runtime_error(message.str());\n}\n+ }\n};\n+void Encoder_BCH::parameters\n+::get_description(tools::Argument_map_info &req_args, tools::Argument_map_info &opt_args) const\n+{\n+ Encoder::parameters::get_description(req_args, opt_args);\n+\n+ auto p = this->get_prefix();\n+\ntools::add_ranges<tools::Integer_type<int, tools::Positive_range<>, tools::Non_zero_range<>>>\n- (req_args.at({p+\"-cw-size\", \"N\"}), tools::Function<int>(\"power of 2 minus 1\", check_BCH_N));\n+ (req_args.at({p+\"-cw-size\", \"N\"}), tools::Function<check_BCH_N>(\"power of 2 minus 1\"));\ntools::add_options(opt_args.at({p+\"-type\"}), 0, \"BCH\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -33,6 +33,18 @@ Puncturer_turbo::parameters* Puncturer_turbo::parameters\nreturn new Puncturer_turbo::parameters(*this);\n}\n+\n+struct sub_same_length\n+{\n+ template <typename T>\n+ static void check(const std::vector<T>& v)\n+ {\n+ for(unsigned i = 0; i < v.size(); i++)\n+ if (v[i].size() != v[0].size())\n+ throw std::runtime_error(\"all elements do not have the same length\");\n+ }\n+};\n+\nvoid Puncturer_turbo::parameters\n::get_description(tools::Argument_map_info &req_args, tools::Argument_map_info &opt_args) const\n{\n@@ -46,7 +58,9 @@ void Puncturer_turbo::parameters\nopt_args.add(\n{p+\"-pattern\"},\n- tools::List2D<bool>(tools::Boolean(), std::make_tuple(tools::Length(3, 3)), std::make_tuple(tools::Length(2, 3))),\n+ tools::List2D<bool>(tools::Boolean(),\n+ std::make_tuple(tools::Length(3, 3), tools::Function<sub_same_length>(\"elements of same length\")),\n+ std::make_tuple(tools::Length(1))),\n\"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\");\nopt_args.add(\n@@ -67,7 +81,6 @@ void Puncturer_turbo::parameters\nauto p = this->get_prefix();\n- // if(vals.exist({p+\"-pattern\" })) this->pattern2 = vals.at ({p+\"-pattern\" });\nif(vals.exist({p+\"-pattern\" })) this->pattern = vals.to_list<std::vector<bool>>({p+\"-pattern\" });\nif(vals.exist({p+\"-tail-length\"})) this->tail_length = vals.to_int({p+\"-tail-length\"});\nif(vals.exist({p+\"-no-buff\" })) this->buffered = false;\n@@ -89,7 +102,6 @@ void Puncturer_turbo::parameters\nif (this->type != \"NO\")\n{\nheaders[p].push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + PT::display_pattern(this->pattern) + \"}\")));\n- // headers[p].push_back(std::make_pair(std::string(\"Pattern cmd\"), std::string(\"{\" + this->pattern2 + \"}\")));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Tail length\"), std::to_string(this->tail_length)));\nif (full) headers[p].push_back(std::make_pair(std::string(\"Buffered\"), this->buffered ? \"on\" : \"off\"));\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"new_path": "src/Factory/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "@@ -22,7 +22,6 @@ struct Puncturer_turbo : public Puncturer\npublic:\n// ------------------------------------------------------------------------------------------------- PARAMETERS\n// optional parameters\n- std::string pattern2 = \"111,111,111\";\nstd::vector<std::vector<bool>> pattern = {{1,1,1},{1,1,1},{1,1,1}};\nbool buffered = true;\nint tail_length = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -150,38 +150,6 @@ void Puncturer_turbo<B,Q>\n}\n}\n-// template <typename B, typename Q>\n-// std::vector<std::vector<bool>> Puncturer_turbo<B,Q>\n-// ::convert_pattern(const std::string& pattern)\n-// {\n-// auto str_array = Splitter_D1::split(pattern);\n-\n-// std::vector<std::vector<std::string>> pattern_str;\n-\n-// for(auto& s : str_array)\n-// pattern_str.push_back(Splitter_D2::split(s));\n-\n-// std::vector<std::vector<bool>> pattern_bits(pattern_str.size());\n-\n-// for (unsigned i = 0; i < pattern_str.size(); i++)\n-// {\n-// pattern_bits[i].resize(pattern_str[i].size());\n-\n-// for (unsigned j = 0; j < pattern_str[i].size(); j++)\n-// {\n-// if (pattern_str[i][j] == \"0\")\n-// pattern_bits[i][j] = false;\n-\n-// else if (pattern_str[i][j] == \"1\")\n-// pattern_bits[i][j] = true;\n-\n-// else\n-// throw tools::invalid_argument(__FILE__, __LINE__, __func__, \"Pattern elements must be boolean (0 or 1).\");\n-// }\n-// }\n-// return pattern_bits;\n-// }\n-\ntemplate <typename B, typename Q>\nstd::string Puncturer_turbo<B,Q>\n::display_pattern(const std::vector<std::vector<bool>>& pattern_bits)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Function.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Function.hpp",
"diff": "@@ -8,34 +8,32 @@ namespace aff3ct\nnamespace tools\n{\n-template <typename T, typename F>\n+template <typename F>\nclass Function_range : public Argument_range\n{\n- F f;\n-\npublic:\n- Function_range(const std::string& title, F f)\n- : Argument_range(title), f(f)\n+ Function_range(const std::string& title)\n+ : Argument_range(title)\n{ }\nvirtual ~Function_range() {};\n- virtual Function_range<T,F>* clone() const\n+ virtual Function_range<F>* clone() const\n{\n- return new Function_range<T,F>(*this);\n+ return new Function_range<F>(*this);\n}\ntemplate <typename V>\nvoid check(const V& val) const\n{\n- f((T)val);\n+ F::check(val);\n}\n};\n-template <typename T, typename F>\n-Function_range<T,F>* Function(const std::string& title, F f)\n+template <typename F>\n+Function_range<F>* Function(const std::string& title)\n{\n- return new Function_range<T,F>(title, f);\n+ return new Function_range<F>(title);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "@@ -277,6 +277,10 @@ protected:\nclone->get_ranges().clear();\nreturn clone;\n}\n+\n+ void get_ranges_title(std::string& t) const\n+ {\n+ }\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "@@ -133,7 +133,7 @@ List_type<T,S,Ranges...>* List(Argument_type* val_type, Ranges*... ranges)\ntemplate <typename T = std::string,\nclass S1 = Generic_splitter, class S2 = String_splitter,\ntypename... Ranges1, typename... Ranges2>\n-List_type<std::vector<T>,S1,Ranges1...>* List2D(Argument_type* val_type, std::tuple<Ranges1*...>&& ranges1, std::tuple<Ranges2*...>&& ranges2)\n+List_type<std::vector<T>,S1,Ranges1...>* List2D(Argument_type* val_type, std::tuple<Ranges1*...>&& ranges1 = std::tuple<>(), std::tuple<Ranges2*...>&& ranges2 = std::tuple<>())\n{\nArgument_type* listD2 = apply_tuple(List<T,S2,Ranges2...>, std::tuple_cat(std::make_tuple(val_type), ranges2));\nreturn apply_tuple(List<std::vector<T>,S1,Ranges1...>, std::tuple_cat(std::make_tuple(listD2), ranges1));\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change the Function Range to take a struct with a static check method that is then called; Add default arguments to the List2D helper function; Change the poncturer turbo pattern conditions
|
8,490 |
09.01.2018 13:02:00
| -3,600 |
baeeb3c797172b059cdc1004733719644a0684cc
|
Try a first CI build.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "-test:\n- script:\n+stages:\n+ - build\n+\n+before_script:\n- hostname\n- whoami\n+ - pwd\n+\n+build-linux-gcc:\n+ stage: build\n+ tags:\n+ - build-linux\n+ script:\n+# - git submodule update --init --recursive\n+ - git submodule update --init -- conf\n+ - git submodule update --init -- lib/MIPP\n+ - mkdir build\n+ - cd build\n+ - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - make\n+ - ./bin/aff3ct --version\n+ - ./bin/aff3ct -C POLAR -m 1 -M 3 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Try a first CI build.
|
8,490 |
09.01.2018 13:22:02
| -3,600 |
72156bf2a409d6f2c36fea5a68921247748d3feb
|
Add a CI compilation test for clang.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -19,4 +19,19 @@ build-linux-gcc:\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- make\n- ./bin/aff3ct --version\n- - ./bin/aff3ct -C POLAR -m 1 -M 3 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n\\ No newline at end of file\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\n+\n+build-linux-clang:\n+ stage: build\n+ tags:\n+ - build-linux\n+ script:\n+# - git submodule update --init --recursive\n+ - git submodule update --init -- conf\n+ - git submodule update --init -- lib/MIPP\n+ - mkdir build\n+ - cd build\n+ - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - make\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\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a CI compilation test for clang.
|
8,483 |
09.01.2018 14:21:41
| -3,600 |
4d40c8d8e0e7c8d6e2a1c7834a14799187d056d3
|
Add Including/exceluding set makers with vector as argument
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Set.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Set.hpp",
"diff": "@@ -102,6 +102,24 @@ Including_set(const T option, const O... options)\nreturn new Including_set_range<std::string>(list);\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+\ntemplate <typename T>\nSet_range<T>* Including_set()\n{\n@@ -153,6 +171,24 @@ Excluding_set(const T option, const O... options)\nreturn new Excluding_set_range<std::string>(list);\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+\ntemplate <typename T>\nSet_range<T>* Excluding_set()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/utilities.hpp",
"new_path": "src/Tools/Arguments/utilities.hpp",
"diff": "@@ -12,30 +12,30 @@ namespace tools\nTUPLE UTILITIES\n******************************************************************************/\n-template<int...> struct index_tuple{};\n+template<int...> struct index{};\n-template<int I, typename IndexTuple, typename... Types>\n+template<int I, typename Index, typename... Types>\nstruct make_indexes_impl;\ntemplate<int I, int... Indexes, typename T, typename ... Types>\n-struct make_indexes_impl<I, index_tuple<Indexes...>, T, Types...>\n+struct make_indexes_impl<I, index<Indexes...>, T, Types...>\n{\n- typedef typename make_indexes_impl<I + 1, index_tuple<Indexes..., I>, Types...>::type type;\n+ typedef typename make_indexes_impl<I + 1, index<Indexes..., I>, Types...>::type type;\n};\ntemplate<int I, int... Indexes>\n-struct make_indexes_impl<I, index_tuple<Indexes...> >\n+struct make_indexes_impl<I, index<Indexes...> >\n{\n- typedef index_tuple<Indexes...> type;\n+ typedef index<Indexes...> type;\n};\ntemplate<typename ... Types>\n-struct make_indexes : make_indexes_impl<0, index_tuple<>, Types...>\n+struct make_indexes : make_indexes_impl<0, index<>, Types...>\n{};\ntemplate<class Ret, class... Args, int... Indexes >\n-Ret apply_tuple_helper( Ret (*pf)(Args...), index_tuple< Indexes... >, std::tuple<Args...>&& tup)\n+Ret apply_tuple_helper( Ret (*pf)(Args...), index< Indexes... >, std::tuple<Args...>&& tup)\n{\nreturn pf( std::forward<Args>( std::get<Indexes>(tup))... );\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add Including/exceluding set makers with vector as argument
|
8,483 |
09.01.2018 14:50:52
| -3,600 |
da76771829c9359f98aa99775f2060a23881eca3
|
Separate Argument type limited from Argument type into two files; Add new type 'File'
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Negative.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Negative.hpp",
"diff": "#include <string>\n-#include \"Argument_range.hpp\"\n+#include \"Max.hpp\"\nnamespace aff3ct\n{\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 \"Argument_range.hpp\"\n+#include \"Set.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Positive.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Positive.hpp",
"diff": "#include <string>\n-#include \"Argument_range.hpp\"\n+#include \"Min.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "#include <string>\n#include <stdexcept>\n-#include \"../Argument_range/Argument_range.hpp\"\n-\nnamespace aff3ct\n{\nnamespace tools\n@@ -34,255 +32,6 @@ public:\nconst std::string get_short_title() const;\n};\n-template <typename T>\n-class Argument_type_limited_T : public Argument_type\n-{\n-public:\n- static const std::string ranges_description_separator;\n-\n-private:\n- std::vector<void*> ranges;\n-\n-public:\n- Argument_type_limited_T(const std::string& title)\n- : Argument_type(title)\n- {}\n-\n- void* get_range(size_t pos) const\n- {\n- return ranges.at(pos);\n- }\n-\n- std::vector<void*>& get_ranges()\n- {\n- return ranges;\n- }\n-\n- virtual T convert(const std::string& val) const\n- {\n- throw std::runtime_error(\"This method has not been instantiated for this class.\");\n- }\n-\n- virtual void* get_val(const std::string& val) const\n- {\n- T* p_val = new T(this->convert(val));\n-\n- return (void*)p_val;\n- }\n-\n-protected:\n- const std::vector<void*>& get_ranges() const\n- {\n- return ranges;\n- }\n-};\n-\n-template <typename T>\n-const std::string Argument_type_limited_T<T>::ranges_description_separator = \", \";\n-\n-\n-\n-template <typename T, typename... Ranges>\n-class Argument_type_limited : public Argument_type_limited_T<T>\n-{\n-public:\n- Argument_type_limited(const std::string& title, const Ranges*... new_ranges)\n- : Argument_type_limited_T<T>(title)\n- {\n- add_ranges(new_ranges...);\n- }\n-\n-protected:\n- Argument_type_limited(const std::string& title)\n- : Argument_type_limited_T<T>(title)\n- { }\n-\n-public:\n- virtual ~Argument_type_limited()\n- {\n- _clear<Ranges...>();\n- }\n-\n- virtual const std::string get_title() const\n- {\n- auto t = this->title;\n-\n- if (this->get_ranges().size()) // then add ranges titles to the argument title\n- {\n- t += Argument_type::title_description_separator;\n- get_ranges_title(t);\n- }\n-\n- return t;\n- }\n-\n- template <typename... NewRanges>\n- void add_ranges(NewRanges*... new_ranges)\n- {\n- _add_ranges<NewRanges...>(new_ranges...);\n- }\n-\n-protected:\n- void check_ranges(const T& val) const\n- {\n- if (this->get_ranges().size())\n- _check<Ranges...>(val);\n- }\n-\n- template <typename... OtherRanges>\n- Argument_type_limited<T,Ranges...,OtherRanges...>*\n- clone_ranges(Argument_type_limited<T,Ranges...,OtherRanges...>* clone) const\n- {\n- clone->get_ranges().clear();\n-\n- _clone<Argument_type_limited<T,Ranges...,OtherRanges...>,Ranges...>(clone);\n-\n- return clone;\n- }\n-\n- void get_ranges_title(std::string& t) const\n- {\n- _get_ranges_title<Ranges...>(t);\n- }\n-\n-private:\n- template <typename r>\n- void _clear(size_t pos = 0)\n- {\n- if (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range when clearing : \")\n- + std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n- + this->title);\n-\n- auto* ptr = static_cast<r*>(this->get_ranges()[pos]);\n- if (ptr != nullptr)\n- delete ptr;\n- ptr = nullptr;\n- }\n-\n- template <typename r, typename... R>\n- typename std::enable_if<sizeof...(R) != 0,void>::type _clear(size_t pos = 0)\n- {\n- _clear<r >( pos);\n- _clear<R...>(++pos);\n- }\n-\n- template <typename r>\n- void _check(const T& val, size_t pos = 0) const\n- {\n- if (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range when checking : \")\n- + std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n- + this->title);\n-\n- static_cast<r*>(this->get_ranges()[pos])->check(val);\n- }\n-\n- template <typename r, typename... R>\n- typename std::enable_if<sizeof...(R) != 0,void>::type _check(const T& val, size_t pos = 0) const\n- {\n- _check<r >(val, pos);\n- _check<R...>(val, ++pos);\n- }\n-\n- template <typename C, typename r>\n- void _clone(C* clone, size_t pos = 0) const\n- {\n- if (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range when cloning : \")\n- + std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n- + this->title);\n-\n- clone->add_ranges(static_cast<r*>(this->get_ranges()[pos])->clone());\n- }\n-\n- template <typename C, typename r, typename... R>\n- typename std::enable_if<sizeof...(R) != 0,void>::type _clone(C* clone, size_t pos = 0) const\n- {\n- _clone<C,r >(clone, pos);\n- _clone<C,R...>(clone, ++pos);\n- }\n-\n- template <typename r>\n- void _get_ranges_title(std::string& t, size_t pos = 0) const\n- {\n- if (pos >= this->get_ranges().size())\n- throw std::out_of_range(std::string(\"Given position out of range when getting title : \")\n- + std::to_string(pos) + \" on \"\n- + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n- + this->title);\n-\n- t += static_cast<r*>(this->get_ranges()[pos])->get_title();\n- }\n-\n- template <typename r, typename... R>\n- typename std::enable_if<sizeof...(R) != 0,void>::type _get_ranges_title(std::string& t, size_t pos = 0) const\n- {\n- _get_ranges_title<r >(t, pos);\n-\n- t += this->ranges_description_separator;\n-\n- _get_ranges_title<R...>(t, ++pos);\n- }\n-\n- template <typename r>\n- void _add_ranges(r* new_range)\n- {\n- if (new_range == nullptr)\n- throw std::invalid_argument(\"The given argument range is a nullptr.\");\n-\n- if (this->get_ranges().size() >= sizeof...(Ranges))\n- throw std::out_of_range(std::string(\"Try to add a range but already at its maximum : \")\n- + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n- + this->title);\n-\n- this->get_ranges().push_back((void*)new_range);\n- }\n-\n- template <typename r, typename... R>\n- typename std::enable_if<sizeof...(R) != 0,void>::type _add_ranges(r* new_range, R*... new_ranges)\n- {\n- _add_ranges(new_range );\n- _add_ranges(new_ranges...);\n- }\n-\n- template <typename Friend, typename... FriendRange>\n- friend class Argument_type_limited;\n-};\n-\n-template <typename T>\n-class Argument_type_limited<T> : public Argument_type_limited_T<T>\n-{\n-public:\n- Argument_type_limited(const std::string& title)\n- : Argument_type_limited_T<T>(title)\n- {\n- }\n-\n- virtual ~Argument_type_limited()\n- {\n- }\n-\n-\n-protected:\n- void check_ranges(const T& val) const\n- {\n- }\n-\n- virtual Argument_type_limited<T>* clone_ranges(Argument_type_limited<T>* clone) const\n- {\n- clone->get_ranges().clear();\n- return clone;\n- }\n-\n- void get_ranges_title(std::string& t) const\n- {\n- }\n-};\n-\n}\n}\n@@ -292,5 +41,6 @@ protected:\n#include \"Integer.hpp\"\n#include \"Boolean.hpp\"\n#include \"List.hpp\"\n+#include \"File.hpp\"\n#endif /* ARGUMENT_TYPE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/Argument_type_limited.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_LIMITED_HPP_\n+#define ARGUMENT_TYPE_LIMITED_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+\n+#include \"Argument_type.hpp\"\n+#include \"../Argument_range/Argument_range.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T>\n+class Argument_type_limited_T : public Argument_type\n+{\n+public:\n+ static const std::string ranges_description_separator;\n+\n+private:\n+ std::vector<void*> ranges;\n+\n+public:\n+ Argument_type_limited_T(const std::string& title)\n+ : Argument_type(title)\n+ {}\n+\n+ void* get_range(size_t pos) const\n+ {\n+ return ranges.at(pos);\n+ }\n+\n+ std::vector<void*>& get_ranges()\n+ {\n+ return ranges;\n+ }\n+\n+ virtual T convert(const std::string& val) const\n+ {\n+ throw std::runtime_error(\"This method has not been instantiated for this class.\");\n+ }\n+\n+ virtual void* get_val(const std::string& val) const\n+ {\n+ T* p_val = new T(this->convert(val));\n+\n+ return (void*)p_val;\n+ }\n+\n+protected:\n+ const std::vector<void*>& get_ranges() const\n+ {\n+ return ranges;\n+ }\n+};\n+\n+template <typename T>\n+const std::string Argument_type_limited_T<T>::ranges_description_separator = \", \";\n+\n+\n+\n+template <typename T, typename... Ranges>\n+class Argument_type_limited : public Argument_type_limited_T<T>\n+{\n+public:\n+ Argument_type_limited(const std::string& title, const Ranges*... new_ranges)\n+ : Argument_type_limited_T<T>(title)\n+ {\n+ add_ranges(new_ranges...);\n+ }\n+\n+protected:\n+ Argument_type_limited(const std::string& title)\n+ : Argument_type_limited_T<T>(title)\n+ { }\n+\n+public:\n+ virtual ~Argument_type_limited()\n+ {\n+ _clear<Ranges...>();\n+ }\n+\n+ virtual const std::string get_title() const\n+ {\n+ auto t = this->title;\n+\n+ if (this->get_ranges().size()) // then add ranges titles to the argument title\n+ {\n+ t += Argument_type::title_description_separator;\n+ get_ranges_title(t);\n+ }\n+\n+ return t;\n+ }\n+\n+ template <typename... NewRanges>\n+ void add_ranges(NewRanges*... new_ranges)\n+ {\n+ _add_ranges<NewRanges...>(new_ranges...);\n+ }\n+\n+protected:\n+ void check_ranges(const T& val) const\n+ {\n+ if (this->get_ranges().size())\n+ _check<Ranges...>(val);\n+ }\n+\n+ template <typename... OtherRanges>\n+ Argument_type_limited<T,Ranges...,OtherRanges...>*\n+ clone_ranges(Argument_type_limited<T,Ranges...,OtherRanges...>* clone) const\n+ {\n+ clone->get_ranges().clear();\n+\n+ _clone<Argument_type_limited<T,Ranges...,OtherRanges...>,Ranges...>(clone);\n+\n+ return clone;\n+ }\n+\n+ void get_ranges_title(std::string& t) const\n+ {\n+ _get_ranges_title<Ranges...>(t);\n+ }\n+\n+private:\n+ template <typename r>\n+ void _clear(size_t pos = 0)\n+ {\n+ if (pos >= this->get_ranges().size())\n+ throw std::out_of_range(std::string(\"Given position out of range when clearing : \")\n+ + std::to_string(pos) + \" on \"\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\n+\n+ auto* ptr = static_cast<r*>(this->get_ranges()[pos]);\n+ if (ptr != nullptr)\n+ delete ptr;\n+ ptr = nullptr;\n+ }\n+\n+ template <typename r, typename... R>\n+ typename std::enable_if<sizeof...(R) != 0,void>::type _clear(size_t pos = 0)\n+ {\n+ _clear<r >( pos);\n+ _clear<R...>(++pos);\n+ }\n+\n+ template <typename r>\n+ void _check(const T& val, size_t pos = 0) const\n+ {\n+ if (pos >= this->get_ranges().size())\n+ throw std::out_of_range(std::string(\"Given position out of range when checking : \")\n+ + std::to_string(pos) + \" on \"\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\n+\n+ static_cast<r*>(this->get_ranges()[pos])->check(val);\n+ }\n+\n+ template <typename r, typename... R>\n+ typename std::enable_if<sizeof...(R) != 0,void>::type _check(const T& val, size_t pos = 0) const\n+ {\n+ _check<r >(val, pos);\n+ _check<R...>(val, ++pos);\n+ }\n+\n+ template <typename C, typename r>\n+ void _clone(C* clone, size_t pos = 0) const\n+ {\n+ if (pos >= this->get_ranges().size())\n+ throw std::out_of_range(std::string(\"Given position out of range when cloning : \")\n+ + std::to_string(pos) + \" on \"\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\n+\n+ clone->add_ranges(static_cast<r*>(this->get_ranges()[pos])->clone());\n+ }\n+\n+ template <typename C, typename r, typename... R>\n+ typename std::enable_if<sizeof...(R) != 0,void>::type _clone(C* clone, size_t pos = 0) const\n+ {\n+ _clone<C,r >(clone, pos);\n+ _clone<C,R...>(clone, ++pos);\n+ }\n+\n+ template <typename r>\n+ void _get_ranges_title(std::string& t, size_t pos = 0) const\n+ {\n+ if (pos >= this->get_ranges().size())\n+ throw std::out_of_range(std::string(\"Given position out of range when getting title : \")\n+ + std::to_string(pos) + \" on \"\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\n+\n+ t += static_cast<r*>(this->get_ranges()[pos])->get_title();\n+ }\n+\n+ template <typename r, typename... R>\n+ typename std::enable_if<sizeof...(R) != 0,void>::type _get_ranges_title(std::string& t, size_t pos = 0) const\n+ {\n+ _get_ranges_title<r >(t, pos);\n+\n+ t += this->ranges_description_separator;\n+\n+ _get_ranges_title<R...>(t, ++pos);\n+ }\n+\n+ template <typename r>\n+ void _add_ranges(r* new_range)\n+ {\n+ if (new_range == nullptr)\n+ throw std::invalid_argument(\"The given argument range is a nullptr.\");\n+\n+ if (this->get_ranges().size() >= sizeof...(Ranges))\n+ throw std::out_of_range(std::string(\"Try to add a range but already at its maximum : \")\n+ + std::to_string(this->get_ranges().size()) + \"elements. title =\"\n+ + this->title);\n+\n+ this->get_ranges().push_back((void*)new_range);\n+ }\n+\n+ template <typename r, typename... R>\n+ typename std::enable_if<sizeof...(R) != 0,void>::type _add_ranges(r* new_range, R*... new_ranges)\n+ {\n+ _add_ranges(new_range );\n+ _add_ranges(new_ranges...);\n+ }\n+\n+ template <typename Friend, typename... FriendRange>\n+ friend class Argument_type_limited;\n+};\n+\n+template <typename T>\n+class Argument_type_limited<T> : public Argument_type_limited_T<T>\n+{\n+public:\n+ Argument_type_limited(const std::string& title)\n+ : Argument_type_limited_T<T>(title)\n+ {\n+ }\n+\n+ virtual ~Argument_type_limited()\n+ {\n+ }\n+\n+\n+protected:\n+ void check_ranges(const T& val) const\n+ {\n+ }\n+\n+ virtual Argument_type_limited<T>* clone_ranges(Argument_type_limited<T>* clone) const\n+ {\n+ clone->get_ranges().clear();\n+ return clone;\n+ }\n+\n+ void get_ranges_title(std::string& t) const\n+ {\n+ }\n+};\n+\n+}\n+}\n+\n+#endif /* ARGUMENT_TYPE_LIMITED_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"diff": "#include <stdexcept>\n#include <sstream>\n-#include \"Argument_type.hpp\"\n+#include \"Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/File.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_FILE_HPP_\n+#define ARGUMENT_TYPE_FILE_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+#include <fstream>\n+\n+#include \"Argument_type_limited.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+enum openmode {read, write, read_write};\n+\n+\n+template <typename T = std::string, typename... Ranges>\n+class File_type : public Argument_type_limited<T,Ranges...>\n+{\n+private:\n+ const openmode mode;\n+\n+public:\n+ template <typename r, typename... R>\n+ File_type(openmode mode, const r* range, const R*... ranges)\n+ : Argument_type_limited<T,Ranges...>(\"File\", range, ranges...), mode(mode)\n+ { }\n+\n+ File_type(openmode mode)\n+ : Argument_type_limited<T,Ranges...>(\"File\"), mode(mode)\n+ { }\n+\n+ virtual ~File_type() {};\n+\n+ virtual File_type<T,Ranges...>* clone() const\n+ {\n+ auto clone = new File_type<T,Ranges...>(mode);\n+\n+ return dynamic_cast<File_type<T,Ranges...>*>(this->clone_ranges(clone));\n+ }\n+\n+ template <typename... NewRanges>\n+ File_type<T, Ranges..., NewRanges...>*\n+ clone(NewRanges*... new_ranges)\n+ {\n+ auto clone = new File_type<T, Ranges..., NewRanges...>(mode);\n+\n+ this->clone_ranges(clone);\n+\n+ clone->template add_ranges(new_ranges...);\n+\n+ return clone;\n+ }\n+\n+ virtual T convert(const std::string& val) const\n+ {\n+ return val;\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ auto str_val = this->convert(val);\n+\n+ if (str_val.empty())\n+ throw std::runtime_error(\"shall be a file name\");\n+\n+ switch(mode)\n+ {\n+ case openmode::read :\n+ {\n+ std::ifstream f(str_val);\n+ if(f.bad())\n+ throw std::runtime_error(\"file has not been found\");\n+\n+ break;\n+ }\n+ case openmode::write :\n+ case openmode::read_write : // nothing to check\n+ break;\n+ }\n+\n+ this->check_ranges(str_val);\n+ }\n+};\n+\n+template <typename T = std::string, typename... Ranges>\n+File_type<T,Ranges...>* File(openmode mode, Ranges*... ranges)\n+{\n+ return new File_type<T,Ranges...>(mode, ranges...);\n+}\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_FILE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"diff": "#include <string>\n#include <stdexcept>\n-#include \"Argument_type.hpp\"\n+#include \"Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "#include <type_traits>\n#include <tuple>\n-#include \"Argument_type.hpp\"\n+#include \"Argument_type_limited.hpp\"\n#include \"../utilities.hpp\"\n#include \"../Splitter/Splitter.hpp\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"diff": "#include <string>\n#include <stdexcept>\n-#include \"Argument_type.hpp\"\n+#include \"Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"diff": "#include <stdexcept>\n#include <type_traits>\n-#include \"Argument_type.hpp\"\n+#include \"Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Separate Argument type limited from Argument type into two files; Add new type 'File'
|
8,483 |
09.01.2018 15:23:41
| -3,600 |
cdbfea1d17c93a9cdf795cacf1aaabdf72c7a4d2
|
Add title generator method in File and List types
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/File.hpp",
"new_path": "src/Tools/Arguments/Argument_type/File.hpp",
"diff": "@@ -24,11 +24,11 @@ private:\npublic:\ntemplate <typename r, typename... R>\nFile_type(openmode mode, const r* range, const R*... ranges)\n- : Argument_type_limited<T,Ranges...>(\"file\", range, ranges...), mode(mode)\n+ : Argument_type_limited<T,Ranges...>(generate_title(mode), range, ranges...), mode(mode)\n{ }\nFile_type(openmode mode)\n- : Argument_type_limited<T,Ranges...>(\"file\"), mode(mode)\n+ : Argument_type_limited<T,Ranges...>(generate_title(mode)), mode(mode)\n{ }\nvirtual ~File_type() {};\n@@ -82,6 +82,30 @@ public:\nthis->check_ranges(str_val);\n}\n+\n+ static std::string generate_title(openmode mode)\n+ {\n+ std::string str = \"file [\";\n+\n+ switch(mode)\n+ {\n+ case openmode::read :\n+ str += \"read only\";\n+ break;\n+\n+ case openmode::write :\n+ str += \"write only\";\n+ break;\n+\n+ case openmode::read_write : // nothing to check\n+ str += \"read/write\";\n+ break;\n+ }\n+\n+ str += \"]\";\n+\n+ return str;\n+ }\n};\ntemplate <typename T = std::string, typename... Ranges>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/List.hpp",
"diff": "@@ -25,11 +25,11 @@ protected:\npublic:\ntemplate <typename r, typename... R>\nList_type(Argument_type* val_type, const r* range, const R*... ranges)\n- : Argument_type_limited<std::vector<T>,Ranges...>(\"list of \" + val_type->get_short_title(), range, ranges...), val_type(val_type)\n+ : Argument_type_limited<std::vector<T>,Ranges...>(generate_title(val_type), range, ranges...), val_type(val_type)\n{ }\nList_type(Argument_type* val_type)\n- : Argument_type_limited<std::vector<T>,Ranges...>(\"list of \" + val_type->get_short_title()), val_type(val_type)\n+ : Argument_type_limited<std::vector<T>,Ranges...>(generate_title(val_type)), val_type(val_type)\n{ }\nvirtual ~List_type()\n@@ -122,6 +122,13 @@ public:\nreturn list_T;\n}\n+\n+ static std::string generate_title(Argument_type* val_type)\n+ {\n+ std::string str = \"list of \" + val_type->get_short_title();\n+\n+ return str;\n+ }\n};\ntemplate <typename T = std::string, class S = Generic_splitter, typename... Ranges>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add title generator method in File and List types
|
8,483 |
09.01.2018 15:26:14
| -3,600 |
410bd44aee186b47529c6dc02b0fd3c69f9817ea
|
Change Text types into File types for some arguments
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp",
"new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.cpp",
"diff": "@@ -47,7 +47,7 @@ void Decoder_LDPC::parameters\nreq_args.add(\n{p+\"-h-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"path to the H matrix (AList or QC formated file).\");\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"BP\", \"BP_FLOODING\", \"BP_LAYERED\" );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Encoder.cpp",
"new_path": "src/Factory/Module/Encoder/Encoder.cpp",
"diff": "@@ -63,7 +63,7 @@ void Encoder::parameters\nopt_args.add(\n{p+\"-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"path to a file containing one or a set of pre-computed codewords, to use with \\\"--enc-type USER\\\".\");\nopt_args.add(\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "@@ -42,12 +42,12 @@ void Encoder_LDPC::parameters\nopt_args.add(\n{p+\"-h-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"path to the H matrix (AList formated file, required by the \\\"LDPC_H\\\" encoder).\");\nopt_args.add(\n{p+\"-g-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"path to the G matrix (AList formated file, required by the \\\"LDPC\\\" encoder).\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hxx",
"new_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hxx",
"diff": "@@ -97,7 +97,7 @@ void Encoder_turbo::parameters<E1,E2>\nopt_args.add(\n{p+\"-json-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::write),\n\"path to store the encoder and decoder traces formated in JSON.\");\nsub1->get_description(req_args, opt_args);\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": "@@ -83,7 +83,7 @@ void Encoder_turbo_DB::parameters\nopt_args.add(\n{p+\"-json-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::write),\n\"path to store the encoder and decoder traces formated in JSON.\");\nsub->get_description(req_args, opt_args);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Modem/Modem.cpp",
"new_path": "src/Factory/Module/Modem/Modem.cpp",
"diff": "@@ -69,7 +69,7 @@ void Modem::parameters\nopt_args.add(\n{p+\"-const-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"path to the ordered modulation symbols (constellation), to use with \\\"--mod-type USER\\\".\");\nopt_args.add(\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Source/Source.cpp",
"new_path": "src/Factory/Module/Source/Source.cpp",
"diff": "@@ -52,7 +52,7 @@ void Source::parameters\nopt_args.add(\n{p+\"-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"path to a file containing one or a set of pre-computed source bits, to use with \\\"--src-type USER\\\".\");\nopt_args.add(\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/BFER/BFER.cpp",
"new_path": "src/Factory/Simulation/BFER/BFER.cpp",
"diff": "@@ -118,7 +118,7 @@ void BFER::parameters\nopt_args.add(\n{p+\"-err-trk-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read_write),\n\"base path for the files where the bad frames will be stored or read.\");\nopt_args.add(\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Interleaver/Interleaver_core.cpp",
"new_path": "src/Factory/Tools/Interleaver/Interleaver_core.cpp",
"diff": "@@ -59,7 +59,7 @@ void Interleaver_core::parameters\nopt_args.add(\n{p+\"-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"specify the path to the interleaver file (to use with \\\"--itl-type USER\\\").\");\nopt_args.add(\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change Text types into File types for some arguments
|
8,483 |
09.01.2018 15:34:51
| -3,600 |
eef1c462558b621af8097bf8db4fa20bcc6fd62f
|
Add argument -pb-path as a read only file
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Code/Polar/Frozenbits_generator.cpp",
"new_path": "src/Factory/Tools/Code/Polar/Frozenbits_generator.cpp",
"diff": "@@ -61,7 +61,7 @@ void Frozenbits_generator::parameters\n#ifdef ENABLE_POLAR_BOUNDS\nopt_args.add(\n{p+\"-pb-path\"},\n- tools::Text(),\n+ tools::File(tools::openmode::read),\n\"path of the polar bounds code generator (generates best channels to use).\");\n#endif\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add argument -pb-path as a read only file
|
8,483 |
09.01.2018 17:12:32
| -3,600 |
c4b780f6cd530cf6eea9b10215100f87d0aae8ee
|
Move types in subfolders Container and Number
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "@@ -36,11 +36,13 @@ public:\n}\n#include \"None.hpp\"\n-#include \"Text.hpp\"\n-#include \"Real.hpp\"\n-#include \"Integer.hpp\"\n-#include \"Boolean.hpp\"\n-#include \"List.hpp\"\n-#include \"File.hpp\"\n+#include \"Number/Real.hpp\"\n+#include \"Number/Integer.hpp\"\n+#include \"Number/Boolean.hpp\"\n+#include \"Container/Text.hpp\"\n+#include \"Container/List.hpp\"\n+#include \"File_system/File.hpp\"\n+#include \"File_system/Folder.hpp\"\n+#include \"File_system/Path.hpp\"\n#endif /* ARGUMENT_TYPE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Arguments/Argument_type/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Container/List.hpp",
"diff": "#include <type_traits>\n#include <tuple>\n-#include \"Argument_type_limited.hpp\"\n-#include \"../utilities.hpp\"\n-#include \"../Splitter/Splitter.hpp\"\n+#include \"../Argument_type_limited.hpp\"\n+#include \"../../utilities.hpp\"\n+#include \"../../Splitter/Splitter.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Arguments/Argument_type/Text.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Container/Text.hpp",
"diff": "#include <stdexcept>\n#include <type_traits>\n-#include \"Argument_type_limited.hpp\"\n+#include \"../Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Arguments/Argument_type/Boolean.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Number/Boolean.hpp",
"diff": "#include <stdexcept>\n#include <sstream>\n-#include \"Argument_type_limited.hpp\"\n+#include \"../Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Arguments/Argument_type/Integer.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Number/Integer.hpp",
"diff": "#include <string>\n#include <stdexcept>\n-#include \"Argument_type_limited.hpp\"\n+#include \"../Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Arguments/Argument_type/Real.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Number/Real.hpp",
"diff": "#include <string>\n#include <stdexcept>\n-#include \"Argument_type_limited.hpp\"\n+#include \"../Argument_type_limited.hpp\"\nnamespace aff3ct\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move types in subfolders Container and Number
|
8,490 |
09.01.2018 17:36:42
| -3,600 |
6b424d9cca332ce445f78da610fcfbfdb22e28b9
|
Add a CI compilation test for gcc on Windows.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -16,7 +16,7 @@ build-linux-gcc:\n- git submodule update --init -- lib/MIPP\n- mkdir build\n- cd build\n- - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\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\"\n- make\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\n@@ -31,7 +31,23 @@ build-linux-clang:\n- git submodule update --init -- lib/MIPP\n- mkdir build\n- cd build\n- - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- make\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\n+\n+build-windows-gcc:\n+ stage: build\n+ tags:\n+ - build-windows\n+ script:\n+# - git submodule update --init --recursive\n+ - git submodule update --init -- conf\n+ - git submodule update --init -- lib/MIPP\n+ - mkdir build\n+ - cd build\n+ - cmake .. -G\"MinGW Makefiles\" || true\n+ - cmake .. -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_CC_COMPILER=gcc.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - mingw32-make\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\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a CI compilation test for gcc on Windows.
|
8,483 |
09.01.2018 17:40:35
| -3,600 |
61b4fa89e38afbe2f59da99ab298493db9a0afbe
|
Add File system type, with File, Folder or Path inheritance
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Tools/Code/Polar/Frozenbits_generator.cpp",
"new_path": "src/Factory/Tools/Code/Polar/Frozenbits_generator.cpp",
"diff": "@@ -55,7 +55,7 @@ void Frozenbits_generator::parameters\nopt_args.add(\n{p+\"-awgn-path\"},\n- tools::Text(),\n+ tools::Path(tools::openmode::read),\n\"path to a file or a directory containing the best channels to use for information bits.\");\n#ifdef ENABLE_POLAR_BOUNDS\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type.hpp",
"diff": "@@ -36,13 +36,6 @@ public:\n}\n#include \"None.hpp\"\n-#include \"Number/Real.hpp\"\n-#include \"Number/Integer.hpp\"\n-#include \"Number/Boolean.hpp\"\n-#include \"Container/Text.hpp\"\n-#include \"Container/List.hpp\"\n-#include \"File_system/File.hpp\"\n-#include \"File_system/Folder.hpp\"\n-#include \"File_system/Path.hpp\"\n+#include \"Argument_type_limited.hpp\"\n#endif /* ARGUMENT_TYPE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type_limited.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type_limited.hpp",
"diff": "@@ -264,4 +264,12 @@ protected:\n}\n}\n+#include \"Number/Real.hpp\"\n+#include \"Number/Integer.hpp\"\n+#include \"Number/Boolean.hpp\"\n+#include \"Container/Text.hpp\"\n+#include \"Container/List.hpp\"\n+#include \"File_system/File_system.hpp\"\n+\n+\n#endif /* ARGUMENT_TYPE_LIMITED_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "src/Tools/Arguments/Argument_type/File.hpp",
"new_path": null,
"diff": "-#ifndef ARGUMENT_TYPE_FILE_HPP_\n-#define ARGUMENT_TYPE_FILE_HPP_\n-\n-#include <string>\n-#include <stdexcept>\n-#include <fstream>\n-\n-#include \"Argument_type_limited.hpp\"\n-\n-namespace aff3ct\n-{\n-namespace tools\n-{\n-\n-enum openmode {read, write, read_write};\n-\n-\n-template <typename T = std::string, typename... Ranges>\n-class File_type : public Argument_type_limited<T,Ranges...>\n-{\n-private:\n- const openmode mode;\n-\n-public:\n- template <typename r, typename... R>\n- File_type(openmode mode, const r* range, const R*... ranges)\n- : Argument_type_limited<T,Ranges...>(generate_title(mode), range, ranges...), mode(mode)\n- { }\n-\n- File_type(openmode mode)\n- : Argument_type_limited<T,Ranges...>(generate_title(mode)), mode(mode)\n- { }\n-\n- virtual ~File_type() {};\n-\n- virtual File_type<T,Ranges...>* clone() const\n- {\n- auto clone = new File_type<T,Ranges...>(mode);\n-\n- return dynamic_cast<File_type<T,Ranges...>*>(this->clone_ranges(clone));\n- }\n-\n- template <typename... NewRanges>\n- File_type<T, Ranges..., NewRanges...>*\n- clone(NewRanges*... new_ranges)\n- {\n- auto clone = new File_type<T, Ranges..., NewRanges...>(mode);\n-\n- this->clone_ranges(clone);\n-\n- clone->template add_ranges(new_ranges...);\n-\n- return clone;\n- }\n-\n- virtual T convert(const std::string& val) const\n- {\n- return val;\n- }\n-\n- virtual void check(const std::string& val) const\n- {\n- auto str_val = this->convert(val);\n-\n- if (str_val.empty())\n- throw std::runtime_error(\"shall be a file name\");\n-\n- switch(mode)\n- {\n- case openmode::read :\n- {\n- std::ifstream f(str_val);\n- if(f.fail())\n- throw std::runtime_error(\"does not name an existing file\");\n-\n- break;\n- }\n- case openmode::write :\n- case openmode::read_write : // nothing to check\n- break;\n- }\n-\n- this->check_ranges(str_val);\n- }\n-\n- static std::string generate_title(openmode mode)\n- {\n- std::string str = \"file [\";\n-\n- switch(mode)\n- {\n- case openmode::read :\n- str += \"read only\";\n- break;\n-\n- case openmode::write :\n- str += \"write only\";\n- break;\n-\n- case openmode::read_write : // nothing to check\n- str += \"read/write\";\n- break;\n- }\n-\n- str += \"]\";\n-\n- return str;\n- }\n-};\n-\n-template <typename T = std::string, typename... Ranges>\n-File_type<T,Ranges...>* File(openmode mode, Ranges*... ranges)\n-{\n- return new File_type<T,Ranges...>(mode, ranges...);\n-}\n-\n-}\n-}\n-#endif /* ARGUMENT_TYPE_FILE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/File_system/File.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_FILE_HPP_\n+#define ARGUMENT_TYPE_FILE_HPP_\n+\n+#include \"File_system.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = std::string, typename... Ranges>\n+class File_type : public File_system_type<T, isFile, noCheck, noCheck, Ranges...>\n+{\n+public:\n+ using parent_type = File_system_type<T, isFile, noCheck, noCheck, Ranges...>;\n+\n+ template <typename r, typename... R>\n+ File_type(const openmode& mode, const r* range, const R*... ranges)\n+ : parent_type(\"file\", mode, range, ranges...)\n+ { }\n+\n+ File_type(const openmode& mode)\n+ : parent_type(\"file\", mode)\n+ { }\n+\n+ virtual ~File_type() {};\n+};\n+\n+template <typename T = std::string, typename... Ranges>\n+typename File_type<T,Ranges...>::parent_type* File(openmode mode, Ranges*... ranges)\n+{\n+ return new File_type<T,Ranges...>(mode, ranges...);\n+}\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_FILE_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/File_system/File_system.cpp",
"diff": "+#include <fstream>\n+#include <dirent.h>\n+\n+#include \"File_system.hpp\"\n+\n+std::string aff3ct::tools::openmode_to_string(const openmode& mode)\n+{\n+ std::string str;\n+\n+ switch(mode)\n+ {\n+ case openmode::read :\n+ str += \"read only\";\n+ break;\n+\n+ case openmode::write :\n+ str += \"write only\";\n+ break;\n+\n+ case openmode::read_write : // nothing to check\n+ str += \"read/write\";\n+ break;\n+ }\n+\n+ return str;\n+}\n+\n+bool aff3ct::tools::isFile::check(const std::string& filename)\n+{\n+ std::ifstream f(filename);\n+ return f.good();\n+}\n+\n+bool aff3ct::tools::isFolder::check(const std::string& foldername)\n+{\n+ DIR *dp = opendir(foldername.c_str());\n+\n+ if (dp != nullptr)\n+ {\n+ closedir(dp);\n+ return true;\n+ }\n+\n+ return false;\n+}\n+\n+bool aff3ct::tools::isPath::check(const std::string& path)\n+{\n+ return isFile::check(path) || isFolder::check(path);\n+}\n+\n+bool aff3ct::tools::noCheck::check(const std::string&)\n+{\n+ return true;\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/File_system/File_system.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_FILE_SYSTEM_HPP_\n+#define ARGUMENT_TYPE_FILE_SYSTEM_HPP_\n+\n+#include <string>\n+#include <stdexcept>\n+\n+#include \"../Argument_type_limited.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+enum openmode {read, write, read_write};\n+\n+std::string openmode_to_string(const openmode& mode);\n+\n+struct isFile\n+{\n+ static bool check(const std::string& filename);\n+};\n+\n+struct isFolder\n+{\n+ static bool check(const std::string& foldername);\n+};\n+\n+struct isPath\n+{\n+ static bool check(const std::string& path);\n+};\n+\n+struct noCheck\n+{\n+ static bool check(const std::string&);\n+};\n+\n+\n+template <typename T = std::string, typename Read_F = noCheck, typename Write_F = noCheck, typename RW_F = noCheck, typename... Ranges>\n+class File_system_type : public Argument_type_limited<T,Ranges...>\n+{\n+protected:\n+ const std::string name;\n+ const openmode mode;\n+\n+public:\n+ template <typename r, typename... R>\n+ File_system_type(const std::string& name, const openmode& mode, const r* range, const R*... ranges)\n+ : Argument_type_limited<T,Ranges...>(generate_title(name, mode), range, ranges...), name(name), mode(mode)\n+ { }\n+\n+ File_system_type(const std::string& name, const openmode& mode)\n+ : Argument_type_limited<T,Ranges...>(generate_title(name, mode)), name(name), mode(mode)\n+ { }\n+\n+ virtual ~File_system_type() {};\n+\n+ virtual File_system_type<T, Read_F, Write_F, RW_F, Ranges...>* clone() const\n+ {\n+ auto clone = new File_system_type<T, Read_F, Write_F, RW_F, Ranges...>(name, mode);\n+\n+ return dynamic_cast<File_system_type<T, Read_F, Write_F, RW_F, Ranges...>*>(this->clone_ranges(clone));\n+ }\n+\n+ template <typename... NewRanges>\n+ File_system_type<T, Read_F, Write_F, RW_F, Ranges..., NewRanges...>* clone(NewRanges*... new_ranges)\n+ {\n+ auto clone = new File_system_type<T, Read_F, Write_F, RW_F, Ranges..., NewRanges...>(name, mode);\n+\n+ this->clone_ranges(clone);\n+\n+ clone->template add_ranges(new_ranges...);\n+\n+ return clone;\n+ }\n+\n+ static std::string generate_title(const std::string& name, const openmode& mode)\n+ {\n+ return name + \" [\" + openmode_to_string(mode) + \"]\";\n+ }\n+\n+ virtual T convert(const std::string& val) const\n+ {\n+ return val;\n+ }\n+\n+ virtual void check(const std::string& val) const\n+ {\n+ auto str_val = this->convert(val);\n+\n+ if (str_val.empty())\n+ throw std::runtime_error(\"shall be a \" + name + \" name\");\n+\n+ switch(mode)\n+ {\n+ case openmode::read :\n+ if(!Read_F::check(str_val))\n+ throw std::runtime_error(\"does not name an existing \" + name);\n+ break;\n+\n+ case openmode::write :\n+ if(!Write_F::check(str_val))\n+ throw std::runtime_error(\"does not name a \" + name);\n+ break;\n+\n+ case openmode::read_write : // nothing to check\n+ if(!RW_F::check(str_val))\n+ throw std::runtime_error(\"does not name a \" + name);\n+ break;\n+ }\n+\n+ this->check_ranges(str_val);\n+ }\n+};\n+\n+}\n+}\n+\n+#include \"File.hpp\"\n+#include \"Folder.hpp\"\n+#include \"Path.hpp\"\n+\n+#endif /* ARGUMENT_TYPE_FILE_SYSTEM_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/File_system/Folder.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_FOLDER_HPP_\n+#define ARGUMENT_TYPE_FOLDER_HPP_\n+\n+#include \"File_system.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = std::string, typename... Ranges>\n+class Folder_type : public File_system_type<T, isFolder, noCheck, noCheck, Ranges...>\n+{\n+public:\n+ using parent_type = File_system_type<T, isFolder, noCheck, noCheck, Ranges...>;\n+\n+ template <typename r, typename... R>\n+ Folder_type(const openmode& mode, const r* range, const R*... ranges)\n+ : parent_type(\"folder\", mode, range, ranges...)\n+ { }\n+\n+ Folder_type(const openmode& mode)\n+ : parent_type(\"folder\", mode)\n+ { }\n+\n+ virtual ~Folder_type() {};\n+};\n+\n+template <typename T = std::string, typename... Ranges>\n+typename Folder_type<T,Ranges...>::parent_type* Folder(openmode mode, Ranges*... ranges)\n+{\n+ return new Folder_type<T,Ranges...>(mode, ranges...);\n+}\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_FOLDER_HPP_ */\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Arguments/Argument_type/File_system/Path.hpp",
"diff": "+#ifndef ARGUMENT_TYPE_PATH_HPP_\n+#define ARGUMENT_TYPE_PATH_HPP_\n+\n+#include \"File_system.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+\n+template <typename T = std::string, typename... Ranges>\n+class Path_type : public File_system_type<T, isPath, noCheck, noCheck, Ranges...>\n+{\n+public:\n+ using parent_type = File_system_type<T, isPath, noCheck, noCheck, Ranges...>;\n+\n+ template <typename r, typename... R>\n+ Path_type(const openmode& mode, const r* range, const R*... ranges)\n+ : parent_type(\"path\", mode, range, ranges...)\n+ { }\n+\n+ Path_type(const openmode& mode)\n+ : parent_type(\"path\", mode)\n+ { }\n+\n+ virtual ~Path_type() {};\n+};\n+\n+template <typename T = std::string, typename... Ranges>\n+typename Path_type<T,Ranges...>::parent_type* Path(openmode mode, Ranges*... ranges)\n+{\n+ return new Path_type<T,Ranges...>(mode, ranges...);\n+}\n+\n+}\n+}\n+#endif /* ARGUMENT_TYPE_PATH_HPP_ */\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add File system type, with File, Folder or Path inheritance
|
8,490 |
09.01.2018 17:51:30
| -3,600 |
c0bb9d1f97afb01dd62096d2450f94ca32bdd69b
|
Try to fix prev. commit...
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -41,6 +41,9 @@ build-windows-gcc:\ntags:\n- build-windows\nscript:\n+ - set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n+ - set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n+ - set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n# - git submodule update --init --recursive\n- git submodule update --init -- conf\n- git submodule update --init -- lib/MIPP\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Try to fix prev. commit...
|
8,490 |
09.01.2018 18:17:49
| -3,600 |
fe8df00eaac106ab621b00c9d978dbd7649dcc8e
|
Try to fix prev. commit, again...
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -52,5 +52,6 @@ build-windows-gcc:\n- cmake .. -G\"MinGW Makefiles\" || true\n- cmake .. -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_CC_COMPILER=gcc.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- mingw32-make\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\n\\ No newline at end of file\n+ - cd bin\n+ - aff3ct.exe --version\n+ - aff3ct.exe -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Try to fix prev. commit, again...
|
8,490 |
10.01.2018 14:12:04
| -3,600 |
b832ffc6a6b803016122069a22d0f776d9716295
|
Add CI MSVC build test.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -49,9 +49,30 @@ build-windows-gcc:\n- git submodule update --init -- lib/MIPP\n- mkdir build\n- cd build\n- - cmake .. -G\"MinGW Makefiles\" || true\n- - cmake .. -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_CC_COMPILER=gcc.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - cmake .. -G\"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- mingw32-make\n- cd bin\n- aff3ct.exe --version\n- aff3ct.exe -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n+\n+build-windows-msvc:\n+ stage: build\n+ tags:\n+ - build-windows\n+ script:\n+ - set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n+ - set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n+ - set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n+ - set PATH=%PATH%;C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\n+ - set \"VSCMD_START_DIR=%CD%\"\n+ - vcvars64\n+# - git submodule update --init --recursive\n+ - git submodule update --init -- conf\n+ - git submodule update --init -- lib/MIPP\n+ - mkdir build\n+ - cd build\n+ - cmake .. -G\"Visual Studio 15 2017 Win64\" -DCMAKE_CXX_FLAGS=\"-D_CRT_SECURE_NO_DEPRECATE -DMULTI_PREC /EHsc /arch:AVX\"\n+ - devenv /build Release aff3ct.sln\n+ - cd bin\\Release\n+ - aff3ct.exe --version\n+ - aff3ct.exe -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add CI MSVC build test.
|
8,490 |
10.01.2018 14:32:28
| -3,600 |
8fa63a4064b83041c8627c7773d130899d20a8e6
|
Fix CI MSVC test.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -63,9 +63,8 @@ build-windows-msvc:\n- set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n- set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n- set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n- - set PATH=%PATH%;C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\n- set \"VSCMD_START_DIR=%CD%\"\n- - vcvars64\n+ - call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"\n# - git submodule update --init --recursive\n- git submodule update --init -- conf\n- git submodule update --init -- lib/MIPP\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix CI MSVC test.
|
8,490 |
10.01.2018 14:40:47
| -3,600 |
272f4bfdf1dbde44a103c98a35eab74ab8faf59a
|
Try to fix CI submodule update bug.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -5,15 +5,14 @@ before_script:\n- hostname\n- whoami\n# - pwd\n+ - git submodule sync --recursive\n+ - git submodule update --init --recursive\nbuild-linux-gcc:\nstage: build\ntags:\n- build-linux\nscript:\n-# - git submodule update --init --recursive\n- - git submodule update --init -- conf\n- - git submodule update --init -- lib/MIPP\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 -DMULTI_PREC\"\n@@ -26,9 +25,6 @@ build-linux-clang:\ntags:\n- build-linux\nscript:\n-# - git submodule update --init --recursive\n- - git submodule update --init -- conf\n- - git submodule update --init -- lib/MIPP\n- mkdir build\n- cd build\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n@@ -44,9 +40,6 @@ build-windows-gcc:\n- set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n- set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n- set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n-# - git submodule update --init --recursive\n- - git submodule update --init -- conf\n- - git submodule update --init -- lib/MIPP\n- mkdir build\n- cd build\n- cmake .. -G\"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n@@ -65,9 +58,6 @@ build-windows-msvc:\n- set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n- set \"VSCMD_START_DIR=%CD%\"\n- call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"\n-# - git submodule update --init --recursive\n- - git submodule update --init -- conf\n- - git submodule update --init -- lib/MIPP\n- mkdir build\n- cd build\n- cmake .. -G\"Visual Studio 15 2017 Win64\" -DCMAKE_CXX_FLAGS=\"-D_CRT_SECURE_NO_DEPRECATE -DMULTI_PREC /EHsc /arch:AVX\"\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Try to fix CI submodule update bug.
|
8,490 |
10.01.2018 15:47:28
| -3,600 |
5d81e5d8e617f593ad3b5c1e5cd62e9f97cadd01
|
Add a static analysis with cppcheck in the CI.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "stages:\n+ - analyse\n- build\nbefore_script:\n@@ -8,6 +9,24 @@ before_script:\n- git submodule sync --recursive\n- git submodule update --init --recursive\n+analyse-cppcheck:\n+ stage: analyse\n+ artifacts:\n+ name: analyse-cppcheck-logs\n+ paths:\n+ - cppcheck.log\n+ - cppcheck_error.log\n+ - cppcheck_warning.log\n+ - cppcheck_performance.log\n+ - cppcheck_style.log\n+ - cppcheck_portability.log\n+ - cppcheck_information.log\n+ - cppcheck_unusedFunction.log\n+ - cppcheck_missingInclude.log\n+ tags: build-linux\n+ script:\n+ - ./ci/cppcheck.sh\n+\nbuild-linux-gcc:\nstage: build\ntags:\n@@ -18,7 +37,7 @@ build-linux-gcc:\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\"\n- make\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\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\nbuild-linux-clang:\nstage: build\n@@ -30,7 +49,7 @@ build-linux-clang:\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- make\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\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\nbuild-windows-gcc:\nstage: build\n@@ -46,7 +65,7 @@ build-windows-gcc:\n- mingw32-make\n- cd bin\n- aff3ct.exe --version\n- - aff3ct.exe -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n+ - aff3ct.exe -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\nbuild-windows-msvc:\nstage: build\n@@ -64,4 +83,4 @@ build-windows-msvc:\n- devenv /build Release aff3ct.sln\n- cd bin\\Release\n- aff3ct.exe --version\n- - aff3ct.exe -C POLAR -m 1.0 -M 3.5 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n\\ No newline at end of file\n+ - aff3ct.exe -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/cppcheck.sh",
"diff": "+#!/bin/bash\n+\n+find .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n+cppcheck --force --enable=all --std=c++11 --file-list=src_files.txt 2> cppcheck.log\n+cat cppcheck.log | grep \"(error)\" > cppcheck_error.log\n+cat cppcheck.log | grep \"(warning)\" > cppcheck_warning.log\n+cat cppcheck.log | grep \"(performance)\" > cppcheck_performance.log\n+cat cppcheck.log | grep \"(style)\" > cppcheck_style.log\n+cat cppcheck.log | grep \"(portability)\" > cppcheck_portability.log\n+cat cppcheck.log | grep \"(information)\" > cppcheck_information.log\n+cat cppcheck.log | grep \"(unusedFunction)\" > cppcheck_unusedFunction.log\n+cat cppcheck.log | grep \"(missingInclude)\" > cppcheck_missingInclude.log\n+\n+COUNT=$(wc -l < cppcheck_error.log )\n+\n+if [ $COUNT -gt 0 ]; then\n+ echo \"Error count is $COUNT! cppcheck run failed :-(.\";\n+ exit 1;\n+else\n+ echo \"Error count is $COUNT... Ok :-).\"\n+fi\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a static analysis with cppcheck in the CI.
|
8,490 |
10.01.2018 16:00:49
| -3,600 |
ea3e43bb38696e1c1892b9ad376e2dec03ababa1
|
Update cppcheck CI.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -15,7 +15,7 @@ analyse-cppcheck:\nname: analyse-cppcheck-logs\npaths:\n- cppcheck.log\n- - cppcheck_error.log\n+# - cppcheck_error.log\n- cppcheck_warning.log\n- cppcheck_performance.log\n- cppcheck_style.log\n"
},
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "find .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\ncppcheck --force --enable=all --std=c++11 --file-list=src_files.txt 2> cppcheck.log\n-cat cppcheck.log | grep \"(error)\" > cppcheck_error.log\n+#cat cppcheck.log | grep \"(error)\" > cppcheck_error.log\ncat cppcheck.log | grep \"(warning)\" > cppcheck_warning.log\ncat cppcheck.log | grep \"(performance)\" > cppcheck_performance.log\ncat cppcheck.log | grep \"(style)\" > cppcheck_style.log\n@@ -15,7 +15,10 @@ COUNT=$(wc -l < cppcheck_error.log )\nif [ $COUNT -gt 0 ]; then\necho \"Error count is $COUNT! cppcheck run failed :-(.\";\n+ echo \"\"\n+ echo \"Errors list:\"\n+ cat cppcheck_error.log\nexit 1;\nelse\n- echo \"Error count is $COUNT... Ok :-).\"\n+ echo \"There is no error :-).\"\nfi\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update cppcheck CI.
|
8,490 |
10.01.2018 16:49:21
| -3,600 |
1f9da9a0f9bb8476b1640d01cfc9c3d0eb46c4a7
|
Remove blocking cppcheck.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -15,7 +15,7 @@ analyse-cppcheck:\nname: analyse-cppcheck-logs\npaths:\n- cppcheck.log\n-# - cppcheck_error.log\n+ - cppcheck_error.log\n- cppcheck_warning.log\n- cppcheck_performance.log\n- cppcheck_style.log\n"
},
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "@@ -11,14 +11,14 @@ cat cppcheck.log | grep \"(information)\" > cppcheck_information.log\ncat cppcheck.log | grep \"(unusedFunction)\" > cppcheck_unusedFunction.log\ncat cppcheck.log | grep \"(missingInclude)\" > cppcheck_missingInclude.log\n-COUNT=$(wc -l < cppcheck_error.log )\n-\n-if [ $COUNT -gt 0 ]; then\n- echo \"Error count is $COUNT! cppcheck run failed :-(.\";\n- echo \"\"\n- echo \"Errors list:\"\n- cat cppcheck_error.log\n- exit 1;\n-else\n- echo \"There is no error :-).\"\n-fi\n\\ No newline at end of file\n+#COUNT=$(wc -l < cppcheck_error.log )\n+#\n+#if [ $COUNT -gt 0 ]; then\n+# echo \"Error count is $COUNT! cppcheck run failed :-(.\";\n+# echo \"\"\n+# echo \"Errors list:\"\n+# cat cppcheck_error.log\n+# exit 1;\n+#else\n+# echo \"There is no error :-).\"\n+#fi\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/system_functions.cpp",
"new_path": "src/Tools/system_functions.cpp",
"diff": "@@ -82,7 +82,7 @@ std::string aff3ct::tools::get_back_trace(int first_call)\nstd::string aff3ct::tools::runSystemCommand(std::string cmd)\n{\nstd::string data;\n- FILE * stream;\n+ FILE * stream = nullptr;\nconst int max_buffer = 256;\nchar buffer[max_buffer];\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove blocking cppcheck.
|
8,490 |
10.01.2018 16:58:14
| -3,600 |
a6dbe654775ab2d3cd6b2a0afa6559f63bb57bb4
|
Rename cppcheck.log in cppcheck_all.log.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -14,7 +14,7 @@ analyse-cppcheck:\nartifacts:\nname: analyse-cppcheck-logs\npaths:\n- - cppcheck.log\n+ - cppcheck_all.log\n- cppcheck_error.log\n- cppcheck_warning.log\n- cppcheck_performance.log\n"
},
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "#!/bin/bash\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n-cppcheck --force --enable=all --std=c++11 --file-list=src_files.txt 2> cppcheck.log\n-cat cppcheck.log | grep \"(error)\" > cppcheck_error.log\n-cat cppcheck.log | grep \"(warning)\" > cppcheck_warning.log\n-cat cppcheck.log | grep \"(performance)\" > cppcheck_performance.log\n-cat cppcheck.log | grep \"(style)\" > cppcheck_style.log\n-cat cppcheck.log | grep \"(portability)\" > cppcheck_portability.log\n-cat cppcheck.log | grep \"(information)\" > cppcheck_information.log\n-cat cppcheck.log | grep \"(unusedFunction)\" > cppcheck_unusedFunction.log\n-cat cppcheck.log | grep \"(missingInclude)\" > cppcheck_missingInclude.log\n+cppcheck --force --enable=all --std=c++11 --file-list=src_files.txt 2> cppcheck_all.log\n+cat cppcheck_all.log | grep \"(error)\" > cppcheck_error.log\n+cat cppcheck_all.log | grep \"(warning)\" > cppcheck_warning.log\n+cat cppcheck_all.log | grep \"(performance)\" > cppcheck_performance.log\n+cat cppcheck_all.log | grep \"(style)\" > cppcheck_style.log\n+cat cppcheck_all.log | grep \"(portability)\" > cppcheck_portability.log\n+cat cppcheck_all.log | grep \"(information)\" > cppcheck_information.log\n+cat cppcheck_all.log | grep \"(unusedFunction)\" > cppcheck_unusedFunction.log\n+cat cppcheck_all.log | grep \"(missingInclude)\" > cppcheck_missingInclude.log\n#COUNT=$(wc -l < cppcheck_error.log )\n#\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rename cppcheck.log in cppcheck_all.log.
|
8,490 |
10.01.2018 17:17:31
| -3,600 |
22578dcabaa6df214928df9d25dbe3023f6654c5
|
Add CI compilation test for MacOSX (AppleClang).
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -62,7 +62,7 @@ build-windows-gcc:\n- set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n- mkdir build\n- cd build\n- - cmake .. -G\"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - cmake .. -G\"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -Wno-misleading-indentation -funroll-loops -march=native -DMULTI_PREC\"\n- mingw32-make\n- cd bin\n- aff3ct.exe --version\n@@ -85,3 +85,15 @@ build-windows-msvc:\n- cd bin\\Release\n- aff3ct.exe --version\n- aff3ct.exe -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+\n+build-mac-osx-clang:\n+ stage: build\n+ tags:\n+ - build-mac-osx\n+ script:\n+ - mkdir build\n+ - cd build\n+ - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - make\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"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add CI compilation test for MacOSX (AppleClang).
|
8,490 |
10.01.2018 17:59:50
| -3,600 |
64138f1d6002f4090f8404fcf8344177af80057a
|
CI change tags.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -24,14 +24,14 @@ analyse-cppcheck:\n- cppcheck_unusedFunction.log\n- cppcheck_missingInclude.log\ntags:\n- - build-linux\n+ - cppcheck\nscript:\n- ./ci/cppcheck.sh\nbuild-linux-gcc:\nstage: build\ntags:\n- - build-linux\n+ - linux\nscript:\n- mkdir build\n- cd build\n@@ -43,7 +43,7 @@ build-linux-gcc:\nbuild-linux-clang:\nstage: build\ntags:\n- - build-linux\n+ - linux\nscript:\n- mkdir build\n- cd build\n@@ -55,7 +55,7 @@ build-linux-clang:\nbuild-windows-gcc:\nstage: build\ntags:\n- - build-windows\n+ - windows\nscript:\n- set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n- set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n@@ -71,7 +71,7 @@ build-windows-gcc:\nbuild-windows-msvc:\nstage: build\ntags:\n- - build-windows\n+ - windows\nscript:\n- set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n- set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n@@ -89,7 +89,7 @@ build-windows-msvc:\nbuild-mac-osx-clang:\nstage: build\ntags:\n- - build-mac-osx\n+ - mac-osx\nscript:\n- mkdir build\n- cd build\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
CI change tags.
|
8,490 |
10.01.2018 19:53:07
| -3,600 |
a919031b8291bf94dcdb334e830d84021027df37
|
Add the ability to reorder the LDPC CNs of the H matrix at runtime.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Factory/Module/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -86,6 +86,7 @@ void Codec_LDPC::parameters\nauto pdec = dec->get_prefix();\nopt_args.erase({penc+\"-h-path\" });\n+ opt_args.erase({penc+\"-h-reorder\" });\nreq_args.erase({pdec+\"-cw-size\", \"N\" });\nreq_args.erase({pdec+\"-info-bits\", \"K\" });\nopt_args.erase({pdec+\"-fra\", \"F\" });\n@@ -125,6 +126,7 @@ void Codec_LDPC::parameters\ndec->store(vals);\nthis->enc->H_path = this->dec->H_path;\n+ this->enc->H_reorder = this->dec->H_reorder;\nthis->K = this->enc->K;\nthis->N_cw = this->enc->N_cw;\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": "@@ -49,6 +49,12 @@ void Decoder_LDPC::parameters\n{\"string\",\n\"path to the H matrix (AList or QC formated file).\"};\n+ opt_args[{p+\"-h-reorder\"}] =\n+ {\"string\",\n+ \"specify if the check nodes (CNs) from H have to be reordered, 'NONE': do nothing (default), 'ASC': from the \"\n+ \"smallest to the biggest CNs, 'DSC': from the biggest to the smallest CNs.\",\n+ \"NONE, ASC, DSC\"};\n+\nopt_args[{p+\"-min\"}] =\n{\"string\",\n\"the MIN implementation for the nodes (AMS decoder).\",\n@@ -92,6 +98,7 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\nif(exist(vals, {p+\"-h-path\" })) this->H_path = vals.at({p+\"-h-path\" });\n+ if(exist(vals, {p+\"-h-reorder\" })) this->H_reorder = vals.at({p+\"-h-reorder\" });\nif(exist(vals, {p+\"-min\" })) this->min = vals.at({p+\"-min\" });\nif(exist(vals, {p+\"-ite\", \"i\"})) this->n_ite = std::stoi(vals.at({p+\"-ite\", \"i\"}));\nif(exist(vals, {p+\"-off\" })) this->offset = std::stof(vals.at({p+\"-off\" }));\n@@ -109,7 +116,10 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\nif (!this->H_path.empty())\n+ {\nheaders[p].push_back(std::make_pair(\"H matrix path\", this->H_path));\n+ headers[p].push_back(std::make_pair(\"H matrix reordering\", this->H_reorder));\n+ }\nif (!this->simd_strategy.empty())\nheaders[p].push_back(std::make_pair(\"SIMD strategy\", this->simd_strategy));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp",
"new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp",
"diff": "@@ -27,6 +27,7 @@ struct Decoder_LDPC : public Decoder\nstd::string H_path;\n// optional parameters\n+ std::string H_reorder = \"NONE\";\nstd::string min = \"MINL\";\nstd::string simd_strategy = \"\";\nfloat norm_factor = 1.f;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "@@ -47,6 +47,12 @@ void Encoder_LDPC::parameters\nopt_args[{p+\"-g-path\"}] =\n{\"string\",\n\"path to the G matrix (AList formated file, required by the \\\"LDPC\\\" encoder).\"};\n+\n+ opt_args[{p+\"-h-reorder\"}] =\n+ {\"string\",\n+ \"specify if the check nodes (CNs) from H have to be reordered, 'NONE': do nothing (default), 'ASC': from the \"\n+ \"smallest to the biggest CNs, 'DSC': from the biggest to the smallest CNs.\",\n+ \"NONE, ASC, DSC\"};\n}\nvoid Encoder_LDPC::parameters\n@@ -58,6 +64,7 @@ void Encoder_LDPC::parameters\nif(exist(vals, {p+\"-h-path\" })) this->H_path = vals.at({p+\"-h-path\" });\nif(exist(vals, {p+\"-g-path\" })) this->G_path = vals.at({p+\"-g-path\" });\n+ if(exist(vals, {p+\"-h-reorder\"})) this->H_reorder = vals.at({p+\"-h-reorder\"});\n}\nvoid Encoder_LDPC::parameters\n@@ -70,7 +77,10 @@ void Encoder_LDPC::parameters\nif (this->type == \"LDPC\")\nheaders[p].push_back(std::make_pair(\"G matrix path\", this->G_path));\nif (this->type == \"LDPC_H\" || this->type == \"LDPC_QC\")\n+ {\nheaders[p].push_back(std::make_pair(\"H matrix path\", this->H_path));\n+ headers[p].push_back(std::make_pair(\"H matrix reordering\", this->H_reorder));\n+ }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"new_path": "src/Factory/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"diff": "@@ -25,6 +25,9 @@ struct Encoder_LDPC : public Encoder\nstd::string H_path = \"\";\nstd::string G_path = \"\";\n+ // optional parameters\n+ std::string H_reorder = \"NONE\";\n+\n// ---------------------------------------------------------------------------------------------------- METHODS\nparameters(const std::string p = Encoder_LDPC::prefix);\nvirtual ~parameters();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -154,6 +154,12 @@ Codec_LDPC<B,Q>\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+ if (dec_params.H_reorder != \"NONE\")\n+ {\n+ // reorder the H matrix following the check node degrees\n+ H.sort_cols_per_density(dec_params.H_reorder);\n+ }\n+\nif (!is_info_bits_pos)\n{\nif (enc_params.type == \"LDPC_H\")\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"new_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"diff": "#include <sstream>\n#include <vector>\n#include <algorithm>\n-#include <sstream>\n#include \"Tools/Exception/exception.hpp\"\n@@ -163,3 +162,31 @@ float Sparse_matrix\n{\nreturn ((float)n_connections / (float)(n_rows * n_cols));\n}\n+\n+void Sparse_matrix\n+::sort_cols_per_density(std::string order)\n+{\n+ if (order != \"ASC\" && order != \"DSC\")\n+ {\n+ std::stringstream message;\n+ message << \"'order' is unsupported, it sould be 'ASC' or 'DSC' ('order' = \" << order << \").\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (order == \"ASC\")\n+ {\n+ std::sort(this->col_to_rows.begin(), this->col_to_rows.end(),\n+ [](std::vector<unsigned> &i1, std::vector<unsigned> &i2) { return i1.size() < i2.size(); });\n+ }\n+ else // order == \"DSC\"\n+ {\n+ std::sort(this->col_to_rows.begin(), this->col_to_rows.end(),\n+ [](std::vector<unsigned> &i1, std::vector<unsigned> &i2) { return i1.size() > i2.size(); });\n+ }\n+\n+ for (auto &r : this->row_to_cols)\n+ r.clear();\n+ for (size_t i = 0; i < this->col_to_rows.size(); i++)\n+ for (size_t j = 0; j < i; j++)\n+ this->row_to_cols[this->col_to_rows[i][j]].push_back(i);\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.hpp",
"new_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.hpp",
"diff": "#define SPARSE_MATRIX_HPP_\n#include <vector>\n+#include <string>\nnamespace aff3ct\n{\n@@ -55,6 +56,12 @@ public:\n* Return the density of ones in this matrix\n*/\nfloat compute_density() const;\n+\n+ /*\n+ * Sort the sparse matrix per density of lines\n+ * The \"order\" parameter can be \"ASC\" for ascending or \"DSC\" for descending\n+ */\n+ void sort_cols_per_density(std::string order = \"DSC\");\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ability to reorder the LDPC CNs of the H matrix at runtime.
|
8,490 |
11.01.2018 13:38:47
| -3,600 |
5dafb3f62cbc49a6088bc8b9de8702dfa5cd2142
|
Fix a segfault introduced in the prev. commit (in Sparse_matrix).
|
[
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "@@ -11,6 +11,7 @@ cat cppcheck_all.log | grep \"(information)\" > cppcheck_information.log\ncat cppcheck_all.log | grep \"(unusedFunction)\" > cppcheck_unusedFunction.log\ncat cppcheck_all.log | grep \"(missingInclude)\" > cppcheck_missingInclude.log\n+## Uncomment this block if you want a failure when there is errors\n#COUNT=$(wc -l < cppcheck_error.log )\n#\n#if [ $COUNT -gt 0 ]; then\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"new_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"diff": "@@ -187,6 +187,6 @@ void Sparse_matrix\nfor (auto &r : this->row_to_cols)\nr.clear();\nfor (size_t i = 0; i < this->col_to_rows.size(); i++)\n- for (size_t j = 0; j < i; j++)\n+ for (size_t j = 0; j < this->col_to_rows[i].size(); j++)\nthis->row_to_cols[this->col_to_rows[i][j]].push_back(i);\n}\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a segfault introduced in the prev. commit (in Sparse_matrix).
|
8,483 |
11.01.2018 16:10:04
| -3,600 |
dcfcea3ac68570c5ffae57972c8d418a3ad7b058
|
Add using namespace aff3ct in those two files
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Codec/Codec.cpp",
"new_path": "src/Factory/Module/Codec/Codec.cpp",
"diff": "#include \"Codec.hpp\"\n+using namespace aff3ct;\nusing namespace aff3ct::factory;\nconst std::string aff3ct::factory::Codec::name = \"Codec\";\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Decoder.cpp",
"new_path": "src/Factory/Module/Decoder/Decoder.cpp",
"diff": "#include \"Decoder.hpp\"\n+using namespace aff3ct;\nusing namespace aff3ct::factory;\nconst std::string aff3ct::factory::Decoder::name = \"Decoder\";\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add using namespace aff3ct in those two files
|
8,490 |
11.01.2018 16:43:14
| -3,600 |
c49f127bea4dcc4b9adf9a2d68439d046f46ed7c
|
Fix a compilation error with gcc-4.8 and add a CI test for this legacy compiler.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -52,6 +52,18 @@ build-linux-clang:\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+build-linux-gcc-4.8:\n+ stage: build\n+ tags:\n+ - linux\n+ script:\n+ - mkdir build\n+ - cd build\n+ - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+ - make\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+\nbuild-windows-gcc:\nstage: build\ntags:\n"
},
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "#!/bin/bash\n+set -x\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\ncppcheck --force --enable=all --std=c++11 --file-list=src_files.txt 2> cppcheck_all.log\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"new_path": "src/Tools/Algo/Sparse_matrix/Sparse_matrix.cpp",
"diff": "@@ -176,12 +176,12 @@ void Sparse_matrix\nif (order == \"ASC\")\n{\nstd::sort(this->col_to_rows.begin(), this->col_to_rows.end(),\n- [](std::vector<unsigned> &i1, std::vector<unsigned> &i2) { return i1.size() < i2.size(); });\n+ [](const std::vector<unsigned> &i1, const std::vector<unsigned> &i2) { return i1.size() < i2.size(); });\n}\nelse // order == \"DSC\"\n{\nstd::sort(this->col_to_rows.begin(), this->col_to_rows.end(),\n- [](std::vector<unsigned> &i1, std::vector<unsigned> &i2) { return i1.size() > i2.size(); });\n+ [](const std::vector<unsigned> &i1, const std::vector<unsigned> &i2) { return i1.size() > i2.size(); });\n}\nfor (auto &r : this->row_to_cols)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a compilation error with gcc-4.8 and add a CI test for this legacy compiler.
|
8,490 |
11.01.2018 18:09:32
| -3,600 |
d956a7bc578d04458bec491289daa5f20e4b171d
|
Enable multi-core compilation on Linux.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -36,7 +36,9 @@ build-linux-gcc:\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 -DMULTI_PREC\"\n- - make\n+ - THREADS=$(grep -c ^processor /proc/cpuinfo)\n+ - echo $THREADS\n+ - make -j $THREADS\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@@ -48,7 +50,9 @@ build-linux-clang:\n- mkdir build\n- cd build\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- - make\n+ - THREADS=$(grep -c ^processor /proc/cpuinfo)\n+ - echo $THREADS\n+ - make -j $THREADS\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@@ -60,7 +64,9 @@ build-linux-gcc-4.8:\n- mkdir build\n- cd build\n- cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- - make\n+ - THREADS=$(grep -c ^processor /proc/cpuinfo)\n+ - echo $THREADS\n+ - make -j $THREADS\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"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Enable multi-core compilation on Linux.
|
8,483 |
12.01.2018 08:30:23
| -3,600 |
f9726c34cd27c047f28375cdd5dbf25e96a12909
|
Add a star to the clone pointers.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Container/List.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Container/List.hpp",
"diff": "@@ -39,7 +39,7 @@ public:\nvirtual List_type<T, S, Ranges...>* clone() const\n{\n- auto clone = new List_type<T, S, Ranges...>(val_type);\n+ auto* clone = new List_type<T, S, Ranges...>(val_type);\nclone->val_type = val_type->clone();\n@@ -50,11 +50,11 @@ public:\nInteger_type<T, S, Ranges..., NewRanges...>*\nclone(NewRanges*... new_ranges)\n{\n- auto clone = new List_type<T, S, Ranges..., NewRanges...>(val_type);\n+ auto* clone = new List_type<T, S, Ranges..., NewRanges...>(val_type);\nthis->clone_ranges(clone);\n- clone->template add_ranges(new_ranges...);\n+ clone->add_ranges(new_ranges...);\nreturn clone;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Container/Text.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Container/Text.hpp",
"diff": "@@ -29,7 +29,7 @@ public:\nvirtual Text_type<T,Ranges...>* clone() const\n{\n- auto clone = new Text_type<T,Ranges...>();\n+ auto* clone = new Text_type<T,Ranges...>();\nreturn dynamic_cast<Text_type<T,Ranges...>*>(this->clone_ranges(clone));\n}\n@@ -38,11 +38,11 @@ public:\nText_type<T, Ranges..., NewRanges...>*\nclone(NewRanges*... new_ranges)\n{\n- auto clone = new Text_type<T, Ranges..., NewRanges...>();\n+ auto* clone = new Text_type<T, Ranges..., NewRanges...>();\nthis->clone_ranges(clone);\n- clone->template add_ranges(new_ranges...);\n+ clone->add_ranges(new_ranges...);\nreturn clone;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/File_system/File_system.hpp",
"new_path": "src/Tools/Arguments/Argument_type/File_system/File_system.hpp",
"diff": "@@ -57,7 +57,7 @@ public:\nvirtual File_system_type<T, Read_F, Write_F, RW_F, Ranges...>* clone() const\n{\n- auto clone = new File_system_type<T, Read_F, Write_F, RW_F, Ranges...>(name, mode);\n+ auto* clone = new File_system_type<T, Read_F, Write_F, RW_F, Ranges...>(name, mode);\nreturn dynamic_cast<File_system_type<T, Read_F, Write_F, RW_F, Ranges...>*>(this->clone_ranges(clone));\n}\n@@ -65,11 +65,11 @@ public:\ntemplate <typename... NewRanges>\nFile_system_type<T, Read_F, Write_F, RW_F, Ranges..., NewRanges...>* clone(NewRanges*... new_ranges)\n{\n- auto clone = new File_system_type<T, Read_F, Write_F, RW_F, Ranges..., NewRanges...>(name, mode);\n+ auto* clone = new File_system_type<T, Read_F, Write_F, RW_F, Ranges..., NewRanges...>(name, mode);\nthis->clone_ranges(clone);\n- clone->template add_ranges(new_ranges...);\n+ clone->add_ranges(new_ranges...);\nreturn clone;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Number/Integer.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Number/Integer.hpp",
"diff": "@@ -29,7 +29,7 @@ public:\nvirtual Integer_type<T,Ranges...>* clone() const\n{\n- auto clone = new Integer_type<T,Ranges...>();\n+ auto* clone = new Integer_type<T,Ranges...>();\nreturn dynamic_cast<Integer_type<T,Ranges...>*>(this->clone_ranges(clone));\n}\n@@ -38,11 +38,11 @@ public:\nInteger_type<T, Ranges..., NewRanges...>*\nclone(NewRanges*... new_ranges)\n{\n- auto clone = new Integer_type<T, Ranges..., NewRanges...>();\n+ auto* clone = new Integer_type<T, Ranges..., NewRanges...>();\nthis->clone_ranges(clone);\n- clone->template add_ranges(new_ranges...);\n+ clone->add_ranges(new_ranges...);\nreturn clone;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Number/Real.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Number/Real.hpp",
"diff": "@@ -28,7 +28,7 @@ public:\nvirtual Real_type<T,Ranges...>* clone() const\n{\n- auto clone = new Real_type<T,Ranges...>();\n+ auto* clone = new Real_type<T,Ranges...>();\nreturn dynamic_cast<Real_type<T,Ranges...>*>(this->clone_ranges(clone));\n}\n@@ -37,11 +37,11 @@ public:\nReal_type<T, Ranges..., NewRanges...>*\nclone(NewRanges*... new_ranges)\n{\n- auto clone = new Real_type<T, Ranges..., NewRanges...>();\n+ auto* clone = new Real_type<T, Ranges..., NewRanges...>();\nthis->clone_ranges(clone);\n- clone->template add_ranges(new_ranges...);\n+ clone->add_ranges(new_ranges...);\nreturn clone;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a star to the clone pointers.
|
8,490 |
12.01.2018 11:42:55
| -3,600 |
a6040aa7ca21fbfd2a1051a6aafbd8ebcf10d3fb
|
Add CI non-regression tests.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "stages:\n- analyse\n- build\n+ - test\nbefore_script:\n- hostname\n@@ -32,6 +33,9 @@ build-linux-gcc:\nstage: build\ntags:\n- linux\n+ cache:\n+ - paths:\n+ - build/\nscript:\n- mkdir build\n- cd build\n@@ -115,3 +119,18 @@ build-mac-osx-clang:\n- make\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+\n+test-regression:\n+ stage: test\n+ tags:\n+ - test\n+ cache:\n+ - paths:\n+ - build/\n+ artifacts:\n+ name: test-regression-results\n+ paths:\n+ - tests/results/\n+ script:\n+ - cd tests\n+ - ./tests.py --max-snr-time 5 --sensibility 1.5\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/refs",
"new_path": "tests/refs",
"diff": "-Subproject commit 0d7fbbceadf0dd70f503700906837822cf61fa61\n+Subproject commit 052153566e6b2c3751e296dcae5a2806f791ef82\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add CI non-regression tests.
|
8,490 |
12.01.2018 11:56:37
| -3,600 |
103d59e792747929f1fca15281cfcc6a1661e8b8
|
CI: rm cache for now.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -33,9 +33,6 @@ build-linux-gcc:\nstage: build\ntags:\n- linux\n- cache:\n- - paths:\n- - build/\nscript:\n- mkdir build\n- cd build\n@@ -124,13 +121,16 @@ test-regression:\nstage: test\ntags:\n- test\n- cache:\n- - paths:\n- - build/\nartifacts:\nname: test-regression-results\npaths:\n- tests/results/\nscript:\n- - cd tests\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 -DMULTI_PREC -DENABLE_COOL_BASH\"\n+ - THREADS=$(grep -c ^processor /proc/cpuinfo)\n+ - echo $THREADS\n+ - make -j $THREADS\n+ - cd ../tests\n- ./tests.py --max-snr-time 5 --sensibility 1.5\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
CI: rm cache for now.
|
8,490 |
12.01.2018 14:18:31
| -3,600 |
0cf923a12cad46f0e10dcb638c82d63e8995c7b6
|
Improve the Python tests script.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -133,4 +133,4 @@ test-regression:\n- echo $THREADS\n- make -j $THREADS\n- cd ../tests\n- - ./tests.py --max-snr-time 5 --sensibility 1.5\n\\ No newline at end of file\n+ - ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 1\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/tests.py",
"new_path": "tests/tests.py",
"diff": "-#!/usr/bin/python3\n+#!/usr/bin/env python3\n# =============================================================================\n# ==================================================================== PACKAGES\n@@ -82,7 +82,9 @@ print('#')\nPathOrigin = os.getcwd()\n# get the filenames to test\n+isFile = False\nfileNames = []\n+if os.path.isdir(args.refsPath):\nfileNamesTmp = os.listdir(args.refsPath)\nfor f in fileNamesTmp:\nif not os.path.isdir(args.refsPath + \"/\" + f):\n@@ -90,6 +92,12 @@ for f in fileNamesTmp:\nelse:\nif args.recursiveScan:\nrecursivelyGetFilenames(args.refsPath + \"/\" + f, fileNames)\n+else:\n+ isFile = True\n+ basename = os.path.basename(args.refsPath)\n+ dirname = args.refsPath.replace(basename, '')\n+ args.refsPath = dirname\n+ fileNames.append(basename)\nprint(\"# Starting the test script...\")\n@@ -164,7 +172,6 @@ for fn in fileNames:\ndel argsAFFECT[idx]\n-\nargsAFFECT.append(\"--ter-freq\")\nargsAFFECT.append(\"0\")\nif args.maxFE:\n@@ -213,6 +220,11 @@ for fn in fileNames:\nvalid = 0;\nidx = 0\nfor ref in simuRef:\n+ cur_fe = int(simuCur[idx][4])\n+\n+ if cur_fe < args.maxFE / 2:\n+ break\n+\nnumRef = float(ref[6][0:4])\npowerRef = int(ref[6][6:8])\ntry:\n@@ -234,8 +246,6 @@ for fn in fileNames:\nvalid = valid + 1\nfRes.write(outputAFFECTLines[idx] + \"\\n\")\n- cur_fe = int(simuCur[idx][4])\n-\nidx = idx + 1\nif cur_fe < args.maxFE:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the Python tests script.
|
8,490 |
12.01.2018 16:03:58
| -3,600 |
fed8aaee9f0baaa6c4a6602f609a28ee8f21a738
|
Always upload artifacts in CI.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -14,6 +14,7 @@ analyse-cppcheck:\nstage: analyse\nartifacts:\nname: analyse-cppcheck-logs\n+ when: always\npaths:\n- cppcheck_all.log\n- cppcheck_error.log\n@@ -123,6 +124,7 @@ test-regression:\n- test\nartifacts:\nname: test-regression-results\n+ when: always\npaths:\n- tests/results/\nscript:\n@@ -133,4 +135,4 @@ test-regression:\n- echo $THREADS\n- make -j $THREADS\n- cd ../tests\n- - ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 1\n\\ No newline at end of file\n+ - ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 0.9\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Always upload artifacts in CI.
|
8,490 |
13.01.2018 00:20:59
| -3,600 |
e7a0590b9d1c46418a67a909d9199fdc760a4b49
|
Skip the _MSC_VER macro.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "set -x\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n-cppcheck --force --enable=all --std=c++11 --file-list=src_files.txt 2> cppcheck_all.log\n+cppcheck --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck_all.log\ncat cppcheck_all.log | grep \"(error)\" > cppcheck_error.log\ncat cppcheck_all.log | grep \"(warning)\" > cppcheck_warning.log\ncat cppcheck_all.log | grep \"(performance)\" > cppcheck_performance.log\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Skip the _MSC_VER macro.
|
8,490 |
13.01.2018 23:10:47
| -3,600 |
6604a0eee3567a3dbf04d91aae4b2986ec7b67ee
|
Apply style cppcheck tips.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "@@ -39,7 +39,7 @@ template <typename B, typename R>\nvoid Decoder_BCH<B, R>\n::_decode(B *Y_N)\n{\n- int i, j, u, q, t2, count = 0, syn_error = 0;\n+ int i, j, t2, syn_error = 0;\nt2 = 2 * t;\n@@ -85,8 +85,8 @@ void Decoder_BCH<B, R>\nl[1] = 0;\nu_lu[0] = -1;\nu_lu[1] = 0;\n- u = 0;\n+ int q, u = 0;\ndo\n{\nu++;\n@@ -173,7 +173,7 @@ void Decoder_BCH<B, R>\n/* Chien search: find roots of the error location polynomial */\nfor (i = 1; i <= l[u]; i++)\nreg[i] = elp[u][i];\n- count = 0;\n+ int count = 0;\nfor (i = 1; i <= this->N; i++)\n{\nq = 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hxx",
"new_path": "src/Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hxx",
"diff": "@@ -254,7 +254,6 @@ struct RSC_BCJR_inter_intra_normalize <signed char, I>\nstatic mipp::Reg<signed char> apply(const mipp::Reg<signed char> &r_metrics, const mipp::Reg<signed char> &r_cmask_norm, const int &i = 0)\n{\nreturn RSC_BCJR_inter_intra_normalize_core<signed char>::apply(r_metrics, r_cmask_norm);\n- return r_metrics;\n}\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Module.hpp",
"new_path": "src/Module/Module.hpp",
"diff": "@@ -87,7 +87,7 @@ public:\nreturn n_frames;\n}\n- inline void set_name(const std::string name)\n+ inline void set_name(const std::string &name)\n{\nthis->name = name;\n}\n@@ -97,7 +97,7 @@ public:\nreturn this->name;\n}\n- inline void set_short_name(const std::string short_name)\n+ inline void set_short_name(const std::string &short_name)\n{\nthis->short_name = short_name;\n}\n@@ -113,7 +113,7 @@ public:\n}\nprotected:\n- Task& create_task(const std::string name, const int id = -1)\n+ Task& create_task(const std::string &name, const int id = -1)\n{\nbool autoalloc = false, autoexec = false, stats = false, fast = false, debug = false;\nauto t = new Task(*this, name, autoalloc, autoexec, stats, fast, debug);\n@@ -145,19 +145,19 @@ protected:\n}\ntemplate <typename T>\n- Socket& create_socket_in(Task& task, const std::string name, const size_t n_elmts)\n+ Socket& create_socket_in(Task& task, const std::string &name, const size_t n_elmts)\n{\nreturn task.template create_socket_in<T>(name, n_elmts);\n}\ntemplate <typename T>\n- Socket& create_socket_in_out(Task& task, const std::string name, const size_t n_elmts)\n+ Socket& create_socket_in_out(Task& task, const std::string &name, const size_t n_elmts)\n{\nreturn task.template create_socket_in_out<T>(name, n_elmts);\n}\ntemplate <typename T>\n- Socket& create_socket_out(Task& task, const std::string name, const size_t n_elmts)\n+ Socket& create_socket_out(Task& task, const std::string &name, const size_t n_elmts)\n{\nreturn task.template create_socket_out<T>(name, n_elmts);\n}\n@@ -167,7 +167,7 @@ protected:\ntask.create_codelet(codelet);\n}\n- void register_timer(Task& task, const std::string key)\n+ void register_timer(Task& task, const std::string &key)\n{\ntask.register_timer(key);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Socket.hpp",
"new_path": "src/Module/Socket.hpp",
"diff": "@@ -40,7 +40,7 @@ protected:\nbool fast;\nvoid* dataptr;\n- Socket(Task &task, const std::string name, const std::type_index datatype, const size_t databytes,\n+ Socket(Task &task, const std::string &name, const std::type_index datatype, const size_t databytes,\nconst bool fast = false, void *dataptr = nullptr)\n: task(task), name(name), datatype(datatype), databytes(databytes), fast(fast), dataptr(dataptr)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Task.cpp",
"new_path": "src/Module/Task.cpp",
"diff": "using namespace aff3ct;\nusing namespace aff3ct::module;\n-Task::Task(const Module &module, const std::string name, const bool autoalloc, const bool autoexec,\n+Task::Task(const Module &module, const std::string &name, const bool autoalloc, const bool autoexec,\nconst bool stats, const bool fast, const bool debug)\n: module(module),\nname(name),\n@@ -258,7 +258,7 @@ int Task::exec()\n}\ntemplate <typename T>\n-Socket& Task::create_socket(const std::string name, const size_t n_elmts)\n+Socket& Task::create_socket(const std::string &name, const size_t n_elmts)\n{\nif (name.empty())\n{\n@@ -286,7 +286,7 @@ Socket& Task::create_socket(const std::string name, const size_t n_elmts)\n}\ntemplate <typename T>\n-Socket& Task::create_socket_in(const std::string name, const size_t n_elmts)\n+Socket& Task::create_socket_in(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n@@ -297,7 +297,7 @@ Socket& Task::create_socket_in(const std::string name, const size_t n_elmts)\n}\ntemplate <typename T>\n-Socket& Task::create_socket_in_out(const std::string name, const size_t n_elmts)\n+Socket& Task::create_socket_in_out(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n@@ -308,7 +308,7 @@ Socket& Task::create_socket_in_out(const std::string name, const size_t n_elmts)\n}\ntemplate <typename T>\n-Socket& Task::create_socket_out(const std::string name, const size_t n_elmts)\n+Socket& Task::create_socket_out(const std::string &name, const size_t n_elmts)\n{\nauto &s = create_socket<T>(name, n_elmts);\n@@ -394,7 +394,7 @@ Socket_type Task::get_socket_type(const Socket &s) const\nthrow tools::runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n-void Task::register_timer(const std::string name)\n+void Task::register_timer(const std::string &name)\n{\nthis->timers_name .push_back(name );\nthis->timers_n_calls.push_back(0 );\n@@ -417,25 +417,25 @@ void Task::reset_stats()\n}\n// ==================================================================================== explicit template instantiation\n-template Socket& Task::create_socket_in<int8_t >(const std::string, const size_t);\n-template Socket& Task::create_socket_in<int16_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_in<int32_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_in<int64_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_in<float >(const std::string, const size_t);\n-template Socket& Task::create_socket_in<double >(const std::string, const size_t);\n-\n-template Socket& Task::create_socket_in_out<int8_t >(const std::string, const size_t);\n-template Socket& Task::create_socket_in_out<int16_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_in_out<int32_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_in_out<int64_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_in_out<float >(const std::string, const size_t);\n-template Socket& Task::create_socket_in_out<double >(const std::string, const size_t);\n-\n-template Socket& Task::create_socket_out<int8_t >(const std::string, const size_t);\n-template Socket& Task::create_socket_out<int16_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_out<int32_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_out<int64_t>(const std::string, const size_t);\n-template Socket& Task::create_socket_out<float >(const std::string, const size_t);\n-template Socket& Task::create_socket_out<double >(const std::string, const size_t);\n+template Socket& Task::create_socket_in<int8_t >(const std::string&, const size_t);\n+template Socket& Task::create_socket_in<int16_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_in<int32_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_in<int64_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_in<float >(const std::string&, const size_t);\n+template Socket& Task::create_socket_in<double >(const std::string&, const size_t);\n+\n+template Socket& Task::create_socket_in_out<int8_t >(const std::string&, const size_t);\n+template Socket& Task::create_socket_in_out<int16_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_in_out<int32_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_in_out<int64_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_in_out<float >(const std::string&, const size_t);\n+template Socket& Task::create_socket_in_out<double >(const std::string&, const size_t);\n+\n+template Socket& Task::create_socket_out<int8_t >(const std::string&, const size_t);\n+template Socket& Task::create_socket_out<int16_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_out<int32_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_out<int64_t>(const std::string&, const size_t);\n+template Socket& Task::create_socket_out<float >(const std::string&, const size_t);\n+template Socket& Task::create_socket_out<double >(const std::string&, const size_t);\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Task.hpp",
"new_path": "src/Module/Task.hpp",
"diff": "@@ -66,7 +66,7 @@ public:\nstd::vector<Socket*> sockets;\nTask(const Module &module,\n- const std::string name,\n+ const std::string &name,\nconst bool autoalloc = false,\nconst bool autoexec = false,\nconst bool stats = false,\n@@ -136,22 +136,22 @@ public:\n}\nprotected:\n- void register_timer(const std::string key);\n+ void register_timer(const std::string &key);\ntemplate <typename T>\n- Socket& create_socket_in(const std::string name, const size_t n_elmts);\n+ Socket& create_socket_in(const std::string &name, const size_t n_elmts);\ntemplate <typename T>\n- Socket& create_socket_in_out(const std::string name, const size_t n_elmts);\n+ Socket& create_socket_in_out(const std::string &name, const size_t n_elmts);\ntemplate <typename T>\n- Socket& create_socket_out(const std::string name, const size_t n_elmts);\n+ Socket& create_socket_out(const std::string &name, const size_t n_elmts);\nvoid create_codelet(std::function<int(void)> codelet);\nprivate:\ntemplate <typename T>\n- inline Socket& create_socket(const std::string name, const size_t n_elmts);\n+ inline Socket& create_socket(const std::string &name, const size_t n_elmts);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"new_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"diff": "@@ -177,7 +177,7 @@ Sparse_matrix AList\nunsigned n_connections = 0;\nstream >> n_connections;\n- if (n_connections <= 0 || n_connections > rows_max_degree)\n+ if (n_connections == 0 || n_connections > rows_max_degree)\n{\nstd::stringstream message;\nmessage << \"'n_connections' has to be greater than 0 and smaller or equal to 'rows_max_degree' \"\n@@ -189,13 +189,13 @@ Sparse_matrix AList\nrows_degree[i] = n_connections;\n}\n- std::vector<unsigned> cols_degree(n_cols);\n+ // std::vector<unsigned> cols_degree(n_cols);\nfor (unsigned i = 0; i < n_cols; i++)\n{\nunsigned n_connections = 0;\nstream >> n_connections;\n- if (n_connections <= 0 || n_connections > cols_max_degree)\n+ if (n_connections == 0 || n_connections > cols_max_degree)\n{\nstd::stringstream message;\nmessage << \"'n_connections' has to be greater than 0 and smaller or equal to 'cols_max_degree' \"\n@@ -204,7 +204,7 @@ Sparse_matrix AList\nthrow runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n- cols_degree[i] = n_connections;\n+ // cols_degree[i] = n_connections;\n}\nfor (unsigned i = 0; i < n_rows; i++)\n@@ -216,7 +216,7 @@ Sparse_matrix AList\nstream >> col_index;\nif ((col_index > 0 && j < rows_degree[i]) ||\n- (col_index <= 0 && j >= rows_degree[i]))\n+ (col_index == 0 && j >= rows_degree[i]))\n{\nif (col_index)\nmatrix.add_connection(i, col_index -1);\n@@ -295,7 +295,7 @@ Sparse_matrix AList\nn_rows = std::stoi(values[0]);\nn_cols = std::stoi(values[1]);\n- if (n_rows <= 0 || n_cols <= 0)\n+ if (n_rows == 0 || n_cols == 0)\n{\nstd::stringstream message;\nmessage << \"'n_rows' and 'n_cols' have to be greater than 0 ('n_rows' = \" << n_rows\n@@ -317,7 +317,7 @@ Sparse_matrix AList\nrows_max_degree = std::stoi(values[0]);\ncols_max_degree = std::stoi(values[1]);\n- if (rows_max_degree <= 0 || cols_max_degree <= 0)\n+ if (rows_max_degree == 0 || cols_max_degree == 0)\n{\nstd::stringstream message;\nmessage << \"'rows_max_degree' and 'cols_max_degree' have to be greater than 0 ('rows_max_degree' = \"\n@@ -360,19 +360,19 @@ Sparse_matrix AList\nthrow runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n- std::vector<unsigned> cols_degree(n_rows);\n+ // std::vector<unsigned> cols_degree(n_rows);\nfor (unsigned i = 0; i < n_cols; i++)\n{\nunsigned n_connections = std::stoi(values[i]);\n- if (n_connections > 0 && n_connections <= cols_max_degree)\n- cols_degree[i] = n_connections;\n- else\n+ if (!(n_connections > 0 && n_connections <= cols_max_degree))\n{\nstd::stringstream message;\nmessage << \"'n_connections' has to be greater than 0 and smaller than 'cols_max_degree' \"\n<< \"('n_connections' = \" << n_connections << \", 'cols_max_degree' = \" << cols_max_degree << \").\";\nthrow runtime_error(__FILE__, __LINE__, __func__, message.str());\n}\n+ // else\n+ // cols_degree[i] = n_connections;\n}\nfor (unsigned i = 0; i < n_rows; i++)\n@@ -471,7 +471,7 @@ Sparse_matrix AList\nn_cols = std::stoi(values[0]);\nn_rows = std::stoi(values[1]);\n- if (n_rows <= 0 || n_cols <= 0)\n+ if (n_rows == 0 || n_cols == 0)\n{\nstd::stringstream message;\nmessage << \"'n_rows' and 'n_cols' have to be greater than 0 ('n_rows' = \" << n_rows\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/QC/QC.cpp",
"new_path": "src/Tools/Code/LDPC/QC/QC.cpp",
"diff": "-#include \"../QC/QC.hpp\"\n-\n#include <string>\n#include <sstream>\n#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/general_utils.h\"\n+#include \"QC.hpp\"\nusing namespace aff3ct::tools;\n@@ -31,7 +30,7 @@ Sparse_matrix QC\nM_red = std::stoi(values[1]);\nZ = std::stoi(values[2]);\n- if (N_red <= 0 || M_red <= 0 || Z <= 0)\n+ if (N_red == 0 || M_red == 0 || Z == 0)\n{\nstd::stringstream message;\nmessage << \"'N_red', 'M_red' and 'Z' have to be greater than 0 ('N_red' = \" << N_red\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_TV.cpp",
"new_path": "src/Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_TV.cpp",
"diff": "@@ -62,16 +62,15 @@ void Frozenbits_generator_TV\nmutex_create_folder.lock();\nif ((dp = opendir(sub_folder.c_str())) == nullptr)\n{\n- int ret;\n// mkdir mod = rwx r.x r.x\n#ifdef _MSC_VER // Windows with MSVC\n- if ((ret = _mkdir(sub_folder.c_str())) != 0)\n+ if (_mkdir(sub_folder.c_str()) != 0)\n{\n#elif defined(_WIN32) // MinGW on Windows\n- if((ret = mkdir(sub_folder.c_str())) != 0)\n+ if (mkdir(sub_folder.c_str()) != 0)\n{\n#else // UNIX like\n- if ((ret = mkdir(sub_folder.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) != 0)\n+ if (mkdir(sub_folder.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0)\n{\n#endif\nmutex_create_folder.unlock();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/decoder_polar_functions.hxx",
"new_path": "src/Tools/Code/Polar/decoder_polar_functions.hxx",
"diff": "@@ -65,8 +65,8 @@ inline R f_LLR_tanh_safe(const R& lambda_a, const R& lambda_b)\n{\nauto abs_lambda_a_plus_lambda_b = (lambda_a + lambda_b >= 0) ? lambda_b + lambda_a : -(lambda_b + lambda_a);\nauto abs_lambda_a_minus_lambda_b = (lambda_a - lambda_b >= 0) ? lambda_a - lambda_b : -(lambda_a - lambda_b);\n- return le + std::log(1 + std::exp(-abs_lambda_a_plus_lambda_b)) -\n- std::log(1 + std::exp(-abs_lambda_a_minus_lambda_b));\n+ return le + std::log1p(std::exp(-abs_lambda_a_plus_lambda_b)) -\n+ std::log1p(std::exp(-abs_lambda_a_minus_lambda_b));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Statistics/Statistics.cpp",
"new_path": "src/Tools/Display/Statistics/Statistics.cpp",
"diff": "@@ -212,8 +212,6 @@ void Statistics\n});\n}\n- size_t ttask_n_elmts = 0;\n- uint32_t ttask_n_calls = 0;\nauto ttask_tot_duration = std::chrono::nanoseconds(0);\nauto ttask_min_duration = std::chrono::nanoseconds(0);\nauto ttask_max_duration = std::chrono::nanoseconds(0);\n@@ -230,6 +228,9 @@ void Statistics\n{\nStatistics::show_header(stream);\n+ size_t ttask_n_elmts = 0;\n+ uint32_t ttask_n_calls = 0;\n+\nauto is_first = true;\nfor (auto *t : tasks)\n{\n@@ -340,7 +341,6 @@ void Statistics\n});\n}\n- size_t ttask_n_elmts = 0;\nauto ttask_n_calls = 0;\nauto ttask_tot_duration = nanoseconds(0);\nauto ttask_min_duration = nanoseconds(0);\n@@ -359,6 +359,8 @@ void Statistics\n{\nStatistics::show_header(stream);\n+ size_t ttask_n_elmts = 0;\n+\nauto is_first = true;\nfor (auto &vt : tasks)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Interleaver/Interleaver_core.hpp",
"new_path": "src/Tools/Interleaver/Interleaver_core.hpp",
"diff": "@@ -34,7 +34,7 @@ public:\n* \\param n_frames: number of frames to process in the Interleaver.\n* \\param name: Interleaver's name.\n*/\n- Interleaver_core(const int size, const std::string name, const bool uniform = false, const int n_frames = 1)\n+ Interleaver_core(const int size, const std::string &name, const bool uniform = false, const int n_frames = 1)\n: size(size), name(name), n_frames(n_frames), uniform(uniform), initialized(false),\npi(size * n_frames, 0), pi_inv(size * n_frames, 0)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/system_functions.cpp",
"new_path": "src/Tools/system_functions.cpp",
"diff": "@@ -84,8 +84,6 @@ std::string aff3ct::tools::runSystemCommand(std::string cmd)\nstd::string data;\nFILE * stream = nullptr;\n- const int max_buffer = 256;\n- char buffer[max_buffer];\ncmd.append(\" 2>&1\");\n#if (defined(__GNUC__) || defined(__clang__) || defined(__llvm__)) && (defined(__linux__) || defined(__linux) || defined(__APPLE__))\n@@ -96,6 +94,8 @@ std::string aff3ct::tools::runSystemCommand(std::string cmd)\nif (stream)\n{\n+ const int max_buffer = 256;\n+ char buffer[max_buffer];\nwhile (!feof(stream))\nif (fgets(buffer, max_buffer, stream) != NULL)\ndata.append(buffer);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "@@ -126,9 +126,9 @@ int sc_main(int argc, char **argv)\nfactory::Launcher::parameters params(\"sim\");\nread_arguments(argc, (const char**)argv, params);\n- launcher::Launcher *launcher = nullptr;\ntry\n{\n+ launcher::Launcher *launcher = nullptr;\n#ifdef MULTI_PREC\nswitch (params.sim_prec)\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Apply style cppcheck tips.
|
8,490 |
14.01.2018 13:06:59
| -3,600 |
43118ba26cc2120c1e9ecefb64440800e02120fd
|
Improve the test script: add a verbose mode.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -135,4 +135,4 @@ test-regression:\n- echo $THREADS\n- make -j $THREADS\n- cd ../tests\n- - ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 0.9\n\\ No newline at end of file\n+ - ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 0.9 --verbose 1\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/tests.py",
"new_path": "tests/tests.py",
"diff": "@@ -29,6 +29,7 @@ parser.add_argument('--recursive-scan', action='store', dest='recursiveScan', ty\nparser.add_argument('--max-fe', action='store', dest='maxFE', type=int, default=100, help='Maximum number of frames errors to simulate per SNR point.') # choices=xrange(0, +inf)\nparser.add_argument('--weak-rate', action='store', dest='weakRate', type=float, default=0.8, help='Rate of valid SNR points to passed a test.') # choices=xrange(0.0, 1.0 )\nparser.add_argument('--max-snr-time', action='store', dest='maxSNRTime', type=int, default=600, help='The maximum amount of time to spend to compute a SNR point in seconds (0 = illimited)') # choices=xrange(0, +inf)\n+parser.add_argument('--verbose', action='store', dest='verbose', type=bool, default=False, help='Enable the verbose mode.')\n# ================================================================== PARAMETERS\n# =============================================================================\n@@ -77,6 +78,7 @@ print('# recursive scan =', args.recursiveScan)\nprint('# max fe =', args.maxFE )\nprint('# weak rate =', args.weakRate )\nprint('# max snr time =', args.maxSNRTime )\n+print('# verbose =', args.verbose )\nprint('#')\nPathOrigin = os.getcwd()\n@@ -217,8 +219,10 @@ for fn in fileNames:\nfRes.flush()\n# validate (or not) the BER/FER performance\n- valid = 0;\n+ valid = 0\nidx = 0\n+ sumSensibility = 0.0\n+ errorsList = []\nfor ref in simuRef:\ncur_fe = int(simuCur[idx][4])\n@@ -240,8 +244,10 @@ for fn in fileNames:\nnumRef = numRef * 10**(math.fabs(powerRef - powerCur))\nabsoluteNumDiff = math.fabs(numRef - numCur)\n+ sumSensibility = sumSensibility + absoluteNumDiff\nif absoluteNumDiff > args.sensibility:\nfRes.write(outputAFFECTLines[idx] + \"WRONG! FER=\" + ref[6][0:8] + \"\\n\")\n+ errorsList.append([float(simuCur[idx][1][0:4]), absoluteNumDiff])\nelse:\nvalid = valid + 1\nfRes.write(outputAFFECTLines[idx] + \"\\n\")\n@@ -251,6 +257,13 @@ for fn in fileNames:\nif cur_fe < args.maxFE:\nbreak\n+ avgSensibility = 0\n+ if idx == 0:\n+ avgSensibility = 0\n+ else:\n+ avgSensibility = sumSensibility / float(idx)\n+ rateSensibility = (avgSensibility / args.sensibility) * 100\n+\nif valid == idx:\nprint(\" - STRONG PASSED.\", end=\"\\n\");\nelif idx != 0 and float(valid) / float(idx) >= args.weakRate:\n@@ -259,6 +272,20 @@ for fn in fileNames:\nprint(\" - FAILED.\", end=\"\\n\");\nnErrors = nErrors +1\n+ if args.verbose:\n+ print(\"---- Details: 'valid SNR points' = \", valid, \"/\", idx, \", 'avg sensibility' = %.2f\" % avgSensibility , \", 'sensibility rate' = %.1f\" % rateSensibility, \"%.\", end=\"\\n\")\n+ if idx > 0:\n+ print(\"---- Details: 'first SNR point' = \", float(simuCur[0][1][0:4]), \"dB, 'last SNR point' = \", float(simuCur[idx -1][1][0:4]), \"dB.\")\n+ if len(errorsList):\n+ print(\"---- Details: 'errors list' = [\", end=\"\")\n+ el = 0\n+ for error in errorsList:\n+ print(\"{\", error[0], \"dB -> +-%.2f\" %error[1], \"}\", end=\"\")\n+ if el < len(errorsList) -1:\n+ print(\", \", end=\"\")\n+ el = el + 1\n+ print(\"].\", end=\"\\n\")\n+\nfRes.write(\"# End of the simulation.\\n\")\nfRes.close();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the test script: add a verbose mode.
|
8,490 |
14.01.2018 14:41:10
| -3,600 |
484bac9537d914104a6dbb46c16db0d293c3d0dc
|
Improve the Python test script.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/tests.py",
"new_path": "tests/tests.py",
"diff": "@@ -221,8 +221,8 @@ for fn in fileNames:\n# validate (or not) the BER/FER performance\nvalid = 0\nidx = 0\n- sumSensibility = 0.0\nerrorsList = []\n+ sensibilityList = []\nfor ref in simuRef:\ncur_fe = int(simuCur[idx][4])\n@@ -244,7 +244,7 @@ for fn in fileNames:\nnumRef = numRef * 10**(math.fabs(powerRef - powerCur))\nabsoluteNumDiff = math.fabs(numRef - numCur)\n- sumSensibility = sumSensibility + absoluteNumDiff\n+ sensibilityList.append(absoluteNumDiff)\nif absoluteNumDiff > args.sensibility:\nfRes.write(outputAFFECTLines[idx] + \"WRONG! FER=\" + ref[6][0:8] + \"\\n\")\nerrorsList.append([float(simuCur[idx][1][0:4]), absoluteNumDiff])\n@@ -257,13 +257,6 @@ for fn in fileNames:\nif cur_fe < args.maxFE:\nbreak\n- avgSensibility = 0\n- if idx == 0:\n- avgSensibility = 0\n- else:\n- avgSensibility = sumSensibility / float(idx)\n- rateSensibility = (avgSensibility / args.sensibility) * 100\n-\nif valid == idx:\nprint(\" - STRONG PASSED.\", end=\"\\n\");\nelif idx != 0 and float(valid) / float(idx) >= args.weakRate:\n@@ -273,9 +266,20 @@ for fn in fileNames:\nnErrors = nErrors +1\nif args.verbose:\n- print(\"---- Details: 'valid SNR points' = \", valid, \"/\", idx, \", 'avg sensibility' = %.2f\" % avgSensibility , \", 'sensibility rate' = %.1f\" % rateSensibility, \"%.\", end=\"\\n\")\n+ avgSensibility = 0\n+ minSensibility = 0\n+ maxSensibility = 0\n+ if idx == 0:\n+ avgSensibility = 0\n+ else:\n+ avgSensibility = sum(sensibilityList) / float(idx)\n+ minSensibility = min(sensibilityList)\n+ maxSensibility = max(sensibilityList)\n+ rateSensibility = (avgSensibility / args.sensibility) * 100\n+\n+ print(\"---- Details: 'valid SNR points' = \", valid, \"/\", idx, \", 'sensibility [avg,min,max,rate]' = [ %.2f\" %avgSensibility , \", %.2f\" %minSensibility, \", %.2f\" %maxSensibility, \", %.1f\" % rateSensibility, \"% ].\", end=\"\\n\")\nif idx > 0:\n- print(\"---- Details: 'first SNR point' = \", float(simuCur[0][1][0:4]), \"dB, 'last SNR point' = \", float(simuCur[idx -1][1][0:4]), \"dB.\")\n+ print(\"---- Details: 'first SNR point' =\", float(simuCur[0][1][0:4]), \"dB (@\", simuCur[0][6][0:8], \"FER), 'last SNR point' =\", float(simuCur[idx -1][1][0:4]), \"dB (@\", simuCur[idx -1][6][0:8], \"FER).\")\nif len(errorsList):\nprint(\"---- Details: 'errors list' = [\", end=\"\")\nel = 0\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the Python test script.
|
8,490 |
14.01.2018 20:34:07
| -3,600 |
8277bc9418d1616ce2b79e147c1d6cabf869e7c9
|
Improve the test script again.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/tests.py",
"new_path": "tests/tests.py",
"diff": "@@ -239,15 +239,15 @@ for fn in fileNames:\nif powerRef - powerCur != 0:\nif powerRef > powerCur:\n- numCur = numCur * 10**(math.fabs(powerRef - powerCur))\n+ numCur = numCur * 10**(math.fabs(powerCur - powerRef))\nelse:\n- numRef = numRef * 10**(math.fabs(powerRef - powerCur))\n+ numRef = numRef * 10**(math.fabs(powerCur - powerRef))\n- absoluteNumDiff = math.fabs(numRef - numCur)\n+ absoluteNumDiff = math.fabs(numCur - numRef)\nsensibilityList.append(absoluteNumDiff)\nif absoluteNumDiff > args.sensibility:\nfRes.write(outputAFFECTLines[idx] + \"WRONG! FER=\" + ref[6][0:8] + \"\\n\")\n- errorsList.append([float(simuCur[idx][1][0:4]), absoluteNumDiff])\n+ errorsList.append([float(simuCur[idx][1][0:4]), numCur - numRef])\nelse:\nvalid = valid + 1\nfRes.write(outputAFFECTLines[idx] + \"\\n\")\n@@ -284,7 +284,10 @@ for fn in fileNames:\nprint(\"---- Details: 'errors list' = [\", end=\"\")\nel = 0\nfor error in errorsList:\n- print(\"{\", error[0], \"dB -> +-%.2f\" %error[1], \"}\", end=\"\")\n+ if error[1] > 0:\n+ print(\"{\", error[0], \"dB -> +%.2f\" %error[1], \"}\", end=\"\")\n+ else:\n+ print(\"{\", error[0], \"dB -> %.2f\" %error[1], \"}\", end=\"\")\nif el < len(errorsList) -1:\nprint(\", \", end=\"\")\nel = el + 1\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the test script again.
|
8,490 |
15.01.2018 16:53:31
| -3,600 |
8a77379d4201fa453a1a2fd94782d1d38f93198e
|
Allow the cppcheck script to fail.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "@@ -3,7 +3,7 @@ set -x\n#cppcheck --suppress=missingIncludeSystem -I./src/ --force --enable=all --std=c++11 -U_MSC_VER ./src/ 2> cppcheck_all.log\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n-cppcheck --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck_all.log\n+cppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck_all.log\ncat cppcheck_all.log | grep \"(error)\" > cppcheck_error.log\ncat cppcheck_all.log | grep \"(warning)\" > cppcheck_warning.log\ncat cppcheck_all.log | grep \"(performance)\" > cppcheck_performance.log\n@@ -13,17 +13,17 @@ cat cppcheck_all.log | grep \"(information)\" > cppcheck_information.log\ncat cppcheck_all.log | grep \"(unusedFunction)\" > cppcheck_unusedFunction.log\ncat cppcheck_all.log | grep \"(missingInclude)\" > cppcheck_missingInclude.log\n-## Uncomment this block if you want a failure when there is errors\n-#COUNT=$(wc -l < cppcheck_error.log )\n-#\n-#if [ $COUNT -gt 0 ]; then\n-# echo \"Error count is $COUNT! cppcheck run failed :-(.\";\n-# echo \"\"\n-# echo \"Errors list:\"\n-# cat cppcheck_error.log\n-# exit 1;\n-#else\n-# echo \"There is no error :-).\"\n-#fi\n+# Uncomment this block if you want a failure when there is errors\n+COUNT=$(wc -l < cppcheck_error.log )\n+\n+if [ $COUNT -gt 5 ]; then\n+ echo \"Error count is $COUNT! cppcheck run failed :-(.\";\n+ echo \"\"\n+ echo \"Errors list:\"\n+ cat cppcheck_error.log\n+ exit 1;\n+else\n+ echo \"There is no error :-).\"\n+fi\nexit 0;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Allow the cppcheck script to fail.
|
8,490 |
15.01.2018 16:57:52
| -3,600 |
b78ba9d5b5182f3a38e6a33cc12aa1ca32a094e5
|
Print the cppcheck version.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/cppcheck.sh",
"new_path": "ci/cppcheck.sh",
"diff": "#!/bin/bash\nset -x\n+cppcheck --version\n+\n#cppcheck --suppress=missingIncludeSystem -I./src/ --force --enable=all --std=c++11 -U_MSC_VER ./src/ 2> cppcheck_all.log\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck_all.log\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Print the cppcheck version.
|
8,490 |
15.01.2018 20:24:55
| -3,600 |
e2cc21925797405ed2ea51903e40e4ba9dad84c4
|
Simplify the CI script a little bit.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -16,107 +16,53 @@ analyse-cppcheck:\nname: analyse-cppcheck-logs\nwhen: always\npaths:\n- - cppcheck_all.log\n- - cppcheck_error.log\n- - cppcheck_warning.log\n- - cppcheck_performance.log\n- - cppcheck_style.log\n- - cppcheck_portability.log\n- - cppcheck_information.log\n- - cppcheck_unusedFunction.log\n- - cppcheck_missingInclude.log\n+ - cppcheck/\ntags:\n- cppcheck\nscript:\n- - ./ci/cppcheck.sh\n+ - ./ci/analyse-cppcheck.sh\nbuild-linux-gcc:\nstage: build\ntags:\n- linux\nscript:\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 -DMULTI_PREC\"\n- - THREADS=$(grep -c ^processor /proc/cpuinfo)\n- - echo $THREADS\n- - make -j $THREADS\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+ - ./ci/build-linux-gcc.sh\nbuild-linux-clang:\nstage: build\ntags:\n- linux\nscript:\n- - mkdir build\n- - cd build\n- - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- - THREADS=$(grep -c ^processor /proc/cpuinfo)\n- - echo $THREADS\n- - make -j $THREADS\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+ - ./ci/build-linux-clang.sh\nbuild-linux-gcc-4.8:\nstage: build\ntags:\n- linux\nscript:\n- - mkdir build\n- - cd build\n- - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- - THREADS=$(grep -c ^processor /proc/cpuinfo)\n- - echo $THREADS\n- - make -j $THREADS\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+ - ./ci/build-linux-gcc-4.8.sh\nbuild-windows-gcc:\nstage: build\ntags:\n- windows\nscript:\n- - set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n- - set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n- - set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n- - mkdir build\n- - cd build\n- - cmake .. -G\"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -Wno-misleading-indentation -funroll-loops -march=native -DMULTI_PREC\"\n- - mingw32-make\n- - cd bin\n- - aff3ct.exe --version\n- - aff3ct.exe -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+ - ./ci/build-windows-gcc.bat\nbuild-windows-msvc:\nstage: build\ntags:\n- windows\nscript:\n- - set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n- - set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n- - set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n- - set \"VSCMD_START_DIR=%CD%\"\n- - call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"\n- - mkdir build\n- - cd build\n- - cmake .. -G\"Visual Studio 15 2017 Win64\" -DCMAKE_CXX_FLAGS=\"-D_CRT_SECURE_NO_DEPRECATE -DMULTI_PREC /EHsc /arch:AVX\"\n- - devenv /build Release aff3ct.sln\n- - cd bin\\Release\n- - aff3ct.exe --version\n- - aff3ct.exe -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+ - ./ci/build-windows-msvc.bat\nbuild-mac-osx-clang:\nstage: build\ntags:\n- mac-osx\nscript:\n- - mkdir build\n- - cd build\n- - cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n- - make\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+ - ./ci/build-mac-osx-clang.sh\ntest-regression:\nstage: test\n@@ -128,11 +74,6 @@ test-regression:\npaths:\n- tests/results/\nscript:\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 -DMULTI_PREC -DENABLE_COOL_BASH\"\n- - THREADS=$(grep -c ^processor /proc/cpuinfo)\n- - echo $THREADS\n- - make -j $THREADS\n+ - ./ci/test-build-linux-gcc.sh\n- cd ../tests\n- ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 0.9 --verbose 1\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "ci/analyse-cppcheck.sh",
"diff": "+#!/bin/bash\n+set -x\n+\n+cppcheck --version\n+\n+mkdir cppcheck\n+#cppcheck --suppress=missingIncludeSystem -I./src/ --force --enable=all --std=c++11 -U_MSC_VER ./src/ 2> cppcheck_all.log\n+find .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n+cppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck/cppcheck_all.log\n+cat cppcheck/cppcheck_all.log | grep \"(error)\" > cppcheck/cppcheck_error.log\n+cat cppcheck/cppcheck_all.log | grep \"(warning)\" > cppcheck/cppcheck_warning.log\n+cat cppcheck/cppcheck_all.log | grep \"(performance)\" > cppcheck/cppcheck_performance.log\n+cat cppcheck/cppcheck_all.log | grep \"(style)\" > cppcheck/cppcheck_style.log\n+cat cppcheck/cppcheck_all.log | grep \"(portability)\" > cppcheck/cppcheck_portability.log\n+cat cppcheck/cppcheck_all.log | grep \"(information)\" > cppcheck/cppcheck_information.log\n+cat cppcheck/cppcheck_all.log | grep \"(unusedFunction)\" > cppcheck/cppcheck_unusedFunction.log\n+cat cppcheck/cppcheck_all.log | grep \"(missingInclude)\" > cppcheck/cppcheck_missingInclude.log\n+\n+COUNT=$(wc -l < cppcheck/cppcheck_error.log )\n+\n+if [ $COUNT -gt 5 ]; then\n+ echo \"Error count is $COUNT! cppcheck run failed :-(.\";\n+ echo \"\"\n+ echo \"Errors list:\"\n+ cat cppcheck_error.log\n+ exit 1;\n+else\n+ echo \"There is no error :-).\"\n+fi\n+\n+exit 0;\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "ci/build-linux-clang.sh",
"diff": "+#!/bin/bash\n+set -x\n+\n+mkdir build\n+cd build\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+THREADS=$(grep -c ^processor /proc/cpuinfo)\n+echo $THREADS\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-4.8.sh",
"diff": "+#!/bin/bash\n+set -x\n+\n+mkdir build\n+cd build\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++-4.8 -DCMAKE_BUILD_TYPE=Release -DENABLE_GSL=ON -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+THREADS=$(grep -c ^processor /proc/cpuinfo)\n+echo $THREADS\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.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 -DMULTI_PREC\"\n+THREADS=$(grep -c ^processor /proc/cpuinfo)\n+echo $THREADS\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-mac-osx-clang.sh",
"diff": "+#!/bin/bash\n+set -x\n+\n+mkdir build\n+cd build\n+cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -funroll-loops -march=native -DMULTI_PREC\"\n+make\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-windows-gcc.bat",
"diff": "+@echo on\n+\n+set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n+set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n+set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n+mkdir build\n+cd build\n+cmake .. -G\"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=g++.exe -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-Wall -Wno-misleading-indentation -funroll-loops -march=native -DMULTI_PREC\"\n+mingw32-make\n+\n+cd bin\n+aff3ct.exe --version\n+aff3ct.exe -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-windows-msvc.bat",
"diff": "+@echo on\n+\n+set PATH=%PATH%;C:\\Program Files\\Git\\cmd\n+set PATH=%PATH%;C:\\Program Files\\CMake\\bin\n+set PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\bin\n+set \"VSCMD_START_DIR=%CD%\"\n+call \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat\"\n+mkdir build\n+cd build\n+cmake .. -G\"Visual Studio 15 2017 Win64\" -DCMAKE_CXX_FLAGS=\"-D_CRT_SECURE_NO_DEPRECATE -DMULTI_PREC /EHsc /arch:AVX\"\n+devenv /build Release aff3ct.sln\n+\n+cd bin\\Release\n+aff3ct.exe --version\n+aff3ct.exe -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": "DELETE",
"old_path": "ci/cppcheck.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-set -x\n-\n-cppcheck --version\n-\n-#cppcheck --suppress=missingIncludeSystem -I./src/ --force --enable=all --std=c++11 -U_MSC_VER ./src/ 2> cppcheck_all.log\n-find .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n-cppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck_all.log\n-cat cppcheck_all.log | grep \"(error)\" > cppcheck_error.log\n-cat cppcheck_all.log | grep \"(warning)\" > cppcheck_warning.log\n-cat cppcheck_all.log | grep \"(performance)\" > cppcheck_performance.log\n-cat cppcheck_all.log | grep \"(style)\" > cppcheck_style.log\n-cat cppcheck_all.log | grep \"(portability)\" > cppcheck_portability.log\n-cat cppcheck_all.log | grep \"(information)\" > cppcheck_information.log\n-cat cppcheck_all.log | grep \"(unusedFunction)\" > cppcheck_unusedFunction.log\n-cat cppcheck_all.log | grep \"(missingInclude)\" > cppcheck_missingInclude.log\n-\n-# Uncomment this block if you want a failure when there is errors\n-COUNT=$(wc -l < cppcheck_error.log )\n-\n-if [ $COUNT -gt 5 ]; then\n- echo \"Error count is $COUNT! cppcheck run failed :-(.\";\n- echo \"\"\n- echo \"Errors list:\"\n- cat cppcheck_error.log\n- exit 1;\n-else\n- echo \"There is no error :-).\"\n-fi\n-\n-exit 0;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "ci/test-build-linux-gcc.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 -DMULTI_PREC -DENABLE_COOL_BASH\"\n+ THREADS=$(grep -c ^processor /proc/cpuinfo)\n+ echo $THREADS\n+ make -j $THREADS\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Simplify the CI script a little bit.
|
8,490 |
15.01.2018 21:13:51
| -3,600 |
2d52c26c15d25618088929ebba51bf08dd33fdee
|
Fix bad path.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -75,5 +75,5 @@ test-regression:\n- tests/results/\nscript:\n- ./ci/test-build-linux-gcc.sh\n- - cd ../tests\n+ - cd tests\n- ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 0.9 --verbose 1\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad path.
|
8,483 |
16.01.2018 11:36:47
| -3,600 |
d3717245e767d22b2c748f1202a825bb6bee1202
|
Write a bash script to generate automatically the aff3ct.hpp file; Update aff3ct.hpp file
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "scripts/generate_aff3ct_header.sh",
"diff": "+#!/bin/bash\n+\n+SRC_DIR=\".\\/src\"\n+AFF3CT_HEADER=.\\/src\\/aff3ct.hpp\n+\n+echo -e \"#ifndef AFF3CT_HPP\\n#define AFF3CT_HPP\\n\" > $AFF3CT_HEADER # create the aff3ct header file with the c++ header\n+\n+find .\\/src\\/ -type f -follow -print | # find all source files\n+ grep \"[.]h$\" | # take all .h files\n+ grep -v date.h | # remove date.h from the file list\n+ grep -v dirent.h | # remove dirent.h from the file list\n+ sed 's/[[:blank:]]\\+/\\n/g' | # change end lines with '\\n'\n+ sed \"s/$SRC_DIR\\//#include </\" | # change \"./src\" with \"#include <\"\n+ sed 's|$|>|g' >> $AFF3CT_HEADER # add at the end of each line the \">\" to close the 'include'\n+ # and add the result in the aff3ct header file\n+\n+echo -ne \"\\n\" >> $AFF3CT_HEADER # add some empty lines in the aff3ct header file\n+\n+find .\\/src\\/ -type f -follow -print | # find all source files\n+ grep \"[.]hpp$\" | # take all .hpp files\n+ grep -v aff3ct.hpp | # remove aff3ct.hpp from the file list\n+ sed 's/[[:blank:]]\\+/\\n/g' | # change end lines with '\\n'\n+ sed \"s/$SRC_DIR\\//#include </\" | # change \"./src\" with \"#include <\"\n+ sed 's|$|>|g' >> $AFF3CT_HEADER # add at the end of each line the \">\" to close the 'include'\n+ # and add the result in the aff3ct header file\n+\n+echo -ne \"\\n#endif\" >> $AFF3CT_HEADER # add some empty lines in the aff3ct header file and close the 'define' header\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#ifndef AFF3CT_HPP\n#define AFF3CT_HPP\n-//find .\\/src\\/ -type f -follow -print | grep \"[.]h$\" | sed 's/[[:blank:]]\\+/\\n/g' | sed 's/.\\/src\\//#include </' | sed 's|$|>|g'\n#include <Tools/Code/Polar/API/functions_polar_inter.h>\n#include <Tools/Code/Polar/API/functions_polar_inter_8bit_bitpacking.h>\n#include <Tools/Code/Polar/API/functions_polar_inter_intra.h>\n#include <Tools/Code/Polar/decoder_polar_functions.h>\n#include <Tools/Code/Polar/fb_extract.h>\n#include <Tools/Code/Polar/nodes_parser.h>\n-// #include <Tools/date.h>\n#include <Tools/Display/bash_tools.h>\n#include <Tools/general_utils.h>\n#include <Tools/Math/matrix.h>\n#include <Tools/Math/max.h>\n#include <Tools/Math/utils.h>\n-// #include <Tools/MSVC/dirent.h>\n#include <Tools/Perf/hard_decision.h>\n#include <Tools/Perf/Transpose/transpose_AVX.h>\n#include <Tools/Perf/Transpose/transpose_NEON.h>\n#include <Tools/types.h>\n#include <Tools/version.h>\n-//find .\\/src\\/ -type f -follow -print | grep \"[.]hpp$\" | sed 's/[[:blank:]]\\+/\\n/g' | sed 's/.\\/src\\//#include </' | sed 's|$|>|g'\n-// #include <aff3ct.hpp>\n#include <Factory/Factory.hpp>\n#include <Factory/Launcher/Launcher.hpp>\n#include <Factory/Module/Channel/Channel.hpp>\n#include <Tools/SystemC/SC_Router.hpp>\n#include <Tools/Threads/Barrier.hpp>\n-#endif /* AFF3CT_HPP */\n+#endif\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Write a bash script to generate automatically the aff3ct.hpp file; Update aff3ct.hpp file
|
8,483 |
16.01.2018 14:20:03
| -3,600 |
1da3f188d50e3d05236dc727b95ef4f8d7f22ebd
|
Complete correctly the None.cpp file
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/None.cpp",
"new_path": "src/Tools/Arguments/Argument_type/None.cpp",
"diff": "#include \"None.hpp\"\n+using namespace aff3ct;\n+using namespace tools;\n+\n+None_type\n+::None_type()\n+: Argument_type(\"\")\n+{\n+\n+}\n+\n+None_type\n+::~None_type()\n+{\n+\n+}\n+\n+None_type* None_type\n+::clone() const\n+{\n+ return new None_type(*this);\n+}\n+\n+void None_type\n+::check(const std::string& val) const\n+{\n+\n+}\n+\naff3ct::tools::None_type* aff3ct::tools::None()\n{\nreturn new None_type();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/None.hpp",
"new_path": "src/Tools/Arguments/Argument_type/None.hpp",
"diff": "@@ -14,20 +14,13 @@ namespace tools\nclass None_type : public Argument_type\n{\npublic:\n- None_type()\n- : Argument_type(\"\")\n- { }\n+ None_type();\n- virtual ~None_type() {};\n+ virtual ~None_type();\n- virtual None_type* clone() const\n- {\n- return new None_type(*this);\n- }\n+ virtual None_type* clone() const;\n- virtual void check(const std::string& val) const\n- {\n- }\n+ virtual void check(const std::string& val) const;\n};\nNone_type* None();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Complete correctly the None.cpp file
|
8,483 |
16.01.2018 14:47:25
| -3,600 |
263a1f05ba535690275fe1c309072dbcaefa8867
|
Add a parsing command function in Factory to make the argument handling as easy as possible
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Factory.cpp",
"new_path": "src/Factory/Factory.cpp",
"diff": "#include <vector>\n#include <map>\n+#include \"Tools/system_functions.h\"\n#include \"Tools/general_utils.h\"\n#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Arguments/Argument_handler.hpp\"\n#include \"Factory.hpp\"\n@@ -110,6 +112,59 @@ tools::Argument_map_group Factory\nreturn grps;\n}\n+bool Factory\n+::parse_command(int argc, char** argv, std::vector<Factory::parameters*> ¶ms, std::ostream& err_stream)\n+{\n+ // build the required and optional arguments for the cmd line\n+ auto args = aff3ct::factory::Factory::get_description(params);\n+\n+ // parse the argument from the command line\n+ tools::Argument_handler ahandler(argc, (const char**)argv);\n+ std::vector<std::string> warnings, errors;\n+ auto read_args = ahandler.parse_arguments(args.first, args.second, warnings, errors);\n+\n+ try\n+ {\n+ // write the parameters values in \"params\" from \"read_args\"\n+ Factory::store(params, read_args);\n+ }\n+ catch(const aff3ct::tools::exception& e)\n+ {\n+ errors.push_back(e.what_no_bt());\n+ }\n+ catch(const std::exception& e)\n+ {\n+ errors.push_back(tools::addr2line(e.what()));\n+ }\n+\n+ // if there is blocking errors\n+ if (errors.size())\n+ {\n+ // create groups of arguments\n+ auto grps = aff3ct::factory::Factory::create_groups(params);\n+\n+ // display the command usage and the help (the parameters are ordered by group)\n+ ahandler.print_help(args.first, args.second, grps);\n+\n+ // print the warnings\n+ for (unsigned e = 0; e < warnings.size(); e++)\n+ err_stream << aff3ct::tools::format_warning(warnings[e]) << std::endl;\n+\n+ // print the errors\n+ for (size_t e = 0; e < errors.size(); e++)\n+ err_stream << aff3ct::tools::format_error(errors[e]) << std::endl;\n+\n+ // exit the program here\n+ return 1;\n+ }\n+\n+ // print the warnings\n+ for (size_t w = 0; w < warnings.size(); w++)\n+ err_stream << aff3ct::tools::format_warning(warnings[w]) << std::endl;\n+\n+ return 0;\n+}\n+\nvoid aff3ct::factory::Header::print_parameters(std::string grp_key, std::string grp_name, header_list header,\nint max_n_chars, std::ostream& stream)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Factory.hpp",
"new_path": "src/Factory/Factory.hpp",
"diff": "@@ -66,6 +66,8 @@ struct Factory\nstatic std::pair<tools::Argument_map_info, tools::Argument_map_info> get_description(const std::vector<Factory::parameters*> ¶ms);\nstatic void store (std::vector<Factory::parameters*> ¶ms, const tools::Argument_map_value &vals);\nstatic tools::Argument_map_group create_groups(const std::vector<Factory::parameters*> ¶ms);\n+\n+ static bool parse_command(int argc, char** argv, std::vector<Factory::parameters*> ¶ms, std::ostream& err_stream = std::cerr);\n};\nstruct Header\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a parsing command function in Factory to make the argument handling as easy as possible
|
8,483 |
16.01.2018 15:52:54
| -3,600 |
e18cf85a819fa786e11ef40a9116f6c9ac4aaff0
|
Create a command scanner class for the aff3ct library project. Allow easy argument management and error display
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Factory/Command_scanner.cpp",
"diff": "+#include \"Command_scanner.hpp\"\n+\n+using namespace aff3ct;\n+using namespace factory;\n+\n+const tools::Argument_tag aff3ct::factory::Command_scanner::help_tag = {\"help\", \"h\"};\n+\n+Command_scanner\n+::Command_scanner(int argc, char** argv,\n+ std::vector<Factory::parameters*> &_params,\n+ bool add_help_tag,\n+ std::ostream& _err_stream)\n+: ahandler(argc, (const char**)argv), params(_params), err_stream(_err_stream), help_asked(false)\n+{\n+ parse(add_help_tag);\n+}\n+\n+Command_scanner\n+::~Command_scanner()\n+{\n+\n+}\n+\n+void Command_scanner\n+::parse(bool add_help_tag)\n+{\n+ // build the required and optional arguments for the cmd line\n+ Factory::get_description(params, req_args, opt_args);\n+\n+ if (add_help_tag && !opt_args.exist(Command_scanner::help_tag))\n+ {\n+ opt_args.add(Command_scanner::help_tag, tools::None(), \"print this help.\");\n+ }\n+\n+ // parse the argument from the command line\n+ auto read_args = ahandler.parse_arguments(req_args, opt_args, warnings, errors);\n+\n+ try\n+ {\n+ // write the parameters values in \"params\" from \"read_args\"\n+ Factory::store(params, read_args);\n+ }\n+ catch(const aff3ct::tools::exception& e)\n+ {\n+ errors.push_back(e.what_no_bt());\n+ }\n+ catch(const std::exception& e)\n+ {\n+ errors.push_back(tools::addr2line(e.what()));\n+ }\n+\n+ if (read_args.exist(Command_scanner::help_tag))\n+ help_asked = true;\n+}\n+\n+void Command_scanner\n+::print_help()\n+{\n+ if (help_asked)\n+ {\n+ // create groups of arguments\n+ auto grps = Factory::create_groups(params);\n+\n+ // display the command usage and the help (the parameters are ordered by group)\n+ ahandler.print_help(req_args, opt_args, grps);\n+\n+ std::cout << std::endl;\n+ }\n+ else if (opt_args.exist(Command_scanner::help_tag))\n+ {\n+ std::string message = \"For more information please display the help (\\\"\";\n+ message += tools::Argument_handler::print_tag(Command_scanner::help_tag) += \"\\\").\";\n+\n+ err_stream << tools::format_info(message) << std::endl << std::endl;\n+ }\n+}\n+\n+void Command_scanner\n+::print_errors()\n+{\n+ for (size_t e = 0; e < errors.size(); e++)\n+ err_stream << aff3ct::tools::format_error(errors[e]) << std::endl;\n+}\n+\n+void Command_scanner\n+::print_warnings()\n+{\n+ for (size_t w = 0; w < warnings.size(); w++)\n+ err_stream << aff3ct::tools::format_warning(warnings[w]) << std::endl;\n+}\n+\n+bool Command_scanner\n+::parsing_failed()\n+{\n+ return errors.size() > 0;\n+}\n+\n+bool Command_scanner\n+::parsing_succeeded()\n+{\n+ return errors.empty();\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Factory/Command_scanner.hpp",
"diff": "+#ifndef COMMAND_SCANNER_HPP\n+#define COMMAND_SCANNER_HPP\n+\n+#include <iostream>\n+#include <vector>\n+#include <string>\n+\n+#include \"Factory/Factory.hpp\"\n+#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Arguments/Argument_handler.hpp\"\n+\n+#include \"Tools/system_functions.h\"\n+#include \"Tools/Exception/exception.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace factory\n+{\n+\n+class Command_scanner\n+{\n+private:\n+ tools::Argument_handler ahandler;\n+ std::vector<Factory::parameters*> ¶ms;\n+ std::ostream& err_stream;\n+ std::vector<std::string> warnings;\n+ std::vector<std::string> errors;\n+\n+ tools::Argument_map_info req_args;\n+ tools::Argument_map_info opt_args;\n+\n+ static const tools::Argument_tag help_tag;\n+ bool help_asked;\n+\n+public:\n+ Command_scanner(int argc, char** argv,\n+ std::vector<Factory::parameters*> ¶ms,\n+ bool add_help_tag = false,\n+ std::ostream& err_stream = std::cerr);\n+\n+ ~Command_scanner();\n+\n+ void print_help ();\n+ void print_errors ();\n+ void print_warnings();\n+\n+ bool parsing_failed (); // return true if there are errors\n+ bool parsing_succeeded(); // return true if no errors\n+\n+private:\n+ void parse(bool add_help_tag);\n+};\n+\n+}\n+}\n+\n+#endif\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Factory.cpp",
"new_path": "src/Factory/Factory.cpp",
"diff": "#include <vector>\n#include <map>\n-#include \"Tools/system_functions.h\"\n#include \"Tools/general_utils.h\"\n#include \"Tools/Exception/exception.hpp\"\n-#include \"Tools/Arguments/Argument_handler.hpp\"\n#include \"Factory.hpp\"\n@@ -74,12 +72,21 @@ std::pair<tools::Argument_map_info, tools::Argument_map_info> Factory\n::get_description(const std::vector<Factory::parameters*> ¶ms)\n{\nstd::pair<tools::Argument_map_info, tools::Argument_map_info> args;\n- for (auto *p : params)\n- p->get_description(args.first, args.second);\n+\n+ get_description(params, args.first, args.second);\nreturn args;\n}\n+void Factory\n+::get_description(const std::vector<Factory::parameters*> ¶ms,\n+ tools::Argument_map_info &req_args,\n+ tools::Argument_map_info &opt_args)\n+{\n+ for (auto *p : params)\n+ p->get_description(req_args, opt_args);\n+}\n+\nvoid Factory\n::store(std::vector<Factory::parameters*> ¶ms, const tools::Argument_map_value &vals)\n{\n@@ -112,59 +119,6 @@ tools::Argument_map_group Factory\nreturn grps;\n}\n-bool Factory\n-::parse_command(int argc, char** argv, std::vector<Factory::parameters*> ¶ms, std::ostream& err_stream)\n-{\n- // build the required and optional arguments for the cmd line\n- auto args = aff3ct::factory::Factory::get_description(params);\n-\n- // parse the argument from the command line\n- tools::Argument_handler ahandler(argc, (const char**)argv);\n- std::vector<std::string> warnings, errors;\n- auto read_args = ahandler.parse_arguments(args.first, args.second, warnings, errors);\n-\n- try\n- {\n- // write the parameters values in \"params\" from \"read_args\"\n- Factory::store(params, read_args);\n- }\n- catch(const aff3ct::tools::exception& e)\n- {\n- errors.push_back(e.what_no_bt());\n- }\n- catch(const std::exception& e)\n- {\n- errors.push_back(tools::addr2line(e.what()));\n- }\n-\n- // if there is blocking errors\n- if (errors.size())\n- {\n- // create groups of arguments\n- auto grps = aff3ct::factory::Factory::create_groups(params);\n-\n- // display the command usage and the help (the parameters are ordered by group)\n- ahandler.print_help(args.first, args.second, grps);\n-\n- // print the warnings\n- for (unsigned e = 0; e < warnings.size(); e++)\n- err_stream << aff3ct::tools::format_warning(warnings[e]) << std::endl;\n-\n- // print the errors\n- for (size_t e = 0; e < errors.size(); e++)\n- err_stream << aff3ct::tools::format_error(errors[e]) << std::endl;\n-\n- // exit the program here\n- return 1;\n- }\n-\n- // print the warnings\n- for (size_t w = 0; w < warnings.size(); w++)\n- err_stream << aff3ct::tools::format_warning(warnings[w]) << std::endl;\n-\n- return 0;\n-}\n-\nvoid aff3ct::factory::Header::print_parameters(std::string grp_key, std::string grp_name, header_list header,\nint max_n_chars, std::ostream& stream)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Factory.hpp",
"new_path": "src/Factory/Factory.hpp",
"diff": "@@ -64,10 +64,10 @@ struct Factory\n};\nstatic std::pair<tools::Argument_map_info, tools::Argument_map_info> get_description(const std::vector<Factory::parameters*> ¶ms);\n+ static void get_description(const std::vector<Factory::parameters*> ¶ms, tools::Argument_map_info &req_args, tools::Argument_map_info &opt_args);\n+\nstatic void store (std::vector<Factory::parameters*> ¶ms, const tools::Argument_map_value &vals);\nstatic tools::Argument_map_group create_groups(const std::vector<Factory::parameters*> ¶ms);\n-\n- static bool parse_command(int argc, char** argv, std::vector<Factory::parameters*> ¶ms, std::ostream& err_stream = std::cerr);\n};\nstruct Header\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Create a command scanner class for the aff3ct library project. Allow easy argument management and error display
|
8,483 |
16.01.2018 16:01:56
| -3,600 |
c6711b5af9b5ace1cc04170aa61033762e287cab
|
Change name Command scanner -> Command parser
|
[
{
"change_type": "RENAME",
"old_path": "src/Factory/Command_scanner.cpp",
"new_path": "src/Factory/Command_parser.cpp",
"diff": "-#include \"Command_scanner.hpp\"\n+#include \"Command_parser.hpp\"\nusing namespace aff3ct;\nusing namespace factory;\n-const tools::Argument_tag aff3ct::factory::Command_scanner::help_tag = {\"help\", \"h\"};\n+const tools::Argument_tag aff3ct::factory::Command_parser::help_tag = {\"help\", \"h\"};\n-Command_scanner\n-::Command_scanner(int argc, char** argv,\n+Command_parser\n+::Command_parser(int argc, char** argv,\nstd::vector<Factory::parameters*> &_params,\nbool add_help_tag,\nstd::ostream& _err_stream)\n@@ -15,21 +15,21 @@ Command_scanner\nparse(add_help_tag);\n}\n-Command_scanner\n-::~Command_scanner()\n+Command_parser\n+::~Command_parser()\n{\n}\n-void Command_scanner\n+void Command_parser\n::parse(bool add_help_tag)\n{\n// build the required and optional arguments for the cmd line\nFactory::get_description(params, req_args, opt_args);\n- if (add_help_tag && !opt_args.exist(Command_scanner::help_tag))\n+ if (add_help_tag && !opt_args.exist(Command_parser::help_tag))\n{\n- opt_args.add(Command_scanner::help_tag, tools::None(), \"print this help.\");\n+ opt_args.add(Command_parser::help_tag, tools::None(), \"print this help.\");\n}\n// parse the argument from the command line\n@@ -49,11 +49,11 @@ void Command_scanner\nerrors.push_back(tools::addr2line(e.what()));\n}\n- if (read_args.exist(Command_scanner::help_tag))\n+ if (read_args.exist(Command_parser::help_tag))\nhelp_asked = true;\n}\n-void Command_scanner\n+void Command_parser\n::print_help()\n{\nif (help_asked)\n@@ -66,36 +66,36 @@ void Command_scanner\nstd::cout << std::endl;\n}\n- else if (opt_args.exist(Command_scanner::help_tag))\n+ else if (opt_args.exist(Command_parser::help_tag))\n{\nstd::string message = \"For more information please display the help (\\\"\";\n- message += tools::Argument_handler::print_tag(Command_scanner::help_tag) += \"\\\").\";\n+ message += tools::Argument_handler::print_tag(Command_parser::help_tag) += \"\\\").\";\nerr_stream << tools::format_info(message) << std::endl << std::endl;\n}\n}\n-void Command_scanner\n+void Command_parser\n::print_errors()\n{\nfor (size_t e = 0; e < errors.size(); e++)\nerr_stream << aff3ct::tools::format_error(errors[e]) << std::endl;\n}\n-void Command_scanner\n+void Command_parser\n::print_warnings()\n{\nfor (size_t w = 0; w < warnings.size(); w++)\nerr_stream << aff3ct::tools::format_warning(warnings[w]) << std::endl;\n}\n-bool Command_scanner\n+bool Command_parser\n::parsing_failed()\n{\nreturn errors.size() > 0;\n}\n-bool Command_scanner\n+bool Command_parser\n::parsing_succeeded()\n{\nreturn errors.empty();\n"
},
{
"change_type": "RENAME",
"old_path": "src/Factory/Command_scanner.hpp",
"new_path": "src/Factory/Command_parser.hpp",
"diff": "-#ifndef COMMAND_SCANNER_HPP\n-#define COMMAND_SCANNER_HPP\n+#ifndef COMMAND_PARSER_HPP\n+#define COMMAND_PARSER_HPP\n#include <iostream>\n#include <vector>\n@@ -17,7 +17,7 @@ namespace aff3ct\nnamespace factory\n{\n-class Command_scanner\n+class Command_parser\n{\nprivate:\ntools::Argument_handler ahandler;\n@@ -33,12 +33,12 @@ private:\nbool help_asked;\npublic:\n- Command_scanner(int argc, char** argv,\n+ Command_parser(int argc, char** argv,\nstd::vector<Factory::parameters*> ¶ms,\nbool add_help_tag = false,\nstd::ostream& err_stream = std::cerr);\n- ~Command_scanner();\n+ ~Command_parser();\nvoid print_help ();\nvoid print_errors ();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/types.h>\n#include <Tools/version.h>\n-#include <Factory/Command_scanner.hpp>\n+#include <Factory/Command_parser.hpp>\n#include <Factory/Factory.hpp>\n#include <Factory/Launcher/Launcher.hpp>\n#include <Factory/Module/Channel/Channel.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change name Command scanner -> Command parser
|
8,490 |
16.01.2018 16:36:03
| -3,600 |
561204f67953d9d27f8569654fd1e9b1c4c73cdb
|
Rm outdated scripts.
|
[
{
"change_type": "DELETE",
"old_path": "scripts/GSM_LDPC/gsm_BPF_MAXS_SPA.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../../build\n-\n-./bin/aff3ct \\\n- --sim-type BFERI \\\n- --sim-prec 32 \\\n- --sim-snr-min 1.0 \\\n- --sim-snr-max 3.0 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 100 \\\n- --src-type RAND_FAST \\\n- -K 2112 \\\n- --sim-cde-type LDPC \\\n- --sim-coset \\\n- -N 4224 \\\n- --itl-type RANDOM \\\n- --mdm-type CPM \\\n- --mdm-max MAXS \\\n- --chn-type AWGN_FAST \\\n- --dec-type BP_FLOODING \\\n- --dec-implem SPA \\\n- --dec-no-synd \\\n- --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mdm-cpm-std GSM \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/GSM_LDPC/gsm_BPF_MAX_NMS.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../../build\n-\n-./bin/aff3ct \\\n- --sim-type BFERI \\\n- --sim-prec 32 \\\n- --sim-snr-min 1.0 \\\n- --sim-snr-max 3.0 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 100 \\\n- --src-type RAND_FAST \\\n- -K 2112 \\\n- --sim-cde-type LDPC \\\n- --sim-coset \\\n- -N 4224 \\\n- --itl-type RANDOM \\\n- --mdm-type CPM \\\n- --mdm-max MAX \\\n- --chn-type AWGN_FAST \\\n- --dec-type BP_FLOODING \\\n- --dec-implem ONMS \\\n- --dec-norm 0.825 \\\n- --dec-no-synd \\\n- --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mdm-cpm-std GSM \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/GSM_LDPC/gsm_BPL_MAXS_SPA.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../../build\n-\n-./bin/aff3ct \\\n- --sim-type BFERI \\\n- --sim-prec 32 \\\n- --sim-snr-min 1.0 \\\n- --sim-snr-max 3.0 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 100 \\\n- --src-type RAND_FAST \\\n- -K 2112 \\\n- --sim-cde-type LDPC \\\n- --sim-coset \\\n- -N 4224 \\\n- --itl-type RANDOM \\\n- --mdm-type CPM \\\n- --mdm-max MAXS \\\n- --chn-type AWGN_FAST \\\n- --dec-type BP_LAYERED \\\n- --dec-implem SPA \\\n- --dec-no-synd \\\n- --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mdm-cpm-std GSM \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/GSM_LDPC/gsm_BPL_MAX_NMS.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../../build\n-\n-./bin/aff3ct \\\n- --sim-type BFERI \\\n- --sim-prec 32 \\\n- --sim-snr-min 1.0 \\\n- --sim-snr-max 3.0 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 100 \\\n- --src-type RAND_FAST \\\n- -K 2112 \\\n- --sim-cde-type LDPC \\\n- --sim-coset \\\n- -N 4224 \\\n- --itl-type RANDOM \\\n- --mdm-type CPM \\\n- --mdm-max MAX \\\n- --chn-type AWGN_FAST \\\n- --dec-type BP_LAYERED \\\n- --dec-implem ONMS \\\n- --dec-norm 0.825 \\\n- --dec-no-synd \\\n- --dec-h-path ../conf/dec/LDPC/GSM_2112_4224.alist \\\n- --mdm-cpm-std GSM \\\n- \"$@\"\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/generate_aff3ct_header.sh",
"new_path": "scripts/generate_aff3ct_header.sh",
"diff": ""
},
{
"change_type": "DELETE",
"old_path": "scripts/run_bch.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../build\n-\n-./bin/aff3ct \\\n- --sim-type BFER \\\n- --sim-cde-type BCH \\\n- -N 63 \\\n- -K 57 \\\n- -t 1 \\\n- --sim-snr-min 0 \\\n- --sim-snr-max 9 \\\n- --sim-snr-step 0.5 \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/run_bfer_polar_SC.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../build\n-\n-./bin/aff3ct \\\n- --sim-type BFER \\\n- --sim-cde-type POLAR \\\n- -K 2048 \\\n- -N 4096 \\\n- --sim-snr-min 2.0 \\\n- --sim-snr-max 3.01 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 100 \\\n- --dec-type SC \\\n- --dec-implem FAST \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/run_bfer_polar_SCL.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../build\n-\n-./bin/aff3ct \\\n- --sim-type BFER \\\n- --sim-cde-type POLAR \\\n- -K 344 \\\n- -N 1024 \\\n- --sim-snr-min 1.0 \\\n- --sim-snr-max 2.01 \\\n- --sim-snr-step 0.25 \\\n- --mnt-max-fe 100 \\\n- --dec-type SCL \\\n- --dec-implem NAIVE \\\n- -L 4 \\\n- --crc-poly 8-DVB-S2 \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/run_bfer_polar_SC_debug.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../build\n-\n-./bin/aff3ct \\\n- --sim-type BFER \\\n- --sim-cde-type POLAR \\\n- -K 4 \\\n- -N 8 \\\n- --sim-snr-min 0.50 \\\n- --sim-snr-max 0.50 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 1 \\\n- --sim-threads 1 \\\n- --sim-debug \\\n- --dec-type SC \\\n- --dec-implem NAIVE \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/run_bfer_polar_SC_small.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../build\n-\n-./bin/aff3ct \\\n- --sim-type BFER \\\n- --sim-cde-type POLAR \\\n- -K 128 \\\n- -N 256 \\\n- --sim-snr-min 0.50 \\\n- --sim-snr-max 4.01 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 100 \\\n- --dec-type SC \\\n- --dec-implem NAIVE \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/run_bfer_turbo_LTE.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../build\n-\n-./bin/aff3ct \\\n- --sim-type BFER \\\n- --sim-cde-type TURBO \\\n- -K 6144 \\\n- --sim-snr-min 0.0 \\\n- --sim-snr-max 1.01 \\\n- --sim-snr-step 0.1 \\\n- --mnt-max-fe 100 \\\n- --enc-std LTE \\\n- --dec-ite 6 \\\n- --dec-type BCJR \\\n- --dec-implem FAST \\\n- \"$@\"\n"
},
{
"change_type": "DELETE",
"old_path": "scripts/run_exit_polar_SCAN.sh",
"new_path": null,
"diff": "-#!/bin/bash\n-\n-cd ../build\n-\n-./bin/aff3ct \\\n- --sim-type EXIT \\\n- --sim-cde-type POLAR \\\n- -K 1194 \\\n- -N 2048 \\\n- --sim-snr-min -3 \\\n- --sim-snr-max -3 \\\n- --sim-siga-min 0.0 \\\n- --sim-siga-max 5.01 \\\n- --sim-snr-step 0.1 \\\n- --chn-type AWGN \\\n- --dec-type SCAN \\\n- --dec-implem NAIVE \\\n- --enc-fb-sigma 0.8 \\\n- \"$@\"\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rm outdated scripts.
|
8,490 |
17.01.2018 10:28:35
| -3,600 |
0718420720cb77f34e4173baf8bf9165860de06c
|
Shorten the trace in the readme.
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -37,69 +37,7 @@ Expected output:\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n# Parameters :\n- # * Simulation ------------------------------------\n- # ** Type = BFER\n- # ** Type of bits = int32\n- # ** Type of reals = float32\n- # ** Date (UTC) = 2017-10-19 09:54:56\n- # ** Git version = v1.3.0\n- # ** Code type (C) = POLAR\n- # ** SNR min (m) = 1.000000 dB\n- # ** SNR max (M) = 4.000100 dB\n- # ** SNR step (s) = 0.250000 dB\n- # ** Seed = 0\n- # ** Statistics = off\n- # ** Debug mode = off\n- # ** Multi-threading (t) = 4 thread(s)\n- # ** SNR type = EB\n- # ** Coset approach (c) = no\n- # ** Coded monitoring = no\n- # ** Bad frames tracking = off\n- # ** Bad frames replay = off\n- # ** Bit rate = 0.841309\n- # ** Inter frame level = 1\n- # * Source ----------------------------------------\n- # ** Type = RAND\n- # ** Info. bits (K_info) = 1723\n- # * CRC -------------------------------------------\n- # ** Type = FAST\n- # ** Name = 32-GZIP\n- # ** Polynomial (hexadecimal) = 0x4c11db7\n- # ** Size (in bit) = 32\n- # * Codec -----------------------------------------\n- # ** Type = POLAR\n- # ** Info. bits (K) = 1755\n- # ** Codeword size (N_cw) = 2048\n- # ** Frame size (N) = 2048\n- # ** Code rate = 0.856934\n- # * Encoder ---------------------------------------\n- # ** Type = POLAR\n- # ** Systematic = yes\n- # Frozen bits generator ------------------------\n- # ** Type = GA\n- # ** Sigma = adaptive\n- # * Decoder ---------------------------------------\n- # ** Type (D) = ASCL\n- # ** Implementation = FAST\n- # ** Systematic = yes\n- # ** Max num. of lists (L) = 8\n- # ** Adaptative mode = full\n- # ** Polar node types = {R0,R0L,R1,REP,REPL,SPC}\n- # * Modem -----------------------------------------\n- # ** Type = BPSK\n- # ** Bits per symbol = 1\n- # ** Sampling factor = 1\n- # ** Sigma square = on\n- # * Channel ---------------------------------------\n- # ** Type = AWGN\n- # ** Complex = off\n- # ** Add users = off\n- # * Monitor ---------------------------------------\n- # ** Frame error count (e) = 100\n- # * Terminal --------------------------------------\n- # ** Type = STD\n- # ** Enabled = yes\n- # ** Frequency (ms) = 500\n+ # [...]\n#\n# The simulation is running...\n# ----------------------------------------------------------------------||---------------------\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Shorten the trace in the readme.
|
8,483 |
17.01.2018 11:58:09
| -3,600 |
e8501828cf2999444c911abb8851c44fbaa36bdd
|
Add file checking in Codec LDPC before calling Alist or QC; Add exception throws when wrong format in Alist and QC readers
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -95,15 +95,20 @@ Codec_LDPC<B,Q>\n{\nauto G_format = get_matrix_format(enc_params.G_path);\n- if (G_format == \"QC\")\n- {\nstd::ifstream file_G(enc_params.G_path, std::ifstream::in);\n+\n+ if (!file_G.is_open() || G_format == \"BAD_FILE\")\n+ {\n+ std::stringstream message;\n+ message << \"'enc_params.G_path' can't be opened ('enc_params.G_path' = \\\"\" + enc_params.G_path + \"\\\").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ else if (G_format == \"QC\")\n+ {\nG = tools::QC::read(file_G);\n- file_G.close();\n}\nelse if (G_format == \"ALIST\")\n{\n- std::ifstream file_G(enc_params.G_path, std::ifstream::in);\nG = tools::AList::read(file_G);\ntry\n@@ -115,29 +120,29 @@ Codec_LDPC<B,Q>\n{\n// information bits positions are not in the G matrix file\n}\n-\n- file_G.close();\n}\n- else if (G_format == \"BAD_FILE\")\n+ }\n+\n+\n+\n+ auto H_format = get_matrix_format(dec_params.H_path);\n+\n+ std::ifstream file_H(dec_params.H_path, std::ifstream::in);\n+\n+ if (!file_H.is_open() || H_format == \"BAD_FILE\")\n{\nstd::stringstream message;\n- message << \"'enc_params.G_path' can't be opened ('enc_params.G_path' = \\\"\" + enc_params.G_path + \"\\\").\";\n+ message << \"'dec_params.H_path' can't be opened ('dec_params.H_path' = \\\"\" + dec_params.H_path + \"\\\").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n- }\n-\n- auto H_format = get_matrix_format(dec_params.H_path);\n- if (H_format == \"QC\")\n+ else if (H_format == \"QC\")\n{\n- std::ifstream file_H(dec_params.H_path, std::ifstream::in);\nH = tools::QC::read(file_H);\nif (pct_params && pct_params->pattern.empty())\npct_params->pattern = tools::QC::read_pct_pattern(file_H);\n- file_H.close();\n}\nelse if (H_format == \"ALIST\")\n{\n- std::ifstream file_H(dec_params.H_path, std::ifstream::in);\nH = tools::AList::read(file_H);\ntry\n@@ -146,14 +151,6 @@ Codec_LDPC<B,Q>\nis_info_bits_pos = true;\n}\ncatch (std::exception const&) { }\n-\n- file_H.close();\n- }\n- else if (H_format == \"BAD_FILE\")\n- {\n- std::stringstream message;\n- message << \"'dec_params.H_path' can't be opened ('dec_params.H_path' = \\\"\" + dec_params.H_path + \"\\\").\";\n- throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\nif (dec_params.H_reorder != \"NONE\")\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"new_path": "src/Tools/Code/LDPC/AList/AList.cpp",
"diff": "@@ -29,11 +29,20 @@ Sparse_matrix AList\nreturn AList::read_format2(stream);\n}\ncatch (std::exception const&)\n+ {\n+ try\n{\nstream.clear();\nstream.seekg(init_pos);\nreturn AList::read_format3(stream);\n}\n+ catch (std::exception const&)\n+ {\n+ std::stringstream message;\n+ message << \"The given stream does not refer to a AList format file.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/QC/QC.cpp",
"new_path": "src/Tools/Code/LDPC/QC/QC.cpp",
"diff": "@@ -11,6 +11,21 @@ using namespace aff3ct::tools;\nSparse_matrix QC\n::read(std::istream &stream)\n+{\n+ try\n+ {\n+ return QC::_read(stream);\n+ }\n+ catch (std::exception const&)\n+ {\n+ std::stringstream message;\n+ message << \"The given stream does not refer to a QC format file.\";\n+ throw runtime_error(__FILE__, __LINE__, __func__, message.str());\n+ }\n+}\n+\n+Sparse_matrix QC\n+::_read(std::istream &stream)\n{\n// ----------------------------------------------------------------------------------------- read matrix from file\nstd::string line;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/QC/QC.hpp",
"new_path": "src/Tools/Code/LDPC/QC/QC.hpp",
"diff": "@@ -18,6 +18,9 @@ public:\nstatic Sparse_matrix read ( std::istream &stream );\nstatic std::vector<bool> read_pct_pattern( std::istream &stream, int N_red = -1);\nstatic void write (const Sparse_matrix &matrix, std::ostream &stream );\n+\n+private:\n+ static Sparse_matrix _read ( std::istream &stream );\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add file checking in Codec LDPC before calling Alist or QC; Add exception throws when wrong format in Alist and QC readers
|
8,483 |
17.01.2018 14:07:36
| -3,600 |
c0b2ee32552844fcd341f8c1ecd29ed6932bfd36
|
Remove range including set in dec-implem to allow any possiblity. Use add_range function to add including_set to it when it is needed; Fix Argument_type_limited clone_ranges bug
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Decoder.cpp",
"new_path": "src/Factory/Module/Decoder/Decoder.cpp",
"diff": "@@ -50,7 +50,7 @@ void Decoder::parameters\nopt_args.add(\n{p+\"-implem\"},\n- tools::Text(tools::Including_set<std::string>()),\n+ tools::Text(),\n\"select the implementation of the algorithm to decode.\");\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": "@@ -51,7 +51,9 @@ void Decoder_LDPC::parameters\n\"path to the H matrix (AList or QC formated file).\");\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"BP\", \"BP_FLOODING\", \"BP_LAYERED\" );\n- tools::add_options(opt_args.at({p+\"-implem\" }), 0, \"ONMS\", \"SPA\", \"LSPA\", \"GALA\", \"AMS\");\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"ONMS\", \"SPA\", \"LSPA\", \"GALA\", \"AMS\"));\nopt_args.add(\n{p+\"-ite\", \"i\"},\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": "@@ -39,7 +39,9 @@ void Decoder_NO::parameters\nauto p = this->get_prefix();\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"NONE\");\n- tools::add_options(opt_args.at({p+\"-implem\" }), 0, \"HARD_DECISION\");\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"HARD_DECISION\"));\n}\nvoid Decoder_NO::parameters\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,9 @@ void Decoder_RA::parameters\nopt_args.erase({pi+\"-fra\", \"F\"});\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"RA\" );\n- tools::add_options(opt_args.at({p+\"-implem\" }), 0, \"STD\");\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"STD\"));\nopt_args.add(\n{p+\"-ite\", \"i\"},\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": "@@ -58,7 +58,9 @@ void Decoder_RSC::parameters\nreq_args.erase({p+\"-cw-size\", \"N\"});\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"BCJR\");\n- tools::add_options(opt_args.at({p+\"-implem\"}), 0, \"GENERIC\", \"STD\", \"FAST\", \"VERY_FAST\");\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"GENERIC\", \"STD\", \"FAST\", \"VERY_FAST\"));\nopt_args.add(\n{p+\"-simd\"},\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": "@@ -41,7 +41,9 @@ void Decoder_RSC_DB::parameters\nreq_args.erase({p+\"-cw-size\", \"N\"});\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"BCJR\");\n- tools::add_options(opt_args.at({p+\"-implem\"}), 0, \"GENERIC\", \"DVB-RCS1\", \"DVB-RCS2\");\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"GENERIC\", \"DVB-RCS1\", \"DVB-RCS2\"));\nopt_args.add(\n{p+\"-max\"},\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,9 @@ void Decoder_repetition::parameters\nauto p = this->get_prefix();\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"REPETITION\" );\n- tools::add_options(opt_args.at({p+\"-implem\" }), 0, \"STD\", \"FAST\");\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"STD\", \"FAST\"));\nopt_args.add(\n{p+\"-no-buff\"},\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,9 @@ void Decoder_turbo::parameters<D1,D2>\nopt_args.erase({pi+\"-fra\", \"F\"});\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"TURBO\" );\n- tools::add_options(opt_args.at({p+\"-implem\" }), 0, \"STD\", \"FAST\");\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"STD\", \"FAST\"));\nopt_args.add(\n{p+\"-ite\", \"i\"},\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,9 @@ void Decoder_turbo_DB::parameters\nopt_args.erase({pi+\"-fra\", \"F\"});\ntools::add_options(opt_args.at({p+\"-type\", \"D\"}), 0, \"TURBO_DB\");\n- tools::add_options(opt_args.at({p+\"-implem\" }), 0, \"STD\" );\n+\n+ tools::add_ranges<tools::Text_type<>>\n+ (opt_args.at({p+\"-implem\"}), tools::Including_set(\"STD\"));\nopt_args.add(\n{p+\"-ite\", \"i\"},\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_range/Set.hpp",
"new_path": "src/Tools/Arguments/Argument_range/Set.hpp",
"diff": "@@ -78,7 +78,7 @@ public:\nvoid check(const T& val) const\n{\nif (this->options.empty())\n- return;\n+ throw std::runtime_error(\"accepts no argument\");\nauto it = std::find(this->options.begin(), this->options.end(), val);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments/Argument_type/Argument_type_limited.hpp",
"new_path": "src/Tools/Arguments/Argument_type/Argument_type_limited.hpp",
"diff": "@@ -71,7 +71,7 @@ public:\n}\nprotected:\n- Argument_type_limited(const std::string& title)\n+ explicit Argument_type_limited(const std::string& title)\n: Argument_type_limited_T<T>(title)\n{ }\n@@ -250,7 +250,9 @@ protected:\n{\n}\n- virtual Argument_type_limited<T>* clone_ranges(Argument_type_limited<T>* clone) const\n+ template <typename... OtherRanges>\n+ Argument_type_limited<T,OtherRanges...>*\n+ clone_ranges(Argument_type_limited<T,OtherRanges...>* clone) const\n{\nclone->get_ranges().clear();\nreturn clone;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove range including set in dec-implem to allow any possiblity. Use add_range function to add including_set to it when it is needed; Fix Argument_type_limited clone_ranges bug
|
8,490 |
19.01.2018 18:15:01
| -3,600 |
d45ce8ecfa810abd01ece94da83c016dc3ede1a0
|
Add SonarQube CI test.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "@@ -22,6 +22,15 @@ analyse-cppcheck:\nscript:\n- ./ci/analyse-cppcheck.sh\n+analyse-sonarqube:\n+ stage: analyse\n+ tags:\n+ - sonarqube\n+ only:\n+ - master\n+ script:\n+ - ./ci/analyse-sonarqube.sh\n+\nbuild-linux-gcc:\nstage: build\ntags:\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "ci/analyse-sonarqube.sh",
"diff": "+#!/bin/bash\n+\n+set -x\n+\n+VERSION=$(git tag | tail -n 1 | cut -c2,3,4,5,6)\n+\n+find .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n+cppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt --xml --xml-version=2 2> cppcheck.xml\n+\n+# Create the sonar config file on the fly\n+echo \"sonar.projectKey=STORM:AFF3CT\" > sonar-project.properties\n+echo \"sonar.projectName=AFF3CT\" >> sonar-project.properties\n+echo \"sonar.projectVersion=$VERSION\" >> sonar-project.properties\n+echo \"sonar.login=b20709e3e9263173baa66e62d8c65a9e56b04aea\" >> sonar-project.properties\n+echo \"sonar.sources=./src/\" >> sonar-project.properties\n+echo \"sonar.links.homepage=https://aff3ct.github.io/\" >> sonar-project.properties\n+echo \"sonar.links.scm=https://github.com/aff3ct/aff3ct\" >> sonar-project.properties\n+echo \"sonar.links.ci=https://gitlab.inria.fr/fec/aff3ct/pipelines\" >> sonar-project.properties\n+echo \"sonar.links.issue=https://github.com/aff3ct/aff3ct/issues\" >> sonar-project.properties\n+echo \"sonar.language=c++\" >> sonar-project.properties\n+echo \"sonar.cxx.cppcheck.reportPath=cppcheck.xml\" >> sonar-project.properties\n+\n+sonar-scanner\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add SonarQube CI test.
|
8,490 |
19.01.2018 22:41:02
| -3,600 |
6ccaeaa2627653423e7c4560db301931e4f1b739
|
Add exception files to SonarQube and CppCheck.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/analyse-cppcheck.sh",
"new_path": "ci/analyse-cppcheck.sh",
"diff": "@@ -6,6 +6,8 @@ cppcheck --version\nmkdir cppcheck\n#cppcheck --suppress=missingIncludeSystem -I./src/ --force --enable=all --std=c++11 -U_MSC_VER ./src/ 2> cppcheck_all.log\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n+sed -i -e 's/.\\/src\\/Tools\\/date.h//g' src_files.txt\n+sed -i -e 's/.\\/src\\/Tools\\/MSVC\\/dirent.h//g' src_files.txt\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt 2> cppcheck/cppcheck_all.log\ncat cppcheck/cppcheck_all.log | grep \"(error)\" > cppcheck/cppcheck_error.log\ncat cppcheck/cppcheck_all.log | grep \"(warning)\" > cppcheck/cppcheck_warning.log\n"
},
{
"change_type": "MODIFY",
"old_path": "ci/analyse-sonarqube.sh",
"new_path": "ci/analyse-sonarqube.sh",
"diff": "#!/bin/bash\n-\nset -x\nVERSION=$(git tag | tail -n 1 | cut -c2,3,4,5,6)\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\n+sed -i -e 's/.\\/src\\/Tools\\/date.h//g' src_files.txt\n+sed -i -e 's/.\\/src\\/Tools\\/MSVC\\/dirent.h//g' src_files.txt\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt --xml --xml-version=2 2> cppcheck.xml\n# Create the sonar config file on the fly\n@@ -13,6 +14,7 @@ echo \"sonar.projectName=AFF3CT\" >> sonar-proj\necho \"sonar.projectVersion=$VERSION\" >> sonar-project.properties\necho \"sonar.login=b20709e3e9263173baa66e62d8c65a9e56b04aea\" >> sonar-project.properties\necho \"sonar.sources=./src/\" >> sonar-project.properties\n+echo \"sonar.exclusions=./src/Tools/date.h, ./src/Tools/MSVC/dirent.h\" >> sonar-project.properties\necho \"sonar.links.homepage=https://aff3ct.github.io/\" >> sonar-project.properties\necho \"sonar.links.scm=https://github.com/aff3ct/aff3ct\" >> sonar-project.properties\necho \"sonar.links.ci=https://gitlab.inria.fr/fec/aff3ct/pipelines\" >> sonar-project.properties\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add exception files to SonarQube and CppCheck.
|
8,490 |
22.01.2018 10:39:33
| -3,600 |
bba0441a37e12b534419ebde53207365707dc884
|
Improve the cut.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/analyse-sonarqube.sh",
"new_path": "ci/analyse-sonarqube.sh",
"diff": "#!/bin/bash\nset -x\n-VERSION=$(git tag | tail -n 1 | cut -c2,3,4,5,6)\n+VERSION=$(git tag | tail -n 1 | cut -d $'v' -f2-)\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\nsed -i -e 's/.\\/src\\/Tools\\/date.h//g' src_files.txt\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the cut.
|
8,490 |
22.01.2018 14:22:49
| -3,600 |
0eadf39d0f72ea0aa340d3dfb2985cfa80e689c6
|
Skip date.h and dirent.h files.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/analyse-sonarqube.sh",
"new_path": "ci/analyse-sonarqube.sh",
"diff": "@@ -14,7 +14,7 @@ echo \"sonar.projectName=AFF3CT\" >> sonar-p\necho \"sonar.projectVersion=$VERSION\" >> sonar-project.properties\necho \"sonar.login=b20709e3e9263173baa66e62d8c65a9e56b04aea\" >> sonar-project.properties\necho \"sonar.sources=./src/\" >> sonar-project.properties\n-echo \"sonar.exclusions=./src/Tools/date.h, ./src/Tools/MSVC/dirent.h\" >> sonar-project.properties\n+echo \"sonar.exclusions=**/date.h, **/dirent.h\" >> sonar-project.properties\necho \"sonar.links.homepage=https://aff3ct.github.io/\" >> sonar-project.properties\necho \"sonar.links.scm=https://github.com/aff3ct/aff3ct\" >> sonar-project.properties\necho \"sonar.links.ci=https://gitlab.inria.fr/fec/aff3ct/pipelines\" >> sonar-project.properties\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Skip date.h and dirent.h files.
|
8,490 |
22.01.2018 14:57:30
| -3,600 |
70cf90a8146f72f1ee6ae3f7ded8ec23d6b02957
|
Add some code to get the compiler info in SonarQube.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/analyse-sonarqube.sh",
"new_path": "ci/analyse-sonarqube.sh",
"diff": "#!/bin/bash\nset -x\n-VERSION=$(git tag | tail -n 1 | cut -d $'v' -f2-)\n-\n+# cppcheck\nfind .\\/src\\/ -type f -follow -print | grep \"[.]h$\\|[.]hpp$\\|[.]hxx$\\|[.]cpp$\" > src_files.txt\nsed -i -e 's/.\\/src\\/Tools\\/date.h//g' src_files.txt\nsed -i -e 's/.\\/src\\/Tools\\/MSVC\\/dirent.h//g' src_files.txt\ncppcheck --language=c++ --suppress=missingIncludeSystem --force --enable=all --std=c++11 -U_MSC_VER --file-list=src_files.txt --xml --xml-version=2 2> cppcheck.xml\n+## gcc\n+#mkdir build_sonar\n+#cd build_sonar\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\"\n+#THREADS=$(grep -c ^processor /proc/cpuinfo)\n+#build-wrapper-linux-x86-64 --out-dir bw-output make -j $THREADS clean all\n+#cd ..\n+\n# Create the sonar config file on the fly\n+VERSION=$(git tag | tail -n 1 | cut -d $'v' -f2-)\necho \"sonar.projectKey=STORM:AFF3CT\" > sonar-project.properties\necho \"sonar.projectName=AFF3CT\" >> sonar-project.properties\necho \"sonar.projectVersion=$VERSION\" >> sonar-project.properties\n@@ -21,5 +29,6 @@ echo \"sonar.links.ci=https://gitlab.inria.fr/fec/aff3ct/pipelines\" >> sonar-proj\necho \"sonar.links.issue=https://github.com/aff3ct/aff3ct/issues\" >> sonar-project.properties\necho \"sonar.language=c++\" >> sonar-project.properties\necho \"sonar.cxx.cppcheck.reportPath=cppcheck.xml\" >> sonar-project.properties\n+#echo \"sonar.cfamily.build-wrapper-output=./build_sonar/bw-output\" >> sonar-project.properties\nsonar-scanner\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add some code to get the compiler info in SonarQube.
|
8,490 |
25.01.2018 10:17:33
| -3,600 |
8c0dc997c63d606be4ddcc0061c0d9caba1b906e
|
Rename 'analyse' stage in 'analysis' + move the test script + add a '.gitignore' file.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": ".gitignore",
"diff": "+*.gitignore*\n+\n+.cproject\n+.project\n+.pydevproject\n+.settings\n+cppcheck.xml\n+sonar-project.properties\n+src_files.txt\n+\n+.scannerwork/\n+build*/\n+cppcheck/\n+doc/html/\n+doc/latex/\n+src/Tools/version.cpp\n+test-regression-results/\n+\n"
},
{
"change_type": "MODIFY",
"old_path": ".gitlab-ci.yml",
"new_path": ".gitlab-ci.yml",
"diff": "stages:\n- - analyse\n+ - analysis\n- build\n- test\n@@ -10,26 +10,26 @@ before_script:\n- git submodule sync --recursive\n- git submodule update --init --recursive\n-analyse-cppcheck:\n- stage: analyse\n+analysis-cppcheck:\n+ stage: analysis\nartifacts:\n- name: analyse-cppcheck-logs\n+ name: analysis-cppcheck-logs\nwhen: always\npaths:\n- cppcheck/\ntags:\n- cppcheck\nscript:\n- - ./ci/analyse-cppcheck.sh\n+ - ./ci/analysis-cppcheck.sh\n-analyse-sonarqube:\n- stage: analyse\n+analysis-sonarqube:\n+ stage: analysis\ntags:\n- sonarqube\nonly:\n- master\nscript:\n- - ./ci/analyse-sonarqube.sh\n+ - ./ci/analysis-sonarqube.sh\nbuild-linux-gcc:\nstage: build\n@@ -81,8 +81,7 @@ test-regression:\nname: test-regression-results\nwhen: always\npaths:\n- - tests/results/\n+ - test-regression-results/\nscript:\n- ./ci/test-build-linux-gcc.sh\n- - cd tests\n- - ./tests.py --max-snr-time 5 --sensibility 2.5 --weak-rate 0.9 --verbose 1\n\\ No newline at end of file\n+ - ./ci/test-regression.py --max-snr-time 5 --sensibility 2.5 --weak-rate 0.9 --verbose 1\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": ".gitmodules",
"new_path": ".gitmodules",
"diff": "path = conf\nurl = ../configuration_files\n[submodule \"tests/refs\"]\n- path = tests/refs\n+ path = refs\nurl = ../error_rate_references\n"
},
{
"change_type": "RENAME",
"old_path": "ci/analyse-cppcheck.sh",
"new_path": "ci/analysis-cppcheck.sh",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "ci/analyse-sonarqube.sh",
"new_path": "ci/analysis-sonarqube.sh",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "tests/tests.py",
"new_path": "ci/test-regression.py",
"diff": "@@ -16,12 +16,10 @@ import subprocess\n# =============================================================================\n# ================================================================== PARAMETERS\n-parser = argparse.ArgumentParser(\n- prog='aff3ct_tests',\n- formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n+parser = argparse.ArgumentParser(prog='aff3ct-test-regression', formatter_class=argparse.ArgumentDefaultsHelpFormatter)\nparser.add_argument('--refs-path', action='store', dest='refsPath', type=str, default=\"refs\", help='Path to the references to re-simulate.')\n-parser.add_argument('--results-path', action='store', dest='resultsPath', type=str, default=\"results\", help='Path to the simulated results.')\n-parser.add_argument('--build-path', action='store', dest='buildPath', type=str, default=\"../build\", help='Path to the AFF3CT build.')\n+parser.add_argument('--results-path', action='store', dest='resultsPath', type=str, default=\"test-regression-results\", help='Path to the simulated results.')\n+parser.add_argument('--build-path', action='store', dest='buildPath', type=str, default=\"build\", help='Path to the AFF3CT build.')\nparser.add_argument('--start-id', action='store', dest='startId', type=int, default=0, help='Starting id to avoid computing results one again.') # choices=xrange(0, +inf)\nparser.add_argument('--sensibility', action='store', dest='sensibility', type=float, default=1.0, help='Sensibility to verify a SNR point.') # choices=xrange(0.0, +inf)\nparser.add_argument('--n-threads', action='store', dest='nThreads', type=int, default=0, help='Number of threads to use in the simulation (0 = all available).') # choices=xrange(0, +ing)\n"
},
{
"change_type": "RENAME",
"old_path": "tests/refs",
"new_path": "refs",
"diff": ""
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Rename 'analyse' stage in 'analysis' + move the test script + add a '.gitignore' file.
|
8,490 |
25.01.2018 11:29:42
| -3,600 |
aa57445f383e9d2abfcbb154f78d29d42344f2ee
|
Improve the readme by adding a short presentation of AFF3CT.
|
[
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "@@ -15,4 +15,3 @@ doc/html/\ndoc/latex/\nsrc/Tools/version.cpp\ntest-regression-results/\n\\ No newline at end of file\n-\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "-# How to compile and run the code\n+# AFF3CT Short Presentation\n+\n+**AFF3CT** (A Fast Forward Error Correction Tool!) is a library dedicated to the [Forward Error Correction](https://en.wikipedia.org/wiki/Forward_error_correction) (FEC or channel coding).\n+It is written in **C++11** and it supports a large range of codes: from the well-spread **Turbo codes** to the very new **Polar codes** including the **Low-Density Parity-Check (LDPC) codes**.\n+AFF3CT can be used in two different ways, as:\n+- a dedicated **toolbox** or **library** that can be used in various projects,\n+- a **standalone application** for [Monte Carlo](https://en.wikipedia.org/wiki/Monte_Carlo_method) [BER/FER](https://en.wikipedia.org/wiki/Bit_error_rate) and [EXIT chart](https://en.wikipedia.org/wiki/EXIT_chart) simulations.\n+The following section focuses on the compilation and the execution of the AFF3CT standalone application.\n+\n+# How to Compile and Run the Code\n+\nThis project use `cmake` in order to generate any type of projects (Makefile, Visual Studio, Eclipse, CLion, etc.).\n-## Get the Git submodules\n+## Get the Git Submodules\nAFF3CT depends on some other Git repositories (or submodules). It is highly recommended to get those submodules before trying to do anything else. Here is the command to get all the required submodules:\n$ git submodule update --init --recursive\n-## Exemple of a Makefile project generation (with the C++ GNU compiler)\n+## Example of a Makefile Project Generation (with the C++ GNU Compiler)\n-Open a shell and type (from the `AFF3CT` root folder):\n+Open a terminal and type (from the `AFF3CT` root folder):\n$ mkdir build\n$ cd build\n$ cmake .. -G\"Unix Makefiles\" -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=\"-funroll-loops -march=native -DMULTI_PREC\"\n-## Compile the code with the Makefile\n+## Compile the Code with the Makefile\n$ make -j4\nThis command will use the generated Makefile.\n-## Run the code\n+## Run the Code\nHere is an example of run. You can skip the computations of the current SNR point with the `ctrl+c` combination on the keyboard.\nIf you use `ctrl+c` twice in a small time-step (500ms), the program will stop.\n-### Decoding of the Polar codes with the Successive Cancellation List decoder (SCL)\n+### Decoding of the Polar Codes with the Successive Cancellation List Decoder (SCL)\n-Open a shell and type (from the `$ROOT_AFF3CT/build/` folder):\n+Open a terminal and type (from the `$ROOT_AFF3CT/build/` folder):\n$ ./bin/aff3ct -C POLAR -m 1 -M 4 -s 0.25 -K 1755 -N 2048 --crc-poly 32-GZIP --dec-type ASCL\n@@ -63,6 +73,9 @@ Expected output:\n3.25 | 4.00 | 174249 | 1910 | 100 | 6.36e-06 | 5.74e-04 || 28.97 | 00h00'10\n# End of the simulation.\n-## More\n+# More\n-See the [AFF3CT Wiki](https://github.com/aff3ct/aff3ct/wiki).\n+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\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the readme by adding a short presentation of AFF3CT.
|
8,490 |
25.01.2018 11:38:18
| -3,600 |
6ca4f77c16a7348a8df92c15d4a5b37a9454e52f
|
Up the readme.
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "**AFF3CT** (A Fast Forward Error Correction Tool!) is a library dedicated to the [Forward Error Correction](https://en.wikipedia.org/wiki/Forward_error_correction) (FEC or channel coding).\nIt is written in **C++11** and it supports a large range of codes: from the well-spread **Turbo codes** to the very new **Polar codes** including the **Low-Density Parity-Check (LDPC) codes**.\nAFF3CT can be used in two different ways, as:\n-- a dedicated **toolbox** or **library** that can be used in various projects,\n+- a dedicated **toolbox** or **library** for your projects, many modules (like codecs, modems, channels, ...) are available and easy to use,\n- a **standalone application** for [Monte Carlo](https://en.wikipedia.org/wiki/Monte_Carlo_method) [BER/FER](https://en.wikipedia.org/wiki/Bit_error_rate) and [EXIT chart](https://en.wikipedia.org/wiki/EXIT_chart) simulations.\n+\nThe following section focuses on the compilation and the execution of the AFF3CT standalone application.\n# How to Compile and Run the Code\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Up the readme.
|
8,490 |
25.01.2018 19:15:13
| -3,600 |
600ad125b765f6153287f1a8f784d2298b65f972
|
Fix the regression script.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/test-regression.py",
"new_path": "ci/test-regression.py",
"diff": "@@ -93,6 +93,7 @@ if os.path.isdir(args.refsPath):\nfileNamesTmp = os.listdir(args.refsPath)\nfor f in fileNamesTmp:\nif not os.path.isdir(args.refsPath + \"/\" + f):\n+ if pathlib.Path(f).suffix in extensions:\nfileNames.append(f)\nelse:\nif args.recursiveScan:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the regression script.
|
8,490 |
25.01.2018 19:16:12
| -3,600 |
b21dfb2b5e4101d02b62244fae7d0503ff440912
|
Fix compilation error when using -DPREC_8_BIT and -DPREC_16_BIT.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Launcher/Launcher.cpp",
"new_path": "src/Factory/Launcher/Launcher.cpp",
"diff": "@@ -81,7 +81,11 @@ void factory::Launcher::parameters\nopt_args[{p+\"-type\"}] =\n{\"string\",\n\"select the type of simulation to launch (default is BFER).\",\n- \"BFER, BFERI, EXIT\"};\n+ \"BFER, BFERI\"};\n+\n+#if !defined(PREC_8_BIT) && !defined(PREC_16_BIT)\n+ opt_args[{p+\"-type\"}][2] += \", EXIT\";\n+#endif\n#ifdef MULTI_PREC\nopt_args[{p+\"-prec\", \"p\"}] =\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/EXIT/EXIT.cpp",
"new_path": "src/Factory/Simulation/EXIT/EXIT.cpp",
"diff": "+#if !defined(PREC_8_BIT) && !defined(PREC_16_BIT)\n+\n#include \"Simulation/EXIT/EXIT.hpp\"\n#include \"EXIT.hpp\"\n@@ -175,3 +177,4 @@ template aff3ct::simulation::EXIT<B,R>* aff3ct::factory::EXIT::build<B,R>(const\n#endif\n// ==================================================================================== explicit template instantiation\n+#endif\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Simulation/EXIT/EXIT.hpp",
"new_path": "src/Factory/Simulation/EXIT/EXIT.hpp",
"diff": "+#if !defined(PREC_8_BIT) && !defined(PREC_16_BIT)\n+\n#ifndef FACTORY_SIMULATION_EXIT_HPP_\n#define FACTORY_SIMULATION_EXIT_HPP_\n@@ -88,3 +90,5 @@ struct EXIT : Simulation\n}\n#endif /* FACTORY_SIMULATION_EXIT_HPP_ */\n+\n+#endif\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/EXIT.cpp",
"new_path": "src/Launcher/Simulation/EXIT.cpp",
"diff": "+#if !defined(PREC_8_BIT) && !defined(PREC_16_BIT)\n+\n#include \"Simulation/EXIT/EXIT.hpp\"\n#include <thread>\n@@ -141,3 +143,4 @@ template class aff3ct::launcher::EXIT<B,R>;\n#endif\n// ==================================================================================== explicit template instantiation\n+#endif\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Simulation/EXIT.hpp",
"new_path": "src/Launcher/Simulation/EXIT.hpp",
"diff": "+#if !defined(PREC_8_BIT) && !defined(PREC_16_BIT)\n+\n#ifndef LAUNCHER_EXIT_HPP_\n#define LAUNCHER_EXIT_HPP_\n@@ -29,3 +31,5 @@ protected:\n}\n#endif /* LAUNCHER_EXIT_HPP_ */\n+\n+#endif\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/EXIT.cpp",
"new_path": "src/Simulation/EXIT/EXIT.cpp",
"diff": "+#if !defined(PREC_8_BIT) && !defined(PREC_16_BIT)\n+\n#include <cmath>\n#include <algorithm>\n@@ -419,3 +421,5 @@ template class aff3ct::simulation::EXIT<B_64,R_64>;\ntemplate class aff3ct::simulation::EXIT<B,R>;\n#endif\n// ==================================================================================== explicit template instantiation\n+\n+#endif\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/EXIT/EXIT.hpp",
"new_path": "src/Simulation/EXIT/EXIT.hpp",
"diff": "+#if !defined(PREC_8_BIT) && !defined(PREC_16_BIT)\n+\n#ifndef SIMULATION_EXIT_HPP_\n#define SIMULATION_EXIT_HPP_\n@@ -69,3 +71,5 @@ protected:\n}\n#endif /* SIMULATION_EXIT_HPP_ */\n+\n+#endif\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix compilation error when using -DPREC_8_BIT and -DPREC_16_BIT.
|
8,490 |
25.01.2018 21:48:57
| -3,600 |
f915668da6c39181d33e79f52f595b6ed48b1905
|
Fix a possible out of range bug.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/test-regression.py",
"new_path": "ci/test-regression.py",
"diff": "@@ -231,18 +231,18 @@ for fn in fileNames:\nerrorsList = []\nsensibilityList = []\nfor ref in simuRef:\n+ try:\ncur_fe = int(simuCur[idx][4])\n+ except IndexError: # no such line\n+ break\nif cur_fe < args.maxFE / 2:\nbreak\nnumRef = float(ref[6][0:4])\npowerRef = int(ref[6][6:8])\n- try:\nnumCur = float(simuCur[idx][6][0:4])\npowerCur = int(simuCur[idx][6][6:8])\n- except IndexError: # no such line\n- break\nif powerRef - powerCur != 0:\nif powerRef > powerCur:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a possible out of range bug.
|
8,490 |
25.01.2018 23:36:23
| -3,600 |
68859cb56addd73a565a1c36165e70e94dab025a
|
Improve the getFileNames function.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/test-regression.py",
"new_path": "ci/test-regression.py",
"diff": "@@ -39,22 +39,32 @@ extensions = ['.txt', '.perf', '.data', '.dat']\n# =============================================================================\n# =================================================================== FUNCTIONS\n-def recursivelyGetFilenames(currentPath, fileNames):\n+def getFileNames(currentPath, fileNames):\n+ if os.path.isdir(currentPath):\nif not os.path.exists(currentPath.replace(args.refsPath, args.resultsPath)):\nos.makedirs(currentPath.replace(args.refsPath, args.resultsPath))\nfiles = os.listdir(currentPath)\nfor f in files:\n- if \".empty\" in f:\n- continue\nif \"~\" in f:\ncontinue\n- if os.path.isdir(currentPath + \"/\" + f):\nnewCurrentPath = currentPath + \"/\" + f\n- recursivelyGetFilenames(newCurrentPath, fileNames)\n+ if os.path.isdir(newCurrentPath):\n+ if args.recursiveScan:\n+ getFileNames(newCurrentPath, fileNames)\n+ else:\n+ getFileNames(newCurrentPath, fileNames)\nelse:\n- if pathlib.Path(f).suffix in extensions:\n- fileNames.append(currentPath.replace(args.refsPath + \"/\", \"\") + \"/\" + f)\n+ if pathlib.Path(currentPath).suffix in extensions:\n+ if args.refsPath == currentPath:\n+ basename = os.path.basename(args.refsPath)\n+ dirname = args.refsPath.replace(basename, '')\n+ args.refsPath = dirname\n+ fileNames.append(basename)\n+ else:\n+ shortenPath = currentPath.replace(args.refsPath + \"/\", \"\")\n+ shortenPath = shortenPath.replace(args.refsPath, \"\")\n+ fileNames.append(shortenPath)\n# -----\n@@ -86,25 +96,17 @@ print('#')\nPathOrigin = os.getcwd()\n+if os.path.isfile(args.resultsPath):\n+ print(\"# (EE) The results path should not be an existing file.\")\n+ sys.exit(1);\n+\n+# auto create the result folder if it does not exist\n+if not os.path.exists(args.resultsPath):\n+ os.makedirs(args.resultsPath)\n+\n# get the filenames to test\n-isFile = False\nfileNames = []\n-if os.path.isdir(args.refsPath):\n- fileNamesTmp = os.listdir(args.refsPath)\n- for f in fileNamesTmp:\n- if not os.path.isdir(args.refsPath + \"/\" + f):\n- if pathlib.Path(f).suffix in extensions:\n- fileNames.append(f)\n- else:\n- if args.recursiveScan:\n- recursivelyGetFilenames(args.refsPath + \"/\" + f, fileNames)\n-else:\n- isFile = True\n- basename = os.path.basename(args.refsPath)\n- dirname = args.refsPath.replace(basename, '')\n- args.refsPath = dirname\n- if pathlib.Path(basename).suffix in extensions:\n- fileNames.append(basename)\n+getFileNames(args.refsPath, fileNames)\nprint(\"# Starting the test script...\")\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the getFileNames function.
|
8,490 |
26.01.2018 08:53:13
| -3,600 |
44a98efed5d61e5df2cd5de30012349cb6522fb5
|
Improve the path errors management.
|
[
{
"change_type": "MODIFY",
"old_path": "ci/test-regression.py",
"new_path": "ci/test-regression.py",
"diff": "@@ -21,7 +21,7 @@ parser = argparse.ArgumentParser(prog='aff3ct-test-regression', formatter_class=\nparser.add_argument('--refs-path', action='store', dest='refsPath', type=str, default=\"refs\", help='Path to the references to re-simulate.')\nparser.add_argument('--results-path', action='store', dest='resultsPath', type=str, default=\"test-regression-results\", help='Path to the simulated results.')\nparser.add_argument('--build-path', action='store', dest='buildPath', type=str, default=\"build\", help='Path to the AFF3CT build.')\n-parser.add_argument('--start-id', action='store', dest='startId', type=int, default=0, help='Starting id to avoid computing results one again.') # choices=xrange(0, +inf)\n+parser.add_argument('--start-id', action='store', dest='startId', type=int, default=1, help='Starting id to avoid computing results one again.') # choices=xrange(1, +inf)\nparser.add_argument('--sensibility', action='store', dest='sensibility', type=float, default=1.0, help='Sensibility to verify a SNR point.') # choices=xrange(0.0, +inf)\nparser.add_argument('--n-threads', action='store', dest='nThreads', type=int, default=0, help='Number of threads to use in the simulation (0 = all available).') # choices=xrange(0, +ing)\nparser.add_argument('--recursive-scan', action='store', dest='recursiveScan', type=bool, default=True, help='If enabled, scan the path of refs recursively.')\n@@ -54,7 +54,7 @@ def getFileNames(currentPath, fileNames):\ngetFileNames(newCurrentPath, fileNames)\nelse:\ngetFileNames(newCurrentPath, fileNames)\n- else:\n+ elif os.path.isfile(currentPath):\nif pathlib.Path(currentPath).suffix in extensions:\nif args.refsPath == currentPath:\nbasename = os.path.basename(args.refsPath)\n@@ -65,6 +65,8 @@ def getFileNames(currentPath, fileNames):\nshortenPath = currentPath.replace(args.refsPath + \"/\", \"\")\nshortenPath = shortenPath.replace(args.refsPath, \"\")\nfileNames.append(shortenPath)\n+ else:\n+ print(\"# (WW) The path '\", currentPath, \"' does not exist.\")\n# -----\n@@ -77,6 +79,9 @@ def getFileNames(currentPath, fileNames):\n#parser.print_help()\nargs = parser.parse_args()\n+if args.startId <= 0:\n+ args.startId = 1\n+\nprint('# AFF3CT tests')\nprint('# ------------')\nprint('#')\n@@ -108,7 +113,10 @@ if not os.path.exists(args.resultsPath):\nfileNames = []\ngetFileNames(args.refsPath, fileNames)\n-print(\"# Starting the test script...\")\n+if (len(fileNames) - (args.startId -1) > 0) :\n+ print(\"# (II) Starting the test script...\")\n+else:\n+ print(\"# (WW) There is no simulation to replay.\")\nnErrors = 0\ntestId = 0\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the path errors management.
|
8,490 |
26.01.2018 12:04:07
| -3,600 |
63702987f4645a7a01fe11707a6f3d42f4eb54cd
|
First implem of a ML decoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp",
"new_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp",
"diff": "#include \"Module/Decoder/Repetition/Decoder_repetition_std.hpp\"\n#include \"Module/Decoder/Repetition/Decoder_repetition_fast.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n#include \"Decoder_repetition.hpp\"\n@@ -37,7 +38,7 @@ void Decoder_repetition::parameters\nauto p = this->get_prefix();\n- opt_args[{p+\"-type\", \"D\"}].push_back(\"REPETITION\");\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"REPETITION, ML\");\nopt_args[{p+\"-implem\" }].push_back(\"STD, FAST\");\nopt_args[{p+\"-no-buff\"}] =\n@@ -67,37 +68,41 @@ void Decoder_repetition::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_repetition::parameters\n-::build() const\n+::build(module::Encoder_repetition_sys<B> *encoder) 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, this->n_frames);\n+ }\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_repetition\n-::build(const parameters ¶ms)\n+::build(const parameters ¶ms, module::Encoder_repetition_sys<B> *encoder)\n{\n- return params.template build<B,Q>();\n+ return params.template build<B,Q>(encoder);\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_repetition::parameters::build<B_8 ,Q_8 >() const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_repetition::parameters::build<B_16,Q_16>() const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_repetition::parameters::build<B_32,Q_32>() const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_repetition::parameters::build<B_64,Q_64>() const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_repetition::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_repetition::parameters&);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_repetition::build<B_16,Q_16>(const aff3ct::factory::Decoder_repetition::parameters&);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_repetition::build<B_32,Q_32>(const aff3ct::factory::Decoder_repetition::parameters&);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_repetition::build<B_64,Q_64>(const aff3ct::factory::Decoder_repetition::parameters&);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_repetition::parameters::build<B_8 ,Q_8 >(module::Encoder_repetition_sys<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_repetition::parameters::build<B_16,Q_16>(module::Encoder_repetition_sys<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_repetition::parameters::build<B_32,Q_32>(module::Encoder_repetition_sys<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_repetition::parameters::build<B_64,Q_64>(module::Encoder_repetition_sys<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_repetition::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_repetition::parameters&, module::Encoder_repetition_sys<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_repetition::build<B_16,Q_16>(const aff3ct::factory::Decoder_repetition::parameters&, module::Encoder_repetition_sys<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_repetition::build<B_32,Q_32>(const aff3ct::factory::Decoder_repetition::parameters&, module::Encoder_repetition_sys<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_repetition::build<B_64,Q_64>(const aff3ct::factory::Decoder_repetition::parameters&, module::Encoder_repetition_sys<B_64>*);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_repetition::parameters::build<B,Q>() const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_repetition::build<B,Q>(const aff3ct::factory::Decoder_repetition::parameters&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_repetition::parameters::build<B,Q>(module::Encoder_repetition_sys<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_repetition::build<B,Q>(const aff3ct::factory::Decoder_repetition::parameters&, module::Encoder_repetition_sys<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.hpp",
"new_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.hpp",
"diff": "#include <string>\n#include \"Module/Decoder/Decoder_SIHO.hpp\"\n+#include \"Module/Encoder/Repetition/Encoder_repetition_sys.hpp\"\n#include \"../Decoder.hpp\"\n@@ -34,11 +35,11 @@ struct Decoder_repetition : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SIHO<B,Q>* build() const;\n+ module::Decoder_SIHO<B,Q>* build(module::Encoder_repetition_sys<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms);\n+ static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms, module::Encoder_repetition_sys<B> *encoder = nullptr);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Repetition/Encoder_repetition.cpp",
"new_path": "src/Factory/Module/Encoder/Repetition/Encoder_repetition.cpp",
"diff": "@@ -63,7 +63,7 @@ void Encoder_repetition::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_repetition::parameters\n+module::Encoder_repetition_sys<B>* Encoder_repetition::parameters\n::build() const\n{\nif (this->type == \"REPETITION\") return new module::Encoder_repetition_sys<B>(this->K, this->N_cw, this->buffered, this->n_frames);\n@@ -72,7 +72,7 @@ module::Encoder<B>* Encoder_repetition::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_repetition\n+module::Encoder_repetition_sys<B>* Encoder_repetition\n::build(const parameters ¶ms)\n{\nreturn params.template build<B>();\n@@ -81,17 +81,17 @@ module::Encoder<B>* Encoder_repetition\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_repetition::parameters::build<B_8 >() const;\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_repetition::parameters::build<B_16>() const;\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_repetition::parameters::build<B_32>() const;\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_repetition::parameters::build<B_64>() const;\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_repetition::build<B_8 >(const aff3ct::factory::Encoder_repetition::parameters&);\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_repetition::build<B_16>(const aff3ct::factory::Encoder_repetition::parameters&);\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_repetition::build<B_32>(const aff3ct::factory::Encoder_repetition::parameters&);\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_repetition::build<B_64>(const aff3ct::factory::Encoder_repetition::parameters&);\n+template aff3ct::module::Encoder_repetition_sys<B_8 >* aff3ct::factory::Encoder_repetition::parameters::build<B_8 >() const;\n+template aff3ct::module::Encoder_repetition_sys<B_16>* aff3ct::factory::Encoder_repetition::parameters::build<B_16>() const;\n+template aff3ct::module::Encoder_repetition_sys<B_32>* aff3ct::factory::Encoder_repetition::parameters::build<B_32>() const;\n+template aff3ct::module::Encoder_repetition_sys<B_64>* aff3ct::factory::Encoder_repetition::parameters::build<B_64>() const;\n+template aff3ct::module::Encoder_repetition_sys<B_8 >* aff3ct::factory::Encoder_repetition::build<B_8 >(const aff3ct::factory::Encoder_repetition::parameters&);\n+template aff3ct::module::Encoder_repetition_sys<B_16>* aff3ct::factory::Encoder_repetition::build<B_16>(const aff3ct::factory::Encoder_repetition::parameters&);\n+template aff3ct::module::Encoder_repetition_sys<B_32>* aff3ct::factory::Encoder_repetition::build<B_32>(const aff3ct::factory::Encoder_repetition::parameters&);\n+template aff3ct::module::Encoder_repetition_sys<B_64>* aff3ct::factory::Encoder_repetition::build<B_64>(const aff3ct::factory::Encoder_repetition::parameters&);\n#else\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_repetition::parameters::build<B>() const;\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_repetition::build<B>(const aff3ct::factory::Encoder_repetition::parameters&);\n+template aff3ct::module::Encoder_repetition_sys<B>* aff3ct::factory::Encoder_repetition::parameters::build<B>() const;\n+template aff3ct::module::Encoder_repetition_sys<B>* aff3ct::factory::Encoder_repetition::build<B>(const aff3ct::factory::Encoder_repetition::parameters&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Repetition/Encoder_repetition.hpp",
"new_path": "src/Factory/Module/Encoder/Repetition/Encoder_repetition.hpp",
"diff": "#include <string>\n-#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Module/Encoder/Repetition/Encoder_repetition_sys.hpp\"\n#include \"../Encoder.hpp\"\n@@ -34,11 +34,11 @@ struct Encoder_repetition : public Encoder\n// builder\ntemplate <typename B = int>\n- module::Encoder<B>* build() const;\n+ module::Encoder_repetition_sys<B>* build() const;\n};\ntemplate <typename B = int>\n- static module::Encoder<B>* build(const parameters ¶ms);\n+ static module::Encoder_repetition_sys<B>* build(const parameters ¶ms);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/Repetition/Codec_repetition.cpp",
"new_path": "src/Module/Codec/Repetition/Codec_repetition.cpp",
"diff": "@@ -52,16 +52,18 @@ Codec_repetition<B,Q>\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pct_params));\n+ Encoder_repetition_sys<B> *encoder_rep_sys = nullptr;\ntry\n{\n- this->set_encoder(factory::Encoder_repetition::build<B>(enc_params));\n+ encoder_rep_sys = factory::Encoder_repetition::build<B>(enc_params);\n+ this->set_encoder(encoder_rep_sys);\n}\ncatch (tools::cannot_allocate const&)\n{\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n- this->set_decoder_siho(factory::Decoder_repetition::build<B,Q>(dec_params));\n+ this->set_decoder_siho(factory::Decoder_repetition::build<B,Q>(dec_params, encoder_rep_sys));\n}\ntemplate <typename B, typename Q>\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.cpp",
"diff": "+#include <chrono>\n+#include <iostream>\n+\n+#include \"Tools/Exception/exception.hpp\"\n+#include \"Tools/Algo/Bit_packer.hpp\"\n+\n+#include \"Decoder_maximum_likelihood.hpp\"\n+\n+using namespace aff3ct;\n+using namespace aff3ct::module;\n+\n+template <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 (K, N, n_frames, 1),\n+ Decoder_SIHO<B,R>(K, N, n_frames, 1),\n+ encoder(encoder),\n+ U_K(K+7), // +7 to avoid segmentation fault when casting B to uint64_t\n+ X_N(N),\n+ best_U_K(K),\n+ best_X_N(N),\n+ min_euclidean_dist(std::numeric_limits<float>::max())\n+{\n+ const std::string name = \"Decoder_maximum_likelihood\";\n+ this->set_name(name);\n+\n+ if (K > 64)\n+ {\n+ std::stringstream message;\n+ message << \"'K' has to be smaller or equal to 64 ('K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (encoder.get_K() != K)\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.get_K()' has to be equal to 'K' ('encoder.get_K()' = \" << encoder.get_K()\n+ << \", 'K' = \" << K << \").\";\n+ throw tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n+ }\n+\n+ if (encoder.get_N() != N)\n+ {\n+ std::stringstream message;\n+ message << \"'encoder.get_N()' has to be equal to 'N' ('encoder.get_N()' = \" << encoder.get_N()\n+ << \", 'N' = \" << N << \").\";\n+ throw 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+}\n+\n+template <typename B, typename R>\n+Decoder_maximum_likelihood<B,R>\n+::~Decoder_maximum_likelihood()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_maximum_likelihood<B,R>\n+::_decode_siho(const R *Y_N, B *V_K, const int frame_id)\n+{\n+ this->_decode_siho_cw(Y_N, this->best_X_N.data(), frame_id);\n+ std::copy(this->best_U_K.begin(), this->best_U_K.end(), V_K);\n+}\n+\n+template <typename B, typename R>\n+void Decoder_maximum_likelihood<B,R>\n+::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n+{\n+ this->min_euclidean_dist = std::numeric_limits<float>::max();\n+\n+ // determine the maximum sequence 'u' of information bits\n+ uint64_t u_max = 0;\n+ if (this->K > 0)\n+ {\n+ if (this->K == 64)\n+ u_max = std::numeric_limits<uint64_t>::max();\n+ else\n+ u_max = ((uint64_t)1 << (uint64_t)(this->K)) -1;\n+ }\n+\n+ // for all the possible sequences of information bits\n+ for (uint64_t u = 0; u <= u_max; u++)\n+ {\n+ // convert information bits to codeword\n+ std::fill(U_K.begin(), U_K.end(), (B)0);\n+ auto data = (uint64_t*)this->U_K.data();\n+ data[0] = u;\n+ tools::Bit_packer<B>::unpack(this->U_K.data(), this->K);\n+ this->encoder.encode(this->U_K.data(), this->X_N.data());\n+\n+ // compute the Euclidean distance between the input LLR and the current codeword\n+ float cur_euclidean_dist = 0.f;\n+ for (auto n = 0; n < this->N; n++)\n+ {\n+ auto tmp = (this->X_N[n] ? -1.f : +1.f) - (float)Y_N[n];\n+ cur_euclidean_dist += tmp * tmp;\n+ }\n+\n+ // we can avoid the sqrt because of the monotonicity of the sqrt function\n+ // cur_euclidean_dist = std::sqrt(cur_euclidean_dist);\n+\n+ // update the 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.end(), V_N);\n+ std::copy(this->U_K.begin(), this->U_K.begin() + this->K, this->best_U_K.begin());\n+ }\n+\n+ // trick to avoid infinite loop when u_max is the max 64-bit unsigned integer\n+ if (u_max == std::numeric_limits<uint64_t>::max())\n+ break;\n+ }\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_maximum_likelihood<B_8,Q_8>;\n+template class aff3ct::module::Decoder_maximum_likelihood<B_16,Q_16>;\n+template class aff3ct::module::Decoder_maximum_likelihood<B_32,Q_32>;\n+template class aff3ct::module::Decoder_maximum_likelihood<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_maximum_likelihood<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.hpp",
"diff": "+#ifndef DECODER_MAXIMUM_LIKELIHOOD_HPP_\n+#define DECODER_MAXIMUM_LIKELIHOOD_HPP_\n+\n+#include \"Module/Encoder/Encoder.hpp\"\n+\n+#include \"../Decoder_SIHO.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<B,R>\n+{\n+protected:\n+ Encoder<B> &encoder;\n+ std::vector<B> U_K;\n+ std::vector<B> X_N;\n+\n+ std::vector<B> best_U_K;\n+ std::vector<B> best_X_N;\n+ float min_euclidean_dist;\n+\n+public:\n+ Decoder_maximum_likelihood(const int K, const int N, Encoder<B> &encoder, const int n_frames = 1);\n+ virtual ~Decoder_maximum_likelihood();\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+};\n+\n+template <typename B = int, typename R = float>\n+using Decoder_ML = Decoder_maximum_likelihood<B,R>;\n+}\n+}\n+\n+#endif /* DECODER_MAXIMUM_LIKELIHOOD_HPP_ */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
First implem of a ML decoder.
|
8,490 |
26.01.2018 13:45:20
| -3,600 |
51def87125710e1f68eb8d42072f663b7d6a9661
|
Add the ML decoder with the minimal Hamming distance (dmin).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp",
"new_path": "src/Factory/Module/Decoder/Repetition/Decoder_repetition.cpp",
"diff": "@@ -77,7 +77,7 @@ module::Decoder_SIHO<B,Q>* Decoder_repetition::parameters\n}\nelse if (this->type == \"ML\" && encoder)\n{\n- return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, this->n_frames);\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/Module/Decoder/ML/Decoder_maximum_likelihood.cpp",
"new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.cpp",
"diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Tools/Algo/Bit_packer.hpp\"\n+#include \"Tools/Perf/hard_decision.h\"\n#include \"Decoder_maximum_likelihood.hpp\"\n@@ -11,15 +12,19 @@ using namespace aff3ct::module;\ntemplate <typename B, typename R>\nDecoder_maximum_likelihood<B,R>\n-::Decoder_maximum_likelihood(const int K, const int N, Encoder<B> &encoder, const int n_frames)\n+::Decoder_maximum_likelihood(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_SIHO<B,R>(K, N, n_frames, 1),\n+ Decoder_SIHO_HIHO<B,R>(K, N, n_frames, 1),\nencoder(encoder),\n+ hamming(hamming),\nU_K(K+7), // +7 to avoid segmentation fault when casting B to uint64_t\nX_N(N),\nbest_U_K(K),\nbest_X_N(N),\n- min_euclidean_dist(std::numeric_limits<float>::max())\n+ hard_Y_N(N),\n+ u_max(0),\n+ min_euclidean_dist(std::numeric_limits<float>::max()),\n+ min_hamming_dist(0)\n{\nconst std::string name = \"Decoder_maximum_likelihood\";\nthis->set_name(name);\n@@ -54,6 +59,15 @@ Decoder_maximum_likelihood<B,R>\n<< encoder.get_n_frames() << \").\";\nthrow tools::invalid_argument(__FILE__, __LINE__, __func__, message.str());\n}\n+\n+ // determine the maximum sequence 'u' of information bits\n+ if (K > 0)\n+ {\n+ if (K == 64)\n+ u_max = std::numeric_limits<uint64_t>::max();\n+ else\n+ u_max = ((uint64_t)1 << (uint64_t)(K)) -1;\n+ }\n}\ntemplate <typename B, typename R>\n@@ -74,22 +88,20 @@ template <typename B, typename R>\nvoid Decoder_maximum_likelihood<B,R>\n::_decode_siho_cw(const R *Y_N, B *V_N, const int frame_id)\n{\n- this->min_euclidean_dist = std::numeric_limits<float>::max();\n-\n- // determine the maximum sequence 'u' of information bits\n- uint64_t u_max = 0;\n- if (this->K > 0)\n+ // compute Hamming distance instead of Euclidean distance\n+ if (hamming)\n{\n- if (this->K == 64)\n- u_max = std::numeric_limits<uint64_t>::max();\n- else\n- u_max = ((uint64_t)1 << (uint64_t)(this->K)) -1;\n+ tools::hard_decide(Y_N, this->hard_Y_N.data(), this->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// for all the possible sequences of information bits\n- for (uint64_t u = 0; u <= u_max; u++)\n+ for (uint64_t u = 0; u <= this->u_max; u++)\n{\n- // convert information bits to codeword\n+ // convert the information bits to the codeword\nstd::fill(U_K.begin(), U_K.end(), (B)0);\nauto data = (uint64_t*)this->U_K.data();\ndata[0] = u;\n@@ -107,7 +119,7 @@ void Decoder_maximum_likelihood<B,R>\n// we can avoid the sqrt because of the monotonicity of the sqrt function\n// cur_euclidean_dist = std::sqrt(cur_euclidean_dist);\n- // update the codeword\n+ // update the best codeword\nif (cur_euclidean_dist < this->min_euclidean_dist)\n{\nthis->min_euclidean_dist = cur_euclidean_dist;\n@@ -120,6 +132,50 @@ void Decoder_maximum_likelihood<B,R>\nbreak;\n}\n}\n+}\n+\n+template <typename B, typename R>\n+void Decoder_maximum_likelihood<B,R>\n+::_decode_hiho(const B *Y_N, B *V_K, const int frame_id)\n+{\n+ this->_decode_hiho_cw(Y_N, this->best_X_N.data(), frame_id);\n+ std::copy(this->best_U_K.begin(), this->best_U_K.end(), V_K);\n+}\n+\n+template <typename B, typename R>\n+void Decoder_maximum_likelihood<B,R>\n+::_decode_hiho_cw(const B *Y_N, B *V_N, const int frame_id)\n+{\n+ this->min_hamming_dist = std::numeric_limits<uint64_t>::max();\n+\n+ // for all the possible sequences of information bits\n+ for (uint64_t u = 0; u <= this->u_max; u++)\n+ {\n+ // convert the information bits to the codeword\n+ std::fill(U_K.begin(), U_K.end(), (B)0);\n+ auto data = (uint64_t*)this->U_K.data();\n+ data[0] = u;\n+ tools::Bit_packer<B>::unpack(this->U_K.data(), this->K);\n+ this->encoder.encode(this->U_K.data(), this->X_N.data());\n+\n+ // compute the Hamming distance between the input bits and the current codeword\n+ uint64_t cur_hamming_dist = 0;\n+ for (auto n = 0; n < this->N; n++)\n+ cur_hamming_dist += this->X_N[n] != Y_N[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.end(), V_N);\n+ std::copy(this->U_K.begin(), this->U_K.begin() + this->K, this->best_U_K.begin());\n+ }\n+\n+ // trick to avoid infinite loop when u_max is the max 64-bit unsigned integer\n+ if (u_max == std::numeric_limits<uint64_t>::max())\n+ break;\n+ }\n+}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\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": "#include \"Module/Encoder/Encoder.hpp\"\n-#include \"../Decoder_SIHO.hpp\"\n+#include \"../Decoder_SIHO_HIHO.hpp\"\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int, typename R = float>\n-class Decoder_maximum_likelihood : public Decoder_SIHO<B,R>\n+class Decoder_maximum_likelihood : public Decoder_SIHO_HIHO<B,R>\n{\nprotected:\nEncoder<B> &encoder;\n+ const bool hamming;\nstd::vector<B> U_K;\nstd::vector<B> X_N;\n-\nstd::vector<B> best_U_K;\nstd::vector<B> best_X_N;\n+ std::vector<B> hard_Y_N;\n+ uint64_t u_max;\nfloat min_euclidean_dist;\n+ uint64_t min_hamming_dist;\npublic:\n- Decoder_maximum_likelihood(const int K, const int N, Encoder<B> &encoder, const int n_frames = 1);\n+ Decoder_maximum_likelihood(const int K, const int N, Encoder<B> &encoder, const bool hamming = false,\n+ const int n_frames = 1);\nvirtual ~Decoder_maximum_likelihood();\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);\n};\ntemplate <typename B = int, typename R = float>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ML decoder with the minimal Hamming distance (dmin).
|
8,490 |
26.01.2018 17:15:18
| -3,600 |
c28398ec94a60b027924438da9fbc98fbd80cbdd
|
Add the ML decoder for the RA codes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/RA/Decoder_RA.cpp",
"new_path": "src/Factory/Module/Decoder/RA/Decoder_RA.cpp",
"diff": "#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Decoder/RA/Decoder_RA.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n#include \"Decoder_RA.hpp\"\n@@ -72,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\");\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"RA, ML\");\nopt_args[{p+\"-implem\" }].push_back(\"STD\");\nopt_args[{p+\"-ite\", \"i\"}] =\n@@ -104,39 +105,46 @@ void Decoder_RA::parameters\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}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_RA::parameters\n-::build(const module::Interleaver<Q> &itl) const\n+::build(const module::Interleaver<Q> &itl, module::Encoder_RA<B> *encoder) 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\" && this->implem == \"STD\" && 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}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_RA\n-::build(const parameters ¶ms, const module::Interleaver<Q> &itl)\n+::build(const parameters ¶ms, const module::Interleaver<Q> &itl, module::Encoder_RA<B> *encoder)\n{\n- return params.template build<B,Q>(itl);\n+ return params.template build<B,Q>(itl, encoder);\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_RA::parameters::build<B_8 ,Q_8 >(const aff3ct::module::Interleaver<Q_8 >&) const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RA::parameters::build<B_16,Q_16>(const aff3ct::module::Interleaver<Q_16>&) const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RA::parameters::build<B_32,Q_32>(const aff3ct::module::Interleaver<Q_32>&) const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RA::parameters::build<B_64,Q_64>(const aff3ct::module::Interleaver<Q_64>&) const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RA::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_8 >&);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RA::build<B_16,Q_16>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_16>&);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RA::build<B_32,Q_32>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_32>&);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RA::build<B_64,Q_64>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_64>&);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RA::parameters::build<B_8 ,Q_8 >(const aff3ct::module::Interleaver<Q_8 >&, module::Encoder_RA<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RA::parameters::build<B_16,Q_16>(const aff3ct::module::Interleaver<Q_16>&, module::Encoder_RA<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RA::parameters::build<B_32,Q_32>(const aff3ct::module::Interleaver<Q_32>&, module::Encoder_RA<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RA::parameters::build<B_64,Q_64>(const aff3ct::module::Interleaver<Q_64>&, module::Encoder_RA<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RA::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_8 >&, module::Encoder_RA<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RA::build<B_16,Q_16>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_16>&, module::Encoder_RA<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RA::build<B_32,Q_32>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_32>&, module::Encoder_RA<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RA::build<B_64,Q_64>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q_64>&, module::Encoder_RA<B_64>*);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RA::parameters::build<B,Q>(const aff3ct::module::Interleaver<Q>&) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RA::build<B,Q>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q>&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RA::parameters::build<B,Q>(const aff3ct::module::Interleaver<Q>&, module::Encoder_RA<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RA::build<B,Q>(const aff3ct::factory::Decoder_RA::parameters&, const aff3ct::module::Interleaver<Q>&, module::Encoder_RA<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/RA/Decoder_RA.hpp",
"new_path": "src/Factory/Module/Decoder/RA/Decoder_RA.hpp",
"diff": "#include <string>\n#include \"Module/Decoder/Decoder_SIHO.hpp\"\n+#include \"Module/Encoder/RA/Encoder_RA.hpp\"\n#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n@@ -43,11 +44,13 @@ struct Decoder_RA : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SIHO<B,Q>* build(const module::Interleaver<Q> &itl) const;\n+ module::Decoder_SIHO<B,Q>* build(const module::Interleaver<Q> &itl,\n+ module::Encoder_RA<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms, const module::Interleaver<Q> &itl);\n+ static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms, const module::Interleaver<Q> &itl,\n+ module::Encoder_RA<B> *encoder = nullptr);\n};\n}\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": "@@ -63,6 +63,7 @@ void Decoder_repetition::parameters\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@@ -75,7 +76,7 @@ module::Decoder_SIHO<B,Q>* Decoder_repetition::parameters\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+ else if (this->type == \"ML\" && this->implem == \"STD\" && encoder)\n{\nreturn new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/RA/Encoder_RA.cpp",
"new_path": "src/Factory/Module/Encoder/RA/Encoder_RA.cpp",
"diff": "@@ -92,7 +92,7 @@ void Encoder_RA::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_RA::parameters\n+module::Encoder_RA<B>* Encoder_RA::parameters\n::build(const module::Interleaver<B> &itl) const\n{\nif (this->type == \"RA\") return new module::Encoder_RA<B>(this->K, this->N_cw, itl, this->n_frames);\n@@ -101,7 +101,7 @@ module::Encoder<B>* Encoder_RA::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_RA\n+module::Encoder_RA<B>* Encoder_RA\n::build(const parameters& params, const module::Interleaver<B> &itl)\n{\nreturn params.template build<B>(itl);\n@@ -110,16 +110,16 @@ module::Encoder<B>* Encoder_RA\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_RA::parameters::build<B_8 >(const aff3ct::module::Interleaver<B_8 >&) const;\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_RA::parameters::build<B_16>(const aff3ct::module::Interleaver<B_16>&) const;\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_RA::parameters::build<B_32>(const aff3ct::module::Interleaver<B_32>&) const;\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_RA::parameters::build<B_64>(const aff3ct::module::Interleaver<B_64>&) const;\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_RA::build<B_8 >(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_8 >&);\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_RA::build<B_16>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_16>&);\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_RA::build<B_32>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_32>&);\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_RA::build<B_64>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_64>&);\n+template aff3ct::module::Encoder_RA<B_8 >* aff3ct::factory::Encoder_RA::parameters::build<B_8 >(const aff3ct::module::Interleaver<B_8 >&) const;\n+template aff3ct::module::Encoder_RA<B_16>* aff3ct::factory::Encoder_RA::parameters::build<B_16>(const aff3ct::module::Interleaver<B_16>&) const;\n+template aff3ct::module::Encoder_RA<B_32>* aff3ct::factory::Encoder_RA::parameters::build<B_32>(const aff3ct::module::Interleaver<B_32>&) const;\n+template aff3ct::module::Encoder_RA<B_64>* aff3ct::factory::Encoder_RA::parameters::build<B_64>(const aff3ct::module::Interleaver<B_64>&) const;\n+template aff3ct::module::Encoder_RA<B_8 >* aff3ct::factory::Encoder_RA::build<B_8 >(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_8 >&);\n+template aff3ct::module::Encoder_RA<B_16>* aff3ct::factory::Encoder_RA::build<B_16>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_16>&);\n+template aff3ct::module::Encoder_RA<B_32>* aff3ct::factory::Encoder_RA::build<B_32>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_32>&);\n+template aff3ct::module::Encoder_RA<B_64>* aff3ct::factory::Encoder_RA::build<B_64>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B_64>&);\n#else\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_RA::parameters::build<B>(const aff3ct::module::Interleaver<B>&) const;\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_RA::build<B>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B>&);\n+template aff3ct::module::Encoder_RA<B>* aff3ct::factory::Encoder_RA::parameters::build<B>(const aff3ct::module::Interleaver<B>&) const;\n+template aff3ct::module::Encoder_RA<B>* aff3ct::factory::Encoder_RA::build<B>(const aff3ct::factory::Encoder_RA::parameters&, const aff3ct::module::Interleaver<B>&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/RA/Encoder_RA.hpp",
"new_path": "src/Factory/Module/Encoder/RA/Encoder_RA.hpp",
"diff": "#include <string>\n-#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Module/Encoder/RA/Encoder_RA.hpp\"\n#include \"Module/Interleaver/Interleaver.hpp\"\n#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n@@ -41,11 +41,11 @@ struct Encoder_RA : public Encoder\n// builder\ntemplate <typename B = int>\n- module::Encoder<B>* build(const module::Interleaver<B> &itl) const;\n+ module::Encoder_RA<B>* build(const module::Interleaver<B> &itl) const;\n};\ntemplate <typename B = int>\n- static module::Encoder<B>* build(const parameters& params, const module::Interleaver<B> &itl);\n+ static module::Encoder_RA<B>* build(const parameters& params, const module::Interleaver<B> &itl);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/RA/RA.cpp",
"new_path": "src/Launcher/Code/RA/RA.cpp",
"diff": "@@ -33,8 +33,6 @@ void RA<L,B,R,Q>\nthis->opt_args.erase({penc+\"-fra\", \"F\"});\nthis->opt_args.erase({penc+\"-seed\", \"S\"});\n- this->opt_args.erase({pdec+\"-implem\" });\n- this->opt_args.erase({pdec+\"-type\", \"D\"});\nthis->opt_args.erase({pitl+\"-seed\", \"S\"});\nL::get_description_args();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/RA/Codec_RA.cpp",
"new_path": "src/Module/Codec/RA/Codec_RA.cpp",
"diff": "@@ -54,16 +54,18 @@ Codec_RA<B,Q>\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pct_params));\nthis->set_interleaver(factory::Interleaver_core::build<>(*dec_params.itl->core));\n+ Encoder_RA<B> *encoder_ra = nullptr;\ntry\n{\n- this->set_encoder(factory::Encoder_RA::build<B>(enc_params, this->get_interleaver_bit()));\n+ encoder_ra = factory::Encoder_RA::build<B>(enc_params, this->get_interleaver_bit());\n+ this->set_encoder(encoder_ra);\n}\ncatch (tools::cannot_allocate const&)\n{\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n- this->set_decoder_siho(factory::Decoder_RA::build<B,Q>(dec_params, this->get_interleaver_llr()));\n+ this->set_decoder_siho(factory::Decoder_RA::build<B,Q>(dec_params, this->get_interleaver_llr(), encoder_ra));\n}\ntemplate <typename B, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.cpp",
"new_path": "src/Module/Decoder/ML/Decoder_maximum_likelihood.cpp",
"diff": "@@ -114,6 +114,7 @@ void Decoder_maximum_likelihood<B,R>\n{\nauto tmp = (this->X_N[n] ? -1.f : +1.f) - (float)Y_N[n];\ncur_euclidean_dist += tmp * tmp;\n+ // cur_euclidean_dist += std::abs(tmp); // performance degradation with the abs\n}\n// we can avoid the sqrt because of the monotonicity of the sqrt function\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ML decoder for the RA codes.
|
8,490 |
26.01.2018 17:48:43
| -3,600 |
13947dfeea56bd934af080392390d0661de0c7a7
|
Add the ML decoder for the Polar codes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp",
"new_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.cpp",
"diff": "#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp\"\n#include \"Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp\"\n#include \"Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n//#define API_POLAR_DYNAMIC 1\n@@ -76,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\");\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"SC, SCL, SCL_MEM, ASCL, ASCL_MEM, SCAN, ML\");\nopt_args[{p+\"-ite\", \"i\"}] =\n{\"strictly_positive_int\",\n@@ -128,6 +129,8 @@ void Decoder_polar::parameters\nauto p = this->get_prefix();\n+ if (this->type != \"ML\")\n+ {\nif (!this->simd_strategy.empty())\nheaders[p].push_back(std::make_pair(\"SIMD strategy\", this->simd_strategy));\n@@ -151,6 +154,7 @@ void Decoder_polar::parameters\nthis->type == \"ASCL_MEM\") && this->implem == \"FAST\")\nheaders[p].push_back(std::make_pair(\"Polar node types\", this->polar_nodes));\n}\n+}\ntemplate <typename B, typename Q>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_polar::parameters\n@@ -242,8 +246,13 @@ module::Decoder_SIHO<B,Q>* Decoder_polar::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_polar::parameters\n-::build(const std::vector<bool> &frozen_bits, module::CRC<B> *crc) const\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{\n+ return new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n+ }\n+\nif (this->type.find(\"SCL\") != std::string::npos && this->implem == \"FAST\")\n{\nif (this->simd_strategy == \"INTRA\")\n@@ -348,9 +357,10 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_polar\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_polar\n-::build(const parameters& params, const std::vector<bool> &frozen_bits, module::CRC<B> *crc)\n+::build(const parameters& params, const std::vector<bool> &frozen_bits, module::CRC<B> *crc,\n+ module::Encoder_polar<B> *encoder)\n{\n- return params.template build<B,Q>(frozen_bits, crc);\n+ return params.template build<B,Q>(frozen_bits, crc, encoder);\n}\n// ==================================================================================== explicit template instantiation\n@@ -370,16 +380,16 @@ template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_polar:\n#endif\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_polar::parameters::build<B_8 ,Q_8 >(const std::vector<bool>&, module::CRC<B_8 >*) const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_polar::parameters::build<B_16,Q_16>(const std::vector<bool>&, module::CRC<B_16>*) const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_polar::parameters::build<B_32,Q_32>(const std::vector<bool>&, module::CRC<B_32>*) const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_polar::parameters::build<B_64,Q_64>(const std::vector<bool>&, module::CRC<B_64>*) const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_polar::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_8 >*);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_polar::build<B_16,Q_16>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_16>*);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_polar::build<B_32,Q_32>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_32>*);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_polar::build<B_64,Q_64>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_64>*);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_polar::parameters::build<B_8 ,Q_8 >(const std::vector<bool>&, module::CRC<B_8 >*, module::Encoder_polar<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_polar::parameters::build<B_16,Q_16>(const std::vector<bool>&, module::CRC<B_16>*, module::Encoder_polar<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_polar::parameters::build<B_32,Q_32>(const std::vector<bool>&, module::CRC<B_32>*, module::Encoder_polar<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_polar::parameters::build<B_64,Q_64>(const std::vector<bool>&, module::CRC<B_64>*, module::Encoder_polar<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_polar::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_8 >*, module::Encoder_polar<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_polar::build<B_16,Q_16>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_16>*, module::Encoder_polar<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_polar::build<B_32,Q_32>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_32>*, module::Encoder_polar<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_polar::build<B_64,Q_64>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B_64>*, module::Encoder_polar<B_64>*);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_polar::parameters::build<B,Q>(const std::vector<bool>&, module::CRC<B>*) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_polar::build<B,Q>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B>*);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_polar::parameters::build<B,Q>(const std::vector<bool>&, module::CRC<B>*, module::Encoder_polar<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_polar::build<B,Q>(const aff3ct::factory::Decoder_polar::parameters&, const std::vector<bool>&, module::CRC<B>*, module::Encoder_polar<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.hpp",
"new_path": "src/Factory/Module/Decoder/Polar/Decoder_polar.hpp",
"diff": "#include \"Module/CRC/CRC.hpp\"\n#include \"Module/Decoder/Decoder_SISO_SIHO.hpp\"\n#include \"Module/Decoder/Decoder_SIHO.hpp\"\n+#include \"Module/Encoder/Polar/Encoder_polar.hpp\"\n#include \"../Decoder.hpp\"\n@@ -45,7 +46,8 @@ struct Decoder_polar : public Decoder\nmodule::Decoder_SISO_SIHO<B,Q>* build_siso(const std::vector<bool> &frozen_bits) const;\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SIHO<B,Q>* build(const std::vector<bool> &frozen_bits, module::CRC<B> *crc = nullptr) const;\n+ module::Decoder_SIHO<B,Q>* build(const std::vector<bool> &frozen_bits, module::CRC<B> *crc = nullptr,\n+ module::Encoder_polar<B> *encoder = nullptr) const;\ntemplate <typename B = int, typename Q = float>\nmodule::Decoder_SIHO<B,Q>* build_gen(module::CRC<B> *crc = nullptr) const;\n@@ -70,7 +72,7 @@ struct Decoder_polar : public Decoder\ntemplate <typename B = int, typename Q = float>\nstatic module::Decoder_SIHO<B,Q>* build(const parameters& params, const std::vector<bool> &frozen_bits,\n- module::CRC<B> *crc = nullptr);\n+ module::CRC<B> *crc = nullptr, module::Encoder_polar<B> *encoder = nullptr);\ntemplate <typename B = int, typename Q = float>\nstatic module::Decoder_SIHO<B,Q>* build_gen(const parameters ¶ms, module::CRC<B> *crc = nullptr);\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": "@@ -117,7 +117,7 @@ module::Decoder_SIHO<B,Q>* Decoder_RA::parameters\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\" && this->implem == \"STD\" && encoder)\n+ else if (this->type == \"ML\" && encoder)\n{\nreturn new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\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": "@@ -76,7 +76,7 @@ module::Decoder_SIHO<B,Q>* Decoder_repetition::parameters\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\" && this->implem == \"STD\" && encoder)\n+ else if (this->type == \"ML\" && encoder)\n{\nreturn new module::Decoder_ML<B,Q>(this->K, this->N_cw, *encoder, false, this->n_frames);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Polar/Encoder_polar.cpp",
"new_path": "src/Factory/Module/Encoder/Polar/Encoder_polar.cpp",
"diff": "@@ -56,7 +56,7 @@ void Encoder_polar::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_polar::parameters\n+module::Encoder_polar<B>* Encoder_polar::parameters\n::build(const std::vector<bool> &frozen_bits) const\n{\nif (this->type == \"POLAR\" && !this->systematic) return new module::Encoder_polar <B>(this->K, this->N_cw, frozen_bits, this->n_frames);\n@@ -66,7 +66,7 @@ module::Encoder<B>* Encoder_polar::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_polar\n+module::Encoder_polar<B>* Encoder_polar\n::build(const parameters& params, const std::vector<bool> &frozen_bits)\n{\nreturn params.template build<B>(frozen_bits);\n@@ -75,16 +75,16 @@ module::Encoder<B>* Encoder_polar\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_polar::parameters::build<B_8 >(const std::vector<bool>&) const;\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_polar::parameters::build<B_16>(const std::vector<bool>&) const;\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_polar::parameters::build<B_32>(const std::vector<bool>&) const;\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_polar::parameters::build<B_64>(const std::vector<bool>&) const;\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_polar::build<B_8 >(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_polar::build<B_16>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_polar::build<B_32>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_polar::build<B_64>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n+template aff3ct::module::Encoder_polar<B_8 >* aff3ct::factory::Encoder_polar::parameters::build<B_8 >(const std::vector<bool>&) const;\n+template aff3ct::module::Encoder_polar<B_16>* aff3ct::factory::Encoder_polar::parameters::build<B_16>(const std::vector<bool>&) const;\n+template aff3ct::module::Encoder_polar<B_32>* aff3ct::factory::Encoder_polar::parameters::build<B_32>(const std::vector<bool>&) const;\n+template aff3ct::module::Encoder_polar<B_64>* aff3ct::factory::Encoder_polar::parameters::build<B_64>(const std::vector<bool>&) const;\n+template aff3ct::module::Encoder_polar<B_8 >* aff3ct::factory::Encoder_polar::build<B_8 >(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n+template aff3ct::module::Encoder_polar<B_16>* aff3ct::factory::Encoder_polar::build<B_16>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n+template aff3ct::module::Encoder_polar<B_32>* aff3ct::factory::Encoder_polar::build<B_32>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n+template aff3ct::module::Encoder_polar<B_64>* aff3ct::factory::Encoder_polar::build<B_64>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n#else\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_polar::parameters::build<B>(const std::vector<bool>&) const;\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_polar::build<B>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n+template aff3ct::module::Encoder_polar<B>* aff3ct::factory::Encoder_polar::parameters::build<B>(const std::vector<bool>&) const;\n+template aff3ct::module::Encoder_polar<B>* aff3ct::factory::Encoder_polar::build<B>(const aff3ct::factory::Encoder_polar::parameters&, const std::vector<bool>&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Polar/Encoder_polar.hpp",
"new_path": "src/Factory/Module/Encoder/Polar/Encoder_polar.hpp",
"diff": "#include <string>\n#include <vector>\n-#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Module/Encoder/Polar/Encoder_polar.hpp\"\n#include \"../Encoder.hpp\"\n@@ -34,11 +34,11 @@ struct Encoder_polar : public Encoder\n// builder\ntemplate <typename B = int>\n- module::Encoder<B>* build(const std::vector<bool> &frozen_bits) const;\n+ module::Encoder_polar<B>* build(const std::vector<bool> &frozen_bits) const;\n};\ntemplate <typename B = int>\n- static module::Encoder<B>* build(const parameters ¶ms, const std::vector<bool> &frozen_bits);\n+ static module::Encoder_polar<B>* build(const parameters ¶ms, const std::vector<bool> &frozen_bits);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/Polar/Codec_polar.cpp",
"new_path": "src/Module/Codec/Polar/Codec_polar.cpp",
"diff": "@@ -91,9 +91,11 @@ Codec_polar<B,Q>\n}\n}\n+ Encoder_polar<B>* encoder_polar = nullptr;\ntry\n{\n- this->set_encoder(factory::Encoder_polar::build<B>(enc_params, frozen_bits));\n+ encoder_polar = factory::Encoder_polar::build<B>(enc_params, frozen_bits);\n+ this->set_encoder(encoder_polar);\n}\ncatch (tools::cannot_allocate const&)\n{\n@@ -111,8 +113,9 @@ Codec_polar<B,Q>\nif (generated_decoder)\nthis->set_decoder_siho(factory::Decoder_polar::build_gen<B,Q>(dec_params, crc ));\nelse\n- this->set_decoder_siho(factory::Decoder_polar::build <B,Q>(dec_params, frozen_bits, crc));\n+ this->set_decoder_siho(factory::Decoder_polar::build <B,Q>(dec_params, frozen_bits, crc, encoder_polar));\n}\n+ if (dec_params.type != \"ML\")\nthis->fb_decoder = dynamic_cast<tools::Frozenbits_notifier*>(this->get_decoder_siho());\n// ------------------------------------------------------------------------------------------------- frozen bit gen\n@@ -161,6 +164,7 @@ void Codec_polar<B,Q>\nif (this->N_cw != this->N)\npuncturer_wangliu->gen_frozen_bits(frozen_bits);\n+ if (this->fb_decoder)\nthis->fb_decoder->notify_frozenbits_update();\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ML decoder for the Polar codes.
|
8,490 |
26.01.2018 18:08:18
| -3,600 |
340c129719873dabc8bab24a5536133737adb2f1
|
Add the ML decoder for the LDPC codes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Decoder.cpp",
"new_path": "src/Factory/Module/Decoder/Decoder.cpp",
"diff": "@@ -69,7 +69,7 @@ void Decoder::parameters\nauto p = this->get_prefix();\nheaders[p].push_back(std::make_pair(\"Type (D)\",this->type));\n- if(this->implem.size())\n+ if(this->implem.size() && this->type != \"ML\")\nheaders[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)));\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": "#include \"Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp\"\n#include \"Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_ONMS_inter.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n#include \"Decoder_LDPC.hpp\"\n@@ -60,7 +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\");\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED, ML\");\nopt_args[{p+\"-implem\"}].push_back(\"ONMS, SPA, LSPA, GALA, AMS\");\n@@ -115,6 +116,8 @@ void Decoder_LDPC::parameters\nauto p = this->get_prefix();\n+ if (this->type != \"ML\")\n+ {\nif (!this->H_path.empty())\n{\nheaders[p].push_back(std::make_pair(\"H matrix path\", this->H_path));\n@@ -141,6 +144,7 @@ void Decoder_LDPC::parameters\nif (this->implem == \"AMS\")\nheaders[p].push_back(std::make_pair(\"Min type\", this->min));\n}\n+}\ntemplate <typename B, typename Q>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_LDPC::parameters\n@@ -176,12 +180,17 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_LDPC::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_LDPC::parameters\n-::build(const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos) const\n+::build(const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos,\n+ module::Encoder_LDPC<B> *encoder) const\n{\nif ((this->type == \"BP\" || this->type == \"BP_FLOODING\") && this->simd_strategy.empty())\n{\nif (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}\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+ }\nreturn build_siso<B,Q>(H, info_bits_pos);\n@@ -197,9 +206,10 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_LDPC\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_LDPC\n-::build(const parameters& params, const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos)\n+::build(const parameters& params, const tools::Sparse_matrix &H, const std::vector<unsigned> &info_bits_pos,\n+ module::Encoder_LDPC<B> *encoder)\n{\n- return params.template build<B,Q>(H, info_bits_pos);\n+ return params.template build<B,Q>(H, info_bits_pos, encoder);\n}\n// ==================================================================================== explicit template instantiation\n@@ -220,16 +230,16 @@ template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_LDPC::parameters::build<B_8 ,Q_8 >(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&) const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_LDPC::parameters::build<B_16,Q_16>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&) const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_LDPC::parameters::build<B_32,Q_32>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&) const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_LDPC::parameters::build<B_64,Q_64>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&) const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_LDPC::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_LDPC::build<B_16,Q_16>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_LDPC::build<B_32,Q_32>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_LDPC::build<B_64,Q_64>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_LDPC::parameters::build<B_8 ,Q_8 >(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_LDPC::parameters::build<B_16,Q_16>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_LDPC::parameters::build<B_32,Q_32>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_LDPC::parameters::build<B_64,Q_64>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_LDPC::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_LDPC::build<B_16,Q_16>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_LDPC::build<B_32,Q_32>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_LDPC::build<B_64,Q_64>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B_64>*);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::parameters::build<B,Q>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::build<B,Q>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::parameters::build<B,Q>(const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_LDPC::build<B,Q>(const aff3ct::factory::Decoder_LDPC::parameters&, const aff3ct::tools::Sparse_matrix&, const std::vector<unsigned>&, module::Encoder_LDPC<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp",
"new_path": "src/Factory/Module/Decoder/LDPC/Decoder_LDPC.hpp",
"diff": "#include \"Module/Decoder/Decoder_SIHO.hpp\"\n#include \"Module/Decoder/Decoder_SISO_SIHO.hpp\"\n+#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n#include \"../Decoder.hpp\"\n@@ -48,7 +49,8 @@ struct Decoder_LDPC : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\nmodule::Decoder_SIHO<B,Q>* build(const tools::Sparse_matrix &H,\n- const std::vector<unsigned> &info_bits_pos) const;\n+ const std::vector<unsigned> &info_bits_pos,\n+ module::Encoder_LDPC<B> *encoder = nullptr) const;\ntemplate <typename B = int, typename Q = float>\nmodule::Decoder_SISO_SIHO<B,Q>* build_siso(const tools::Sparse_matrix &H,\n@@ -57,7 +59,8 @@ struct Decoder_LDPC : public Decoder\ntemplate <typename B = int, typename Q = float>\nstatic module::Decoder_SIHO<B,Q>* build(const parameters& params, const tools::Sparse_matrix &H,\n- const std::vector<unsigned> &info_bits_pos);\n+ const std::vector<unsigned> &info_bits_pos,\n+ module::Encoder_LDPC<B> *encoder = nullptr);\ntemplate <typename B = int, typename Q = float>\nstatic module::Decoder_SISO_SIHO<B,Q>* build_siso(const parameters& params, const tools::Sparse_matrix &H,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"new_path": "src/Module/Codec/LDPC/Codec_LDPC.cpp",
"diff": "@@ -123,8 +123,6 @@ Codec_LDPC<B,Q>\n}\n}\n-\n-\nauto H_format = get_matrix_format(dec_params.H_path);\nstd::ifstream file_H(dec_params.H_path, std::ifstream::in);\n@@ -197,9 +195,11 @@ Codec_LDPC<B,Q>\n}\n}\n+ Encoder_LDPC<B> *encoder_LDPC = nullptr;\ntry\n{\n- this->set_encoder(factory::Encoder_LDPC::build<B>(enc_params, G, H));\n+ encoder_LDPC = factory::Encoder_LDPC::build<B>(enc_params, G, H);\n+ this->set_encoder(encoder_LDPC);\n}\ncatch (tools::cannot_allocate const&)\n{\n@@ -214,7 +214,7 @@ Codec_LDPC<B,Q>\n}\ncatch (const std::exception&)\n{\n- this->set_decoder_siho(factory::Decoder_LDPC::build<B,Q>(dec_params, H, info_bits_pos));\n+ this->set_decoder_siho(factory::Decoder_LDPC::build<B,Q>(dec_params, H, info_bits_pos, encoder_LDPC));\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ML decoder for the LDPC codes.
|
8,490 |
26.01.2018 18:25:05
| -3,600 |
df15267acb7c59332d868f763cfa6a4fd5820f89
|
Add the ML decoder for the BCH codes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Factory/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "#include <sstream>\n-#include \"Tools/Exception/exception.hpp\"\n#include \"Module/Decoder/BCH/Decoder_BCH.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n+\n+#include \"Tools/Exception/exception.hpp\"\n#include \"Decoder_BCH.hpp\"\n@@ -37,6 +39,9 @@ void Decoder_BCH::parameters\nauto p = this->get_prefix();\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"ALGEBRAIC, ML\");\n+ opt_args[{p+\"-implem\"}].push_back(\"STD\");\n+\nopt_args[{p+\"-corr-pow\", \"T\"}] =\n{\"strictly_positive_int\",\n\"correction power of the BCH code.\"};\n@@ -70,43 +75,50 @@ void Decoder_BCH::parameters\nauto p = this->get_prefix();\n+ if (this->type != \"ML\")\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+}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_BCH::parameters\n-::build(const tools::BCH_polynomial_generator &GF) const\n+::build(const tools::BCH_polynomial_generator &GF, module::Encoder_BCH<B> *encoder) 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}\ntemplate <typename B, typename Q>\nmodule::Decoder_SIHO<B,Q>* Decoder_BCH\n-::build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF)\n+::build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF, module::Encoder_BCH<B> *encoder)\n{\n- return params.template build<B,Q>(GF);\n+ return params.template build<B,Q>(GF, encoder);\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_BCH::parameters::build<B_8 ,Q_8 >(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::parameters::build<B_16,Q_16>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::parameters::build<B_32,Q_32>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::parameters::build<B_64,Q_64>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n-template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::build<B_16,Q_16>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n-template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::build<B_32,Q_32>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n-template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::build<B_64,Q_64>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::parameters::build<B_8 ,Q_8 >(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::parameters::build<B_16,Q_16>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::parameters::build<B_32,Q_32>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::parameters::build<B_64,Q_64>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_BCH::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_BCH::build<B_16,Q_16>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_BCH::build<B_32,Q_32>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_BCH::build<B_64,Q_64>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B_64>*);\n#else\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::parameters::build<B,Q>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::build<B,Q>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::parameters::build<B,Q>(const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_BCH::build<B,Q>(const aff3ct::factory::Decoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&, module::Encoder_BCH<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\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 \"Module/Decoder/Decoder_SIHO.hpp\"\n#include \"Module/Decoder/Decoder_SISO.hpp\"\n+#include \"Module/Encoder/BCH/Encoder_BCH.hpp\"\n#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n#include \"../Decoder.hpp\"\n@@ -40,11 +41,13 @@ struct Decoder_BCH : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SIHO<B,Q>* build(const tools::BCH_polynomial_generator &GF) const;\n+ module::Decoder_SIHO<B,Q>* build(const tools::BCH_polynomial_generator &GF,\n+ module::Encoder_BCH<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF);\n+ static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF,\n+ module::Encoder_BCH<B> *encoder = nullptr);\n};\n}\n}\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": "@@ -51,7 +51,7 @@ void Encoder_BCH::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_BCH::parameters\n+module::Encoder_BCH<B>* Encoder_BCH::parameters\n::build(const tools::BCH_polynomial_generator &GF) const\n{\nif (this->type == \"BCH\") return new module::Encoder_BCH<B>(this->K, this->N_cw, GF, this->n_frames);\n@@ -60,7 +60,7 @@ module::Encoder<B>* Encoder_BCH::parameters\n}\ntemplate <typename B>\n-module::Encoder<B>* Encoder_BCH\n+module::Encoder_BCH<B>* Encoder_BCH\n::build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF)\n{\nreturn params.template build<B>(GF);\n@@ -69,16 +69,16 @@ module::Encoder<B>* Encoder_BCH\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::parameters::build<B_8 >(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::parameters::build<B_16>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::parameters::build<B_32>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::parameters::build<B_64>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Encoder<B_8 >* aff3ct::factory::Encoder_BCH::build<B_8 >(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n-template aff3ct::module::Encoder<B_16>* aff3ct::factory::Encoder_BCH::build<B_16>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n-template aff3ct::module::Encoder<B_32>* aff3ct::factory::Encoder_BCH::build<B_32>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n-template aff3ct::module::Encoder<B_64>* aff3ct::factory::Encoder_BCH::build<B_64>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder_BCH<B_8 >* aff3ct::factory::Encoder_BCH::parameters::build<B_8 >(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder_BCH<B_16>* aff3ct::factory::Encoder_BCH::parameters::build<B_16>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder_BCH<B_32>* aff3ct::factory::Encoder_BCH::parameters::build<B_32>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder_BCH<B_64>* aff3ct::factory::Encoder_BCH::parameters::build<B_64>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder_BCH<B_8 >* aff3ct::factory::Encoder_BCH::build<B_8 >(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder_BCH<B_16>* aff3ct::factory::Encoder_BCH::build<B_16>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder_BCH<B_32>* aff3ct::factory::Encoder_BCH::build<B_32>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder_BCH<B_64>* aff3ct::factory::Encoder_BCH::build<B_64>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n#else\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::parameters::build<B>(const aff3ct::tools::BCH_polynomial_generator&) const;\n-template aff3ct::module::Encoder<B>* aff3ct::factory::Encoder_BCH::build<B>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n+template aff3ct::module::Encoder_BCH<B>* aff3ct::factory::Encoder_BCH::parameters::build<B>(const aff3ct::tools::BCH_polynomial_generator&) const;\n+template aff3ct::module::Encoder_BCH<B>* aff3ct::factory::Encoder_BCH::build<B>(const aff3ct::factory::Encoder_BCH::parameters&, const aff3ct::tools::BCH_polynomial_generator&);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.hpp",
"new_path": "src/Factory/Module/Encoder/BCH/Encoder_BCH.hpp",
"diff": "#include <string>\n-#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Module/Encoder/BCH/Encoder_BCH.hpp\"\n#include \"Tools/Code/BCH/BCH_polynomial_generator.hpp\"\n#include \"../Encoder.hpp\"\n@@ -34,11 +34,11 @@ struct Encoder_BCH : public Encoder\n// builder\ntemplate <typename B = int>\n- module::Encoder<B>* build(const tools::BCH_polynomial_generator &GF) const;\n+ module::Encoder_BCH<B>* build(const tools::BCH_polynomial_generator &GF) const;\n};\ntemplate <typename B = int>\n- static module::Encoder<B>* build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF);\n+ static module::Encoder_BCH<B>* build(const parameters ¶ms, const tools::BCH_polynomial_generator &GF);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Code/BCH/BCH.cpp",
"new_path": "src/Launcher/Code/BCH/BCH.cpp",
"diff": "@@ -32,8 +32,6 @@ void BCH<L,B,R,Q>\nthis->opt_args.erase({penc+\"-fra\", \"F\"});\nthis->opt_args.erase({penc+\"-seed\", \"S\"});\n- this->opt_args.erase({pdec+\"-implem\" });\n- this->opt_args.erase({pdec+\"-type\", \"D\"});\nL::get_description_args();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/BCH/Codec_BCH.cpp",
"new_path": "src/Module/Codec/BCH/Codec_BCH.cpp",
"diff": "@@ -55,16 +55,18 @@ Codec_BCH<B,Q>\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pct_params));\n+ Encoder_BCH<B> *encoder_BCH = nullptr;\ntry\n{\n- this->set_encoder(factory::Encoder_BCH::build<B>(enc_params, GF_poly));\n+ encoder_BCH = factory::Encoder_BCH::build<B>(enc_params, GF_poly);\n+ this->set_encoder(encoder_BCH);\n}\ncatch (tools::cannot_allocate const&)\n{\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));\n+ this->set_decoder_siho(factory::Decoder_BCH::build<B,Q>(dec_params, GF_poly, encoder_BCH));\n}\ntemplate <typename B, typename Q>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ML decoder for the BCH codes.
|
8,490 |
26.01.2018 19:00:51
| -3,600 |
b0aafb5917c5ae05643e1af7309ad5e87b63fd06
|
Add the ML decoder for the RSC codes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp",
"new_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.cpp",
"diff": "#include \"Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_fast.hpp\"\n#include \"Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_very_fast.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n+\n#include \"Decoder_RSC.hpp\"\nusing namespace aff3ct;\n@@ -57,7 +59,7 @@ void Decoder_RSC::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, STD, FAST, VERY_FAST\");\n@@ -129,6 +131,8 @@ void Decoder_RSC::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@@ -146,10 +150,11 @@ void Decoder_RSC::parameters\nheaders[p].push_back(std::make_pair(std::string(\"Max type\"), this->max));\n}\n+}\ntemplate <typename B, typename Q, typename QD, tools::proto_max<Q> MAX1, tools::proto_max<QD> MAX2>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_RSC::parameters\n-::_build_seq(const std::vector<std::vector<int>> &trellis,\n+::_build_siso_seq(const std::vector<std::vector<int>> &trellis,\nstd::ostream &stream,\nconst int n_ite) const\n{\n@@ -168,7 +173,7 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_RSC::parameters\ntemplate <typename B, typename Q, typename QD, tools::proto_max_i<Q> MAX>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_RSC::parameters\n-::_build_simd(const std::vector<std::vector<int>> &trellis) const\n+::_build_siso_simd(const std::vector<std::vector<int>> &trellis) const\n{\nif (this->type == \"BCJR\" && this->simd_strategy == \"INTER\")\n{\n@@ -216,7 +221,7 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_RSC::parameters\ntemplate <typename B, typename Q>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_RSC::parameters\n-::build(const std::vector<std::vector<int>> &trellis,\n+::build_siso(const std::vector<std::vector<int>> &trellis,\nstd::ostream &stream,\nconst int n_ite) const\n{\n@@ -224,43 +229,83 @@ module::Decoder_SISO_SIHO<B,Q>* Decoder_RSC::parameters\nif (this->simd_strategy.empty())\n{\n- if (this->max == \"MAX\" ) return _build_seq<B,Q,QD,tools::max <Q>,tools::max <QD>>(trellis, stream, n_ite);\n- else if (this->max == \"MAXS\") return _build_seq<B,Q,QD,tools::max_star <Q>,tools::max_star <QD>>(trellis, stream, n_ite);\n- else if (this->max == \"MAXL\") return _build_seq<B,Q,QD,tools::max_linear<Q>,tools::max_linear<QD>>(trellis, stream, n_ite);\n+ if (this->max == \"MAX\" ) return _build_siso_seq<B,Q,QD,tools::max <Q>,tools::max <QD>>(trellis, stream, n_ite);\n+ else if (this->max == \"MAXS\") return _build_siso_seq<B,Q,QD,tools::max_star <Q>,tools::max_star <QD>>(trellis, stream, n_ite);\n+ else if (this->max == \"MAXL\") return _build_siso_seq<B,Q,QD,tools::max_linear<Q>,tools::max_linear<QD>>(trellis, stream, n_ite);\n}\nelse\n{\n- if (this->max == \"MAX\" ) return _build_simd<B,Q,QD,tools::max_i <Q>>(trellis);\n- else if (this->max == \"MAXS\") return _build_simd<B,Q,QD,tools::max_star_i <Q>>(trellis);\n- else if (this->max == \"MAXL\") return _build_simd<B,Q,QD,tools::max_linear_i<Q>>(trellis);\n+ if (this->max == \"MAX\" ) return _build_siso_simd<B,Q,QD,tools::max_i <Q>>(trellis);\n+ else if (this->max == \"MAXS\") return _build_siso_simd<B,Q,QD,tools::max_star_i <Q>>(trellis);\n+ else if (this->max == \"MAXL\") return _build_siso_simd<B,Q,QD,tools::max_linear_i<Q>>(trellis);\n+ }\n+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_RSC::parameters\n+::build(const std::vector<std::vector<int>> &trellis,\n+ std::ostream &stream,\n+ const int n_ite,\n+ module::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+ return build_siso<B,Q>(trellis, stream, n_ite);\n+\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\ntemplate <typename B, typename Q>\nmodule::Decoder_SISO_SIHO<B,Q>* Decoder_RSC\n-::build(const parameters ¶ms,\n+::build_siso(const parameters ¶ms,\nconst std::vector<std::vector<int>> &trellis,\nstd::ostream &stream,\nconst int n_ite)\n{\n- return params.template build<B,Q>(trellis, stream, n_ite);\n+ return params.template build_siso<B,Q>(trellis, stream, n_ite);\n+}\n+\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_RSC\n+::build(const parameters ¶ms,\n+ const std::vector<std::vector<int>> &trellis,\n+ std::ostream &stream,\n+ const int n_ite,\n+ module::Encoder_RSC_sys<B> *encoder)\n+{\n+ return params.template build<B,Q>(trellis, stream, n_ite, encoder);\n}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC::parameters::build<B_8 ,Q_8 >(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC::parameters::build<B_16,Q_16>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC::parameters::build<B_32,Q_32>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC::parameters::build<B_64,Q_64>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n-template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC::build<B_16,Q_16>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n-template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC::build<B_32,Q_32>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n-template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC::build<B_64,Q_64>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n+template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC::parameters::build_siso<B_8 ,Q_8 >(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC::parameters::build_siso<B_16,Q_16>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC::parameters::build_siso<B_32,Q_32>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC::parameters::build_siso<B_64,Q_64>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC::build_siso<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n+template aff3ct::module::Decoder_SISO_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC::build_siso<B_16,Q_16>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n+template aff3ct::module::Decoder_SISO_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC::build_siso<B_32,Q_32>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n+template aff3ct::module::Decoder_SISO_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC::build_siso<B_64,Q_64>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n+#else\n+template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_RSC::parameters::build_siso<B,Q>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n+template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_RSC::build_siso<B,Q>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n+#endif\n+\n+#ifdef MULTI_PREC\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC::parameters::build<B_8 ,Q_8 >(const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_8 >*) const;\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC::parameters::build<B_16,Q_16>(const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_16>*) const;\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC::parameters::build<B_32,Q_32>(const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_32>*) const;\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC::parameters::build<B_64,Q_64>(const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_64>*) const;\n+template aff3ct::module::Decoder_SIHO<B_8 ,Q_8 >* aff3ct::factory::Decoder_RSC::build<B_8 ,Q_8 >(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_8 >*);\n+template aff3ct::module::Decoder_SIHO<B_16,Q_16>* aff3ct::factory::Decoder_RSC::build<B_16,Q_16>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_16>*);\n+template aff3ct::module::Decoder_SIHO<B_32,Q_32>* aff3ct::factory::Decoder_RSC::build<B_32,Q_32>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_32>*);\n+template aff3ct::module::Decoder_SIHO<B_64,Q_64>* aff3ct::factory::Decoder_RSC::build<B_64,Q_64>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B_64>*);\n#else\n-template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_RSC::parameters::build<B,Q>(const std::vector<std::vector<int>>&, std::ostream&, const int) const;\n-template aff3ct::module::Decoder_SISO_SIHO<B,Q>* aff3ct::factory::Decoder_RSC::build<B,Q>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int);\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RSC::parameters::build<B,Q>(const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B>*) const;\n+template aff3ct::module::Decoder_SIHO<B,Q>* aff3ct::factory::Decoder_RSC::build<B,Q>(const aff3ct::factory::Decoder_RSC::parameters&, const std::vector<std::vector<int>>&, std::ostream&, const int, module::Encoder_RSC_sys<B>*);\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.hpp",
"new_path": "src/Factory/Module/Decoder/RSC/Decoder_RSC.hpp",
"diff": "#include \"Tools/Math/max.h\"\n#include \"Module/Decoder/Decoder_SISO_SIHO.hpp\"\n+#include \"Module/Encoder/RSC/Encoder_RSC_sys.hpp\"\n#include \"../Decoder.hpp\"\n@@ -43,22 +44,35 @@ struct Decoder_RSC : public Decoder\n// builder\ntemplate <typename B = int, typename Q = float>\n- module::Decoder_SISO_SIHO<B,Q>* build(const std::vector<std::vector<int>> &trellis,\n+ module::Decoder_SIHO<B,Q>* build(const std::vector<std::vector<int>> &trellis,\n+ std::ostream &stream = std::cout,\n+ const int n_ite = 1,\n+ module::Encoder_RSC_sys<B> *encoder = nullptr) const;\n+\n+ template <typename B = int, typename Q = float>\n+ module::Decoder_SISO_SIHO<B,Q>* build_siso(const std::vector<std::vector<int>> &trellis,\nstd::ostream &stream = std::cout,\nconst int n_ite = 1) const;\nprivate:\ntemplate <typename B = int, typename Q = float, typename QD = Q, tools::proto_max<Q> MAX1, tools::proto_max<QD> MAX2>\n- module::Decoder_SISO_SIHO<B,Q>* _build_seq(const std::vector<std::vector<int>> &trellis,\n+ module::Decoder_SISO_SIHO<B,Q>* _build_siso_seq(const std::vector<std::vector<int>> &trellis,\nstd::ostream &stream = std::cout,\nconst int n_ite = 1) const;\ntemplate <typename B = int, typename Q = float, typename QD = Q, tools::proto_max_i<Q> MAX>\n- module::Decoder_SISO_SIHO<B,Q>* _build_simd(const std::vector<std::vector<int>> &trellis) const;\n+ module::Decoder_SISO_SIHO<B,Q>* _build_siso_simd(const std::vector<std::vector<int>> &trellis) const;\n};\ntemplate <typename B = int, typename Q = float>\n- static module::Decoder_SISO_SIHO<B,Q>* build(const parameters ¶ms,\n+ static module::Decoder_SIHO<B,Q>* build(const parameters ¶ms,\n+ const std::vector<std::vector<int>> &trellis,\n+ std::ostream &stream = std::cout,\n+ const int n_ite = 1,\n+ module::Encoder_RSC_sys<B> *encoder = nullptr);\n+\n+ template <typename B = int, typename Q = float>\n+ static module::Decoder_SISO_SIHO<B,Q>* build_siso(const parameters ¶ms,\nconst std::vector<std::vector<int>> &trellis,\nstd::ostream &stream = std::cout,\nconst int n_ite = 1);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/RSC/Codec_RSC.cpp",
"new_path": "src/Module/Codec/RSC/Codec_RSC.cpp",
"diff": "@@ -63,19 +63,28 @@ Codec_RSC<B,Q>\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pct_params));\n+ Encoder_RSC_sys<B> *encoder_RSC_bis = nullptr;\ntry\n{\n- this->set_encoder(factory::Encoder_RSC::build<B>(enc_params));\n+ encoder_RSC_bis = factory::Encoder_RSC::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::build<B,Q>(dec_params, trellis);\n+ try\n+ {\n+ auto decoder_siso_siho = factory::Decoder_RSC::build_siso<B,Q>(dec_params, trellis);\nthis->set_decoder_siso(decoder_siso_siho);\nthis->set_decoder_siho(decoder_siso_siho);\n}\n+ catch (const std::exception&)\n+ {\n+ this->set_decoder_siho(factory::Decoder_RSC::build<B,Q>(dec_params, trellis, std::cout, 1, encoder_RSC_bis));\n+ }\n+}\ntemplate <typename B, typename Q>\nCodec_RSC<B,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/Turbo/Codec_turbo.cpp",
"new_path": "src/Module/Codec/Turbo/Codec_turbo.cpp",
"diff": "@@ -104,7 +104,7 @@ Codec_turbo<B,Q>\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n- sub_dec = factory::Decoder_RSC::build<B,Q>(*dec_params.sub1, trellis, json_stream, dec_params.n_ite);\n+ sub_dec = factory::Decoder_RSC::build_siso<B,Q>(*dec_params.sub1, trellis, json_stream, dec_params.n_ite);\nauto decoder = factory::Decoder_turbo::build<B,Q>(dec_params, this->get_interleaver_llr(), *sub_dec, *sub_dec);\nthis->set_decoder_siho(decoder);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ML decoder for the RSC codes.
|
8,490 |
26.01.2018 19:35:10
| -3,600 |
a41933c85c4b91fbea8d073da716f4d8425e2afb
|
Add the ML decoder to the Turbo codes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hpp",
"new_path": "src/Factory/Module/Decoder/Turbo/Decoder_turbo.hpp",
"diff": "#include \"Module/Decoder/Turbo/Decoder_turbo.hpp\"\n#include \"Module/Decoder/Decoder_SISO.hpp\"\n#include \"Module/Interleaver/Interleaver.hpp\"\n+#include \"Module/Encoder/Turbo/Encoder_turbo.hpp\"\n#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n#include \"Factory/Tools/Code/Turbo/Flip_and_check.hpp\"\n@@ -59,6 +60,9 @@ struct Decoder_turbo : public Decoder\nmodule::Decoder_turbo<B,Q>* build(const module::Interleaver<Q> &itl,\nmodule::Decoder_SISO<Q> &siso_n,\nmodule::Decoder_SISO<Q> &siso_i) const;\n+\n+ template <typename B = int, typename Q = float>\n+ module::Decoder_SIHO<B,Q>* build_ml(module::Encoder_turbo<B> *encoder = nullptr) const;\n};\ntemplate <typename B = int, typename Q = float, class D1 = Decoder_RSC, class D2 = D1>\n@@ -66,6 +70,10 @@ struct Decoder_turbo : public Decoder\nconst module::Interleaver<Q> &itl,\nmodule::Decoder_SISO<Q> &siso_n,\nmodule::Decoder_SISO<Q> &siso_i);\n+\n+ template <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> ¶ms,\n+ module::Encoder_turbo<B> *encoder = nullptr);\n};\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": "#include \"Module/Decoder/Turbo/Decoder_turbo_std.hpp\"\n#include \"Module/Decoder/Turbo/Decoder_turbo_fast.hpp\"\n+#include \"Module/Decoder/ML/Decoder_maximum_likelihood.hpp\"\n#include \"Decoder_turbo.hpp\"\n@@ -105,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\");\n+ opt_args[{p+\"-type\", \"D\"}].push_back(\"TURBO, ML\");\nopt_args[{p+\"-implem\"}].push_back(\"STD, FAST\");\n@@ -217,6 +218,8 @@ void Decoder_turbo::parameters<D1,D2>\nitl->get_headers(headers, full);\n+ if (this->type != \"ML\")\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@@ -232,6 +235,7 @@ void Decoder_turbo::parameters<D1,D2>\nthis->sub2->get_headers(headers, full);\n}\n}\n+}\ntemplate <class D1, class D2>\ntemplate <typename B, typename Q>\n@@ -249,6 +253,17 @@ module::Decoder_turbo<B,Q>* Decoder_turbo::parameters<D1,D2>\nthrow tools::cannot_allocate(__FILE__, __LINE__, __func__);\n}\n+template <class D1, class D2>\n+template <typename B, typename Q>\n+module::Decoder_SIHO<B,Q>* Decoder_turbo::parameters<D1,D2>\n+::build_ml(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+\n+ throw tools::cannot_allocate(__FILE__, __LINE__, __func__);\n+}\n+\ntemplate <typename B, typename Q, class D1, class D2>\nmodule::Decoder_turbo<B,Q>* Decoder_turbo\n::build(const parameters<D1,D2> ¶ms,\n@@ -258,5 +273,12 @@ module::Decoder_turbo<B,Q>* Decoder_turbo\n{\nreturn params.template build<B,Q>(itl, siso_n, siso_i);\n}\n+\n+template <typename B, typename Q, class D1, class D2>\n+module::Decoder_SIHO<B,Q>* Decoder_turbo\n+::build_ml(const parameters<D1,D2> ¶ms, module::Encoder_turbo<B> *encoder)\n+{\n+ return params.template build_ml<B,Q>(encoder);\n+}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hpp",
"new_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hpp",
"diff": "#include <string>\n#include \"Module/Interleaver/Interleaver.hpp\"\n-#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Module/Encoder/Turbo/Encoder_turbo.hpp\"\n#include \"Factory/Module/Interleaver/Interleaver.hpp\"\n#include \"Factory/Module/Encoder/RSC/Encoder_RSC.hpp\"\n@@ -48,13 +48,13 @@ struct Encoder_turbo : public Encoder\n// builder\ntemplate <typename B = int>\n- module::Encoder<B>* build(const module::Interleaver<B> &itl,\n+ module::Encoder_turbo<B>* build(const module::Interleaver<B> &itl,\nmodule::Encoder <B> *enc_n,\nmodule::Encoder <B> *enc_i = nullptr) const;\n};\ntemplate <typename B = int, class E1 = Encoder_RSC, class E2 = E1>\n- static module::Encoder<B>* build(const parameters<E1,E2> ¶ms,\n+ static module::Encoder_turbo<B>* build(const parameters<E1,E2> ¶ms,\nconst module::Interleaver<B> &itl,\nmodule::Encoder <B> *enc_n,\nmodule::Encoder <B> *enc_i = nullptr);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hxx",
"new_path": "src/Factory/Module/Encoder/Turbo/Encoder_turbo.hxx",
"diff": "@@ -188,7 +188,7 @@ void Encoder_turbo::parameters<E1,E2>\ntemplate <class E1, class E2>\ntemplate <typename B>\n-module::Encoder<B>* Encoder_turbo::parameters<E1,E2>\n+module::Encoder_turbo<B>* Encoder_turbo::parameters<E1,E2>\n::build(const module::Interleaver<B> &itl,\nmodule::Encoder <B> *enc_n,\nmodule::Encoder <B> *enc_i) const\n@@ -208,7 +208,7 @@ module::Encoder<B>* Encoder_turbo::parameters<E1,E2>\n}\ntemplate <typename B, class E1, class E2>\n-module::Encoder<B>* Encoder_turbo\n+module::Encoder_turbo<B>* Encoder_turbo\n::build(const parameters<E1,E2> ¶ms,\nconst module::Interleaver<B> &itl,\nmodule::Encoder <B> *enc_n,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Codec/Turbo/Codec_turbo.cpp",
"new_path": "src/Module/Codec/Turbo/Codec_turbo.cpp",
"diff": "@@ -94,21 +94,33 @@ Codec_turbo<B,Q>\nthis->set_puncturer(factory::Puncturer::build<B,Q>(pctno_params));\n}\n+ Encoder_turbo<B> *encoder_turbo = nullptr;\ntry\n{\nsub_enc = factory::Encoder_RSC::build<B>(*enc_params.sub1, json_stream);\n- this->set_encoder(factory::Encoder_turbo::build<B>(enc_params, this->get_interleaver_bit(), sub_enc, sub_enc));\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}\ncatch (tools::cannot_allocate const&)\n{\nthis->set_encoder(factory::Encoder::build<B>(enc_params));\n}\n+ Decoder_turbo<B,Q>* decoder_turbo = nullptr;\n+ try\n+ {\n+ this->set_decoder_siho(factory::Decoder_turbo::build_ml<B,Q>(dec_params, encoder_turbo));\n+ }\n+ catch (tools::cannot_allocate const&)\n+ {\nsub_dec = factory::Decoder_RSC::build_siso<B,Q>(*dec_params.sub1, trellis, json_stream, dec_params.n_ite);\n- auto decoder = factory::Decoder_turbo::build<B,Q>(dec_params, this->get_interleaver_llr(), *sub_dec, *sub_dec);\n- this->set_decoder_siho(decoder);\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// ------------------------------------------------------------------------------------------------ post processing\n+ if (decoder_turbo)\n+ {\nif (dec_params.sf->enable)\npost_pros.push_back(factory::Scaling_factor::build<B,Q>(*dec_params.sf));\n@@ -120,14 +132,14 @@ Codec_turbo<B,Q>\npost_pros.push_back(factory::Flip_and_check::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<B,Q>(*crc, 2, decoder->get_simd_inter_frame_level()));\n+ post_pros.push_back(new tools::CRC_checker<B,Q>(*crc, 2, decoder_turbo->get_simd_inter_frame_level()));\nif (dec_params.self_corrected)\npost_pros.push_back(new tools::Self_corrected<B,Q>(dec_params.K,\ndec_params.n_ite,\n4,\ndec_params.n_ite,\n- decoder->get_simd_inter_frame_level()));\n+ decoder_turbo->get_simd_inter_frame_level()));\nfor (auto i = 0; i < (int)post_pros.size(); i++)\nif (post_pros[i] != nullptr)\n@@ -135,9 +147,10 @@ Codec_turbo<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"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp",
"new_path": "src/Module/Encoder/Turbo/Encoder_turbo.cpp",
"diff": "@@ -44,6 +44,13 @@ Encoder_turbo<B>\n}\n}\n+template <typename B>\n+int Encoder_turbo<B>\n+::tail_length() const\n+{\n+ return enco_n.tail_length() + enco_i.tail_length();\n+}\n+\ntemplate <typename B>\nvoid Encoder_turbo<B>\n::encode(const B *U_K, 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": "@@ -28,7 +28,7 @@ public:\nconst int n_frames = 1);\nvirtual ~Encoder_turbo() {}\n- int tail_length() const { return enco_n.tail_length() + enco_i.tail_length(); }\n+ int tail_length() const;\nvirtual void encode(const B *U_K, B *X_N); using Encoder<B>::encode;\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": "@@ -13,10 +13,9 @@ template <typename B>\nEncoder_turbo_legacy<B>\n::Encoder_turbo_legacy(const int& K, const int& N, const Interleaver<B> &pi, Encoder<B> &sub_enc,\nconst int n_frames)\n-: Encoder<B>(K, N, n_frames),\n+: Encoder_turbo<B>(K, N, pi, sub_enc, sub_enc, n_frames),\npi(pi),\nsub_enc(sub_enc),\n- U_K_i(K*n_frames),\nX_N_n((2 * (K + sub_enc.tail_length()/2))*n_frames),\nX_N_i((2 * (K + sub_enc.tail_length()/2))*n_frames)\n{\n@@ -44,9 +43,9 @@ template <typename B>\nvoid Encoder_turbo_legacy<B>\n::encode(const B *U_K, B *X_N)\n{\n- pi.interleave (U_K, U_K_i.data(), 0, this->n_frames);\n+ pi.interleave (U_K, this->U_K_i.data(), 0, this->n_frames);\nsub_enc.encode(U_K, X_N_n.data() );\n- sub_enc.encode(U_K_i.data(), X_N_i.data() );\n+ sub_enc.encode(this->U_K_i.data(), X_N_i.data() );\nfor (auto f = 0; f < this->n_frames; f++)\n{\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": "#include <vector>\n#include <string>\n-#include \"Module/Encoder/Encoder.hpp\"\n#include \"Module/Interleaver/Interleaver.hpp\"\n+#include \"Encoder_turbo.hpp\"\n+\nnamespace aff3ct\n{\nnamespace module\n{\ntemplate <typename B = int>\n-class Encoder_turbo_legacy : public Encoder<B>\n+class Encoder_turbo_legacy : public Encoder_turbo<B>\n{\nprotected:\nconst Interleaver<B> π // the interleaver\n-\nEncoder <B> &sub_enc; // sub encoder\n- std::vector<B> U_K_i; // internal buffer for the systematic bits in the interleaved domain\nstd::vector<B> X_N_n; // internal buffer for the encoded bits in the natural domain\nstd::vector<B> X_N_i; // internal buffer for the encoded bits in the interleaved domain\n@@ -27,8 +26,6 @@ public:\nconst int n_frames = 1);\nvirtual ~Encoder_turbo_legacy() {}\n- int tail_length() const { return sub_enc.tail_length() + sub_enc.tail_length(); }\n-\nvirtual void encode(const B *U_K, B *X_N); using Encoder<B>::encode;\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the ML decoder to the Turbo codes.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.