author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
8,490 |
26.02.2017 10:30:25
| -3,600 |
a5e1994e854325d0558482378e98324326b0640c
|
Move warnings and errors in the simulation constructors.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -91,18 +91,7 @@ Simulation_BFER<B,R,Q>\nstd::exit(-1);\n}\n#endif\n-}\n-\n-template <typename B, typename R, typename Q>\n-Simulation_BFER<B,R,Q>\n-::~Simulation_BFER()\n-{\n-}\n-template <typename B, typename R, typename Q>\n-void Simulation_BFER<B,R,Q>\n-::_launch()\n-{\n// check, if the error tracker is enable, if the given file name is good\nif ((this->params.monitor.err_track_enable || this->params.monitor.err_track_revert) &&\n!Monitor_reduction<B,R>::check_path(this->params.monitor.err_track_path))\n@@ -120,11 +109,26 @@ void Simulation_BFER<B,R,Q>\nstd::clog << bold_yellow(\"(WW) Multi-threading detected with error tracking revert feature!\")\n<< bold_yellow(\" Each thread will play the same frames. Please run with one thread.\")\n<< std::endl;\n+\nif (this->params.simulation.inter_frame_level != 1)\nstd::clog << bold_yellow(\"(WW) Inter frame level different than 1 detected with error tracking revert feature!\")\n<< bold_yellow(\" Each bad frame may be played several times. Please run with an inter frame level of 1.\")\n<< std::endl;\n+ }\n+}\n+\n+template <typename B, typename R, typename Q>\n+Simulation_BFER<B,R,Q>\n+::~Simulation_BFER()\n+{\n+}\n+template <typename B, typename R, typename Q>\n+void Simulation_BFER<B,R,Q>\n+::_launch()\n+{\n+ if (this->params.monitor.err_track_revert)\n+ {\nstd::string path_src, path_enc, path_noise;\nMonitor_reduction<B,R>::get_tracker_paths(this->params.monitor.err_track_path, this->snr,\npath_src, path_enc, path_noise);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -93,18 +93,7 @@ Simulation_BFERI<B,R,Q>\nstd::exit(-1);\n}\n#endif\n-}\n-\n-template <typename B, typename R, typename Q>\n-Simulation_BFERI<B,R,Q>\n-::~Simulation_BFERI()\n-{\n-}\n-template <typename B, typename R, typename Q>\n-void Simulation_BFERI<B,R,Q>\n-::_launch()\n-{\n// check, if the error tracker is enable, if the given file name is good\nif ((this->params.monitor.err_track_enable || this->params.monitor.err_track_revert) &&\n!Monitor_reduction<B,R>::check_path(this->params.monitor.err_track_path))\n@@ -122,11 +111,26 @@ void Simulation_BFERI<B,R,Q>\nstd::clog << bold_yellow(\"(WW) Multi-threading detected with error tracking revert feature!\")\n<< bold_yellow(\" Each thread will play the same frames. Please run one thread.\")\n<< std::endl;\n+\nif (this->params.simulation.inter_frame_level != 1)\nstd::clog << bold_yellow(\"(WW) Inter frame level different than 1 detected with error tracking revert feature!\")\n<< bold_yellow(\" Each bad frame may be played several times. Please run with an inter frame level of 1.\")\n<< std::endl;\n+ }\n+}\n+\n+template <typename B, typename R, typename Q>\n+Simulation_BFERI<B,R,Q>\n+::~Simulation_BFERI()\n+{\n+}\n+template <typename B, typename R, typename Q>\n+void Simulation_BFERI<B,R,Q>\n+::_launch()\n+{\n+ if (this->params.monitor.err_track_revert)\n+ {\nstd::string path_src, path_enc, path_noise;\nMonitor_reduction<B,R>::get_tracker_paths(this->params.monitor.err_track_path, this->snr,\npath_src, path_enc, path_noise);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move warnings and errors in the simulation constructors.
|
8,490 |
27.02.2017 13:53:38
| -3,600 |
c96f59b08d9c3502ac30c9026c2bf2cfb505b432
|
Add the full qualifier names (with namespaces) when explicit template instanciation (CRC fast).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial_fast.cpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial_fast.cpp",
"diff": "@@ -234,11 +234,11 @@ unsigned CRC_polynomial_fast<B>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class CRC_polynomial_fast<B_8>;\n-template class CRC_polynomial_fast<B_16>;\n-template class CRC_polynomial_fast<B_32>;\n-template class CRC_polynomial_fast<B_64>;\n+template class aff3ct::module::CRC_polynomial_fast<B_8>;\n+template class aff3ct::module::CRC_polynomial_fast<B_16>;\n+template class aff3ct::module::CRC_polynomial_fast<B_32>;\n+template class aff3ct::module::CRC_polynomial_fast<B_64>;\n#else\n-template class CRC_polynomial_fast<B>;\n+template class aff3ct::module::CRC_polynomial_fast<B>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the full qualifier names (with namespaces) when explicit template instanciation (CRC fast).
|
8,490 |
27.02.2017 14:11:24
| -3,600 |
6526db1a6e08910839b754451e6272d20131add1
|
Fix the SCL_MEM_FAST decoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"diff": "@@ -71,3 +71,4 @@ int Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\nreturn n_valid_paths;\n}\n}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"diff": "#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive.hpp\"\n#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive_sys.hpp\"\n#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp\"\n-//#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp\"\n+#include \"Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp\"\n#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.hpp\"\n#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA_sys.hpp\"\n#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp\"\n-//#include \"Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp\"\n+#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/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp\"\n//#define API_POLAR_DYNAMIC 1\n@@ -213,28 +213,28 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n}\n}\n-// if (params.decoder.type == \"SCL_MEM\" && params.decoder.implem == \"FAST\")\n-// {\n-// if (params.decoder.simd_strategy == \"INTRA\")\n-// {\n-// using API_polar = API_polar_dynamic_intra\n-// <B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\n-// f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n-// if (params.crc.poly.empty())\n-// decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n-// else\n-// decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n-// }\n-// else if (params.decoder.simd_strategy.empty())\n-// {\n-// using API_polar = API_polar_dynamic_seq\n-// <B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\n-// if (params.crc.poly.empty())\n-// decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n-// else\n-// decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n-// }\n-// }\n+ if (params.decoder.type == \"SCL_MEM\" && params.decoder.implem == \"FAST\")\n+ {\n+ if (params.decoder.simd_strategy == \"INTRA\")\n+ {\n+ using API_polar = API_polar_dynamic_intra\n+ <B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\n+ f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n+ if (params.crc.poly.empty())\n+ decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ else\n+ decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ else if (params.decoder.simd_strategy.empty())\n+ {\n+ using API_polar = API_polar_dynamic_seq\n+ <B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\n+ if (params.crc.poly.empty())\n+ decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ else\n+ decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ }\nif (params.decoder.type == \"ASCL\" && params.decoder.implem == \"FAST\")\n{\n@@ -258,24 +258,24 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n}\n}\n-// if (params.decoder.type == \"ASCL_MEM\")\n-// {\n-// if (params.decoder.simd_strategy == \"INTRA\")\n-// {\n-// using API_polar = API_polar_dynamic_intra\n-// <B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\n-// f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n-// if (!params.crc.poly.empty())\n-// decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n-// }\n-// else if (params.decoder.simd_strategy.empty())\n-// {\n-// using API_polar = API_polar_dynamic_seq\n-// <B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\n-// if (!params.crc.poly.empty())\n-// decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n-// }\n-// }\n+ if (params.decoder.type == \"ASCL_MEM\")\n+ {\n+ if (params.decoder.simd_strategy == \"INTRA\")\n+ {\n+ using API_polar = API_polar_dynamic_intra\n+ <B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\n+ f_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\n+ if (!params.crc.poly.empty())\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ else if (params.decoder.simd_strategy.empty())\n+ {\n+ using API_polar = API_polar_dynamic_seq\n+ <B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\n+ if (!params.crc.poly.empty())\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ }\n+ }\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the SCL_MEM_FAST decoder.
|
8,490 |
01.03.2017 11:15:44
| -3,600 |
cc57946ab2adaf44b68ebf09166ec3f2be36d3dd
|
Replace manual copy by std::copy whenever possible.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"diff": "@@ -1148,18 +1148,16 @@ int Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nconst auto n_elmts = 1 << r_d;\nconst auto is_left = (((off_s / n_elmts) % 2) == 0);\n- const auto loop_size = (int)path_2_array_l[old_path].size();\n- for (auto i = 0; i < loop_size; i++)\n- path_2_array_l[new_path][i] = path_2_array_l[old_path][i];\n+ std::copy(path_2_array_l[old_path].begin(), path_2_array_l[old_path].end(), path_2_array_l[new_path].begin());\nfor (auto i = 0; i < m; i++)\nn_array_ref_l[path_2_array_l[new_path][i]][i]++;\n+ std::copy(path_2_array_s[old_path].begin() + r_d +1,\n+ path_2_array_s[old_path].begin() + m,\n+ path_2_array_s[new_path].begin() + r_d +1);\nfor (auto i = r_d +1; i < m; i++)\n- {\n- path_2_array_s[new_path][i] = path_2_array_s[old_path][i];\nn_array_ref_s[path_2_array_s[old_path][i]][i]++;\n- }\nif (!is_left)\n{\n@@ -1167,8 +1165,9 @@ int Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nn_array_ref_s [path_2_array_s[old_path][r_d]][r_d] ++;\n}\n- for (auto i = off_s; i < off_s + n_elmts; i++)\n- s[new_path][i] = s[old_path][i];\n+ std::copy(s[old_path].begin() + off_s,\n+ s[old_path].begin() + off_s + n_elmts,\n+ s[new_path].begin() + off_s);\nreturn new_path;\n}\n@@ -1238,8 +1237,9 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nconst auto child_left = path_2_array_s[paths[i]][r_d - 1];\nif ((child_left != paths[i]) && (n_array_ref_s[paths[i]][r_d -1] > 0))\n- for (auto j = 0; j < n_elm_2; j++)\n- s2[paths[i]][off_s + j] = s[paths[i]][off_s + j];\n+ std::copy(s [paths[i]].begin() + off_s,\n+ s [paths[i]].begin() + off_s + n_elm_2,\n+ s2[paths[i]].begin() + off_s);\n}\n}\ntemplate <typename B, typename R, class API_polar>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace manual copy by std::copy whenever possible.
|
8,490 |
01.03.2017 11:40:37
| -3,600 |
9c4981d02c8e87914a0d91528643e37d13919742
|
Put SCL_MEM_FAST decoder to the same feature level than the SCL_FAST decoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"diff": "@@ -210,8 +210,11 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_polar<B,R,Q>\nif (this->params.decoder.type == \"ASCL\" || this->params.decoder.type == \"ASCL_MEM\")\np.push_back(std::make_pair(\"Max num. of lists (L)\", std::to_string(this->params.decoder.L)));\n- if ((this->params.decoder.type == \"SC\" || this->params.decoder.type == \"SCL\" || this->params.decoder.type == \"ASCL\")\n- && this->params.decoder.implem == \"FAST\")\n+ if ((this->params.decoder.type == \"SC\" ||\n+ this->params.decoder.type == \"SCL\" ||\n+ this->params.decoder.type == \"ASCL\" ||\n+ this->params.decoder.type == \"SCL_MEM\" ||\n+ this->params.decoder.type == \"ASCL_MEM\") && this->params.decoder.implem == \"FAST\")\np.push_back(std::make_pair(\"Polar node types\", this->params.decoder.polar_nodes));\nreturn p;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp",
"diff": "@@ -30,6 +30,13 @@ public:\nDecoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\nCRC<B>& crc, const int n_frames = 1,\nconst std::string name = \"Decoder_polar_ASCL_MEM_fast_CA_sys\");\n+\n+ Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<tools::Pattern_polar_i*> polar_patterns,\n+ const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames = 1,\n+ const std::string name = \"Decoder_polar_ASCL_MEM_fast_CA_sys\");\n+\nvirtual ~Decoder_polar_ASCL_MEM_fast_CA_sys(){};\nvoid load (const mipp::vector<R>& Y_N);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"diff": "@@ -15,6 +15,19 @@ Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\nassert(L_max > 0);\n}\n+template <typename B, typename R, class API_polar>\n+Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n+::Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\n+ const std::vector<tools::Pattern_polar_i*> polar_patterns,\n+ const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames, const std::string name)\n+: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, name),\n+ L_max(L_max), is_full_adaptive(true)\n+{\n+ assert(L_max > 0);\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nvoid Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n::load(const mipp::vector<R>& Y_N)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp",
"diff": "@@ -26,6 +26,12 @@ protected:\npublic:\nDecoder_polar_SCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_MEM_fast_CA_sys\");\n+\n+ Decoder_polar_SCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<tools::Pattern_polar_i*> polar_patterns,\n+ const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames = 1, const std::string name = \"Decoder_polar_SCL_MEM_fast_CA_sys\");\n+\nvirtual ~Decoder_polar_SCL_MEM_fast_CA_sys(){};\nprotected:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"diff": "@@ -14,6 +14,17 @@ Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n{\n}\n+template <typename B, typename R, class API_polar>\n+Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n+::Decoder_polar_SCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\n+ const std::vector<tools::Pattern_polar_i*> polar_patterns,\n+ const int idx_r0, const int idx_r1,\n+ CRC<B>& crc, const int n_frames, const std::string name)\n+: Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, polar_patterns, idx_r0, idx_r1, n_frames, name),\n+ crc(crc), U_test(K)\n+{\n+}\n+\ntemplate <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp",
"diff": "@@ -59,10 +59,12 @@ protected:\npublic:\nDecoder_polar_SCL_MEM_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_MEM_fast_sys\");\n+\nDecoder_polar_SCL_MEM_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCL_fast_sys\");\n+\nvirtual ~Decoder_polar_SCL_MEM_fast_sys();\nvirtual void load (const mipp::vector<R>& Y_N);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"diff": "@@ -215,24 +215,27 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nif (params.decoder.type == \"SCL_MEM\" && params.decoder.implem == \"FAST\")\n{\n+ int idx_r0, idx_r1;\n+ auto polar_patterns = nodes_parser(params.decoder.polar_nodes, idx_r0, idx_r1);\n+\nif (params.decoder.simd_strategy == \"INTRA\")\n{\nusing API_polar = API_polar_dynamic_intra\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\nif (params.crc.poly.empty())\n- decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\nelse\n- decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\nelse if (params.decoder.simd_strategy.empty())\n{\nusing API_polar = API_polar_dynamic_seq\n<B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\nif (params.crc.poly.empty())\n- decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_MEM_fast_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, params.simulation.inter_frame_level);\nelse\n- decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\n}\n@@ -258,22 +261,25 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n}\n}\n- if (params.decoder.type == \"ASCL_MEM\")\n+ if (params.decoder.type == \"ASCL_MEM\" && params.decoder.implem == \"FAST\")\n{\n+ int idx_r0, idx_r1;\n+ auto polar_patterns = nodes_parser(params.decoder.polar_nodes, idx_r0, idx_r1);\n+\nif (params.decoder.simd_strategy == \"INTRA\")\n{\nusing API_polar = API_polar_dynamic_intra\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\nelse if (params.decoder.simd_strategy.empty())\n{\nusing API_polar = API_polar_dynamic_seq\n<B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n}\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Put SCL_MEM_FAST decoder to the same feature level than the SCL_FAST decoder.
|
8,483 |
02.03.2017 09:23:57
| -3,600 |
9164007598b7500a73e4db0d83c47badba62f942
|
working LDPC encoder by reading G matrices in alist format ; working only for BFERI for now ; enable uniform interleaver in BFERI simu
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"diff": "@@ -16,6 +16,7 @@ Launcher_BFER_LDPC<B,R,Q>\n{\nthis->params.code .type = \"LDPC\";\nthis->params.encoder .type = \"AZCW\";\n+ this->params.encoder .systematic = false;\nthis->params.quantizer.n_bits = 6;\nthis->params.quantizer.n_decimals = 2;\nthis->params.decoder .type = \"BP_FLOODING\";\n@@ -37,6 +38,9 @@ void Launcher_BFER_LDPC<B,R,Q>\n{\"string\",\n\"path to the AList formated file.\"};\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ this->opt_args[{\"enc-type\"}][2] += \", LDPC\";\n+\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\nthis->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA, GALA\");\n@@ -107,6 +111,17 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_LDPC<B,R,Q>\nreturn p;\n}\n+template <typename B, typename R, typename Q>\n+std::vector<std::pair<std::string,std::string>> Launcher_BFER_LDPC<B,R,Q>\n+::header_encoder()\n+{\n+ auto p = Launcher_BFER<B,R,Q>::header_encoder();\n+\n+ if (this->params.encoder.type == \"LDPC\")\n+ p.push_back(std::make_pair(\"Path\", this->params.encoder.path));\n+\n+ return p;\n+}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.hpp",
"new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.hpp",
"diff": "@@ -20,6 +20,7 @@ protected:\nvirtual simulation::Simulation* build_simu();\nvirtual std::vector<std::pair<std::string,std::string>> header_code ();\n+ virtual std::vector<std::pair<std::string,std::string>> header_encoder();\nvirtual std::vector<std::pair<std::string,std::string>> header_decoder();\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"new_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"diff": "@@ -76,7 +76,7 @@ void Launcher_BFER<B,R,Q>\nthis->opt_args[{\"enc-type\"}] =\n{\"string\",\n\"select the type of encoder you want to use.\",\n- \"AZCW, COSET, USER, LDPC\" };\n+ \"AZCW, COSET, USER\" };\nthis->opt_args[{\"enc-path\"}] =\n{\"string\",\n\"path to a file containing one or a set of pre-computed codewords, to use with \\\"--enc-type USER\\\".\"};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"new_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"diff": "@@ -16,6 +16,7 @@ Launcher_BFERI_LDPC<B,R,Q>\n{\nthis->params.code .type = \"LDPC\";\nthis->params.encoder .type = \"COSET\";\n+ this->params.encoder .systematic = false;\nthis->params.interleaver.type = \"RANDOM\";\nthis->params.quantizer .n_bits = 6;\nthis->params.quantizer .n_decimals = 2;\n@@ -38,6 +39,9 @@ void Launcher_BFERI_LDPC<B,R,Q>\n{\"string\",\n\"path to the AList formated file.\"};\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ this->opt_args[{\"enc-type\"}][2] += \", LDPC\";\n+\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\nthis->opt_args[{\"dec-implem\" }].push_back(\"ONMS, SPA, LSPA\");\n@@ -109,6 +113,18 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI_LDPC<B,R,Q>\nreturn p;\n}\n+template <typename B, typename R, typename Q>\n+std::vector<std::pair<std::string,std::string>> Launcher_BFERI_LDPC<B,R,Q>\n+::header_encoder()\n+{\n+ auto p = Launcher_BFERI<B,R,Q>::header_encoder();\n+\n+ if (this->params.encoder.type == \"LDPC\")\n+ p.push_back(std::make_pair(\"Path\", this->params.encoder.path));\n+\n+ return p;\n+}\n+\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.hpp",
"new_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.hpp",
"diff": "@@ -20,6 +20,7 @@ protected:\nvirtual simulation::Simulation* build_simu();\nvirtual std::vector<std::pair<std::string,std::string>> header_code ();\n+ virtual std::vector<std::pair<std::string,std::string>> header_encoder();\nvirtual std::vector<std::pair<std::string,std::string>> header_decoder();\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -87,7 +87,7 @@ void Launcher_BFERI<B,R,Q>\nthis->opt_args[{\"itl-type\"}] =\n{\"string\",\n\"specify the type of the interleaver.\",\n- \"LTE, CCSDS, RANDOM, GOLDEN, USER, NO\"};\n+ \"LTE, CCSDS, RANDOM, UNIFORM, GOLDEN, USER, NO\"};\nthis->opt_args[{\"itl-path\"}] =\n{\"string\",\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "#include <cassert>\n+#include <iostream>\n#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Math/matrix.h\"\n#include \"Encoder_LDPC.hpp\"\n-int EncValues[] = {\n- 13, 0, 2084, 1613, 1548, 1286, 1460, 3196, 4297, 2481, 3369, 3451, 4620, 2622,\n- 13, 1, 122, 1516, 3448, 2880, 1407, 1847, 3799, 3529, 373, 971, 4358, 3108,\n- 13, 2, 259, 3399, 929, 2650, 864, 3996, 3833, 107, 5287, 164, 3125, 2350,\n- 3, 3, 342, 3529,\n- 3, 4, 4198, 2147,\n- 3, 5, 1880, 4836,\n- 3, 6, 3864, 4910,\n- 3, 7, 243, 1542,\n- 3, 8, 3011, 1436,\n- 3, 9, 2167, 2512,\n- 3, 10, 4606, 1003,\n- 3, 11, 2835, 705,\n- 3, 12, 3426, 2365,\n- 3, 13, 3848, 2474,\n- 3, 14, 1360, 1743,\n- 3, 0, 163, 2536,\n- 3, 1, 2583, 1180,\n- 3, 2, 1542, 509,\n- 3, 3, 4418, 1005,\n- 3, 4, 5212, 5117,\n- 3, 5, 2155, 2922,\n- 3, 6, 347, 2696,\n- 3, 7, 226, 4296,\n- 3, 8, 1560, 487,\n- 3, 9, 3926, 1640,\n- 3, 10, 149, 2928,\n- 3, 11, 2364, 563,\n- 3, 12, 635, 688,\n- 3, 13, 231, 1684,\n- 3, 14, 1129, 3894\n-};\n-\n-int N_LDPC = 16200;\n-int K_LDPC = 10800;\n-int NmK_LDPC = 5400;\n-int M_LDPC = 360;\n-int Q_LDPC = 15;\n-int N_LINES = 30;\n-\n+using namespace aff3ct;\n+using namespace module;\ntemplate <typename B>\nEncoder_LDPC<B>\n-::Encoder_LDPC(const int K, const int N, const int n_frames, const std::string name)\n-: Encoder_sys<B>(K, N, n_frames, name), K(K), N(N)\n+::Encoder_LDPC(const int K, const int N, const tools::AList_reader &alist_data, const int n_frames,\n+ const std::string name)\n+: Encoder_sys<B>(K, N, n_frames, name), K(K), N(N), tG(N*K,0)\n{\n-// assert( K == (K_LDPC) );\n-// assert( N == (N_LDPC) );\n+ assert(K == (int)alist_data.get_n_CN());\n+ assert(N == (int)alist_data.get_n_VN());\n+\n+ auto CN_to_VN = alist_data.get_CN_to_VN();\n+\n+ mipp::vector<B> G(K*N,0);\n+ for (auto i = 0; i < K; i++)\n+ for (size_t j = 0; j < CN_to_VN[i].size(); ++j)\n+ G[i*N + CN_to_VN[i][j]] = 1;\n+\n+ tools::real_transpose(K,N,G,tG); // transposed for computation matter\n}\ntemplate <typename B>\n@@ -60,23 +34,6 @@ Encoder_LDPC<B>\n{\n}\n-//template <typename B>\n-//void Encoder_LDPC<B>\n-//::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n-//{\n-// assert(U_K.size() <= X_N.size());\n-// assert(this->K * this->n_frames == static_cast<int>(U_K.size()));\n-// assert(this->N * this->n_frames == static_cast<int>(X_N.size()));\n-//\n-// for (auto f = 0; f < this->n_frames; f++)\n-// {\n-// std::copy(U_K.begin() + (f+ 0) * this->K, U_K.begin() + (f +1) * this->K, X_N.begin() + f * this->N);\n-//\n-// for (auto i = this->K; i < this->N; i++)\n-// X_N[f * this->N + i] = (B)this->uniform_dist(this->rd_engine);\n-// }\n-//}\n-\ntemplate <typename B>\nvoid Encoder_LDPC<B>\n::encode_sys(const mipp::vector<B>& U_K, mipp::vector<B>& par)\n@@ -84,57 +41,17 @@ void Encoder_LDPC<B>\nstd::cerr << \"Unimplemented method\" << std::endl;\n}\n-\n-// METHODE PERMETTANT D'ENCODER LES TRAINS DE BITS AU FORMAT DVB-S2 (r=9/10)\n-\ntemplate <typename B>\nvoid Encoder_LDPC<B>\n::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n{\n- std::copy(U_K.begin(), U_K.end(), X_N.begin());\n- std::fill(X_N.begin()+K, X_N.end(), 0);\n-\n-// for(int y=0; y<N; y++)\n-// {\n-// X_N[y] = 0;\n-// }\n-//\n-// for(int y=0; y<K; y++)\n-// {\n-// int bit = rand()%2;\n-// U_K[y] = bit;\n-// X_N[y] = bit;\n-// }\n-\n- std::cout << \"coucou\" << std::endl;\n- return;\n-\n- auto *Px = &X_N[K_LDPC];\n- auto *p = EncValues;\n- int xPos = 0;\n-\n- for(int y=0; y<N_LINES; y++)\n- {\n- int nbPos = (*p++);\n+ assert(K == (int)U_K.size());\n+ assert(N == (int)X_N.size());\n- for(int l=0; l<M_LDPC; l++){\n-\n- int bit = U_K[xPos];\n- if( bit == 1 )\n- {\n- for(int q=0; q<nbPos; q++){\n- int position = (p[q] + (xPos % 360) * Q_LDPC) % NmK_LDPC;\n- Px[position] ^= bit;\n- }\n- }\n- xPos += 1;\n- }\n- p += nbPos;\n- }\n+ tools::rgemm(1, N, K, U_K, tG, X_N);\n- for(int i=1; i<NmK_LDPC; i++){\n- Px[i] = Px[i] ^ Px[i-1];\n- }\n+ for (auto j = 0; j < N; ++j)\n+ X_N[j] %= 2;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"diff": "#ifndef ENCODER_LDPC_HPP_\n#define ENCODER_LDPC_HPP_\n-#include <random>\n+#include <vector>\n+#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n+#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"../Encoder_sys.hpp\"\n+namespace aff3ct\n+{\n+namespace module\n+{\n+\ntemplate <typename B>\nclass Encoder_LDPC : public Encoder_sys<B>\n{\nconst int K, N;\n+ mipp::vector<B> tG; // the generator matrix\npublic:\n- Encoder_LDPC(const int K, const int N, const int n_frames = 1,\n+ Encoder_LDPC(const int K, const int N, const tools::AList_reader &alist_data, const int n_frames = 1,\nconst std::string name = \"Encoder_LDPC\");\nvirtual ~Encoder_LDPC();\n@@ -19,4 +27,7 @@ public:\nvoid encode_sys(const mipp::vector<B>& U_K, mipp::vector<B>& par);\n};\n+}\n+}\n+\n#endif /* ENCODER_LDPC_HPP_ */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.cpp",
"new_path": "src/Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.cpp",
"diff": "#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Factory/LDPC/Factory_encoder_LDPC.hpp\"\n#include \"Tools/Factory/LDPC/Factory_decoder_LDPC.hpp\"\n#include \"Simulation_BFER_LDPC.hpp\"\n@@ -44,7 +45,10 @@ template <typename B, typename R, typename Q>\nEncoder<B>* Simulation_BFER_LDPC<B,R,Q>\n::build_encoder(const int tid)\n{\n- return Simulation_BFER<B,R,Q>::build_encoder(tid);\n+ auto encoder = Simulation_BFER<B,R,Q>::build_encoder(tid);\n+ if (encoder == nullptr)\n+ encoder = Factory_encoder_LDPC<B>::build(this->params);\n+ return encoder;\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.cpp",
"new_path": "src/Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.cpp",
"diff": "#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n+#include \"Tools/Factory/LDPC/Factory_encoder_LDPC.hpp\"\n#include \"Tools/Factory/LDPC/Factory_decoder_LDPC.hpp\"\n#include \"Simulation_BFERI_LDPC.hpp\"\n@@ -47,7 +48,10 @@ template <typename B, typename R, typename Q>\nEncoder<B>* Simulation_BFERI_LDPC<B,R,Q>\n::build_encoder(const int tid)\n{\n- return Simulation_BFERI<B,R,Q>::build_encoder(tid);\n+ auto encoder = Simulation_BFERI<B,R,Q>::build_encoder(tid);\n+ if (encoder == nullptr)\n+ encoder = Factory_encoder_LDPC<B>::build(this->params);\n+ return encoder;\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Simulation_BFERI.cpp",
"diff": "@@ -222,7 +222,8 @@ template <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFERI_i<B,R,Q>\n::build_interleaver(const int tid)\n{\n- return Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, params.simulation.seed);\n+ auto seed = (params.interleaver.type == \"UNIFORM\") ? rd_engine_seed[tid]() : params.simulation.seed;\n+ return Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, seed);\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -443,6 +443,8 @@ void Simulation_BFERI<B,R,Q>\nsimu->monitor[tid]->check_errors(simu->U_K[tid], simu->V_K[tid]);\nauto d_check = steady_clock::now() - t_check;\n+ // useful for the uniform random interleaver\n+ simu->interleaver[tid]->regen_lookup_tables();\n// increment total durations for each operations\nsimu->d_sourc_total[tid] += d_sourc;\n@@ -770,6 +772,9 @@ void Simulation_BFERI<B,R,Q>\nsimu->monitor[0]->check_errors(simu->U_K[0], simu->V_K[0]);\nauto d_check = steady_clock::now() - t_check;\n+ // useful for the uniform random interleaver\n+ simu->interleaver[0]->regen_lookup_tables();\n+\n// increment total durations for each operations\nsimu->d_sourc_total[0] += d_sourc;\nsimu->d_crc_total [0] += d_crc;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_encoder_common.cpp",
"new_path": "src/Tools/Factory/Factory_encoder_common.cpp",
"diff": "#include \"Module/Encoder/AZCW/Encoder_AZCW.hpp\"\n#include \"Module/Encoder/Coset/Encoder_coset.hpp\"\n#include \"Module/Encoder/User/Encoder_user.hpp\"\n-#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n#include \"Factory_encoder_common.hpp\"\n@@ -22,8 +21,6 @@ Encoder<B>* Factory_encoder_common<B>\nencoder = new Encoder_AZCW<B>(params.code.K, params.code.N + params.code.tail_length, n_frames);\nelse if (params.encoder.type == \"COSET\")\nencoder = new Encoder_coset<B>(params.code.K, params.code.N + params.code.tail_length, seed, n_frames);\n- else if (params.encoder.type == \"LDPC\")\n- encoder = new Encoder_LDPC<B>(params.code.K, params.code.N + params.code.tail_length, n_frames);\nelse if (params.encoder.type == \"USER\")\nencoder = new Encoder_user<B>(params.code.K, params.code.N + params.code.tail_length, params.encoder.path, n_frames);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/matrix.h",
"new_path": "src/Tools/Math/matrix.h",
"diff": "@@ -32,6 +32,13 @@ namespace tools\n// op( B ). K must be at least zero. Unchanged on\n// exit.\n+// real general matrix multiplication: C = A * B, tB is B transposed, tC is C transposed\n+template <typename T>\n+__forceinline void rgemm(const int M, const int N, const int K,\n+ const mipp::vector<T> &A,\n+ const mipp::vector<T> &tB,\n+ mipp::vector<T> &tC);\n+\n// complex general matrix multiplication: C = A * B, tB is B transposed, tC is C transposed\ntemplate <typename T>\n__forceinline void cgemm(const int M, const int N, const int K,\n@@ -46,6 +53,12 @@ __forceinline void cgemm_r(const int M, const int N, const int K,\nconst mipp::vector<T> &tB,\nmipp::vector<T> &tC);\n+// real transpose : B = tA, where A is of size M*N and then B of size N*M\n+template <typename T>\n+__forceinline void real_transpose(const int M, const int N,\n+ const mipp::vector<T> &A,\n+ mipp::vector<T> &B);\n+\n// complex transpose : B_real = tA_real and B_imag = -tA_imag, where A is of size M*N*2 and then B of size N*M*2\n// (with both complex elements) : B's elements are the conjugates of A's\ntemplate <typename T>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/matrix.hxx",
"new_path": "src/Tools/Math/matrix.hxx",
"diff": "@@ -4,6 +4,27 @@ namespace aff3ct\n{\nnamespace tools\n{\n+template <typename T>\n+inline void rgemm(const int M, const int N, const int K,\n+ const mipp::vector<T> &A,\n+ const mipp::vector<T> &tB,\n+ mipp::vector<T> &tC)\n+{\n+ assert( A.size() == unsigned(M * K));\n+ assert(tB.size() == unsigned(K * N));\n+ assert(tC.size() == unsigned(M * N));\n+\n+ for (auto i = 0; i < M; i++)\n+ for (auto j = 0; j < N; j++)\n+ {\n+ T sum_r = 0;\n+ for (auto k = 0; k < K; k++)\n+ sum_r += A[i * K + k] * tB[j * K + k];\n+\n+ tC[j * M + i] = sum_r;\n+ }\n+}\n+\ntemplate <typename T>\ninline void cgemm(const int M, const int N, const int K,\nconst mipp::vector<T> &A,\n@@ -67,6 +88,19 @@ inline void cgemm_r(const int M, const int N, const int K,\n}\n}\n+template <typename T>\n+inline void real_transpose(const int M, const int N,\n+ const mipp::vector<T> &A,\n+ mipp::vector<T> &B)\n+{\n+ assert(A.size() == unsigned(M * N));\n+ assert(B.size() == unsigned(N * M));\n+\n+ for (auto i = 0; i < M; i++)\n+ for (auto j = 0; j < N; j++)\n+ B[j*M+i] = A[i*N+j];\n+}\n+\ntemplate <typename T>\ninline void complex_transpose(const int M, const int N,\nconst mipp::vector<T> &A,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
working LDPC encoder by reading G matrices in alist format ; working only for BFERI for now ; enable uniform interleaver in BFERI simu
|
8,483 |
02.03.2017 09:24:22
| -3,600 |
10e27ce9c0ecba5fa16e7da3afcf0a0fbecb1156
|
add encoder LDPC factory
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"diff": "+#include \"Tools/Factory/LDPC/Factory_encoder_LDPC.hpp\"\n+#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n+\n+\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\n+\n+template <typename B>\n+Encoder<B>* Factory_encoder_LDPC<B>\n+::build(const parameters ¶ms, const int seed, const int n_frames)\n+{\n+ Encoder<B> *encoder = nullptr;\n+\n+ // build the encoder\n+ if (params.encoder.type == \"LDPC\")\n+ encoder = new Encoder_LDPC<B>(params.code.K, params.code.N + params.code.tail_length, AList_reader(params.encoder.path), n_frames);\n+\n+ return encoder;\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template struct aff3ct::tools::Factory_encoder_LDPC<B_8>;\n+template struct aff3ct::tools::Factory_encoder_LDPC<B_16>;\n+template struct aff3ct::tools::Factory_encoder_LDPC<B_32>;\n+template struct aff3ct::tools::Factory_encoder_LDPC<B_64>;\n+#else\n+template struct aff3ct::tools::Factory_encoder_LDPC<B>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.hpp",
"diff": "+#ifndef FACTORY_ENCODER_LDPC_HPP\n+#define FACTORY_ENCODER_LDPC_HPP\n+\n+#include \"Module/Encoder/Encoder.hpp\"\n+\n+#include \"Tools/params.h\"\n+\n+#include \"../Factory.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+template <typename B = int>\n+struct Factory_encoder_LDPC : public Factory\n+{\n+ static module::Encoder<B>* build(const parameters ¶ms, const int seed = 0, const int n_frames = 1);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_ENCODER_LDPC_HPP */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
add encoder LDPC factory
|
8,490 |
02.03.2017 17:19:03
| -3,600 |
d1eff68f9547a5af729e8b8a47a6f0fbd05e0f59
|
Put the argument warnings into clog instead of cout.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -788,7 +788,7 @@ void Launcher<B,R,Q>\nstream << \"# The simulation is running...\" << std::endl;\n// print the warnings\nif (params.simulation.mpi_rank == 0)\n- stream << bold_yellow(cmd_warn);\n+ std::clog << bold_yellow(cmd_warn);\nsimu->launch();\nif (params.simulation.mpi_rank == 0)\nstream << \"# End of the simulation.\" << std::endl;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Put the argument warnings into clog instead of cout.
|
8,483 |
03.03.2017 09:47:24
| -3,600 |
8dba3d910e094f27b3e09aaee7108b250ac122eb
|
reduce the range of GSM simulations
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/CPM/gsm_BPF_MAXS_SPA.sh",
"new_path": "scripts/CPM/gsm_BPF_MAXS_SPA.sh",
"diff": "@@ -5,9 +5,9 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n- --sim-snr-min 0.0 \\\n- --sim-snr-max 2.5 \\\n- --sim-snr-step 0.25 \\\n+ --sim-snr-min 1.0 \\\n+ --sim-snr-max 2.21 \\\n+ --sim-snr-step 0.1 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/CPM/gsm_BPF_MAX_NMS.sh",
"new_path": "scripts/CPM/gsm_BPF_MAX_NMS.sh",
"diff": "@@ -5,9 +5,9 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n- --sim-snr-min 0.0 \\\n- --sim-snr-max 2.5 \\\n- --sim-snr-step 0.25 \\\n+ --sim-snr-min 1.0 \\\n+ --sim-snr-max 2.21 \\\n+ --sim-snr-step 0.1 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/CPM/gsm_BPL_MAXS_SPA.sh",
"new_path": "scripts/CPM/gsm_BPL_MAXS_SPA.sh",
"diff": "@@ -5,9 +5,9 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n- --sim-snr-min 0.0 \\\n- --sim-snr-max 2.5 \\\n- --sim-snr-step 0.25 \\\n+ --sim-snr-min 1.0 \\\n+ --sim-snr-max 2.21 \\\n+ --sim-snr-step 0.1 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "scripts/CPM/gsm_BPL_MAX_NMS.sh",
"new_path": "scripts/CPM/gsm_BPL_MAX_NMS.sh",
"diff": "@@ -5,9 +5,9 @@ cd ../build\n./bin/aff3ct \\\n--sim-type BFERI \\\n--sim-prec 32 \\\n- --sim-snr-min 0.0 \\\n- --sim-snr-max 2.5 \\\n- --sim-snr-step 0.25 \\\n+ --sim-snr-min 1.0 \\\n+ --sim-snr-max 2.21 \\\n+ --sim-snr-step 0.1 \\\n--mnt-max-fe 100 \\\n--src-type RAND_FAST \\\n-K 2112 \\\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
reduce the range of GSM simulations
|
8,490 |
04.03.2017 10:43:47
| -3,600 |
1b976309bfa55ee45aadbb5622c033629db9f7ba
|
Add a new cmd line parameter ('dec-partial-adaptive') to select full or partial ASCL decoder.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -111,7 +111,7 @@ _aff3ct() {\nopts=\"$opts --sim-pb-path --cde-awgn-fb-path --cde-fb-gen-method \\\n--cde-sigma --crc-type --crc-poly --crc-rate --enc-no-sys \\\n--dec-type -D --dec-ite -i --dec-lists -L --dec-simd \\\n- --dec-polar-nodes\"\n+ --dec-polar-nodes --dec-partial-adaptive\"\nfi\n# add contents of Launcher_BFER_repetition.cpp\n@@ -190,7 +190,8 @@ _aff3ct() {\n-v | --version | -h | --help | --dmod-no-sig2 | --term-no | \\\n--sim-benchs-no-ldst | -B | --sim-debug | -d | --sim-time-report | \\\n--cde-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n- --crc-rate | --mnt-err-trk | --mnt-err-trk-rev)\n+ --crc-rate | --mnt-err-trk | --mnt-err-trk-rev | \\\n+ --dec-partial-adaptive)\nCOMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"diff": "@@ -34,6 +34,7 @@ Launcher_BFER_polar<B,R,Q>\nthis->params.decoder .L = 1;\nthis->params.decoder .simd_strategy = \"\";\nthis->params.decoder .polar_nodes = \"{R0,R0L,R1,REP,REPL,SPC}\";\n+ this->params.decoder .full_adaptive = true;\n}\ntemplate <typename B, typename R, typename Q>\n@@ -100,6 +101,9 @@ void Launcher_BFER_polar<B,R,Q>\nthis->opt_args[{\"dec-polar-nodes\"}] =\n{\"string\",\n\"the type of nodes you want to detect in the Polar tree (ex: {R0,R1,R0L,REP_2-8,REPL,SPC_4+}).\"};\n+ this->opt_args[{\"dec-partial-adaptive\"}] =\n+ {\"\",\n+ \"enable the partial adaptative mode for the ASCL decoder (by default full adaptative is selected).\"};\n}\ntemplate <typename B, typename R, typename Q>\n@@ -135,6 +139,7 @@ void Launcher_BFER_polar<B,R,Q>\nif(this->ar.exist_arg({\"dec-lists\", \"L\"})) this->params.decoder.L = this->ar.get_arg_int({\"dec-lists\", \"L\"});\nif(this->ar.exist_arg({\"dec-simd\" })) this->params.decoder.simd_strategy = this->ar.get_arg ({\"dec-simd\" });\nif(this->ar.exist_arg({\"dec-polar-nodes\" })) this->params.decoder.polar_nodes = this->ar.get_arg ({\"dec-polar-nodes\"});\n+ if(this->ar.exist_arg({\"dec-partial-adaptive\"})) this->params.decoder.full_adaptive = false;\nif (this->params.decoder.simd_strategy == \"INTER\" && !this->ar.exist_arg({\"sim-inter-lvl\"}))\nthis->params.simulation.inter_frame_level = mipp::nElReg<Q>();\n@@ -208,7 +213,11 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_polar<B,R,Q>\np.push_back(std::make_pair(\"Num. of lists (L)\", std::to_string(this->params.decoder.L)));\nif (this->params.decoder.type == \"ASCL\" || this->params.decoder.type == \"ASCL_MEM\")\n+ {\n+ auto adaptative_mode = this->params.decoder.full_adaptive ? \"full\" : \"partial\";\np.push_back(std::make_pair(\"Max num. of lists (L)\", std::to_string(this->params.decoder.L)));\n+ p.push_back(std::make_pair(\"Adaptative mode\", adaptative_mode));\n+ }\nif ((this->params.decoder.type == \"SC\" ||\nthis->params.decoder.type == \"SCL\" ||\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hpp",
"diff": "@@ -28,13 +28,13 @@ private:\npublic:\nDecoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\n- CRC<B>& crc, const int n_frames = 1,\n+ CRC<B>& crc, const bool is_full_adaptive = true, const int n_frames = 1,\nconst std::string name = \"Decoder_polar_ASCL_MEM_fast_CA_sys\");\nDecoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- CRC<B>& crc, const int n_frames = 1,\n+ CRC<B>& crc, const bool is_full_adaptive = true, const int n_frames = 1,\nconst std::string name = \"Decoder_polar_ASCL_MEM_fast_CA_sys\");\nvirtual ~Decoder_polar_ASCL_MEM_fast_CA_sys(){};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"diff": "@@ -7,10 +7,10 @@ namespace module\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\n- CRC<B>& crc, const int n_frames, const std::string name)\n+ CRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, crc, n_frames, name),\nsc_decoder (K, N , frozen_bits, n_frames, name),\n- L_max(L_max), is_full_adaptive(true)\n+ L_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n}\n@@ -20,10 +20,10 @@ Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- CRC<B>& crc, const int n_frames, const std::string name)\n+ CRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\nsc_decoder (K, N , frozen_bits, n_frames, name),\n- L_max(L_max), is_full_adaptive(true)\n+ L_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hpp",
"diff": "@@ -28,13 +28,13 @@ private:\npublic:\nDecoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\n- CRC<B>& crc, const int n_frames = 1,\n+ CRC<B>& crc, const bool is_full_adaptive = true, const int n_frames = 1,\nconst std::string name = \"Decoder_polar_ASCL_fast_CA_sys\");\nDecoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& max_L, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- CRC<B>& crc, const int n_frames = 1,\n+ CRC<B>& crc, const bool is_full_adaptive = true, const int n_frames = 1,\nconst std::string name = \"Decoder_polar_ASCL_fast_CA_sys\");\nvirtual ~Decoder_polar_ASCL_fast_CA_sys(){};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"diff": "@@ -7,10 +7,10 @@ namespace module\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\n- CRC<B>& crc, const int n_frames, const std::string name)\n+ CRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, crc, n_frames, name),\nsc_decoder (K, N , frozen_bits, n_frames, name),\n- L_max(L_max), is_full_adaptive(true)\n+ L_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n}\n@@ -20,10 +20,10 @@ Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- CRC<B>& crc, const int n_frames, const std::string name)\n+ CRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\nsc_decoder (K, N , frozen_bits, n_frames, name),\n- L_max(L_max), is_full_adaptive(true)\n+ L_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"diff": "@@ -250,14 +250,14 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.decoder.full_adaptive, params.simulation.inter_frame_level);\n}\nelse if (params.decoder.simd_strategy.empty())\n{\nusing API_polar = API_polar_dynamic_seq\n<B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.decoder.full_adaptive, params.simulation.inter_frame_level);\n}\n}\n@@ -272,14 +272,14 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\n<B, R, f_LLR <R>, g_LLR <B,R>, g0_LLR <R>, h_LLR <B,R>, xo_STD <B>,\nf_LLR_i<R>, g_LLR_i<B,R>, g0_LLR_i<R>, h_LLR_i<B,R>, xo_STD_i<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.decoder.full_adaptive, params.simulation.inter_frame_level);\n}\nelse if (params.decoder.simd_strategy.empty())\n{\nusing API_polar = API_polar_dynamic_seq\n<B, R, f_LLR<R>, g_LLR<B,R>, g0_LLR<R>, h_LLR<B,R>, xo_STD<B>>;\nif (!params.crc.poly.empty())\n- decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_ASCL_MEM_fast_CA_sys<B, R, API_polar>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, polar_patterns, idx_r0, idx_r1, *crc, params.decoder.full_adaptive, params.simulation.inter_frame_level);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -131,6 +131,7 @@ struct decoder_parameters\nstd::string gen_path;\nstd::string polar_nodes;\nbool enable_syndrome;\n+ bool full_adaptive;\nfloat normalize_factor;\nfloat offset;\nint n_ite;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a new cmd line parameter ('dec-partial-adaptive') to select full or partial ASCL decoder.
|
8,490 |
07.03.2017 11:42:12
| -3,600 |
1c0ac94d6bdbcf7d87d88c558f95d39aab298ae4
|
Improve the speed of the ASCL.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"diff": "@@ -42,8 +42,11 @@ void Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\nthis->L = 1;\nsc_decoder._hard_decode();\n+// // check the CRC\n+// auto crc_decode_result = this->crc_check(sc_decoder.s);\n+\n// check the CRC\n- auto crc_decode_result = this->crc_check(sc_decoder.s);\n+ auto crc_decode_result = this->crc.check(sc_decoder.ss, this->get_simd_inter_frame_level());\n// delete the path if the CRC result is negative\nif (!crc_decode_result && L_max > 1)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"diff": "@@ -36,9 +36,12 @@ protected:\nconst int m; // graph depth\nmipp::vector<R> l; // lambda, LR or LLR\nmipp::vector<B> s; // bits, partial sums\n+ mipp::vector<B> ss; // bits, partial sums\nmipp::vector<B> s_bis; // bits, partial sums\nconst mipp::vector<B> &frozen_bits; // frozen bits\n+ int cur_bit;\n+\nconst tools::Pattern_polar_parser<B> polar_patterns;\npublic:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "@@ -25,8 +25,8 @@ constexpr int static_level = 6; // 2^6 = 64\ntemplate <typename B, typename R, class API_polar, int REV_D>\nstruct Decoder_polar_SC_fast_sys_static\n{\n- static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<R> &l,\n- const int off_l, const int off_s, int &node_id)\n+ static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<B> &ss, mipp::vector<R> &l,\n+ const int off_l, const int off_s, int &node_id, int &cur_bit)\n{\nconstexpr int reverse_depth = REV_D;\nconstexpr int n_elmts = 1 << reverse_depth;\n@@ -51,7 +51,7 @@ struct Decoder_polar_SC_fast_sys_static\n}\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,REV_D-1>\n- ::decode(polar_patterns, s, l, off_l + n_elmts, off_s, ++node_id); // recursive call left\n+ ::decode(polar_patterns, s, ss, l, off_l + n_elmts, off_s, ++node_id, cur_bit); // recursive call left\n// g\nswitch (node_type)\n@@ -64,7 +64,7 @@ struct Decoder_polar_SC_fast_sys_static\n}\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,REV_D-1>\n- ::decode(polar_patterns, s, l, off_l + n_elmts, off_s + n_elm_2, ++node_id); // recursive call right\n+ ::decode(polar_patterns, s, ss, l, off_l + n_elmts, off_s + n_elm_2, ++node_id, cur_bit); // recursive call right\n// xor\nswitch (node_type)\n@@ -81,11 +81,32 @@ struct Decoder_polar_SC_fast_sys_static\n// h\nswitch (node_type)\n{\n- case tools::RATE_0: // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n- API_polar::template h0 <n_elmts>(s, off_s, n_elmts); break;\n- case tools::RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\n- case tools::REP: API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n- case tools::SPC: API_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n+// case tools::RATE_0: // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n+// API_polar::template h0 <n_elmts>(s, off_s, n_elmts); break;\n+// case tools::RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\n+// case tools::REP: API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n+// case tools::SPC: API_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n+// default:\n+// break;\n+ case tools::RATE_0:\n+ // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n+ API_polar::template h0 <n_elmts>(s, off_s, n_elmts);\n+ break;\n+ case tools::RATE_1:\n+ API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts);\n+ std::copy(s.begin() + off_s, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n+ cur_bit += n_elmts;\n+ break;\n+ case tools::REP:\n+ API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts);\n+ ss[cur_bit] = s[off_s + n_elmts -2];\n+ cur_bit++;\n+ break;\n+ case tools::SPC:\n+ API_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts);\n+ std::copy(s.begin() + off_s +1, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n+ cur_bit += n_elmts -1;\n+ break;\ndefault:\nbreak;\n}\n@@ -96,8 +117,8 @@ struct Decoder_polar_SC_fast_sys_static\ntemplate <typename B, typename R, class API_polar>\nstruct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\n{\n- static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<R> &l,\n- const int off_l, const int off_s, int &id)\n+ static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<B> &ss, mipp::vector<R> &l,\n+ const int off_l, const int off_s, int &id, int &cur_bit)\n{\nconstexpr int reverse_depth = 0;\nconstexpr int n_elmts = 1 << reverse_depth;\n@@ -123,8 +144,10 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\nm ((int)std::log2(N)),\nl (2 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<R>()),\ns (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\n+ ss ( K ),\ns_bis (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\nfrozen_bits (frozen_bits),\n+ cur_bit (0),\npolar_patterns(N,\nfrozen_bits,\n{new tools::Pattern_polar_std,\n@@ -153,6 +176,7 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\ns (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\ns_bis (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\nfrozen_bits (frozen_bits),\n+ cur_bit (0),\npolar_patterns(N, frozen_bits, polar_patterns, idx_r0, idx_r1)\n{\nstatic_assert(sizeof(B) == sizeof(R), \"\");\n@@ -191,6 +215,8 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\ntools::Reorderer_static<R,n_frames>::apply(frames, l.data(), this->N);\n}\n}\n+\n+ cur_bit = 0;\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -211,7 +237,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n{\n// use the static version of the decoder\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,static_level>\n- ::decode(polar_patterns, this->s, this->l, off_l, off_s, node_id);\n+ ::decode(polar_patterns, this->s, this->ss, this->l, off_l, off_s, node_id, cur_bit);\n}\nelse\n{\n@@ -264,11 +290,25 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n// h\nswitch (node_type)\n{\n- case tools::RATE_0: // if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, reverse_depth +1))\n- API_polar::h0 (s, off_s, n_elmts); break;\n- case tools::RATE_1: API_polar::h (s, l, off_l, off_s, n_elmts); break;\n- case tools::REP: API_polar::rep(s, l, off_l, off_s, n_elmts); break;\n- case tools::SPC: API_polar::spc(s, l, off_l, off_s, n_elmts); break;\n+ case tools::RATE_0:\n+ // if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, reverse_depth +1))\n+ API_polar::h0 (s, off_s, n_elmts);\n+ break;\n+ case tools::RATE_1:\n+ API_polar::h (s, l, off_l, off_s, n_elmts);\n+ std::copy(s.begin() + off_s, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n+ cur_bit += n_elmts;\n+ break;\n+ case tools::REP:\n+ API_polar::rep(s, l, off_l, off_s, n_elmts);\n+ ss[cur_bit] = s[off_s + n_elmts -2];\n+ cur_bit++;\n+ break;\n+ case tools::SPC:\n+ API_polar::spc(s, l, off_l, off_s, n_elmts);\n+ std::copy(s.begin() + off_s +1, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n+ cur_bit += n_elmts -1;\n+ break;\ndefault:\nbreak;\n}\n@@ -286,10 +326,11 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nif (n_frames == 1)\n{\n- auto k = 0;\n- for (auto j = 0; j < this->N; j++)\n- if (!frozen_bits[j])\n- V_K[k++] = s[j] ? 1 : 0;\n+// auto k = 0;\n+// for (auto j = 0; j < this->N; j++)\n+// if (!frozen_bits[j])\n+// V_K[k++] = s[j] ? 1 : 0;\n+ V_K = ss;\n}\nelse\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the speed of the ASCL.
|
8,490 |
07.03.2017 17:44:26
| -3,600 |
93433d9370b3b02a714fa5a301009784720b6833
|
Improve the K info. bit extraction in the SC decoder + use this optim in the ASCL.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"diff": "@@ -9,7 +9,7 @@ Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, true, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n@@ -22,7 +22,7 @@ Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, true, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"diff": "@@ -9,7 +9,7 @@ Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, true, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n@@ -22,7 +22,7 @@ Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, true, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nassert(L_max > 0);\n@@ -42,11 +42,8 @@ void Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\nthis->L = 1;\nsc_decoder._hard_decode();\n-// // check the CRC\n-// auto crc_decode_result = this->crc_check(sc_decoder.s);\n-\n// check the CRC\n- auto crc_decode_result = this->crc.check(sc_decoder.ss, this->get_simd_inter_frame_level());\n+ auto crc_decode_result = this->crc.check(sc_decoder.sk, this->get_simd_inter_frame_level());\n// delete the path if the CRC result is negative\nif (!crc_decode_result && L_max > 1)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"diff": "@@ -36,22 +36,24 @@ protected:\nconst int m; // graph depth\nmipp::vector<R> l; // lambda, LR or LLR\nmipp::vector<B> s; // bits, partial sums\n- mipp::vector<B> ss; // bits, partial sums\nmipp::vector<B> s_bis; // bits, partial sums\nconst mipp::vector<B> &frozen_bits; // frozen bits\n-\n- int cur_bit;\n+ const bool k_extract;\n+ mipp::vector<B> sk; // K decoded bits\n+ int sk_idx;\nconst tools::Pattern_polar_parser<B> polar_patterns;\npublic:\nDecoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\n- const int n_frames = 1, const std::string name = \"Decoder_polar_SC_fast_sys\");\n+ const int n_frames = 1, const bool k_extract = false,\n+ const std::string name = \"Decoder_polar_SC_fast_sys\");\nDecoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- const int n_frames = 1, const std::string name = \"Decoder_polar_SC_fast_sys\");\n+ const int n_frames = 1, const bool k_extract = false,\n+ const std::string name = \"Decoder_polar_SC_fast_sys\");\nvirtual ~Decoder_polar_SC_fast_sys();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "@@ -25,8 +25,9 @@ constexpr int static_level = 6; // 2^6 = 64\ntemplate <typename B, typename R, class API_polar, int REV_D>\nstruct Decoder_polar_SC_fast_sys_static\n{\n- static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<B> &ss, mipp::vector<R> &l,\n- const int off_l, const int off_s, int &node_id, int &cur_bit)\n+ static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s,\n+ mipp::vector<R> &l, const int off_l, const int off_s, int &node_id,\n+ const bool k_extract, mipp::vector<B> &sk, int &sk_idx)\n{\nconstexpr int reverse_depth = REV_D;\nconstexpr int n_elmts = 1 << reverse_depth;\n@@ -51,7 +52,7 @@ struct Decoder_polar_SC_fast_sys_static\n}\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,REV_D-1>\n- ::decode(polar_patterns, s, ss, l, off_l + n_elmts, off_s, ++node_id, cur_bit); // recursive call left\n+ ::decode(polar_patterns, s, l, off_l + n_elmts, off_s, ++node_id, k_extract, sk, sk_idx); // recursive call left\n// g\nswitch (node_type)\n@@ -64,7 +65,7 @@ struct Decoder_polar_SC_fast_sys_static\n}\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,REV_D-1>\n- ::decode(polar_patterns, s, ss, l, off_l + n_elmts, off_s + n_elm_2, ++node_id, cur_bit); // recursive call right\n+ ::decode(polar_patterns, s, l, off_l + n_elmts, off_s + n_elm_2, ++node_id, k_extract, sk, sk_idx); // recursive call right\n// xor\nswitch (node_type)\n@@ -81,31 +82,42 @@ struct Decoder_polar_SC_fast_sys_static\n// h\nswitch (node_type)\n{\n-// case tools::RATE_0: // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n-// API_polar::template h0 <n_elmts>(s, off_s, n_elmts); break;\n-// case tools::RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\n-// case tools::REP: API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n-// case tools::SPC: API_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n-// default:\n-// break;\ncase tools::RATE_0:\n// if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\nAPI_polar::template h0<n_elmts>(s, off_s, n_elmts);\nbreak;\ncase tools::RATE_1:\nAPI_polar::template h<n_elmts>(s, l, off_l, off_s, n_elmts);\n- std::copy(s.begin() + off_s, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n- cur_bit += n_elmts;\n+ if (k_extract)\n+ {\n+ std::copy(s.begin() + off_s * API_polar::get_n_frames(),\n+ s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n+ sk.begin() + sk_idx);\n+\n+ sk_idx += n_elmts * API_polar::get_n_frames();\n+ }\nbreak;\ncase tools::REP:\nAPI_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts);\n- ss[cur_bit] = s[off_s + n_elmts -2];\n- cur_bit++;\n+ if (k_extract)\n+ {\n+ std::copy(s.begin() + (off_s + n_elmts -2) * API_polar::get_n_frames(),\n+ s.begin() + (off_s + n_elmts +0) * API_polar::get_n_frames(),\n+ sk.begin() + sk_idx);\n+\n+ sk_idx += API_polar::get_n_frames();\n+ }\nbreak;\ncase tools::SPC:\nAPI_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts);\n- std::copy(s.begin() + off_s +1, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n- cur_bit += n_elmts -1;\n+ if (k_extract)\n+ {\n+ std::copy(s.begin() + (off_s + 1 ) * API_polar::get_n_frames(),\n+ s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n+ sk.begin() + sk_idx);\n+\n+ sk_idx += (n_elmts -1) * API_polar::get_n_frames();\n+ }\nbreak;\ndefault:\nbreak;\n@@ -117,19 +129,32 @@ struct Decoder_polar_SC_fast_sys_static\ntemplate <typename B, typename R, class API_polar>\nstruct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\n{\n- static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<B> &ss, mipp::vector<R> &l,\n- const int off_l, const int off_s, int &id, int &cur_bit)\n+ static void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<R> &l,\n+ const int off_l, const int off_s, int &node_id,\n+ const bool k_extract, mipp::vector<B> &sk, int &sk_idx)\n{\nconstexpr int reverse_depth = 0;\nconstexpr int n_elmts = 1 << reverse_depth;\n- const tools::polar_node_t node_t = polar_patterns.get_node_type(id);\n+ const tools::polar_node_t node_t = polar_patterns.get_node_type(node_id);\nswitch (node_t)\n{\n- case tools::RATE_0: // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, 1))\n- API_polar::template h0<n_elmts>(s, off_s, n_elmts); break;\n- case tools::RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\n+ case tools::RATE_0:\n+ // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, 1))\n+ API_polar::template h0<n_elmts>(s, off_s, n_elmts);\n+ break;\n+ case tools::RATE_1:\n+ API_polar::template h<n_elmts>(s, l, off_l, off_s, n_elmts);\n+ if (k_extract)\n+ {\n+ std::copy(s.begin() + off_s * API_polar::get_n_frames(),\n+ s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n+ sk.begin() + sk_idx);\n+\n+ sk_idx += n_elmts * API_polar::get_n_frames();\n+ }\n+ break;\ndefault:\nbreak;\n}\n@@ -139,15 +164,16 @@ struct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_SC_fast_sys<B,R,API_polar>\n::Decoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits, const int n_frames,\n- const std::string name)\n+ const bool k_extract, const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\nm ((int)std::log2(N)),\nl (2 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<R>()),\ns (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\n- ss ( K ),\ns_bis (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\nfrozen_bits (frozen_bits),\n- cur_bit (0),\n+ k_extract (k_extract),\n+ sk (1 * K * this->simd_inter_frame_level),\n+ sk_idx (0),\npolar_patterns(N,\nfrozen_bits,\n{new tools::Pattern_polar_std,\n@@ -169,14 +195,16 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\n::Decoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- const int n_frames, const std::string name)\n+ const int n_frames, const bool k_extract, const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\nm ((int)std::log2(N)),\nl (2 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<R>()),\ns (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\ns_bis (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\nfrozen_bits (frozen_bits),\n- cur_bit (0),\n+ k_extract (k_extract),\n+ sk (1 * K * this->simd_inter_frame_level),\n+ sk_idx (0),\npolar_patterns(N, frozen_bits, polar_patterns, idx_r0, idx_r1)\n{\nstatic_assert(sizeof(B) == sizeof(R), \"\");\n@@ -216,7 +244,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n}\n}\n- cur_bit = 0;\n+ sk_idx = 0;\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -237,7 +265,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n{\n// use the static version of the decoder\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,static_level>\n- ::decode(polar_patterns, this->s, this->ss, this->l, off_l, off_s, node_id, cur_bit);\n+ ::decode(polar_patterns, this->s, this->l, off_l, off_s, node_id, k_extract, this->sk, sk_idx);\n}\nelse\n{\n@@ -291,23 +319,41 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nswitch (node_type)\n{\ncase tools::RATE_0:\n- // if (!polar_patterns.exist_node_type(polar_node_t::RATE_0_LEFT, reverse_depth +1))\n+ // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\nAPI_polar::h0(s, off_s, n_elmts);\nbreak;\ncase tools::RATE_1:\nAPI_polar::h(s, l, off_l, off_s, n_elmts);\n- std::copy(s.begin() + off_s, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n- cur_bit += n_elmts;\n+ if (k_extract)\n+ {\n+ std::copy(s.begin() + off_s * API_polar::get_n_frames(),\n+ s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n+ sk.begin() + sk_idx);\n+\n+ sk_idx += n_elmts * API_polar::get_n_frames();\n+ }\nbreak;\ncase tools::REP:\nAPI_polar::rep(s, l, off_l, off_s, n_elmts);\n- ss[cur_bit] = s[off_s + n_elmts -2];\n- cur_bit++;\n+ if (k_extract)\n+ {\n+ std::copy(s.begin() + (off_s + n_elmts -2) * API_polar::get_n_frames(),\n+ s.begin() + (off_s + n_elmts +0) * API_polar::get_n_frames(),\n+ sk.begin() + sk_idx);\n+\n+ sk_idx += API_polar::get_n_frames();\n+ }\nbreak;\ncase tools::SPC:\nAPI_polar::spc(s, l, off_l, off_s, n_elmts);\n- std::copy(s.begin() + off_s +1, s.begin() + off_s + n_elmts, ss.begin() + cur_bit);\n- cur_bit += n_elmts -1;\n+ if (k_extract)\n+ {\n+ std::copy(s.begin() + (off_s + 1 ) * API_polar::get_n_frames(),\n+ s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n+ sk.begin() + sk_idx);\n+\n+ sk_idx += (n_elmts -1) * API_polar::get_n_frames();\n+ }\nbreak;\ndefault:\nbreak;\n@@ -326,11 +372,15 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nif (n_frames == 1)\n{\n-// auto k = 0;\n-// for (auto j = 0; j < this->N; j++)\n-// if (!frozen_bits[j])\n-// V_K[k++] = s[j] ? 1 : 0;\n- V_K = ss;\n+ if (k_extract)\n+ V_K = sk;\n+ else\n+ {\n+ auto k = 0;\n+ for (auto j = 0; j < this->N; j++)\n+ if (!frozen_bits[j])\n+ V_K[k++] = s[j] ? 1 : 0;\n+ }\n}\nelse\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the K info. bit extraction in the SC decoder + use this optim in the ASCL.
|
8,495 |
08.03.2017 10:38:16
| -3,600 |
b54a145cf89905dabfa0ce9be54d76e4bd221e3e
|
Add the Flip and Check algorithm (Turbo codes).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -36,6 +36,11 @@ Launcher_BFER_turbo<B,R,Q,QD>\nthis->params.decoder .scaling_factor = \"LTE_VEC\";\nthis->params.decoder .simd_strategy = \"\";\nthis->params.decoder .self_corrected = false;\n+ this->params.decoder .fnc = false;\n+ this->params.decoder .fnc_q = 10;\n+ this->params.decoder .fnc_ite_min = 3;\n+ this->params.decoder .fnc_ite_max = this->params.decoder.n_ite;\n+ this->params.decoder .fnc_ite_step = 1;\n}\ntemplate <typename B, typename R, typename Q, typename QD>\n@@ -95,6 +100,22 @@ void Launcher_BFER_turbo<B,R,Q,QD>\nthis->opt_args[{\"dec-sc\"}] =\n{\"\",\n\"enables the self corrected decoder (requires \\\"--crc-type\\\").\"};\n+ this->opt_args[{\"dec-fnc\"}] =\n+ {\"\",\n+ \"enables the flip and check decoder (requires \\\"--crc-type\\\").\"};\n+ this->opt_args[{\"dec-fnc-q\"}] =\n+ {\"positive_int\",\n+ \"set the search's space for the fnc algorithm.\"};\n+ this->opt_args[{\"dec-fnc-ite-m\"}] =\n+ {\"positive_int\",\n+ \"set first iteration at which the fnc is used.\"};\n+ this->opt_args[{\"dec-fnc-ite-M\"}] =\n+ {\"positive_int\",\n+ \"set last iteration at which the fnc is used.\"};\n+ this->opt_args[{\"dec-fnc-ite-s\"}] =\n+ {\"positive_int\",\n+ \"set iteration step for the fnc algorithm.\"};\n+\n}\ntemplate <typename B, typename R, typename Q, typename QD>\n@@ -139,8 +160,22 @@ void Launcher_BFER_turbo<B,R,Q,QD>\nif(this->ar.exist_arg({\"dec-max\" })) this->params.decoder.max = this->ar.get_arg ({\"dec-max\" });\nif (this->ar.exist_arg({\"crc-type\"}))\n+ {\nif (this->ar.exist_arg({\"dec-sc\"}))\nthis->params.decoder.self_corrected = true;\n+ else if (this->ar.exist_arg({\"dec-fnc\"}))\n+ {\n+ this->params.decoder.fnc = true;\n+ if (this->ar.exist_arg({\"dec-fnc-q\"}))\n+ this->params.decoder.fnc_q = this->ar.get_arg_int({\"dec-fnc-q\"});\n+ if (this->ar.exist_arg({\"dec-fnc-ite-m\"}))\n+ this->params.decoder.fnc_ite_min = this->ar.get_arg_int({\"dec-fnc-ite-m\"});\n+ if (this->ar.exist_arg({\"dec-fnc-ite-M\"}))\n+ this->params.decoder.fnc_ite_max = this->ar.get_arg_int({\"dec-fnc-ite-M\"});\n+ if (this->ar.exist_arg({\"dec-fnc-ite-s\"}))\n+ this->params.decoder.fnc_ite_step = this->ar.get_arg_int({\"dec-fnc-ite-s\"});\n+ }\n+ }\nif (this->params.decoder.simd_strategy == \"INTER\" && !this->ar.exist_arg({\"sim-inter-lvl\"}))\nthis->params.simulation.inter_frame_level = mipp::nElReg<Q>();\n@@ -251,6 +286,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\nauto p = Launcher_BFER<B,R,Q>::header_decoder();\nstd::string sc = ((this->params.decoder.self_corrected) ? \"on\" : \"off\");\n+ std::string fnc = ((this->params.decoder.fnc) ? \"on\" : \"off\");\nif (!this->params.decoder.simd_strategy.empty())\np.push_back(std::make_pair(\"SIMD strategy\", this->params.decoder.simd_strategy));\n@@ -259,8 +295,17 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\np.push_back(std::make_pair(\"Scaling factor\", this->params.decoder.scaling_factor ));\np.push_back(std::make_pair(\"Max type\", this->params.decoder.max ));\nif (this->ar.exist_arg({\"crc-type\"}))\n+ {\np.push_back(std::make_pair(\"Self-corrected\", sc));\n-\n+ p.push_back(std::make_pair(\"Flip aNd Check (FNC)\", fnc));\n+ if (this->params.decoder.fnc)\n+ {\n+ p.push_back(std::make_pair(\"FNC q\" , std::to_string(this->params.decoder.fnc_q)));\n+ p.push_back(std::make_pair(\"FNC ite min\" , std::to_string(this->params.decoder.fnc_ite_min)));\n+ p.push_back(std::make_pair(\"FNC ite max\" , std::to_string(this->params.decoder.fnc_ite_max)));\n+ p.push_back(std::make_pair(\"FNC ite step\", std::to_string(this->params.decoder.fnc_ite_step)));\n+ }\n+ }\nreturn p;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"diff": "+#include <string>\n+#include <fstream>\n+#include <iostream>\n+#include <algorithm>\n+\n+#include \"Tools/Math/utils.h\"\n+\n+#include \"Decoder_turbo_naive_CA_flip_and_check.hpp\"\n+\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\n+\n+template <typename R>\n+mipp::vector<unsigned int> partial_sort_indexes(const mipp::vector<R> &v)\n+{\n+ // initialize original index locations\n+ mipp::vector<unsigned int> idx(v.size());\n+ for (size_t i = 0; i != idx.size(); ++i)\n+ idx[i] = i;\n+ // sort indexes based on comparing values in v\n+ std::partial_sort(idx.begin(),idx.begin() + 20, idx.end(),\n+ [&v](size_t i1, size_t i2) {return v[i1] < v[i2];});\n+ return idx;\n+}\n+\n+template <typename B, typename R>\n+Decoder_turbo_naive_CA_flip_and_check<B,R>\n+::Decoder_turbo_naive_CA_flip_and_check(const int& K,\n+ const int& N_without_tb,\n+ const int& n_ite,\n+ const Interleaver<short> &pi,\n+ SISO<R> &siso_n,\n+ SISO<R> &siso_i,\n+ Scaling_factor<R> &scaling_factor,\n+ CRC<B> &crc,\n+ int fnc_q, int fnc_m, int fnc_M, int fnc_s,\n+ const bool buffered_encoding)\n+: Decoder_turbo_naive_CA<B,R>(K, N_without_tb, n_ite, pi, siso_n, siso_i, scaling_factor, crc, buffered_encoding),\n+ q(fnc_q), nb_patterns((1<<q)-1),\n+ metric(K * siso_n.get_simd_inter_frame_level() + mipp::nElReg<R>(), (R)0),\n+ tab_flips(nb_patterns, mipp::vector<B>(q, (B)0)),\n+ s_tmp((K) * siso_n.get_simd_inter_frame_level())\n+{\n+ for (auto i=0; i<nb_patterns; i++)\n+ for (auto j=0; j<q; j++)\n+ tab_flips[i][j] = ((i +1) >> (q -j -1)) & 1;\n+\n+ int ite = fnc_m;\n+ do\n+ {\n+ fnc_ite.push_back(ite);\n+ ite += fnc_s;\n+ }\n+ while (ite <= fnc_M);\n+}\n+\n+template <typename B, typename R>\n+Decoder_turbo_naive_CA_flip_and_check<B,R>\n+::~Decoder_turbo_naive_CA_flip_and_check()\n+{\n+}\n+\n+template <typename B, typename R>\n+void Decoder_turbo_naive_CA_flip_and_check<B,R>\n+::_hard_decode()\n+{\n+ constexpr auto start_check_crc = 2;\n+\n+ assert(start_check_crc >= 1 );\n+ assert(start_check_crc <= this->n_ite);\n+\n+ const auto n_frames = this->get_simd_inter_frame_level();\n+ const auto tail_n_2 = this->siso_n.tail_length() / 2;\n+ const auto tail_i_2 = this->siso_i.tail_length() / 2;\n+\n+ // iterative turbo decoding process\n+ auto ite = 1;\n+ auto check_crc = false;\n+ do\n+ {\n+ // sys + ext\n+ for (auto i = 0; i < this->K * n_frames; i++)\n+ this->l_sen[i] = this->l_sn[i] + this->l_e1n[i];\n+\n+ for (auto i = this->K * n_frames; i < (this->K + tail_n_2) * n_frames; i++)\n+ this->l_sen[i] = this->l_sn[i];\n+\n+ // SISO in the natural domain\n+ this->siso_n.soft_decode(this->l_sen, this->l_pn, this->l_e2n);\n+\n+ // the CRC is here because it is convenient to do not have to make the interleaving process!\n+ if (ite >= start_check_crc)\n+ {\n+ // compute the hard decision (for the CRC)\n+ for (auto i = 0; i < this->K * n_frames; i++)\n+ this->s[i] = (this->l_e2n[i] + this->l_sen[i]) < 0;\n+\n+ check_crc = this->crc.check(this->s, this->get_simd_inter_frame_level());\n+ }\n+\n+ if (!check_crc && std::binary_search(fnc_ite.begin(), fnc_ite.end(), ite))\n+ apply_flip_and_check(check_crc);\n+\n+ if (!check_crc)\n+ {\n+ // apply the scaling factor\n+ this->scaling_factor(this->l_e2n, ite);\n+\n+ // make the interleaving\n+ this->pi.interleave(this->l_e2n, this->l_e1i, n_frames > 1, this->get_simd_inter_frame_level());\n+\n+ // sys + ext\n+ for (auto i = 0; i < this->K * n_frames; i++)\n+ this->l_sei[i] = this->l_si[i] + this->l_e1i[i];\n+\n+ for (auto i = this->K * n_frames; i < (this->K + tail_i_2) * n_frames; i++)\n+ this->l_sei[i] = this->l_si[i];\n+\n+ // SISO in the interleave domain\n+ this->siso_i.soft_decode(this->l_sei, this->l_pi, this->l_e2i);\n+\n+ if (ite != this->n_ite)\n+ // apply the scaling factor\n+ this->scaling_factor(this->l_e2i, ite);\n+ else\n+ // add the systematic information to the extrinsic information, gives the a posteriori information\n+ for (auto i = 0; i < this->K * n_frames; i++)\n+ this->l_e2i[i] += this->l_sei[i];\n+\n+ // make the deinterleaving\n+ this->pi.deinterleave(this->l_e2i, this->l_e1n, n_frames > 1, this->get_simd_inter_frame_level());\n+\n+ // compute the hard decision only if we are in the last iteration\n+ if (ite == this->n_ite)\n+ for (auto i = 0; i < this->K * n_frames; i++)\n+ this->s[i] = this->l_e1n[i] < 0;\n+ }\n+\n+ ite++; // increment the number of iteration\n+ }\n+ while ((ite <= this->n_ite) && !check_crc);\n+}\n+\n+template <typename B, typename R>\n+void Decoder_turbo_naive_CA_flip_and_check<B,R>\n+::apply_flip_and_check(bool& check_crc)\n+{\n+ for (auto i = 0; i < this->K * this->n_frames; i++)\n+ metric[i] = std::fabs((this->l_e2n[i] + this->l_sen[i]));\n+\n+ mipp::vector<unsigned int> positions = partial_sort_indexes(metric);\n+\n+ auto pattern = 0;\n+ do\n+ {\n+ std::copy(this->s.begin(), this->s.end(), s_tmp.begin());\n+ for (auto depth = 0; depth < q; depth++)\n+ s_tmp[positions[depth]] ^= tab_flips[pattern][depth];\n+ check_crc = this->crc.check(this->s_tmp, this->get_simd_inter_frame_level());\n+ pattern++;\n+ }\n+ while ((pattern < nb_patterns) && !check_crc );\n+\n+ if (check_crc)\n+ std::copy(s_tmp.begin(), s_tmp.end(), this->s.begin());\n+}\n+\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Decoder_turbo_naive_CA_flip_and_check<B_8,Q_8>;\n+template class aff3ct::module::Decoder_turbo_naive_CA_flip_and_check<B_16,Q_16>;\n+template class aff3ct::module::Decoder_turbo_naive_CA_flip_and_check<B_32,Q_32>;\n+template class aff3ct::module::Decoder_turbo_naive_CA_flip_and_check<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Decoder_turbo_naive_CA_flip_and_check<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.hpp",
"diff": "+#ifndef DECODER_TURBO_NAIVE_CA_FLIP_AND_CHECK\n+#define DECODER_TURBO_NAIVE_CA_FLIP_AND_CHECK\n+\n+#include \"../Decoder_turbo_naive_CA.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename R = float>\n+class Decoder_turbo_naive_CA_flip_and_check : public Decoder_turbo_naive_CA<B,R>\n+{\n+private:\n+ int q;\n+ int nb_patterns;\n+ mipp::vector<R> metric;\n+ mipp::vector<mipp::vector<B>> tab_flips; // contains all the binary masks (ie: 1000, 1100 ...)\n+ mipp::vector<B> fnc_ite;\n+ mipp::vector<B> s_tmp;\n+\n+public:\n+ Decoder_turbo_naive_CA_flip_and_check(const int& K,\n+ const int& N_without_tb,\n+ const int& n_ite,\n+ const Interleaver<short> &pi,\n+ SISO<R> &siso_n,\n+ SISO<R> &siso_i,\n+ tools::Scaling_factor<R> &scaling_factor,\n+ CRC<B> &crc,\n+ int fnc_q,\n+ int fnc_m,\n+ int fnc_M,\n+ int fnc_s,\n+ const bool buffered_encoding = true);\n+ virtual ~Decoder_turbo_naive_CA_flip_and_check();\n+\n+protected:\n+ virtual void _hard_decode();\n+ void apply_flip_and_check(bool& check_crc);\n+\n+private:\n+\n+};\n+}\n+}\n+\n+#endif /*DECODER_TURBO_NAIVE_CA_FLIP_AND_CHECK*/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Turbo/Factory_decoder_turbo.cpp",
"new_path": "src/Tools/Factory/Turbo/Factory_decoder_turbo.cpp",
"diff": "#include \"Module/Decoder/Turbo/Decoder_turbo_naive.hpp\"\n#include \"Module/Decoder/Turbo/CRC/Decoder_turbo_naive_CA.hpp\"\n#include \"Module/Decoder/Turbo/CRC/Self_corrected/Decoder_turbo_naive_CA_self_corrected.hpp\"\n+#include \"Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.hpp\"\n#include \"Module/Decoder/Turbo/CRC/Decoder_turbo_fast_CA.hpp\"\n#include \"Factory_decoder_turbo.hpp\"\n@@ -29,16 +30,27 @@ Decoder<B,R>* Factory_decoder_turbo<B,R>\n// there is a CRC\nif (crc != nullptr && !params.crc.type.empty())\n{\n- if(!params.decoder.self_corrected)\n- decoder = new Decoder_turbo_naive_CA<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n- *interleaver, *siso_n, *siso_i, *scaling_factor, *crc,\n- params.encoder.buffered);\n- else\n+ if (params.decoder.self_corrected)\ndecoder = new Decoder_turbo_naive_CA_self_corrected<B,R>(params.code.K, params.code.N,\nparams.decoder.n_ite,\n*interleaver, *siso_n, *siso_i,\n*scaling_factor, *crc,\nparams.encoder.buffered);\n+ else if (params.decoder.fnc)\n+ decoder = new Decoder_turbo_naive_CA_flip_and_check<B,R>(params.code.K, params.code.N,\n+ params.decoder.n_ite,\n+ *interleaver, *siso_n, *siso_i,\n+ *scaling_factor, *crc,\n+ params.decoder.fnc_q,\n+ params.decoder.fnc_ite_min,\n+ params.decoder.fnc_ite_max,\n+ params.decoder.fnc_ite_step,\n+ params.encoder.buffered);\n+ else\n+ decoder = new Decoder_turbo_naive_CA<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n+ *interleaver, *siso_n, *siso_i, *scaling_factor, *crc,\n+ params.encoder.buffered);\n+\n}\n// there is no CRC\nelse\n@@ -51,15 +63,26 @@ Decoder<B,R>* Factory_decoder_turbo<B,R>\n// there is a CRC\nif (crc != nullptr && !params.crc.type.empty())\n{\n- if(!params.decoder.self_corrected)\n- decoder = new Decoder_turbo_fast_CA<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n- *interleaver, *siso_n, *siso_i, *scaling_factor, *crc,\n- params.encoder.buffered);\n- else\n+ if (params.decoder.self_corrected)\ndecoder = new Decoder_turbo_naive_CA_self_corrected<B,R>(params.code.K, params.code.N,\nparams.decoder.n_ite, *interleaver,\n*siso_n, *siso_i, *scaling_factor, *crc,\nparams.encoder.buffered);\n+ else if (params.decoder.fnc)\n+ decoder = new Decoder_turbo_naive_CA_flip_and_check<B,R>(params.code.K, params.code.N,\n+ params.decoder.n_ite,\n+ *interleaver, *siso_n, *siso_i,\n+ *scaling_factor, *crc,\n+ params.decoder.fnc_q,\n+ params.decoder.fnc_ite_min,\n+ params.decoder.fnc_ite_max,\n+ params.decoder.fnc_ite_step,\n+ params.encoder.buffered);\n+ else\n+ decoder = new Decoder_turbo_fast_CA<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n+ *interleaver, *siso_n, *siso_i, *scaling_factor, *crc,\n+ params.encoder.buffered);\n+\n}\n// there is no CRC\nelse\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -132,6 +132,12 @@ struct decoder_parameters\nint n_ite;\nint L;\nbool self_corrected;\n+ bool fnc;\n+ int fnc_q;\n+ int fnc_ite_min;\n+ int fnc_ite_max;\n+ int fnc_ite_step;\n+\n};\nstruct monitor_parameters\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the Flip and Check algorithm (Turbo codes).
|
8,490 |
08.03.2017 15:21:48
| -3,600 |
8d7fb50efbfd307cc81cb359f0ca9120d3128ea1
|
Fix bad PAR CRC.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial.hpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial.hpp",
"diff": "@@ -91,7 +91,7 @@ const std::map<std::string, std::tuple<unsigned, int>> CRC_polynomial<B>::known_\n{\"5-EPC\" , std::make_tuple(0x09 , 5)},\n{\"5-USB\" , std::make_tuple(0x05 , 5)},\n{\"4-ITU\" , std::make_tuple(0x3 , 4)},\n- {\"1-PAR\" , std::make_tuple(0x1 , 4)}};\n+ {\"1-PAR\" , std::make_tuple(0x1 , 1)}};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad PAR CRC.
|
8,490 |
08.03.2017 16:32:34
| -3,600 |
3250d6514ab615cd9543d7e2ce4b146c25c9cafe
|
Fix Wangliu puncturer (Polar codes).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.cpp",
"new_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.cpp",
"diff": "@@ -29,7 +29,7 @@ template <typename B, typename Q>\nvoid Puncturer_polar_wangliu<B,Q>\n::gen_frozen_bits(mipp::vector<B> &frozen_bits)\n{\n- const std::vector<int>& best_channels = fb_generator.get_best_channels();\n+ auto best_channels = fb_generator.get_best_channels();\nint info_bits_placed = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp",
"new_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp",
"diff": "@@ -16,8 +16,8 @@ protected:\nconst tools::Frozenbits_generator<B> &fb_generator;\npublic:\n- Puncturer_polar_wangliu(const int &N,\n- const int &K,\n+ Puncturer_polar_wangliu(const int &K,\n+ const int &N,\nconst tools::Frozenbits_generator<B> &fb_generator,\nconst int n_frames = 1,\nconst std::string name = \"Puncturer_polar_wangliu\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Puncturer.hpp",
"new_path": "src/Module/Puncturer/Puncturer.hpp",
"diff": "@@ -50,6 +50,8 @@ public:\nconst std::string name = \"Puncturer_i\")\n: Module(n_frames, name), K(K), N(N), N_code(N_code)\n{\n+ assert(K <= N);\n+ assert(N_code >= N);\n}\n/*!\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Polar/Simulation_BFER_polar.cpp",
"new_path": "src/Simulation/BFER/Code/Polar/Simulation_BFER_polar.cpp",
"diff": "@@ -59,7 +59,7 @@ void Simulation_BFER_polar<B,R,Q>\nfb_generator->generate(frozen_bits);\nif (this->params.code.N != this->params.code.N_code)\n{\n- Puncturer_polar_wangliu<B,Q> punct(this->params.code.N, this->params.code.K, *fb_generator);\n+ Puncturer_polar_wangliu<B,Q> punct(this->params.code.K, this->params.code.N, *fb_generator);\npunct.gen_frozen_bits(frozen_bits);\n}\n}\n@@ -80,7 +80,7 @@ void Simulation_BFER_polar<B,R,Q>\nif (this->params.code.N != this->params.code.N_code)\n{\n- Puncturer_polar_wangliu<B,Q> punct(this->params.code.N, this->params.code.K, *fb_generator);\n+ Puncturer_polar_wangliu<B,Q> punct(this->params.code.K, this->params.code.N, *fb_generator);\npunct.gen_frozen_bits(frozen_bits);\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix Wangliu puncturer (Polar codes).
|
8,490 |
09.03.2017 10:40:29
| -3,600 |
ddbf768ac3d98411893bcfe334df892f8f84f2ec
|
Use 64-bit unsigned interger to store be and fe in the monitor (useful for MPI simus).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp",
"new_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp",
"diff": "@@ -16,20 +16,21 @@ Channel_additive_user<R>\nstd::ifstream file(filename.c_str(), std::ios::binary);\nif (file.is_open())\n{\n- int n_fra = 0, fra_size = 0;\n+ unsigned long long n_fra = 0;\n+ int fra_size = 0;\n- file.read((char*)&n_fra, sizeof(int));\n- file.read((char*)&fra_size, sizeof(int));\n+ file.read((char*)&n_fra, sizeof(n_fra));\n+ file.read((char*)&fra_size, sizeof(fra_size));\nassert(n_fra > 0 && fra_size > 0);\nthis->noise.resize(n_fra);\n- for (auto i = 0; i < n_fra; i++)\n+ for (unsigned i = 0; i < (unsigned)n_fra; i++)\nthis->noise[i].resize(fra_size);\nif (fra_size == this->N)\n{\n- for (auto i = 0; i < n_fra; i++)\n+ for (unsigned i = 0; i < (unsigned)n_fra; i++)\nfile.read(reinterpret_cast<char*>(&this->noise[i][0]), fra_size*sizeof(R));\n}\nelse\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/User/Channel_user.cpp",
"new_path": "src/Module/Channel/User/Channel_user.cpp",
"diff": "@@ -16,20 +16,21 @@ Channel_user<R>\nstd::ifstream file(filename.c_str(), std::ios::binary);\nif (file.is_open())\n{\n- int n_fra = 0, fra_size = 0;\n+ unsigned long long n_fra = 0;\n+ int fra_size = 0;\n- file.read((char*)&n_fra, sizeof(int));\n- file.read((char*)&fra_size, sizeof(int));\n+ file.read((char*)&n_fra, sizeof(n_fra));\n+ file.read((char*)&fra_size, sizeof(fra_size));\nassert(n_fra > 0 && fra_size > 0);\nthis->noise.resize(n_fra);\n- for (auto i = 0; i < n_fra; i++)\n+ for (unsigned i = 0; i < (unsigned)n_fra; i++)\nthis->noise[i].resize(fra_size);\nif (fra_size == this->N)\n{\n- for (auto i = 0; i < n_fra; i++)\n+ for (unsigned i = 0; i < (unsigned)n_fra; i++)\nfile.read(reinterpret_cast<char*>(&this->noise[i][0]), fra_size*sizeof(R));\n}\nelse\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Monitor.hpp",
"new_path": "src/Module/Monitor/Monitor.hpp",
"diff": "@@ -98,14 +98,14 @@ public:\n*\n* \\return the number of bit errors.\n*/\n- virtual int get_n_be() const = 0;\n+ virtual unsigned long long get_n_be() const = 0;\n/*!\n* \\brief Gets the number of frame errors.\n*\n* \\return the number of frame errors.\n*/\n- virtual int get_n_fe() const = 0;\n+ virtual unsigned long long get_n_fe() const = 0;\n/*!\n* \\brief Gets the bit error rate.\n@@ -133,7 +133,7 @@ public:\n*\n* \\return the frame errors limit.\n*/\n- virtual int get_fe_limit() const = 0;\n+ virtual unsigned get_fe_limit() const = 0;\n/*!\n* \\brief Tells if the frame errors limit is achieved (in this case the current computations should stop).\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"diff": "@@ -13,7 +13,7 @@ using namespace aff3ct::tools;\ntemplate <typename B, typename R>\nMonitor_reduction<B,R>\n-::Monitor_reduction(const int& K, const int& N, const int& max_fe, std::vector<Monitor<B,R>*>& monitors,\n+::Monitor_reduction(const int& K, const int& N, const unsigned& max_fe, std::vector<Monitor<B,R>*>& monitors,\nconst int& n_frames, const std::string name)\n: Monitor_std<B,R>(K, N, max_fe, n_frames, name),\nmonitors (monitors )\n@@ -41,7 +41,7 @@ unsigned long long Monitor_reduction<B,R>\n}\ntemplate <typename B, typename R>\n-int Monitor_reduction<B,R>\n+unsigned long long Monitor_reduction<B,R>\n::get_n_fe() const\n{\nauto cur_fe = this->n_frame_errors;\n@@ -52,7 +52,7 @@ int Monitor_reduction<B,R>\n}\ntemplate <typename B, typename R>\n-int Monitor_reduction<B,R>\n+unsigned long long Monitor_reduction<B,R>\n::get_n_be() const\n{\nauto cur_be = this->n_bit_errors;\n@@ -82,7 +82,7 @@ void Monitor_reduction<B,R>\nstd::exit(-1);\n}\n- int n_fe = get_n_fe();\n+ auto n_fe = get_n_fe();\nint Y_size = 0;\n// get Y_size\nfor (unsigned i = 0; i <= monitors.size(); i++)\n@@ -107,8 +107,8 @@ void Monitor_reduction<B,R>\nfile_enc << this->get_K() << std::endl << std::endl; // write length of non coded frames\nfile_enc << this->get_N() << std::endl << std::endl; // write length of coded frames\n- file_noise.write((char *)&n_fe , sizeof(int)); // write number frames\n- file_noise.write((char *)&Y_size, sizeof(int)); // write length of frames\n+ file_noise.write((char *)&n_fe , sizeof(n_fe )); // write number frames\n+ file_noise.write((char *)&Y_size, sizeof(Y_size)); // write length of frames\n// write frames\nfor (unsigned i = 0; i <= monitors.size(); i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.hpp",
"diff": "@@ -19,13 +19,13 @@ private:\nconst std::string error_tracker_head_file_name;\npublic:\n- Monitor_reduction(const int& K, const int& N, const int& max_fe, std::vector<Monitor<B,R>*>& monitors,\n+ Monitor_reduction(const int& K, const int& N, const unsigned& max_fe, std::vector<Monitor<B,R>*>& monitors,\nconst int& n_frames = 1, const std::string name = \"Monitor_reduction\");\nvirtual ~Monitor_reduction();\nunsigned long long get_n_analyzed_fra() const;\n- int get_n_fe() const;\n- int get_n_be() const;\n+ unsigned long long get_n_fe () const;\n+ unsigned long long get_n_be () const;\nvoid dump_bad_frames(const std::string& base_path, const float snr, const mipp::vector<int>& itl_pi = mipp::vector<int>(0));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"diff": "@@ -11,8 +11,8 @@ using namespace aff3ct::tools;\nstruct monitor_vals\n{\n- int n_be;\n- int n_fe;\n+ unsigned long long n_be;\n+ unsigned long long n_fe;\nunsigned long long n_fra;\n};\n@@ -47,8 +47,8 @@ Monitor_reduction_mpi<B,R>\nMPI_Aint displacements[3];\nMPI_Datatype oldtypes[3];\n- blen[0] = 1; displacements[0] = offsetof(monitor_vals, n_be); oldtypes[0] = MPI_INT;\n- blen[1] = 1; displacements[1] = offsetof(monitor_vals, n_fe); oldtypes[1] = MPI_INT;\n+ blen[0] = 1; displacements[0] = offsetof(monitor_vals, n_be); oldtypes[0] = MPI_UNSIGNED_LONG_LONG;\n+ blen[1] = 1; displacements[1] = offsetof(monitor_vals, n_fe); oldtypes[1] = MPI_UNSIGNED_LONG_LONG;\nblen[2] = 1; displacements[2] = offsetof(monitor_vals, n_fra); oldtypes[2] = MPI_UNSIGNED_LONG_LONG;\nif (auto ret = MPI_Type_create_struct(3, blen, displacements, oldtypes, &MPI_monitor_vals))\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_std.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_std.cpp",
"diff": "@@ -11,7 +11,7 @@ using namespace aff3ct::tools;\ntemplate <typename B, typename R>\nMonitor_std<B,R>\n-::Monitor_std(const int& K, const int& N, const int& max_fe, const int& n_frames, const std::string name)\n+::Monitor_std(const int& K, const int& N, const unsigned& max_fe, const int& n_frames, const std::string name)\n: Monitor<B,R>(K, N, n_frames, name.c_str()),\nmax_fe(max_fe),\nn_bit_errors(0),\n@@ -94,7 +94,7 @@ void Monitor_std<B,R>\n}\ntemplate <typename B, typename R>\n-int Monitor_std<B,R>\n+unsigned Monitor_std<B,R>\n::get_fe_limit() const\n{\nreturn max_fe;\n@@ -108,14 +108,14 @@ unsigned long long Monitor_std<B,R>\n}\ntemplate <typename B, typename R>\n-int Monitor_std<B,R>\n+unsigned long long Monitor_std<B,R>\n::get_n_fe() const\n{\nreturn n_frame_errors;\n}\ntemplate <typename B, typename R>\n-int Monitor_std<B,R>\n+unsigned long long Monitor_std<B,R>\n::get_n_be() const\n{\nreturn n_bit_errors;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_std.hpp",
"new_path": "src/Module/Monitor/Standard/Monitor_std.hpp",
"diff": "@@ -16,10 +16,10 @@ template <typename B = int, typename R = float>\nclass Monitor_std : public Monitor<B,R>\n{\nprotected:\n- const int max_fe;\n+ const unsigned max_fe;\n- int n_bit_errors;\n- int n_frame_errors;\n+ unsigned long long n_bit_errors;\n+ unsigned long long n_frame_errors;\nunsigned long long n_analyzed_frames;\nstd::vector<mipp::vector<B>> buff_src;\n@@ -27,7 +27,7 @@ protected:\nstd::vector<mipp::vector<R>> buff_noise;\npublic:\n- Monitor_std(const int& K, const int& N, const int& max_fe, const int& n_frames = 1,\n+ Monitor_std(const int& K, const int& N, const unsigned& max_fe, const int& n_frames = 1,\nconst std::string name = \"Monitor_std\");\nvirtual ~Monitor_std(){};\n@@ -40,11 +40,11 @@ public:\nconst mipp::vector<R>& Y);\nvirtual bool fe_limit_achieved();\n- int get_fe_limit() const;\n+ unsigned get_fe_limit() const;\nvirtual unsigned long long get_n_analyzed_fra() const;\n- virtual int get_n_fe() const;\n- virtual int get_n_be() const;\n+ virtual unsigned long long get_n_fe () const;\n+ virtual unsigned long long get_n_be () const;\nfloat get_fer() const;\nfloat get_ber() const;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"diff": "@@ -176,7 +176,7 @@ void Terminal_BFER<B,R>\nstr_fer << setprecision(2) << scientific << setw(8) << fer;\nunsigned long long l0 = 99999999; // limit 0\n- auto l1 = 99999999; // limit 1\n+ unsigned long long l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\nstream << setprecision( 2) << fixed << setw(6) << snr_s << bold(\" | \");\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Use 64-bit unsigned interger to store be and fe in the monitor (useful for MPI simus).
|
8,495 |
09.03.2017 17:19:09
| -3,600 |
2925c5aa2d6a22d3c316a76607c83a56dc3bfa49
|
Correction of the protype of method apply_fnc.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -192,6 +192,8 @@ void Launcher_BFER_turbo<B,R,Q,QD>\nthis->params.decoder.fnc_ite_min = this->ar.get_arg_int({\"dec-fnc-ite-m\"});\nif (this->ar.exist_arg({\"dec-fnc-ite-M\"}))\nthis->params.decoder.fnc_ite_max = this->ar.get_arg_int({\"dec-fnc-ite-M\"});\n+ else\n+ this->params.decoder.fnc_ite_max = this->params.decoder.n_ite;\nif (this->ar.exist_arg({\"dec-fnc-ite-s\"}))\nthis->params.decoder.fnc_ite_step = this->ar.get_arg_int({\"dec-fnc-ite-s\"});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"new_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"diff": "@@ -37,13 +37,22 @@ Decoder_turbo_naive_CA_flip_and_check<B,R>\nconst bool buffered_encoding)\n: Decoder_turbo_naive_CA<B,R>(K, N_without_tb, n_ite, pi, siso_n, siso_i, scaling_factor, crc, buffered_encoding),\nq(fnc_q), nb_patterns((1<<q)-1),\n- metric(K * siso_n.get_simd_inter_frame_level() + mipp::nElReg<R>(), (R)0),\n+ metric(K, (R)0),\ntab_flips(nb_patterns, mipp::vector<B>(q, (B)0)),\ns_tmp((K) * siso_n.get_simd_inter_frame_level())\n{\n- for (auto i=0; i<nb_patterns; i++)\n- for (auto j=0; j<q; j++)\n- tab_flips[i][j] = ((i +1) >> (q -j -1)) & 1;\n+ int b10, l;\n+ for (int i=1; i<=nb_patterns; i++)\n+ {\n+ b10 = i; // number in base 10\n+ l = 0;\n+ while (b10 > 0)\n+ {\n+ tab_flips[i-1][l] = (b10 % 2);\n+ b10 /=2;\n+ l++;\n+ }\n+ }\nint ite = fnc_m;\ndo\n@@ -99,7 +108,7 @@ void Decoder_turbo_naive_CA_flip_and_check<B,R>\n}\nif (!check_crc && std::binary_search(fnc_ite.begin(), fnc_ite.end(), ite))\n- apply_flip_and_check(check_crc);\n+ check_crc = apply_flip_and_check(this->l_e2n, this->l_sen, this->s);\nif (!check_crc)\n{\n@@ -142,27 +151,34 @@ void Decoder_turbo_naive_CA_flip_and_check<B,R>\n}\ntemplate <typename B, typename R>\n-void Decoder_turbo_naive_CA_flip_and_check<B,R>\n-::apply_flip_and_check(bool& check_crc)\n+bool Decoder_turbo_naive_CA_flip_and_check<B,R>\n+::apply_flip_and_check(const mipp::vector<R>& l_e2n, const mipp::vector<R>& l_sen, mipp::vector<B>& s)\n{\n- for (auto i = 0; i < this->K * this->n_frames; i++)\n- metric[i] = std::fabs((this->l_e2n[i] + this->l_sen[i]));\n+ // reconstruct the a posteriori information and calculate the metric associated\n+ for (auto i = 0; i < this->K; i++)\n+ metric[i] = std::fabs((l_e2n[i] + l_sen[i]));\n+ // get the least reliable positions\nmipp::vector<unsigned int> positions = partial_sort_indexes(metric);\n+ // test all patterns by xoring with tab_flib\n+ bool check_crc = false;\nauto pattern = 0;\ndo\n{\n- std::copy(this->s.begin(), this->s.end(), s_tmp.begin());\n+ std::copy(s.begin(), s.end(), s_tmp.begin());\nfor (auto depth = 0; depth < q; depth++)\ns_tmp[positions[depth]] ^= tab_flips[pattern][depth];\n- check_crc = this->crc.check(this->s_tmp, this->get_simd_inter_frame_level());\n+ check_crc = this->crc.check(s_tmp, this->get_simd_inter_frame_level());\npattern++;\n}\nwhile ((pattern < nb_patterns) && !check_crc );\n+ // if the crc is verified, replace the decoder's output\nif (check_crc)\n- std::copy(s_tmp.begin(), s_tmp.end(), this->s.begin());\n+ std::copy(s_tmp.begin(), s_tmp.end(), s.begin());\n+\n+ return check_crc;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.hpp",
"new_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.hpp",
"diff": "@@ -36,7 +36,7 @@ public:\nprotected:\nvirtual void _hard_decode();\n- void apply_flip_and_check(bool& check_crc);\n+ bool apply_flip_and_check(const mipp::vector<R>& l_e2n, const mipp::vector<R>& l_sen, mipp::vector<B>& s);\nprivate:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Correction of the protype of method apply_fnc.
|
8,495 |
09.03.2017 17:48:42
| -3,600 |
0fcba29ff7893c8fc3cc23f9f22e19fa728bd9de
|
Shell completions for fnc and sc (launcher turbo).
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -126,7 +126,8 @@ _aff3ct() {\nopts=\"$opts --sim-json-path --crc-type --crc-poly --crc-rate \\\n--enc-no-buff --enc-type --enc-poly --itl-type --itl-path \\\n--dec-type -D --dec-implem --dec-ite -i --dec-sf --dec-simd \\\n- --dec-max\"\n+ --dec-max --dec-sc --dec-fnc --dec-fnc-q --dec-fnc-ite-m \\\n+ --dec-fnc-ite-M --dec-fnc-ite-s\"\nfi\n# add contents of Launcher_EXIT_RSC.cpp\n@@ -182,7 +183,8 @@ _aff3ct() {\n--sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n- --sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes)\n+ --sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n+ --dec-fnc-q | --dec-fnc-ite-m | --dec-fnc-ite-M | --dec-fnc-ite-s )\nCOMPREPLY=()\n;;\n@@ -191,7 +193,7 @@ _aff3ct() {\n--sim-benchs-no-ldst | -B | --sim-debug | -d | --sim-time-report | \\\n--cde-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n--crc-rate | --mnt-err-trk | --mnt-err-trk-rev | \\\n- --dec-partial-adaptive)\n+ --dec-partial-adaptive | --dec-fnc | --dec-sc)\nCOMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n;;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Shell completions for fnc and sc (launcher turbo).
|
8,490 |
17.03.2017 11:43:42
| -3,600 |
b8609018deeb829b4f87a49c2ab5dedcce20fcc4
|
Add an empty LDPC encoder from H.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -232,7 +232,7 @@ _aff3ct() {\nREPETITION) params=\"AZCW COSET USER REPETITION\" ;;\nRA) params=\"AZCW COSET USER RA\" ;;\nTURBO) params=\"AZCW COSET USER TURBO\" ;;\n- LDPC) params=\"AZCW COSET USER LDPC LDPC_DVBS2\" ;;\n+ LDPC) params=\"AZCW COSET USER LDPC LDPC_H LDPC_DVBS2\" ;;\nesac\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"diff": "@@ -39,7 +39,7 @@ void Launcher_BFER_LDPC<B,R,Q>\n\"path to the AList formated file.\"};\n// ------------------------------------------------------------------------------------------------------- encoder\n- this->opt_args[{\"enc-type\"}][2] += \", LDPC, LDPC_DVBS2\";\n+ this->opt_args[{\"enc-type\"}][2] += \", LDPC, LDPC_H, LDPC_DVBS2\";\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"new_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"diff": "@@ -40,7 +40,7 @@ void Launcher_BFERI_LDPC<B,R,Q>\n\"path to the AList formated file.\"};\n// ------------------------------------------------------------------------------------------------------- encoder\n- this->opt_args[{\"enc-type\"}][2] += \", LDPC, LDPC_DVBS2\";\n+ this->opt_args[{\"enc-type\"}][2] += \", LDPC, LDPC_H, LDPC_DVBS2\";\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BP, BP_FLOODING, BP_LAYERED\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "@@ -11,14 +11,14 @@ using namespace module;\ntemplate <typename B>\nEncoder_LDPC<B>\n-::Encoder_LDPC(const int K, const int N, const tools::AList_reader &alist_data, const int n_frames,\n+::Encoder_LDPC(const int K, const int N, const tools::AList_reader &alist_G, const int n_frames,\nconst std::string name)\n-: Encoder_sys<B>(K, N, n_frames, name), K(K), N(N), tG(N*K,0)\n+: Encoder<B>(K, N, n_frames, name), tG(N * K, 0)\n{\n- assert(K == (int)alist_data.get_n_CN());\n- assert(N == (int)alist_data.get_n_VN());\n+ assert(K == (int)alist_G.get_n_CN());\n+ assert(N == (int)alist_G.get_n_VN());\n- auto CN_to_VN = alist_data.get_CN_to_VN();\n+ auto CN_to_VN = alist_G.get_CN_to_VN();\nmipp::vector<B> G(K * N,0);\nfor (auto i = 0; i < K; i++)\n@@ -34,27 +34,20 @@ Encoder_LDPC<B>\n{\n}\n-template <typename B>\n-void Encoder_LDPC<B>\n-::encode_sys(const mipp::vector<B>& U_K, mipp::vector<B>& par)\n-{\n- std::cerr << \"Unimplemented method\" << std::endl;\n-}\n-\ntemplate <typename B>\nvoid Encoder_LDPC<B>\n::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n{\n- assert(K == (int)U_K.size());\n- assert(N == (int)X_N.size());\n+ assert(this->K == (int)U_K.size());\n+ assert(this->N == (int)X_N.size());\n- tools::rgemm(1, N, K, U_K, tG, X_N);\n+ // Real General Matrix Multiplication\n+ tools::rgemm(1, this->N, this->K, U_K, tG, X_N);\n- for (auto j = 0; j < N; ++j)\n+ for (auto j = 0; j < this->N; ++j)\nX_N[j] %= 2;\n}\n-\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"diff": "#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"../Encoder_sys.hpp\"\n+\n+#include \"../Encoder.hpp\"\nnamespace aff3ct\n{\n@@ -13,18 +14,16 @@ namespace module\n{\ntemplate <typename B>\n-class Encoder_LDPC : public Encoder_sys<B>\n+class Encoder_LDPC : public Encoder<B>\n{\n- const int K, N;\nmipp::vector<B> tG; // the generator matrix\npublic:\n- Encoder_LDPC(const int K, const int N, const tools::AList_reader &alist_data, const int n_frames = 1,\n+ Encoder_LDPC(const int K, const int N, const tools::AList_reader &alist_G, const int n_frames = 1,\nconst std::string name = \"Encoder_LDPC\");\nvirtual ~Encoder_LDPC();\nvoid encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N);\n- void encode_sys(const mipp::vector<B>& U_K, mipp::vector<B>& par);\n};\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "+#include <cassert>\n+#include <iostream>\n+\n+#include \"Tools/Display/bash_tools.h\"\n+#include \"Tools/Math/matrix.h\"\n+\n+#include \"Encoder_LDPC_from_H.hpp\"\n+\n+using namespace aff3ct;\n+using namespace module;\n+\n+template <typename B>\n+Encoder_LDPC_from_H<B>\n+::Encoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames,\n+ const std::string name)\n+: Encoder<B>(K, N, n_frames, name), tG(N * K, 0)\n+{\n+ // TODO: compute G\n+// mipp::vector<B> G; // declare the G matrix\n+\n+ // transpose G\n+// tools::real_transpose(K, N, G, tG);\n+}\n+\n+template <typename B>\n+Encoder_LDPC_from_H<B>\n+::~Encoder_LDPC_from_H()\n+{\n+}\n+\n+template <typename B>\n+void Encoder_LDPC_from_H<B>\n+::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n+{\n+ assert(this->K == (int)U_K.size());\n+ assert(this->N == (int)X_N.size());\n+\n+ // Real General Matrix Multiplication\n+ tools::rgemm(1, this->N, this->K, U_K, tG, X_N);\n+\n+ for (auto j = 0; j < this->N; ++j)\n+ X_N[j] %= 2;\n+}\n+\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class Encoder_LDPC_from_H<B_8>;\n+template class Encoder_LDPC_from_H<B_16>;\n+template class Encoder_LDPC_from_H<B_32>;\n+template class Encoder_LDPC_from_H<B_64>;\n+#else\n+template class Encoder_LDPC_from_H<B>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "+#ifndef ENCODER_LDPC_FROM_H_HPP_\n+#define ENCODER_LDPC_FROM_H_HPP_\n+\n+#include <vector>\n+\n+#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n+#include \"Tools/Perf/MIPP/mipp.h\"\n+\n+#include \"../../Encoder.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+\n+template <typename B>\n+class Encoder_LDPC_from_H : public Encoder<B>\n+{\n+ mipp::vector<B> tG; // the generator matrix\n+\n+public:\n+ Encoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames = 1,\n+ const std::string name = \"Encoder_LDPC_from_H\");\n+ virtual ~Encoder_LDPC_from_H();\n+\n+ void encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N);\n+};\n+\n+}\n+}\n+\n+#endif /* ENCODER_LDPC_FROM_H_HPP_ */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"diff": "#include \"Tools/Factory/LDPC/Factory_encoder_LDPC.hpp\"\n#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n+#include \"Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp\"\n#include \"Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp\"\n@@ -15,7 +16,8 @@ Encoder<B>* Factory_encoder_LDPC<B>\n// build the encoder\nif (params.encoder.type == \"LDPC\")\nencoder = new Encoder_LDPC<B>(params.code.K, params.code.N + params.code.tail_length, AList_reader(params.encoder.path), n_frames);\n-\n+ else if (params.encoder.type == \"LDPC_H\")\n+ encoder = new Encoder_LDPC_from_H<B>(params.code.K, params.code.N + params.code.tail_length, AList_reader(params.code.alist_path), n_frames);\nelse if (params.encoder.type == \"LDPC_DVBS2\")\nencoder = new Encoder_LDPC_DVBS2<B>(params.code.K, params.code.N + params.code.tail_length, n_frames);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add an empty LDPC encoder from H.
|
8,487 |
20.03.2017 13:58:25
| -3,600 |
72d67c98421e1900bb55ca9bce8023cfffbea153
|
Add an Encoder LDPC with only H alist file
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "#include <cassert>\n#include <iostream>\n+#include <vector>\n+#include <algorithm>\n+#include <functional>\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/matrix.h\"\nusing namespace aff3ct;\nusing namespace module;\n+using namespace std;\ntemplate <typename B>\nEncoder_LDPC_from_H<B>\n@@ -15,11 +19,141 @@ Encoder_LDPC_from_H<B>\nconst std::string name)\n: Encoder<B>(K, N, n_frames, name), tG(N * K, 0)\n{\n- // TODO: compute G\n-// mipp::vector<B> G; // declare the G matrix\n+// I) take H\n+ // Take some information about H\n+ int n(alist_H.get_n_VN());\n+ int k(alist_H.get_n_CN());\n+ auto positions = alist_H.get_CN_to_VN();\n+ // Initialization of H\n+ vector<vector<bool> > H;\n+ for(int i = 0; i < k; i++)\n+ {\n+ H.push_back(vector<bool>(n,false));\n+ }\n+ // Complete the matrix H\n+ for(unsigned int i = 0; i < positions.size(); i++)\n+ {\n+ for(unsigned int j = 0; j < positions[i].size(); j++)\n+ {\n+ H[i][positions[i][j]] = true;\n+ }\n+ }\n- // transpose G\n-// tools::real_transpose(K, N, G, tG);\n+// II) Gauss pivot\n+ // Initialization of variables\n+ vector<int> swapped;\n+ int i(-1);\n+ bool fund(false);\n+ vector<bool> tmp1(n,false);\n+ vector<bool> tmp2;\n+ // Create a triangularization in H(1:k,1:k)\n+ while( i < k-1 )\n+ {\n+ i++;\n+ if( H[i][i] )\n+ {\n+ for(int j = (i+1); j < k; j++)\n+ {\n+ if( H[j][i] )\n+ {\n+ transform (H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), not_equal_to<bool>());\n+ }\n+ }\n+ }\n+ else\n+ {\n+ for(int j = (i+1); j < k; j++) // find an other row which is good\n+ {\n+ if( H[j][i] )\n+ {\n+ tmp1 = H[i];\n+ H[i] = H[j];\n+ H[j] = tmp1;\n+ i--;\n+ fund = true;\n+ break;\n+ }\n+ }\n+ if( !fund ) // if does not fund\n+ {\n+ for(int j = (i+1); j<n; j++) // find an other column which is good\n+ {\n+ if( H[i][j] )\n+ {\n+ swapped.push_back(i);\n+ swapped.push_back(j);\n+ tmp2.clear();\n+ for(int l = 0; l < k; l++)\n+ {\n+ tmp2.push_back(H[l][i]);\n+ }\n+ for(int l = 0; l < k; l++)\n+ {\n+ H[l][i] = H[l][j];\n+ }\n+ for(int l = 0; l < k; l++)\n+ {\n+ H[l][j] = tmp2[l];\n+ }\n+ i--;\n+ fund = true;\n+ break;\n+ }\n+ }\n+ }\n+ if( !fund ) // if does not fund again this mean that the row is the null vector\n+ {\n+ H.erase( H.begin() + i );\n+ i--;\n+ k--;\n+ }\n+ fund = false;\n+ }\n+ }\n+ // assert of variable K abnd N give by the user\n+ assert(n == N);\n+ assert(n-k == K);\n+ // Create Identity in H(1:k,1:k)\n+ for(int i = k-1 ; i > 0; i--)\n+ {\n+ for(int j = (i-1); j > -1; j--)\n+ {\n+ if( H[j][i] )\n+ {\n+ transform (H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), not_equal_to<bool>());\n+ }\n+ }\n+ }\n+ // Creation of G with previous information\n+ for(int i = 0; i < k; i++) // Kill of the Identity in H\n+ {\n+ H[i].erase( H[i].begin(), H[i].begin() + k );\n+ }\n+ for(int i = k; i < n; i++) // Add identity at the end\n+ {\n+ H.push_back(vector<bool>(n-k,false));\n+ H[i][i-k] = true;\n+ }\n+ // Re-organization: column of G\n+ vector<bool> tmp3(n-k,false);\n+ for(int l = (swapped.size() / 2); l > 0; l-- )\n+ {\n+ tmp3 = H[swapped[l*2-1]];\n+ H[swapped[l*2-1]] = H[swapped[(l-1)*2]];\n+ H[swapped[(l-1)*2]] = tmp3;\n+ }\n+// III) Write G matrix in Gt vector\n+ for(int i = 0; i < N; i++)\n+ {\n+ for(int j = 0; j < K; j++)\n+ {\n+ tG[ K*i + j ] = H[i][j];\n+ }\n+ }\n+// for(unsigned int i = 0; i< tG.size(); i++)\n+// {\n+// cout << tG[i];\n+// }\n}\ntemplate <typename B>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -16,7 +16,8 @@ namespace module\ntemplate <typename B>\nclass Encoder_LDPC_from_H : public Encoder<B>\n{\n- mipp::vector<B> tG; // the generator matrix\n+private:\n+ mipp::vector<B> tG;\npublic:\nEncoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames = 1,\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add an Encoder LDPC with only H alist file
|
8,490 |
20.03.2017 12:29:24
| -3,600 |
cf587cd97cab2fa83310ffdb3e9e466cb0d41c81
|
Add a method in the LDPC encoders to specify the position of the info bits in the coded frame.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "#include <cassert>\n+#include <numeric>\n#include <iostream>\n#include \"Tools/Display/bash_tools.h\"\nusing namespace aff3ct;\nusing namespace module;\n+template <typename B>\n+Encoder_LDPC<B>\n+::Encoder_LDPC(const int K, const int N, const int n_frames, const std::string name)\n+: Encoder<B>(K, N, n_frames, name), tG(N * K, 0)\n+{\n+}\n+\ntemplate <typename B>\nEncoder_LDPC<B>\n::Encoder_LDPC(const int K, const int N, const tools::AList_reader &alist_G, const int n_frames,\n@@ -34,6 +42,14 @@ Encoder_LDPC<B>\n{\n}\n+template <typename B>\n+void Encoder_LDPC<B>\n+::get_info_bits_pos(mipp::vector<B>& info_bits_pos)\n+{\n+ assert(this->K <= (int)info_bits_pos.size());\n+ std::iota(info_bits_pos.begin(), info_bits_pos.begin() + this->K, 0);\n+}\n+\ntemplate <typename B>\nvoid Encoder_LDPC<B>\n::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"diff": "@@ -16,14 +16,20 @@ namespace module\ntemplate <typename B>\nclass Encoder_LDPC : public Encoder<B>\n{\n+protected:\nmipp::vector<B> tG; // the generator matrix\n+protected:\n+ Encoder_LDPC(const int K, const int N, const int n_frames = 1, const std::string name = \"Encoder_LDPC\");\n+\npublic:\nEncoder_LDPC(const int K, const int N, const tools::AList_reader &alist_G, const int n_frames = 1,\nconst std::string name = \"Encoder_LDPC\");\nvirtual ~Encoder_LDPC();\n- void encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N);\n+ virtual void get_info_bits_pos(mipp::vector<B>& info_bits_pos);\n+\n+ virtual void encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N);\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "#include <cassert>\n#include <iostream>\n#include <vector>\n+#include <numeric>\n#include <algorithm>\n#include <functional>\n@@ -17,7 +18,7 @@ template <typename B>\nEncoder_LDPC_from_H<B>\n::Encoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames,\nconst std::string name)\n-: Encoder<B>(K, N, n_frames, name), tG(N * K, 0)\n+: Encoder_LDPC<B>(K, N, n_frames, name)\n{\n// I) take H\n// Take some information about H\n@@ -147,7 +148,7 @@ Encoder_LDPC_from_H<B>\n{\nfor(int j = 0; j < K; j++)\n{\n- tG[ K*i + j ] = H[i][j];\n+ this->tG[ K*i + j ] = H[i][j];\n}\n}\n// for(unsigned int i = 0; i< tG.size(); i++)\n@@ -164,16 +165,10 @@ Encoder_LDPC_from_H<B>\ntemplate <typename B>\nvoid Encoder_LDPC_from_H<B>\n-::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n+::get_info_bits_pos(mipp::vector<B>& info_bits_pos)\n{\n- assert(this->K == (int)U_K.size());\n- assert(this->N == (int)X_N.size());\n-\n- // Real General Matrix Multiplication\n- tools::rgemm(1, this->N, this->K, U_K, tG, X_N);\n-\n- for (auto j = 0; j < this->N; ++j)\n- X_N[j] %= 2;\n+ assert(this->K <= (int)info_bits_pos.size());\n+ std::iota(info_bits_pos.begin(), info_bits_pos.begin() + this->K, 0);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"../../Encoder.hpp\"\n+#include \"../Encoder_LDPC.hpp\"\nnamespace aff3ct\n{\n@@ -14,17 +14,14 @@ namespace module\n{\ntemplate <typename B>\n-class Encoder_LDPC_from_H : public Encoder<B>\n+class Encoder_LDPC_from_H : public Encoder_LDPC<B>\n{\n-private:\n- mipp::vector<B> tG;\n-\npublic:\nEncoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames = 1,\nconst std::string name = \"Encoder_LDPC_from_H\");\nvirtual ~Encoder_LDPC_from_H();\n- void encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N);\n+ virtual void get_info_bits_pos(mipp::vector<B>& info_bits_pos);\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a method in the LDPC encoders to specify the position of the info bits in the coded frame.
|
8,490 |
20.03.2017 16:47:38
| -3,600 |
592592d2bd3782633c8ab8e4bfcd605aaba4e19f
|
DVBS2 inherit from Encoder_LDPC.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"diff": "@@ -11,9 +11,8 @@ using namespace module;\ntemplate <typename B>\nEncoder_LDPC_DVBS2<B>\n-::Encoder_LDPC_DVBS2(const int K, const int N, const int n_frames,\n- const std::string name)\n-: Encoder_sys<B>(K, N, n_frames, name), K(K), N(N)\n+::Encoder_LDPC_DVBS2(const int K, const int N, const int n_frames, const std::string name)\n+: Encoder_LDPC<B>(K, N, n_frames, name)\n{\nbuild_dvbs2();\n@@ -41,9 +40,9 @@ void Encoder_LDPC_DVBS2<B>\n{\ndvbs2 = nullptr;\n- auto NmK = N-K;\n+ auto NmK = this->N - this->K;\n- switch (N)\n+ switch (this->N)\n{\ncase 16200:\n{\n@@ -92,24 +91,17 @@ void Encoder_LDPC_DVBS2<B>\n}\n}\n-template <typename B>\n-void Encoder_LDPC_DVBS2<B>\n-::encode_sys(const mipp::vector<B>& U_K, mipp::vector<B>& par)\n-{\n- std::cerr << \"Unimplemented method\" << std::endl;\n-}\n-\ntemplate <typename B>\nvoid Encoder_LDPC_DVBS2<B>\n::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n{\n- assert((int)U_K.size() == K);\n- assert((int)X_N.size() == N);\n+ assert((int)U_K.size() == this->K);\n+ assert((int)X_N.size() == this->N);\nstd::copy(U_K.begin(), U_K.end(), X_N.begin());\n- std::fill(X_N.begin()+K, X_N.end(), 0 );\n+ std::fill(X_N.begin() + this->K, X_N.end(), 0 );\n- B *Px = &X_N[K];\n+ B* Px = &X_N[this->K];\nconst int *p = dvbs2->EncValues.data();\nint xPos = 0;\n@@ -137,7 +129,6 @@ void Encoder_LDPC_DVBS2<B>\nPx[i] = Px[i] ^ Px[i-1];\n}\n-\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"diff": "#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"../../Encoder_sys.hpp\"\n+#include \"../Encoder_LDPC.hpp\"\n#include \"Encoder_LDPC_DVBS2_constants.hpp\"\nnamespace aff3ct\n@@ -13,19 +13,15 @@ namespace module\n{\ntemplate <typename B>\n-class Encoder_LDPC_DVBS2 : public Encoder_sys<B>\n+class Encoder_LDPC_DVBS2 : public Encoder_LDPC<B>\n{\n- const int K, N;\nconst dvbs2_values* dvbs2 = nullptr;\npublic:\n- Encoder_LDPC_DVBS2(const int K, const int N, const int n_frames = 1,\n- const std::string name = \"Encoder_LDPC\");\n+ Encoder_LDPC_DVBS2(const int K, const int N, const int n_frames = 1, const std::string name = \"Encoder_LDPC\");\nvirtual ~Encoder_LDPC_DVBS2();\n-\nvoid encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N);\n- void encode_sys(const mipp::vector<B>& U_K, mipp::vector<B>& par);\nprivate:\nvoid build_dvbs2();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
DVBS2 inherit from Encoder_LDPC.
|
8,490 |
20.03.2017 17:07:12
| -3,600 |
d8ae37247c4fb866b3c79ceafdf7594239f0f5f5
|
Pass the LDPC info bit positions through the simulation to the decoder factory.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.cpp",
"new_path": "src/Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.cpp",
"diff": "#include <vector>\n#include <chrono>\n#include <cstdlib>\n+#include <numeric>\n#include <algorithm>\n#include \"Tools/Display/bash_tools.h\"\n@@ -18,9 +19,13 @@ using namespace aff3ct::simulation;\ntemplate <typename B, typename R, typename Q>\nSimulation_BFER_LDPC<B,R,Q>\n::Simulation_BFER_LDPC(const parameters& params)\n-: Simulation_BFER<B,R,Q>(params), alist_data(params.code.alist_path)\n+: Simulation_BFER<B,R,Q>(params),\n+ alist_data (params.code.alist_path),\n+ info_bits_pos(this->params.code.K )\n{\nassert(this->params.code.N == (int)alist_data.get_n_VN());\n+\n+ std::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -47,7 +52,15 @@ Encoder<B>* Simulation_BFER_LDPC<B,R,Q>\n{\nauto encoder = Simulation_BFER<B,R,Q>::build_encoder(tid);\nif (encoder == nullptr)\n- encoder = Factory_encoder_LDPC<B>::build(this->params);\n+ {\n+ auto encoder_LDPC = Factory_encoder_LDPC<B>::build(this->params);\n+\n+ if (tid == 0)\n+ encoder_LDPC->get_info_bits_pos(info_bits_pos);\n+\n+ return encoder_LDPC;\n+ }\n+ else\nreturn encoder;\n}\n@@ -55,7 +68,7 @@ template <typename B, typename R, typename Q>\nDecoder<B,Q>* Simulation_BFER_LDPC<B,R,Q>\n::build_decoder(const int tid)\n{\n- return Factory_decoder_LDPC<B,Q>::build(this->params, alist_data);\n+ return Factory_decoder_LDPC<B,Q>::build(this->params, alist_data, info_bits_pos);\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.hpp",
"new_path": "src/Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.hpp",
"diff": "#ifndef SIMULATION_LDPC_HPP_\n#define SIMULATION_LDPC_HPP_\n+#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n+\n#include \"Tools/Code/LDPC/AList_reader/AList_reader.hpp\"\n#include \"Simulation/BFER/Standard/STD_Simulation_BFER.hpp\"\n@@ -14,6 +16,7 @@ class Simulation_BFER_LDPC : public Simulation_BFER<B,R,Q>\n{\nprotected:\ntools::AList_reader alist_data;\n+ mipp::vector<B> info_bits_pos;\npublic:\nSimulation_BFER_LDPC(const tools::parameters& params);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.cpp",
"new_path": "src/Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.cpp",
"diff": "#include <vector>\n#include <chrono>\n#include <cstdlib>\n+#include <numeric>\n#include <algorithm>\n#include \"Tools/Display/bash_tools.h\"\n@@ -21,9 +22,12 @@ Simulation_BFERI_LDPC<B,R,Q>\n::Simulation_BFERI_LDPC(const parameters& params)\n: Simulation_BFERI<B,R,Q>(params),\nalist_data(params.code.alist_path),\n+ info_bits_pos(this->params.code.K),\ndecoder_siso(params.simulation.n_threads, nullptr)\n{\nassert(this->params.code.N == (int)alist_data.get_n_VN());\n+\n+ std::iota(info_bits_pos.begin(), info_bits_pos.end(), 0);\n}\ntemplate <typename B, typename R, typename Q>\n@@ -50,7 +54,15 @@ Encoder<B>* Simulation_BFERI_LDPC<B,R,Q>\n{\nauto encoder = Simulation_BFERI<B,R,Q>::build_encoder(tid);\nif (encoder == nullptr)\n- encoder = Factory_encoder_LDPC<B>::build(this->params);\n+ {\n+ auto encoder_LDPC = Factory_encoder_LDPC<B>::build(this->params);\n+\n+ if (tid == 0)\n+ encoder_LDPC->get_info_bits_pos(info_bits_pos);\n+\n+ return encoder_LDPC;\n+ }\n+ else\nreturn encoder;\n}\n@@ -58,7 +70,7 @@ template <typename B, typename R, typename Q>\nSISO<Q>* Simulation_BFERI_LDPC<B,R,Q>\n::build_siso(const int tid)\n{\n- decoder_siso[tid] = Factory_decoder_LDPC<B,Q>::build(this->params, alist_data);\n+ decoder_siso[tid] = Factory_decoder_LDPC<B,Q>::build(this->params, alist_data, info_bits_pos);\nreturn decoder_siso[tid];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.hpp",
"new_path": "src/Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.hpp",
"diff": "@@ -16,6 +16,7 @@ class Simulation_BFERI_LDPC : public Simulation_BFERI<B,R,Q>\n{\nprotected:\ntools::AList_reader alist_data;\n+ mipp::vector<B> info_bits_pos;\nstd::vector<module::Decoder_SISO<B,Q>*> decoder_siso;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"diff": "@@ -15,7 +15,7 @@ using namespace aff3ct::tools;\ntemplate <typename B, typename R>\nDecoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\n-::build(const parameters ¶ms, const AList_reader &alist_data)\n+::build(const parameters ¶ms, const AList_reader &alist_data, const mipp::vector<B> &info_bits_pos)\n{\nDecoder_SISO<B,R> *decoder = nullptr;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.hpp",
"new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.hpp",
"diff": "@@ -18,7 +18,8 @@ namespace tools\ntemplate <typename B = int, typename R = float>\nstruct Factory_decoder_LDPC : public Factory\n{\n- static module::Decoder_SISO<B,R>* build(const parameters ¶ms, const AList_reader &alist_data);\n+ static module::Decoder_SISO<B,R>* build(const parameters ¶ms, const AList_reader &alist_data,\n+ const mipp::vector<B> &info_bits_pos);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"diff": "@@ -8,10 +8,10 @@ using namespace aff3ct::module;\nusing namespace aff3ct::tools;\ntemplate <typename B>\n-Encoder<B>* Factory_encoder_LDPC<B>\n+Encoder_LDPC<B>* Factory_encoder_LDPC<B>\n::build(const parameters ¶ms, const int seed, const int n_frames)\n{\n- Encoder<B> *encoder = nullptr;\n+ Encoder_LDPC<B> *encoder = nullptr;\n// build the encoder\nif (params.encoder.type == \"LDPC\")\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.hpp",
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.hpp",
"diff": "#ifndef FACTORY_ENCODER_LDPC_HPP\n#define FACTORY_ENCODER_LDPC_HPP\n-#include \"Module/Encoder/Encoder.hpp\"\n+#include \"Module/Encoder/LDPC/Encoder_LDPC.hpp\"\n#include \"Tools/params.h\"\n@@ -14,7 +14,7 @@ namespace tools\ntemplate <typename B = int>\nstruct Factory_encoder_LDPC : public Factory\n{\n- static module::Encoder<B>* build(const parameters ¶ms, const int seed = 0, const int n_frames = 1);\n+ static module::Encoder_LDPC<B>* build(const parameters ¶ms, const int seed = 0, const int n_frames = 1);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Pass the LDPC info bit positions through the simulation to the decoder factory.
|
8,483 |
21.03.2017 09:07:33
| -7,200 |
9a645a509d50d2e25fd38f2696f54e8d0af85f44
|
enable uniform and columns interleaver on BFER
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/RA/Launcher_BFER_RA.cpp",
"new_path": "src/Launcher/BFER/RA/Launcher_BFER_RA.cpp",
"diff": "@@ -18,6 +18,8 @@ Launcher_BFER_RA<B,R,Q>\nthis->params.encoder .type = \"RA\";\nthis->params.interleaver.type = \"RANDOM\";\nthis->params.interleaver.path = \"\";\n+ this->params.interleaver.nbr_columns= 4;\n+ this->params.interleaver.is_uniform = false;\nthis->params.quantizer .n_bits = 7;\nthis->params.quantizer .n_decimals = 2;\nthis->params.decoder .type = \"RA\";\n@@ -38,12 +40,20 @@ void Launcher_BFER_RA<B,R,Q>\nthis->opt_args[{\"itl-type\"}] =\n{\"string\",\n\"specify the type of the interleaver.\",\n- \"LTE, CCSDS, RANDOM, COLUMNS, GOLDEN, USER, NO\"};\n+ \"LTE, CCSDS, RANDOM, GOLDEN, USER, COLUMNS, NO\"};\nthis->opt_args[{\"itl-path\"}] =\n{\"string\",\n\"specify the path to the interleaver file (to use with \\\"--itl-type USER\\\".\"};\n+ this->opt_args[{\"itl-col\"}] =\n+ {\"positive_int\",\n+ \"specify the number of columns used for the COLUMNS interleaver.\"};\n+\n+ this->opt_args[{\"itl-uni\"}] =\n+ {\"\",\n+ \"enable the regeneration of the interleaver for each new frame\"};\n+\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-ite\", \"i\"}] =\n{\"positive_int\",\n@@ -59,6 +69,8 @@ void Launcher_BFER_RA<B,R,Q>\n// --------------------------------------------------------------------------------------------------- interleaver\nif(this->ar.exist_arg({\"itl-type\"})) this->params.interleaver.type = this->ar.get_arg ({\"itl-type\"});\nif(this->ar.exist_arg({\"itl-path\"})) this->params.interleaver.path = this->ar.get_arg ({\"itl-path\"});\n+ if(this->ar.exist_arg({\"itl-col\" })) this->params.interleaver.nbr_columns = this->ar.get_arg_int({\"itl-col\" });\n+ if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.is_uniform = true;\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"RA\" );\n@@ -84,6 +96,11 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_RA<B,R,Q>\nif (this->params.interleaver.type == \"USER\")\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\n+ if (this->params.interleaver.type == \"COLUMNS\")\n+ p.push_back(std::make_pair(\"Nbr columns\", std::to_string(this->params.interleaver.nbr_columns)));\n+\n+ p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.is_uniform ? \"on\" : \"off\")));\n+\nreturn p;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -27,6 +27,8 @@ Launcher_BFER_turbo<B,R,Q,QD>\nthis->params.encoder .poly = {013, 015};\nthis->params.interleaver.type = \"LTE\";\nthis->params.interleaver.path = \"\";\n+ this->params.interleaver.nbr_columns = 4;\n+ this->params.interleaver.is_uniform = false;\nthis->params.quantizer .n_bits = 6;\nthis->params.quantizer .n_decimals = (typeid(Q) == typeid(short)) ? 3 : 2;\nthis->params.decoder .type = \"BCJR\";\n@@ -68,12 +70,20 @@ void Launcher_BFER_turbo<B,R,Q,QD>\nthis->opt_args[{\"itl-type\"}] =\n{\"string\",\n\"specify the type of the interleaver.\",\n- \"LTE, CCSDS, RANDOM, UNIFORM, COLUMNS, GOLDEN, USER, NO\"};\n+ \"LTE, CCSDS, RANDOM, GOLDEN, USER, COLUMNS, NO\"};\nthis->opt_args[{\"itl-path\"}] =\n{\"string\",\n\"specify the path to the interleaver file (to use with \\\"--itl-type USER\\\".\"};\n+ this->opt_args[{\"itl-col\"}] =\n+ {\"positive_int\",\n+ \"specify the number of columns used for the COLUMNS interleaver.\"};\n+\n+ this->opt_args[{\"itl-uni\"}] =\n+ {\"\",\n+ \"enable the regeneration of the interleaver for each new frame\"};\n+\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BCJR, LTE, CCSDS\" );\nthis->opt_args[{\"dec-implem\" }].push_back(\"GENERIC, STD, FAST, VERY_FAST\");\n@@ -131,6 +141,8 @@ void Launcher_BFER_turbo<B,R,Q,QD>\n// --------------------------------------------------------------------------------------------------- interleaver\nif(this->ar.exist_arg({\"itl-type\"})) this->params.interleaver.type = this->ar.get_arg ({\"itl-type\"});\nif(this->ar.exist_arg({\"itl-path\"})) this->params.interleaver.path = this->ar.get_arg ({\"itl-path\"});\n+ if(this->ar.exist_arg({\"itl-col\" })) this->params.interleaver.nbr_columns = this->ar.get_arg_int({\"itl-col\" });\n+ if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.is_uniform = true;\n// ------------------------------------------------------------------------------------------------------- decoder\nif(this->ar.exist_arg({\"dec-ite\", \"i\"})) this->params.decoder.n_ite = this->ar.get_arg_int({\"dec-ite\", \"i\"});\n@@ -260,6 +272,11 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\nif (this->params.interleaver.type == \"USER\")\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\n+ if (this->params.interleaver.type == \"COLUMNS\")\n+ p.push_back(std::make_pair(\"Nbr columns\", std::to_string(this->params.interleaver.nbr_columns)));\n+\n+ p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.is_uniform ? \"on\" : \"off\")));\n+\nreturn p;\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -442,6 +442,9 @@ void Simulation_BFER<B,R,Q>\nsimu->terminal->temp_report(std::clog);\nsimu->t_simu = steady_clock::now();\n}\n+\n+ if (simu->interleaver[tid] != nullptr && simu->params.interleaver.is_uniform)\n+ simu->interleaver[tid]->gen_lookup_tables();\n}\n}\n@@ -767,6 +770,9 @@ void Simulation_BFER<B,R,Q>\nsimu->terminal->temp_report(std::clog);\nt_simu = steady_clock::now();\n}\n+\n+ if (simu->interleaver[0] != nullptr && simu->params.interleaver.is_uniform)\n+ simu->interleaver[0]->gen_lookup_tables();\n}\nsimu->terminal->legend(std::cout);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
enable uniform and columns interleaver on BFER
|
8,490 |
21.03.2017 10:49:07
| -3,600 |
2a968ac89bb0d584c65e11fed34b6c01f9a4012e
|
Cosmetics and renaming.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/RA/Launcher_BFER_RA.cpp",
"new_path": "src/Launcher/BFER/RA/Launcher_BFER_RA.cpp",
"diff": "@@ -18,8 +18,8 @@ Launcher_BFER_RA<B,R,Q>\nthis->params.encoder .type = \"RA\";\nthis->params.interleaver.type = \"RANDOM\";\nthis->params.interleaver.path = \"\";\n- this->params.interleaver.nbr_columns= 4;\n- this->params.interleaver.is_uniform = false;\n+ this->params.interleaver.n_cols = 4;\n+ this->params.interleaver.uniform = false;\nthis->params.quantizer .n_bits = 7;\nthis->params.quantizer .n_decimals = 2;\nthis->params.decoder .type = \"RA\";\n@@ -46,13 +46,13 @@ void Launcher_BFER_RA<B,R,Q>\n{\"string\",\n\"specify the path to the interleaver file (to use with \\\"--itl-type USER\\\".\"};\n- this->opt_args[{\"itl-col\"}] =\n+ this->opt_args[{\"itl-cols\"}] =\n{\"positive_int\",\n\"specify the number of columns used for the COLUMNS interleaver.\"};\nthis->opt_args[{\"itl-uni\"}] =\n{\"\",\n- \"enable the regeneration of the interleaver for each new frame\"};\n+ \"enable the regeneration of the interleaver for each new frame.\"};\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-ite\", \"i\"}] =\n@@ -69,8 +69,8 @@ void Launcher_BFER_RA<B,R,Q>\n// --------------------------------------------------------------------------------------------------- interleaver\nif(this->ar.exist_arg({\"itl-type\"})) this->params.interleaver.type = this->ar.get_arg ({\"itl-type\"});\nif(this->ar.exist_arg({\"itl-path\"})) this->params.interleaver.path = this->ar.get_arg ({\"itl-path\"});\n- if(this->ar.exist_arg({\"itl-col\" })) this->params.interleaver.nbr_columns = this->ar.get_arg_int({\"itl-col\" });\n- if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.is_uniform = true;\n+ if(this->ar.exist_arg({\"itl-cols\"})) this->params.interleaver.n_cols = this->ar.get_arg_int({\"itl-cols\"});\n+ if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.uniform = true;\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"RA\" );\n@@ -97,9 +97,9 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_RA<B,R,Q>\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\nif (this->params.interleaver.type == \"COLUMNS\")\n- p.push_back(std::make_pair(\"Nbr columns\", std::to_string(this->params.interleaver.nbr_columns)));\n+ p.push_back(std::make_pair(\"Number of columns\", std::to_string(this->params.interleaver.n_cols)));\n- p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.is_uniform ? \"on\" : \"off\")));\n+ p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.uniform ? \"on\" : \"off\")));\nreturn p;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -27,8 +27,8 @@ Launcher_BFER_turbo<B,R,Q,QD>\nthis->params.encoder .poly = {013, 015};\nthis->params.interleaver.type = \"LTE\";\nthis->params.interleaver.path = \"\";\n- this->params.interleaver.nbr_columns = 4;\n- this->params.interleaver.is_uniform = false;\n+ this->params.interleaver.n_cols = 4;\n+ this->params.interleaver.uniform = false;\nthis->params.quantizer .n_bits = 6;\nthis->params.quantizer .n_decimals = (typeid(Q) == typeid(short)) ? 3 : 2;\nthis->params.decoder .type = \"BCJR\";\n@@ -76,13 +76,13 @@ void Launcher_BFER_turbo<B,R,Q,QD>\n{\"string\",\n\"specify the path to the interleaver file (to use with \\\"--itl-type USER\\\".\"};\n- this->opt_args[{\"itl-col\"}] =\n+ this->opt_args[{\"itl-cols\"}] =\n{\"positive_int\",\n\"specify the number of columns used for the COLUMNS interleaver.\"};\nthis->opt_args[{\"itl-uni\"}] =\n{\"\",\n- \"enable the regeneration of the interleaver for each new frame\"};\n+ \"enable the regeneration of the interleaver for each new frame.\"};\n// ------------------------------------------------------------------------------------------------------- decoder\nthis->opt_args[{\"dec-type\", \"D\"}].push_back(\"BCJR, LTE, CCSDS\" );\n@@ -141,8 +141,8 @@ void Launcher_BFER_turbo<B,R,Q,QD>\n// --------------------------------------------------------------------------------------------------- interleaver\nif(this->ar.exist_arg({\"itl-type\"})) this->params.interleaver.type = this->ar.get_arg ({\"itl-type\"});\nif(this->ar.exist_arg({\"itl-path\"})) this->params.interleaver.path = this->ar.get_arg ({\"itl-path\"});\n- if(this->ar.exist_arg({\"itl-col\" })) this->params.interleaver.nbr_columns = this->ar.get_arg_int({\"itl-col\" });\n- if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.is_uniform = true;\n+ if(this->ar.exist_arg({\"itl-cols\"})) this->params.interleaver.n_cols = this->ar.get_arg_int({\"itl-cols\"});\n+ if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.uniform = true;\n// ------------------------------------------------------------------------------------------------------- decoder\nif(this->ar.exist_arg({\"dec-ite\", \"i\"})) this->params.decoder.n_ite = this->ar.get_arg_int({\"dec-ite\", \"i\"});\n@@ -273,9 +273,9 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\nif (this->params.interleaver.type == \"COLUMNS\")\n- p.push_back(std::make_pair(\"Nbr columns\", std::to_string(this->params.interleaver.nbr_columns)));\n+ p.push_back(std::make_pair(\"Number of columns\", std::to_string(this->params.interleaver.n_cols)));\n- p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.is_uniform ? \"on\" : \"off\")));\n+ p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.uniform ? \"on\" : \"off\")));\nreturn p;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -30,8 +30,8 @@ Launcher_BFERI<B,R,Q>\nthis->params.encoder .systematic = true;\nthis->params.interleaver.type = \"RANDOM\";\nthis->params.interleaver.path = \"\";\n- this->params.interleaver.nbr_columns = 4;\n- this->params.interleaver.is_uniform = false;\n+ this->params.interleaver.n_cols = 4;\n+ this->params.interleaver.uniform = false;\nthis->params.demodulator.max = \"MAX\";\nthis->params.demodulator.n_ite = 30;\nthis->params.monitor .n_frame_errors = 100;\n@@ -95,13 +95,13 @@ void Launcher_BFERI<B,R,Q>\n{\"string\",\n\"specify the path to the interleaver file (to use with \\\"--itl-type USER\\\".\"};\n- this->opt_args[{\"itl-col\"}] =\n+ this->opt_args[{\"itl-cols\"}] =\n{\"positive_int\",\n\"specify the number of columns used for the COLUMNS interleaver.\"};\nthis->opt_args[{\"itl-uni\"}] =\n{\"\",\n- \"enable the regeneration of the interleaver for each new frame\"};\n+ \"enable the regeneration of the interleaver for each new frame.\"};\n// --------------------------------------------------------------------------------------------------- demodulator\nthis->opt_args[{\"dmod-ite\"}] =\n@@ -168,8 +168,8 @@ void Launcher_BFERI<B,R,Q>\n// --------------------------------------------------------------------------------------------------- interleaver\nif(this->ar.exist_arg({\"itl-type\"})) this->params.interleaver.type = this->ar.get_arg ({\"itl-type\"});\nif(this->ar.exist_arg({\"itl-path\"})) this->params.interleaver.path = this->ar.get_arg ({\"itl-path\"});\n- if(this->ar.exist_arg({\"itl-col\" })) this->params.interleaver.nbr_columns = this->ar.get_arg_int({\"itl-col\" });\n- if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.is_uniform = true;\n+ if(this->ar.exist_arg({\"itl-cols\"})) this->params.interleaver.n_cols = this->ar.get_arg_int({\"itl-cols\"});\n+ if(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.uniform = true;\n// --------------------------------------------------------------------------------------------------- demodulator\nif(this->ar.exist_arg({\"dmod-ite\"})) this-> params.demodulator.n_ite = this->ar.get_arg_int({\"dmod-ite\"});\n@@ -257,9 +257,9 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\nif (this->params.interleaver.type == \"COLUMNS\")\n- p.push_back(std::make_pair(\"Nbr columns\", std::to_string(this->params.interleaver.nbr_columns)));\n+ p.push_back(std::make_pair(\"Number of columns\", std::to_string(this->params.interleaver.n_cols)));\n- p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.is_uniform ? \"on\" : \"off\")));\n+ p.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.uniform ? \"on\" : \"off\")));\nreturn p;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Columns/Interleaver_columns.hpp",
"new_path": "src/Module/Interleaver/Columns/Interleaver_columns.hpp",
"diff": "@@ -18,33 +18,33 @@ private:\nstd::random_device rd;\nstd::mt19937 rd_engine;\n- const int nbr_columns;\n- int columns_size;\n+ const int n_cols;\n+ int col_size;\npublic:\n- Interleaver_columns(const int size, const int nbr_columns, const int seed = 0,\n+ Interleaver_columns(const int size, const int n_cols, const int seed = 0,\nconst std::string name = \"Interleaver_columns\")\n- : Interleaver<T>(size, 1, name), rd(), rd_engine(rd()), nbr_columns(nbr_columns)\n+ : Interleaver<T>(size, 1, name), rd(), rd_engine(rd()), n_cols(n_cols)\n{\n- columns_size = (size/nbr_columns);\n- assert(columns_size * nbr_columns == size);\n+ col_size = (size / n_cols);\n+ assert(col_size * n_cols == size);\nrd_engine.seed(seed);\ngen_lookup_tables();\n}\nvoid gen_lookup_tables()\n{\n- mipp::vector<T> pi_temp(columns_size); // interleaver lookup table for a column\n+ mipp::vector<T> pi_temp(col_size); // interleaver lookup table for a column\n- for (auto column = 0; column < nbr_columns; column++)\n+ for (auto column = 0; column < n_cols; column++)\n{\n- for (auto c = 0; c < columns_size; c++)\n- pi_temp[c] = c + column * columns_size;\n+ for (auto c = 0; c < col_size; c++)\n+ pi_temp[c] = c + column * col_size;\nstd::shuffle(pi_temp.begin(), pi_temp.end(), rd_engine);\n- for (auto c = 0; c < columns_size; c++)\n- this->pi[c + column * columns_size] = pi_temp[c];\n+ for (auto c = 0; c < col_size; c++)\n+ this->pi[c + column * col_size] = pi_temp[c];\n}\nfor (auto i = 0; i < (int)this->pi_inv.size(); i++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/RA/Simulation_BFER_RA.cpp",
"new_path": "src/Simulation/BFER/Code/RA/Simulation_BFER_RA.cpp",
"diff": "@@ -68,7 +68,7 @@ template <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFER_RA<B,R,Q>\n::build_interleaver(const int tid)\n{\n- auto seed = (this->params.interleaver.is_uniform) ? this->rd_engine_seed[tid]() : this->params.simulation.seed;\n+ auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.simulation.seed;\nInterleaver<int>* itl = Factory_interleaver<int>::build(this->params, this->params.code.K, seed);\nthis->check_errors(itl, \"Interleaver<int>\");\nreturn itl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp",
"new_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp",
"diff": "@@ -116,7 +116,7 @@ template <typename B, typename R, typename Q, typename QD>\nInterleaver<int>* Simulation_BFER_turbo<B,R,Q,QD>\n::build_interleaver(const int tid)\n{\n- auto seed = (this->params.interleaver.is_uniform) ? this->rd_engine_seed[tid]() : this->params.simulation.seed;\n+ auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.simulation.seed;\nInterleaver<int>* itl = Factory_interleaver<int>::build(this->params, this->params.code.K, seed);\nthis->check_errors(itl, \"Interleaver<int>\");\nreturn itl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -443,7 +443,7 @@ void Simulation_BFER<B,R,Q>\nsimu->t_simu = steady_clock::now();\n}\n- if (simu->interleaver[tid] != nullptr && simu->params.interleaver.is_uniform)\n+ if (simu->interleaver[tid] != nullptr && simu->params.interleaver.uniform)\nsimu->interleaver[tid]->gen_lookup_tables();\n}\n}\n@@ -771,7 +771,7 @@ void Simulation_BFER<B,R,Q>\nt_simu = steady_clock::now();\n}\n- if (simu->interleaver[0] != nullptr && simu->params.interleaver.is_uniform)\n+ if (simu->interleaver[0] != nullptr && simu->params.interleaver.uniform)\nsimu->interleaver[0]->gen_lookup_tables();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Simulation_BFERI.cpp",
"diff": "@@ -222,7 +222,7 @@ template <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFERI_i<B,R,Q>\n::build_interleaver(const int tid)\n{\n- auto seed = (params.interleaver.is_uniform) ? rd_engine_seed[tid]() : params.simulation.seed;\n+ auto seed = (params.interleaver.uniform) ? rd_engine_seed[tid]() : params.simulation.seed;\nreturn Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, seed);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -470,7 +470,7 @@ void Simulation_BFERI<B,R,Q>\nsimu->t_simu = steady_clock::now();\n}\n- if (simu->interleaver[tid] != nullptr && simu->params.interleaver.is_uniform)\n+ if (simu->interleaver[tid] != nullptr && simu->params.interleaver.uniform)\nsimu->interleaver[tid]->gen_lookup_tables();\n}\n}\n@@ -797,7 +797,7 @@ void Simulation_BFERI<B,R,Q>\nt_simu = steady_clock::now();\n}\n- if (simu->interleaver[0] != nullptr && simu->params.interleaver.is_uniform)\n+ if (simu->interleaver[0] != nullptr && simu->params.interleaver.uniform)\nsimu->interleaver[0]->gen_lookup_tables();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_interleaver.cpp",
"new_path": "src/Tools/Factory/Factory_interleaver.cpp",
"diff": "@@ -25,7 +25,7 @@ Interleaver<T>* Factory_interleaver<T>\nelse if (params.interleaver.type == \"RANDOM\")\ninterleaver = new Interleaver_random<T>(size, seed);\nelse if (params.interleaver.type == \"COLUMNS\")\n- interleaver = new Interleaver_columns<T>(size, params.interleaver.nbr_columns, seed);\n+ interleaver = new Interleaver_columns<T>(size, params.interleaver.n_cols, seed);\nelse if (params.interleaver.type == \"GOLDEN\")\ninterleaver = new Interleaver_golden<T>(size);\nelse if (params.interleaver.type == \"USER\")\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -76,8 +76,8 @@ struct interleaver_parameters\n{\nstd::string type;\nstd::string path;\n- int nbr_columns; // number of columns of then columns interleaver\n- bool is_uniform; // set at true to regenerate the interleaver for each new frame\n+ int n_cols; // number of columns of then columns interleaver\n+ bool uniform; // set at true to regenerate the interleaver for each new frame\n};\nstruct modulator_parameters\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Cosmetics and renaming.
|
8,490 |
21.03.2017 11:19:56
| -3,600 |
9fa672ed76bccd26f159da0d0af7e11cb60490b7
|
Add a seed to the Golden interleaver.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Golden/Interleaver_golden.hpp",
"new_path": "src/Module/Interleaver/Golden/Interleaver_golden.hpp",
"diff": "@@ -14,9 +14,17 @@ namespace module\ntemplate <typename T = int>\nclass Interleaver_golden : public Interleaver<T>\n{\n+private:\n+ std::mt19937 gen;\n+ std::uniform_real_distribution<double> dist;\n+\npublic:\n- Interleaver_golden(int size, const std::string name = \"Interleaver_columns\")\n- : Interleaver<T>(size, 1, name) { gen_lookup_tables(); }\n+ Interleaver_golden(int size, const int seed = 0, const std::string name = \"Interleaver_golden\")\n+ : Interleaver<T>(size, 1, name), gen(), dist(0.0, size * 0.1)\n+ {\n+ gen.seed(seed);\n+ gen_lookup_tables();\n+ }\nvoid gen_lookup_tables()\n{\n@@ -24,9 +32,6 @@ public:\ndouble g2 = g * g;\ndouble c = this->pi.size() * g2;\n- std::mt19937 gen;\n- std::uniform_real_distribution<double> dist(0.0, this->pi.size() * 0.1);\n-\nstd::vector<double> tab;\nfor (auto i = 0; i < (int)this->pi.size(); i++)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a seed to the Golden interleaver.
|
8,490 |
21.03.2017 11:21:04
| -3,600 |
5ee4f3990a2b3cddace24520f8f58ef64779e8c7
|
Add a warning message on the LTE, CCSDS and USER interleaver when the gen_lookup_tables method is called more than once.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp",
"new_path": "src/Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp",
"diff": "@@ -14,12 +14,23 @@ namespace module\ntemplate <typename T = int>\nclass Interleaver_CCSDS : public Interleaver<T>\n{\n+private:\n+ int call_counter;\n+\npublic:\nInterleaver_CCSDS(int size, const std::string name = \"Interleaver_CCSDS\")\n- : Interleaver<T>(size, 1, name) { gen_lookup_tables(); }\n+ : Interleaver<T>(size, 1, name), call_counter(0) { gen_lookup_tables(); }\nvoid gen_lookup_tables()\n{\n+ if (call_counter)\n+ {\n+ std::clog << tools::bold_yellow(\"(WW) It is useless to call the generation of the lookup table multiple \")\n+ << tools::bold_yellow(\"times on the CCSDS interleaver.\")\n+ << std::endl;\n+ }\n+ call_counter++;\n+\nstd::map<T,T> k_1;\nstd::map<T,T> k_2;\nk_1[1784] = 8; k_2[1784] = 223 * 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/LTE/Interleaver_LTE.hpp",
"new_path": "src/Module/Interleaver/LTE/Interleaver_LTE.hpp",
"diff": "@@ -14,12 +14,23 @@ namespace module\ntemplate <typename T = int>\nclass Interleaver_LTE : public Interleaver<T>\n{\n+private:\n+ int call_counter;\n+\npublic:\nInterleaver_LTE(int size, const std::string name = \"Interleaver_LTE\")\n- : Interleaver<T>(size, 1, name) { gen_lookup_tables(); }\n+ : Interleaver<T>(size, 1, name), call_counter(0) { gen_lookup_tables(); }\nvoid gen_lookup_tables()\n{\n+ if (call_counter)\n+ {\n+ std::clog << tools::bold_yellow(\"(WW) It is useless to call the generation of the lookup table multiple \")\n+ << tools::bold_yellow(\"times on the LTE interleaver.\")\n+ << std::endl;\n+ }\n+ call_counter++;\n+\nstd::map<T,T> f_1;\nstd::map<T,T> f_2;\nf_1[ 40] = 3; f_2[ 40] = 10;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"new_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"diff": "@@ -16,13 +16,22 @@ class Interleaver_user : public Interleaver<T>\n{\nprivate:\nconst std::string filename;\n+ int call_counter;\npublic:\nInterleaver_user(int size, const std::string filename, const std::string name = \"Interleaver_user\")\n- : Interleaver<T>(size, 1, name), filename(filename) { gen_lookup_tables(); }\n+ : Interleaver<T>(size, 1, name), filename(filename), call_counter(0) { gen_lookup_tables(); }\nvoid gen_lookup_tables()\n{\n+ if (call_counter)\n+ {\n+ std::clog << tools::bold_yellow(\"(WW) It is useless to call the generation of the lookup table multiple \")\n+ << tools::bold_yellow(\"times on the USER interleaver.\")\n+ << std::endl;\n+ }\n+ call_counter++;\n+\nstd::ifstream file(filename.c_str(), std::ios::in);\nif (file.is_open())\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a warning message on the LTE, CCSDS and USER interleaver when the gen_lookup_tables method is called more than once.
|
8,490 |
21.03.2017 11:21:39
| -3,600 |
017d84ae76470789f2f938f7b364bf5b1686ec24
|
Pass the seed to the Golden interleaver in the factory.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_interleaver.cpp",
"new_path": "src/Tools/Factory/Factory_interleaver.cpp",
"diff": "@@ -27,7 +27,7 @@ Interleaver<T>* Factory_interleaver<T>\nelse if (params.interleaver.type == \"COLUMNS\")\ninterleaver = new Interleaver_columns<T>(size, params.interleaver.n_cols, seed);\nelse if (params.interleaver.type == \"GOLDEN\")\n- interleaver = new Interleaver_golden<T>(size);\n+ interleaver = new Interleaver_golden<T>(size, seed);\nelse if (params.interleaver.type == \"USER\")\ninterleaver = new Interleaver_user<T>(size, params.interleaver.path);\nelse if (params.interleaver.type == \"NO\")\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Pass the seed to the Golden interleaver in the factory.
|
8,491 |
21.03.2017 12:38:06
| -3,600 |
4bc41a586e290d0ff97b3eaf712a747b9c6fc52a
|
Encoder LDPC_H with position of infomration bits
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "@@ -18,7 +18,7 @@ template <typename B>\nEncoder_LDPC_from_H<B>\n::Encoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames,\nconst std::string name)\n-: Encoder_LDPC<B>(K, N, n_frames, name)\n+: Encoder_LDPC<B>(K, N, n_frames, name), positions_information_bits(N)\n{\n// I) take H\n// Take some information about H\n@@ -151,10 +151,15 @@ Encoder_LDPC_from_H<B>\nthis->tG[ K*i + j ] = H[i][j];\n}\n}\n-// for(unsigned int i = 0; i< tG.size(); i++)\n-// {\n-// cout << tG[i];\n-// }\n+// IV) Identify information bits\n+ std::iota(positions_information_bits.begin(), positions_information_bits.begin() + N, 0);\n+ int tmp4;\n+ for(unsigned int l = 1; l <= (swapped.size() / 2); l++ )\n+ {\n+ tmp4 = positions_information_bits[swapped[l*2-1]];\n+ positions_information_bits[swapped[l*2-1]] = positions_information_bits[swapped[(l-1)*2]];\n+ positions_information_bits[swapped[(l-1)*2]] = tmp4;\n+ }\n}\ntemplate <typename B>\n@@ -168,7 +173,7 @@ void Encoder_LDPC_from_H<B>\n::get_info_bits_pos(mipp::vector<B>& info_bits_pos)\n{\nassert(this->K <= (int)info_bits_pos.size());\n- std::iota(info_bits_pos.begin(), info_bits_pos.begin() + this->K, 0);\n+ std::copy(positions_information_bits.begin() + this->N - this->K, positions_information_bits.begin() + this->N, info_bits_pos.begin());\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -16,6 +16,9 @@ namespace module\ntemplate <typename B>\nclass Encoder_LDPC_from_H : public Encoder_LDPC<B>\n{\n+protected:\n+ mipp::vector<int> positions_information_bits; // the position of each information bits\n+\npublic:\nEncoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames = 1,\nconst std::string name = \"Encoder_LDPC_from_H\");\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Encoder LDPC_H with position of infomration bits
|
8,490 |
21.03.2017 13:54:39
| -3,600 |
a28dad5a4cd12331daf9f6575e845e01a130c371
|
Exit StarPU and SystemC simulations when the uniform interleaver is required.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"diff": "@@ -57,18 +57,25 @@ Simulation_BFER<B,R,Q>\n{\nif (params.simulation.debug)\n{\n- std::cerr << bold_red(\"(EE) SystemC simulation does not support the debug mode... Exiting\") << std::endl;\n+ std::cerr << bold_red(\"(EE) StarPU simulation does not support the debug mode... Exiting\") << std::endl;\nstd::exit(-1);\n}\nif (params.simulation.benchs)\n{\n- std::cerr << bold_red(\"(EE) SystemC simulation does not support the bench mode... Exiting\") << std::endl;\n+ std::cerr << bold_red(\"(EE) StarPU simulation does not support the bench mode... Exiting\") << std::endl;\n+ std::exit(-1);\n+ }\n+\n+ if (params.interleaver.uniform)\n+ {\n+ std::cerr << bold_red(\"(EE) StarPU simulation does not support the uniform interleaver mode... Exiting\")\n+ << std::endl;\nstd::exit(-1);\n}\nif (params.simulation.time_report)\n- std::clog << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n+ std::clog << bold_yellow(\"(WW) The time report is not available in the StarPU simulation.\") << std::endl;\n#ifdef ENABLE_MPI\nstd::clog << bold_yellow(\"(WW) This simulation is not MPI ready, the same computations will be launched \")\n@@ -351,7 +358,6 @@ void Simulation_BFER<B,R,Q>\nif (this->params.code.coset)\n{\n-\nauto task_coset_real = Coset<B,Q>::spu_task_apply(this->coset_real[tid], spu_X_N1[tid], spu_Y_N5[tid], spu_Y_N5[tid]);\ntask_coset_real->priority = STARPU_MIN_PRIO +10;\ntask_names[tid][10] = \"cst::apply_\" + str_id; task_coset_real->name = task_names[tid][10].c_str();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp",
"diff": "@@ -43,6 +43,13 @@ Simulation_BFER<B,R,Q>\nstd::exit(-1);\n}\n+ if (params.interleaver.uniform)\n+ {\n+ std::cerr << bold_red(\"(EE) SystemC simulation does not support the uniform interleaver mode... Exiting\")\n+ << std::endl;\n+ std::exit(-1);\n+ }\n+\nif (params.simulation.time_report)\nstd::clog << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp",
"diff": "@@ -44,6 +44,13 @@ Simulation_BFERI<B,R,Q>\nstd::exit(-1);\n}\n+ if (params.interleaver.uniform)\n+ {\n+ std::cerr << bold_red(\"(EE) SystemC simulation does not support the uniform interleaver mode... Exiting\")\n+ << std::endl;\n+ std::exit(-1);\n+ }\n+\nif (params.simulation.time_report)\nstd::clog << bold_yellow(\"(WW) The time report is not available in the SystemC simulation.\") << std::endl;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Exit StarPU and SystemC simulations when the uniform interleaver is required.
|
8,490 |
21.03.2017 18:09:33
| -3,600 |
e83d6c75e0cf1a14a48d9c31e50b76114d03c3c3
|
Add a dedicated seed to the interleavers.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -49,12 +49,13 @@ Launcher<B,R,Q>\nparams.simulation .n_threads = 1;\nparams.simulation .stop_time = std::chrono::seconds(0);\nparams.simulation .inter_frame_level = 1;\n- params.simulation .seed = 0;\nparams.simulation .mpi_rank = 0;\nparams.simulation .mpi_size = 1;\nparams.simulation .mpi_comm_freq = std::chrono::milliseconds(1000);\nparams.simulation .pyber = \"\";\nparams.simulation .snr_type = \"EB\";\n+ params.simulation .seed = 0;\n+ params.interleaver.seed = 0;\nparams.code .tail_length = 0;\nparams.source .type = \"RAND\";\nparams.source .path = \"\";\n@@ -305,6 +306,9 @@ void Launcher<B,R,Q>\nif(ar.exist_arg({\"sim-inter-lvl\" })) params.simulation.inter_frame_level = ar.get_arg_int ({\"sim-inter-lvl\" });\nif(ar.exist_arg({\"sim-stop-time\" })) params.simulation.stop_time = seconds(ar.get_arg_int ({\"sim-stop-time\" }));\nif(ar.exist_arg({\"sim-seed\" })) params.simulation.seed = ar.get_arg_int ({\"sim-seed\" });\n+\n+ params.interleaver.seed = params.simulation.seed;\n+\n#ifndef STARPU\nif (ar.exist_arg({\"sim-threads\", \"t\"}) && ar.get_arg_int({\"sim-threads\", \"t\"}) > 0)\nif(ar.exist_arg({\"sim-threads\", \"t\"})) params.simulation.n_threads = ar.get_arg_int ({\"sim-threads\", \"t\"});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/RA/Simulation_BFER_RA.cpp",
"new_path": "src/Simulation/BFER/Code/RA/Simulation_BFER_RA.cpp",
"diff": "@@ -68,7 +68,7 @@ template <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFER_RA<B,R,Q>\n::build_interleaver(const int tid)\n{\n- auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.simulation.seed;\n+ auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.interleaver.seed;\nInterleaver<int>* itl = Factory_interleaver<int>::build(this->params, this->params.code.K, seed);\nthis->check_errors(itl, \"Interleaver<int>\");\nreturn itl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp",
"new_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp",
"diff": "@@ -116,7 +116,7 @@ template <typename B, typename R, typename Q, typename QD>\nInterleaver<int>* Simulation_BFER_turbo<B,R,Q,QD>\n::build_interleaver(const int tid)\n{\n- auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.simulation.seed;\n+ auto seed = (this->params.interleaver.uniform) ? this->rd_engine_seed[tid]() : this->params.interleaver.seed;\nInterleaver<int>* itl = Factory_interleaver<int>::build(this->params, this->params.code.K, seed);\nthis->check_errors(itl, \"Interleaver<int>\");\nreturn itl;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Simulation_BFERI.cpp",
"diff": "@@ -222,7 +222,7 @@ template <typename B, typename R, typename Q>\nInterleaver<int>* Simulation_BFERI_i<B,R,Q>\n::build_interleaver(const int tid)\n{\n- auto seed = (params.interleaver.uniform) ? rd_engine_seed[tid]() : params.simulation.seed;\n+ auto seed = (params.interleaver.uniform) ? rd_engine_seed[tid]() : params.interleaver.seed;\nreturn Factory_interleaver<int>::build(params, params.code.N + params.code.tail_length, seed);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -76,6 +76,7 @@ struct interleaver_parameters\n{\nstd::string type;\nstd::string path;\n+ int seed;\nint n_cols; // number of columns of then columns interleaver\nbool uniform; // set at true to regenerate the interleaver for each new frame\n};\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a dedicated seed to the interleavers.
|
8,490 |
21.03.2017 18:11:23
| -3,600 |
833be2474994eb664960e7c814b341fde3e23ea5
|
Fix a compilation warning on Windows.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"new_path": "src/Tools/Display/Terminal/BFER/Terminal_BFER.cpp",
"diff": "@@ -153,7 +153,7 @@ void Terminal_BFER<B,R>\nstr_fer << setprecision(2) << scientific << setw(9) << fer;\nunsigned long long l0 = 99999999; // limit 0\n- auto l1 = 99999999; // limit 1\n+ unsigned long long l1 = 99999999; // limit 1\nauto l2 = 99999.99f; // limit 2\nstream << \" \";\nstream << setprecision( 2) << fixed << setw(6) << snr_s << bold(\" | \");\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix a compilation warning on Windows.
|
8,490 |
22.03.2017 11:40:25
| -3,600 |
4e832f914d01edab6864795decde0d4ca667607c
|
Enable inter frame support in the BCH encoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"new_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"diff": "@@ -10,7 +10,7 @@ template <typename B>\nEncoder_BCH<B>\n::Encoder_BCH(const int& K, const int& N, const int& m, const tools::Galois &GF,\nconst int n_frames, const std::string name)\n- : Encoder<B>(K, N, n_frames, name), K(K), N(N), m(m), g(N-K+1), bb(N-K)\n+ : Encoder<B>(K, N, n_frames, name), m(m), g(N-K+1), bb(N-K)\n{\n//assert(2**m == N+1);\n//assertion on K required\n@@ -22,18 +22,29 @@ Encoder_BCH<B>\ntemplate <typename B>\nvoid Encoder_BCH<B>\n::encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N)\n+{\n+ assert(this->K * this->n_frames == (int)U_K.size());\n+ assert(this->N * this->n_frames == (int)X_N.size());\n+\n+ for (auto f = 0; f < this->n_frames; f++)\n+ this->_encode(U_K.data() + f * this->K, X_N.data() + f * this->N);\n+}\n+\n+template <typename B>\n+void Encoder_BCH<B>\n+::_encode(const B* U_K, B* X_N)\n{\nregister int i, j;\nregister int feedback;\n- for (i = 0; i < N - K; i++)\n+ for (i = 0; i < this->N - this->K; i++)\nbb[i] = 0;\n- for (i = K - 1; i >= 0; i--)\n+ for (i = this->K - 1; i >= 0; i--)\n{\n- feedback = U_K[i] ^ bb[N - K - 1];\n+ feedback = U_K[i] ^ bb[this->N - this->K - 1];\nif (feedback != 0)\n{\n- for (j = N - K - 1; j > 0; j--)\n+ for (j = this->N - this->K - 1; j > 0; j--)\nif (g[j] != 0)\nbb[j] = bb[j - 1] ^ feedback;\nelse\n@@ -42,16 +53,16 @@ void Encoder_BCH<B>\n}\nelse\n{\n- for (j = N - K - 1; j > 0; j--)\n+ for (j = this->N - this->K - 1; j > 0; j--)\nbb[j] = bb[j - 1];\nbb[0] = 0;\n}\n}\n- for (i = 0; i < N - K; i++)\n+ for (i = 0; i < this->N - this->K; i++)\nX_N[i] = bb[i];\n- for (i = 0; i < K; i++)\n- X_N[i + N - K] = U_K[i];\n+ for (i = 0; i < this->K; i++)\n+ X_N[i + this->N - this->K] = U_K[i];\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp",
"new_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp",
"diff": "@@ -16,8 +16,6 @@ class Encoder_BCH : public Encoder<B>\n{\nprotected:\n- const int K; // info bits\n- const int N; // code length\nconst int m; // order of the Galois Field\nmipp::vector<int> g; // coefficients of the generator polynomial, g(x)\n@@ -30,6 +28,9 @@ public:\nvirtual ~Encoder_BCH() {}\nvirtual void encode(const mipp::vector<B>& U_K, mipp::vector<B>& X_N);\n+\n+private:\n+ void _encode(const B* U_K, B* X_N);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.cpp",
"new_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.cpp",
"diff": "@@ -15,7 +15,12 @@ Decoder<B,R>* Factory_decoder_BCH<B,R>\nif (params.decoder.type == \"ALGEBRAIC\")\nif (params.decoder.implem == \"STD\")\n- decoder = new Decoder_BCH<B,R>(params.code.K, params.code.N, params.code.mGF, params.code.t, GF);\n+ decoder = new Decoder_BCH<B,R>(params.code.K,\n+ params.code.N,\n+ params.code.mGF,\n+ params.code.t,\n+ GF,\n+ params.simulation.inter_frame_level);\nreturn decoder;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Enable inter frame support in the BCH encoder.
|
8,490 |
22.03.2017 11:46:56
| -3,600 |
4e2201ad66eddf8d9292a2e7b596e8f603e7a651
|
Clean the Decoder_BCH code a little bit.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "@@ -7,17 +7,18 @@ Decoder_BCH<B, R>\n::Decoder_BCH(const int& K, const int& N, const int& m, const int&t, const tools::Galois &GF, const int n_frames,\nconst std::string name)\n: Decoder<B,R>(K, N, n_frames, 1, name),\n- elp(N+2), discrepancy(N+2), l(N+2), u_lu(N+2), s(N+1), loc(200), reg(201), K(K), N(N), m(m), t(t), d(2*t+1),\n- alpha_to(N+1), index_of(N+1), YH_N(N), Y_N(N), V_K(K)\n+ elp(N+2), discrepancy(N+2), l(N+2), u_lu(N+2), s(N+1), loc(200), reg(201), m(m), t(t), d(2*t+1), alpha_to(N+1),\n+ index_of(N+1), YH_N(N), V_K(K)\n{\n+ assert(K <= N);\n+ assert(K > 3);\n+\nalpha_to = GF.alpha_to;\nindex_of = GF.index_of;\nfor (auto i = 0; i < N; i++)\n{\nelp[i].resize(N);\n}\n- assert(K <= N);\n- assert(K > 3);\n}\ntemplate <typename B, typename R>\n@@ -30,8 +31,7 @@ template <typename B, typename R>\nvoid Decoder_BCH<B, R>\n::load(const mipp::vector<R>& Y_N)\n{\n- this->Y_N = Y_N;\n- for (int j = 0; j < N; j++)\n+ for (int j = 0; j < this->N; j++)\nthis->YH_N[j] = (Y_N[j] > 0)? 0 : 1; // hard decision on the input\n}\n@@ -47,9 +47,9 @@ void Decoder_BCH<B, R>\nfor (i = 1; i <= t2; i++)\n{\ns[i] = 0;\n- for (j = 0; j < N; j++)\n+ for (j = 0; j < this->N; j++)\nif (YH_N[j] != 0)\n- s[i] ^= alpha_to[(i * j) % N];\n+ s[i] ^= alpha_to[(i * j) % this->N];\nif (s[i] != 0)\nsyn_error = 1; /* set error flag if non-zero syndrome */\n/*\n@@ -137,7 +137,7 @@ void Decoder_BCH<B, R>\nfor (i = 0; i <= l[q]; i++)\nif (elp[q][i] != -1)\nelp[u + 1][i + u - q] =\n- alpha_to[(discrepancy[u] + N - discrepancy[q] + elp[q][i]) % N];\n+ alpha_to[(discrepancy[u] + this->N - discrepancy[q] + elp[q][i]) % this->N];\nfor (i = 0; i <= l[u]; i++)\n{\nelp[u + 1][i] ^= elp[u][i];\n@@ -157,7 +157,7 @@ void Decoder_BCH<B, R>\nfor (i = 1; i <= l[u + 1]; i++)\nif ((s[u + 1 - i] != -1) && (elp[u + 1][i] != 0))\ndiscrepancy[u + 1] ^= alpha_to[(s[u + 1 - i]\n- + index_of[elp[u + 1][i]]) % N];\n+ + index_of[elp[u + 1][i]]) % this->N];\n/* put d[u+1] into index form */\ndiscrepancy[u + 1] = index_of[discrepancy[u + 1]];\n}\n@@ -175,19 +175,19 @@ void Decoder_BCH<B, R>\nfor (i = 1; i <= l[u]; i++)\nreg[i] = elp[u][i];\ncount = 0;\n- for (i = 1; i <= N; i++)\n+ for (i = 1; i <= this->N; i++)\n{\nq = 1;\nfor (j = 1; j <= l[u]; j++)\nif (reg[j] != -1)\n{\n- reg[j] = (reg[j] + j) % N;\n+ reg[j] = (reg[j] + j) % this->N;\nq ^= alpha_to[reg[j]];\n}\nif (!q)\n{ /* store root and error\n* location number indices */\n- loc[count] = N - i;\n+ loc[count] = this->N - i;\ncount++;\n}\n}\n@@ -199,8 +199,8 @@ void Decoder_BCH<B, R>\n}\n}\n- for (i = 0; i < K; i++)\n- this->V_K[i] = YH_N[i+N-K];\n+ for (i = 0; i < this->K; i++)\n+ this->V_K[i] = YH_N[i+this->N-this->K];\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"diff": "@@ -24,8 +24,6 @@ private:\nmipp::vector<int> reg;\nprotected:\n- const int K; // info bits\n- const int N; // code length\nconst int m; // order of the Galois Field\nconst int t; // correction power\nconst int d; // minimum distance of the code (d=2t+1))\n@@ -34,7 +32,6 @@ protected:\nmipp::vector<int> index_of; // antilog table of GF(2**m)\nmipp::vector<B> YH_N; // hard decision input vector\n- mipp::vector<R> Y_N;\nmipp::vector<B> V_K;\npublic:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Clean the Decoder_BCH code a little bit.
|
8,490 |
22.03.2017 12:24:46
| -3,600 |
e597f2f9b9ba7478ca374e39d702ef699eedaad5
|
Add some assertions in the BCH simulation.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/Algebraic/Galois.cpp",
"new_path": "src/Tools/Math/Algebraic/Galois.cpp",
"diff": "@@ -11,11 +11,13 @@ Galois\n::Galois(const int& m, const int& N, const int& K, const int& t)\n: m(m), K(K), N(N), t(t), d(2*t+1), alpha_to(N+1), index_of(N+1), p(m+1), g(N-K+1)\n{\n+ assert(N == ((1 << m) -1));\n+ assert(K <= N);\n+ assert(N - K == m * t);\n+\nSelect_Polynomial();\nGenerate_GF();\nCompute_BCH_Generator_Polynomial();\n- assert(N == ((1 << m) -1));\n- assert(K <= N);\n}\nGalois\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add some assertions in the BCH simulation.
|
8,490 |
22.03.2017 15:24:05
| -3,600 |
914e3100da72769e9296f889f589493a8ae37861
|
Auto. compute '-T' and '--mGF' parameters from '-N' and '-K' (BCH simulation).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.cpp",
"new_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.cpp",
"diff": "@@ -32,11 +32,11 @@ void Launcher_BFER_BCH<B,R,Q>\nthis->opt_args[{\"enc-type\"}][2] += \", BCH\";\n// ---------------------------------------------------------------------------------------------------------- code\n- this->req_args[{\"cde-corr-pow\", \"T\"}] =\n+ this->opt_args[{\"cde-corr-pow\", \"T\"}] =\n{\"positive_int\",\n\"correction power of the BCH code.\"};\n- this->req_args[{\"cde-gfield-order\", \"mGF\"}] =\n+ this->opt_args[{\"cde-gfield-order\", \"mGF\"}] =\n{\"positive_int\",\n\"order of the Galois Field (used in BCH simulations).\"};\n}\n@@ -48,8 +48,15 @@ void Launcher_BFER_BCH<B,R,Q>\nLauncher_BFER<B,R,Q>::store_args();\n// ---------------------------------------------------------------------------------------------------------- code\n- this->params.code.t = this->ar.get_arg_int({\"cde-corr-pow\", \"T\"});\n+ if (this->ar.exist_arg({\"cde-gfield-order\", \"mGF\"}))\nthis->params.code.mGF = this->ar.get_arg_int({\"cde-gfield-order\", \"mGF\"});\n+ else\n+ this->params.code.mGF = (int)std::log2(this->params.code.N +1);\n+\n+ if (this->ar.exist_arg({\"cde-corr-pow\", \"T\"}))\n+ this->params.code.t = this->ar.get_arg_int({\"cde-corr-pow\", \"T\"});\n+ else\n+ this->params.code.t = (this->params.code.N - this->params.code.K) / this->params.code.mGF;\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/BCH/Simulation_BFER_BCH.cpp",
"new_path": "src/Simulation/BFER/Code/BCH/Simulation_BFER_BCH.cpp",
"diff": "@@ -19,7 +19,7 @@ Simulation_BFER_BCH<B,R,Q>\n::Simulation_BFER_BCH(const parameters& params)\n: Simulation_BFER<B,R,Q>(params), GF(params.code.mGF, params.code.N, params.code.K, params.code.t)\n{\n- // TODO : put some assertion on the BCH code parameters\n+ // assertion are made in the Galois Field (GF)\n}\ntemplate <typename B, typename R, typename Q>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Auto. compute '-T' and '--mGF' parameters from '-N' and '-K' (BCH simulation).
|
8,490 |
22.03.2017 17:11:23
| -3,600 |
d1835fd42e50b662a5ea6ed6fac0b8f99775f9a8
|
Add new curves for the BCH codes.
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/data/BFER/bch/ALGEBRAIC/1023_848_18.txt",
"diff": "+Run command:\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"1023\" -K \"848\" -m \"0\" -M \"6.01\" -s \"0.25\" -e \"1000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" -T \"18\" --sim-pyber \"BCH (1023,848,18)\"\n+Curve name:\n+BCH (1023,848,18)\n+# -------------------------------------------------\n+# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n+# -------------------------------------------------\n+# Parameters:\n+# * Simulation ------------------------------------\n+# ** Type = BFER\n+# ** SNR min (m) = 0.000000 dB\n+# ** SNR max (M) = 6.010000 dB\n+# ** SNR step (s) = 0.250000 dB\n+# ** Type of bits = int (32 bits)\n+# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 1\n+# ** Seed = 0\n+# ** Multi-threading (t) = 4 thread(s)\n+# * Code ------------------------------------------\n+# ** Type = BCH\n+# ** Info. bits (K) = 848\n+# ** Codeword size (N) = 1023\n+# ** Coset approach (c) = off\n+# ** Correction power (T) = 18\n+# ** Order of the GField (mGF) = 10\n+# * Source ----------------------------------------\n+# ** Type = AZCW\n+# * Encoder ---------------------------------------\n+# ** Type = AZCW\n+# ** Systematic encoding = on\n+# * Modulator -------------------------------------\n+# ** Type = BPSK\n+# ** Bits per symbol = 1\n+# ** Sampling factor = 1\n+# * Channel ---------------------------------------\n+# ** Type = AWGN_FAST\n+# ** Domain = LLR\n+# * Demodulator -----------------------------------\n+# ** Sigma square = on\n+# ** Max type = unused\n+# * Decoder ---------------------------------------\n+# ** Type (D) = ALGEBRAIC\n+# ** Implementation = STD\n+# * Monitor ---------------------------------------\n+# ** Frame error count (e) = 1000\n+# ** Bad frames tracking = off\n+# ** Bad frames replay = off\n+#\n+# The simulation is running...\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n+# on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+ -0.81 | 0.00 | 1003 | 84215 | 1003 | 9.90e-02 | 1.00e+00 || 4.90 | 4.06 | 208.98 || 12.82 | 00h00'00\n+ -0.56 | 0.25 | 1003 | 78954 | 1003 | 9.28e-02 | 1.00e+00 || 4.97 | 4.12 | 205.80 || 18.31 | 00h00'00\n+ -0.31 | 0.50 | 1003 | 73472 | 1003 | 8.64e-02 | 1.00e+00 || 5.01 | 4.15 | 204.26 || 18.42 | 00h00'00\n+ -0.06 | 0.75 | 1003 | 67940 | 1003 | 7.99e-02 | 1.00e+00 || 5.06 | 4.20 | 202.03 || 18.61 | 00h00'00\n+ 0.19 | 1.00 | 1003 | 63538 | 1003 | 7.47e-02 | 1.00e+00 || 5.08 | 4.21 | 201.44 || 18.68 | 00h00'00\n+ 0.44 | 1.25 | 1003 | 58615 | 1003 | 6.89e-02 | 1.00e+00 || 5.13 | 4.25 | 199.46 || 18.84 | 00h00'00\n+ 0.69 | 1.50 | 1003 | 53423 | 1003 | 6.28e-02 | 1.00e+00 || 5.17 | 4.28 | 197.99 || 18.95 | 00h00'00\n+ 0.94 | 1.75 | 1003 | 48966 | 1003 | 5.76e-02 | 1.00e+00 || 4.59 | 3.80 | 222.95 || 16.87 | 00h00'00\n+ 1.19 | 2.00 | 1003 | 44506 | 1003 | 5.23e-02 | 1.00e+00 || 4.89 | 4.06 | 209.01 || 16.93 | 00h00'00\n+ 1.44 | 2.25 | 1003 | 40576 | 1003 | 4.77e-02 | 1.00e+00 || 5.23 | 4.34 | 195.58 || 19.12 | 00h00'00\n+ 1.69 | 2.50 | 1003 | 36300 | 1003 | 4.27e-02 | 1.00e+00 || 5.31 | 4.40 | 192.54 || 19.42 | 00h00'00\n+ 1.94 | 2.75 | 1003 | 32940 | 1003 | 3.87e-02 | 1.00e+00 || 5.35 | 4.44 | 191.05 || 19.58 | 00h00'00\n+ 2.19 | 3.00 | 1005 | 29754 | 1003 | 3.49e-02 | 9.98e-01 || 5.45 | 4.52 | 187.79 || 19.92 | 00h00'00\n+ 2.44 | 3.25 | 1013 | 26038 | 1003 | 3.03e-02 | 9.90e-01 || 5.51 | 4.56 | 185.81 || 20.11 | 00h00'00\n+ 2.69 | 3.50 | 1039 | 23460 | 1003 | 2.66e-02 | 9.65e-01 || 5.53 | 4.58 | 185.10 || 20.18 | 00h00'00\n+ 2.94 | 3.75 | 1114 | 21128 | 1003 | 2.24e-02 | 9.00e-01 || 5.50 | 4.56 | 185.85 || 20.14 | 00h00'00\n+ 3.19 | 4.00 | 1402 | 19243 | 1003 | 1.62e-02 | 7.15e-01 || 5.79 | 4.80 | 176.81 || 21.27 | 00h00'00\n+ 3.44 | 4.25 | 2148 | 18214 | 1001 | 1.00e-02 | 4.66e-01 || 6.05 | 5.01 | 169.12 || 22.37 | 00h00'00\n+ 3.69 | 4.50 | 4570 | 17495 | 1001 | 4.51e-03 | 2.19e-01 || 6.43 | 5.33 | 159.02 || 23.94 | 00h00'00\n+ 3.94 | 4.75 | 11393 | 16961 | 1001 | 1.76e-03 | 8.79e-02 || 6.86 | 5.69 | 149.16 || 25.59 | 00h00'00\n+ 4.19 | 5.00 | 48634 | 16617 | 1000 | 4.03e-04 | 2.06e-02 || 7.55 | 6.26 | 135.57 || 28.04 | 00h00'01\n+ 4.44 | 5.25 | 281544 | 16337 | 1000 | 6.84e-05 | 3.55e-03 || 8.28 | 6.86 | 123.60 || 30.57 | 00h00'09\n+ 4.69 | 5.50 | 2058679 | 16237 | 1000 | 9.30e-06 | 4.86e-04 || 8.87 | 7.36 | 115.29 || 32.48 | 00h01'04\n+ 4.94 | 5.75 | 2857823 | 1862 | 114 | 7.68e-07 | 3.99e-05 || 9.81 | 8.13 | 104.26 || 35.67 | 00h01'21 x\n+ 5.19 | 6.00 | 8810599 | 244 | 15 | 3.27e-08 | 1.70e-06 || 10.79 | 8.94 | 94.84 || 38.94 | 00h03'51 x\n+# End of the simulation.\n"
},
{
"change_type": "RENAME",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/1024_983_t4.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/1023_983_4.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"1023\" -K \"983\" -T \"4\" --mGF \"10\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"500\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"1023\" -K \"983\" -T \"4\" --mGF \"10\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"500\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (1023,983,4)\"\nCurve name:\n-BCH (1023, 983)\n+BCH (1023,983,4)\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n"
},
{
"change_type": "RENAME",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/255_231_t3.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/255_231_3.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"231\" -T \"3\" --mGF \"8\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,231)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"231\" -T \"3\" --mGF \"8\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,231,3)\"\nCurve name:\n-BCH (255,231)\n+BCH (255,231,3)\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n"
},
{
"change_type": "RENAME",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/255_239_t2.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/255_239_2.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"239\" -T \"2\" --mGF \"8\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,239)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"255\" -K \"239\" -T \"2\" --mGF \"8\" -m \"0\" -M \"8.01\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (255,239,2)\"\nCurve name:\n-BCH (255,239)\n+BCH (255,239,2)\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n"
},
{
"change_type": "RENAME",
"old_path": "tests/data/BFER/bch/ALGEBRAIC/31_11_t4.txt",
"new_path": "tests/data/BFER/bch/ALGEBRAIC/31_11_4.txt",
"diff": "Run command:\n-./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"31\" -K \"11\" -T \"4\" --mGF \"5\" -m \"0\" -M \"9\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (31,11)\"\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"31\" -K \"11\" -T \"4\" --mGF \"5\" -m \"0\" -M \"9\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (31,11,4)\"\nCurve name:\n-BCH (31,11)\n+BCH (31,11,4)\n# -------------------------------------------------\n# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n# -------------------------------------------------\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/data/BFER/bch/ALGEBRAIC/31_11_5.txt",
"diff": "+Run command:\n+./bin/aff3ct --sim-type \"BFER\" --cde-type \"BCH\" -N \"31\" -K \"11\" -T \"5\" --mGF \"5\" -m \"0\" -M \"8.251\" -s \"0.25\" -e \"4000\" --enc-type \"AZCW\" --chn-type \"AWGN_FAST\" --sim-pyber \"BCH (31,11,5)\"\n+Curve name:\n+BCH (31,11,5)\n+# -------------------------------------------------\n+# ---- A FAST FORWARD ERROR CORRECTION TOOL >> ----\n+# -------------------------------------------------\n+# Parameters:\n+# * Simulation ------------------------------------\n+# ** Type = BFER\n+# ** SNR min (m) = 0.000000 dB\n+# ** SNR max (M) = 8.251000 dB\n+# ** SNR step (s) = 0.250000 dB\n+# ** Type of bits = int (32 bits)\n+# ** Type of reals = float (32 bits)\n+# ** Inter frame level = 1\n+# ** Seed = 0\n+# ** Multi-threading (t) = 4 thread(s)\n+# * Code ------------------------------------------\n+# ** Type = BCH\n+# ** Info. bits (K) = 11\n+# ** Codeword size (N) = 31\n+# ** Coset approach (c) = off\n+# ** Correction power (T) = 5\n+# ** Order of the GField (mGF) = 5\n+# * Source ----------------------------------------\n+# ** Type = AZCW\n+# * Encoder ---------------------------------------\n+# ** Type = AZCW\n+# ** Systematic encoding = on\n+# * Modulator -------------------------------------\n+# ** Type = BPSK\n+# ** Bits per symbol = 1\n+# ** Sampling factor = 1\n+# * Channel ---------------------------------------\n+# ** Type = AWGN_FAST\n+# ** Domain = LLR\n+# * Demodulator -----------------------------------\n+# ** Sigma square = on\n+# ** Max type = unused\n+# * Decoder ---------------------------------------\n+# ** Type (D) = ALGEBRAIC\n+# ** Implementation = STD\n+# * Monitor ---------------------------------------\n+# ** Frame error count (e) = 4000\n+# ** Bad frames tracking = off\n+# ** Bad frames replay = off\n+#\n+# The simulation is running...\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# Bit Error Rate (BER) and Frame Error Rate (FER) depending || Decoder throughput and || Global throughput\n+# on the Signal Noise Ratio (SNR) || latency (per thread) || and elapsed time\n+# ----------------------------------------------------------------------||--------------------------------||---------------------\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+# Es/N0 | Eb/N0 | FRA | BE | FE | BER | FER || CTHR | ITHR | LATENCY || SIM_CTHR | ET/RT\n+# (dB) | (dB) | | | | | || (Mb/s) | (Mb/s) | (us) || (Mb/s) | (hhmmss)\n+# -------|-------|----------|----------|----------|----------|----------||----------|----------|----------||----------|----------\n+ -4.50 | 0.00 | 6808 | 11910 | 4002 | 1.59e-01 | 5.88e-01 || 7.31 | 2.59 | 4.24 || 15.49 | 00h00'00\n+ -4.25 | 0.25 | 7327 | 11739 | 4000 | 1.46e-01 | 5.46e-01 || 9.46 | 3.36 | 3.28 || 21.38 | 00h00'00\n+ -4.00 | 0.50 | 7745 | 11603 | 4000 | 1.36e-01 | 5.16e-01 || 9.52 | 3.38 | 3.26 || 23.59 | 00h00'00\n+ -3.75 | 0.75 | 8330 | 11443 | 4002 | 1.25e-01 | 4.80e-01 || 9.39 | 3.33 | 3.30 || 21.54 | 00h00'00\n+ -3.50 | 1.00 | 9110 | 11397 | 4002 | 1.14e-01 | 4.39e-01 || 9.83 | 3.49 | 3.15 || 24.70 | 00h00'00\n+ -3.25 | 1.25 | 10112 | 11394 | 4001 | 1.02e-01 | 3.96e-01 || 10.13 | 3.59 | 3.06 || 25.68 | 00h00'00\n+ -3.00 | 1.50 | 11113 | 11115 | 4001 | 9.09e-02 | 3.60e-01 || 10.26 | 3.64 | 3.02 || 25.93 | 00h00'00\n+ -2.75 | 1.75 | 12430 | 10973 | 4001 | 8.03e-02 | 3.22e-01 || 10.41 | 3.69 | 2.98 || 26.19 | 00h00'00\n+ -2.50 | 2.00 | 14440 | 10982 | 4000 | 6.91e-02 | 2.77e-01 || 10.60 | 3.76 | 2.92 || 26.42 | 00h00'00\n+ -2.25 | 2.25 | 16751 | 10782 | 4002 | 5.85e-02 | 2.39e-01 || 10.77 | 3.82 | 2.88 || 26.77 | 00h00'00\n+ -2.00 | 2.50 | 19301 | 10754 | 4001 | 5.07e-02 | 2.07e-01 || 10.94 | 3.88 | 2.83 || 26.93 | 00h00'00\n+ -1.75 | 2.75 | 22918 | 10848 | 4000 | 4.30e-02 | 1.75e-01 || 11.23 | 3.98 | 2.76 || 27.52 | 00h00'00\n+ -1.50 | 3.00 | 28083 | 10639 | 4000 | 3.44e-02 | 1.42e-01 || 11.44 | 4.06 | 2.71 || 27.86 | 00h00'00\n+ -1.25 | 3.25 | 34306 | 10429 | 4000 | 2.76e-02 | 1.17e-01 || 11.77 | 4.17 | 2.63 || 28.39 | 00h00'00\n+ -1.00 | 3.50 | 43167 | 10428 | 4000 | 2.20e-02 | 9.27e-02 || 11.90 | 4.22 | 2.61 || 28.35 | 00h00'00\n+ -0.75 | 3.75 | 56727 | 10321 | 4000 | 1.65e-02 | 7.05e-02 || 12.34 | 4.38 | 2.51 || 29.23 | 00h00'00\n+ -0.50 | 4.00 | 71534 | 10443 | 4000 | 1.33e-02 | 5.59e-02 || 12.71 | 4.51 | 2.44 || 29.60 | 00h00'00\n+ -0.25 | 4.25 | 92918 | 10251 | 4000 | 1.00e-02 | 4.30e-02 || 13.10 | 4.65 | 2.37 || 30.27 | 00h00'00\n+ 0.00 | 4.50 | 131460 | 10306 | 4000 | 7.13e-03 | 3.04e-02 || 13.05 | 4.63 | 2.37 || 27.93 | 00h00'00\n+ 0.25 | 4.75 | 182172 | 10119 | 4000 | 5.05e-03 | 2.20e-02 || 13.89 | 4.93 | 2.23 || 31.31 | 00h00'00\n+ 0.50 | 5.00 | 269608 | 10124 | 4000 | 3.41e-03 | 1.48e-02 || 14.52 | 5.15 | 2.14 || 31.91 | 00h00'00\n+ 0.75 | 5.25 | 400361 | 10007 | 4000 | 2.27e-03 | 9.99e-03 || 15.07 | 5.35 | 2.06 || 32.76 | 00h00'00\n+ 1.00 | 5.50 | 593333 | 10067 | 4000 | 1.54e-03 | 6.74e-03 || 15.12 | 5.37 | 2.05 || 32.31 | 00h00'00\n+ 1.25 | 5.75 | 952643 | 10206 | 4000 | 9.74e-04 | 4.20e-03 || 16.00 | 5.68 | 1.94 || 33.56 | 00h00'00\n+ 1.50 | 6.00 | 1567775 | 10023 | 4000 | 5.81e-04 | 2.55e-03 || 15.04 | 5.34 | 2.06 || 31.31 | 00h00'01\n+ 1.75 | 6.25 | 2582291 | 9930 | 4000 | 3.50e-04 | 1.55e-03 || 17.49 | 6.21 | 1.77 || 35.10 | 00h00'02\n+ 2.00 | 6.50 | 4497885 | 9893 | 4000 | 2.00e-04 | 8.89e-04 || 18.24 | 6.47 | 1.70 || 35.78 | 00h00'03\n+ 2.25 | 6.75 | 8268734 | 10071 | 4000 | 1.11e-04 | 4.84e-04 || 19.09 | 6.77 | 1.62 || 36.85 | 00h00'06\n+ 2.50 | 7.00 | 15560432 | 10066 | 4000 | 5.88e-05 | 2.57e-04 || 18.63 | 6.61 | 1.66 || 35.26 | 00h00'13\n+ 2.75 | 7.25 | 30802504 | 9992 | 4000 | 2.95e-05 | 1.30e-04 || 19.50 | 6.92 | 1.59 || 35.74 | 00h00'26\n+ 3.00 | 7.50 | 21697464 | 3234 | 1319 | 1.35e-05 | 6.08e-05 || 21.80 | 7.74 | 1.42 || 39.35 | 00h00'17 x\n+ 3.25 | 7.75 | 22212500 | 1686 | 667 | 6.90e-06 | 3.00e-05 || 22.87 | 8.11 | 1.36 || 40.17 | 00h00'17 x\n+ 3.50 | 8.00 | 19465770 | 582 | 229 | 2.72e-06 | 1.18e-05 || 23.81 | 8.45 | 1.30 || 40.99 | 00h00'14 x\n+ 3.75 | 8.25 | 25297940 | 328 | 124 | 1.18e-06 | 4.90e-06 || 24.86 | 8.82 | 1.25 || 41.73 | 00h00'18 x\n+# End of the simulation.\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add new curves for the BCH codes.
|
8,490 |
22.03.2017 17:11:52
| -3,600 |
d41eae44ba73cdb287dd1470bca0d1c626daffd3
|
Improve the error detection in the BCH simulation.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/Algebraic/Galois.cpp",
"new_path": "src/Tools/Math/Algebraic/Galois.cpp",
"diff": "+#include <cmath>\n#include <cassert>\n#include <iostream>\n@@ -9,11 +10,13 @@ using namespace aff3ct::tools;\nGalois\n::Galois(const int& m, const int& N, const int& K, const int& t)\n- : m(m), K(K), N(N), t(t), d(2*t+1), alpha_to(N+1), index_of(N+1), p(m+1), g(N-K+1)\n+ : m(m), K(K), N(N), t(t), d(2*t+1), alpha_to(N+1), index_of(N+1), p(m+1, 0), g(N-K+1)\n{\n+ assert(m <= 20);\n+ assert(N < 1048576); // N < 2^20\nassert(N == ((1 << m) -1));\nassert(K <= N);\n- assert(N - K == m * t);\n+ assert(m == std::log2(N +1));\nSelect_Polynomial();\nGenerate_GF();\n@@ -28,9 +31,6 @@ Galois\nvoid Galois\n::Select_Polynomial()\n{\n- for (int i=1; i<m; i++)\n- p[i] = 0;\n-\np[0] = p[m] = 1;\nif (m == 2) p[1] = 1;\nelse if (m == 3) p[1] = 1;\n@@ -161,11 +161,11 @@ void Galois\nkaux++;\n}\n- //K = N - rdncy;\n-\n- if (K < 0)\n+ if (K > N - rdncy)\n{\n- std::cerr << bold_red(\"Galois: parameters invalid!\") << std::endl;\n+ std::cerr << bold_red(\"(EE) Galois Field: parameters invalid (K seems to be too big for this \")\n+ << bold_red(\"correction power (t))!\")\n+ << std::endl;\nstd::exit(0);\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the error detection in the BCH simulation.
|
8,490 |
23.03.2017 09:31:39
| -3,600 |
d57011fee672f44c6ffaee8056b7641eb4f621da
|
Refacto + clean code + remove useless mGF parameter.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -103,7 +103,7 @@ _aff3ct() {\n# add contents of Launcher_BFER_BCH.cpp\nif [[ ${codetype} == \"BCH\" && ${simutype} == \"BFER\" ]]\nthen\n- opts=\"$opts --cde-corr-pow -T -cde-gfield-order --mGF\"\n+ opts=\"$opts --cde-corr-pow -T\"\nfi\n# add contents of Launcher_BFER_RSC.cpp\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.cpp",
"new_path": "src/Launcher/BFER/BCH/Launcher_BFER_BCH.cpp",
"diff": "@@ -35,10 +35,6 @@ void Launcher_BFER_BCH<B,R,Q>\nthis->opt_args[{\"cde-corr-pow\", \"T\"}] =\n{\"positive_int\",\n\"correction power of the BCH code.\"};\n-\n- this->opt_args[{\"cde-gfield-order\", \"mGF\"}] =\n- {\"positive_int\",\n- \"order of the Galois Field (used in BCH simulations).\"};\n}\ntemplate <typename B, typename R, typename Q>\n@@ -48,15 +44,10 @@ void Launcher_BFER_BCH<B,R,Q>\nLauncher_BFER<B,R,Q>::store_args();\n// ---------------------------------------------------------------------------------------------------------- code\n- if (this->ar.exist_arg({\"cde-gfield-order\", \"mGF\"}))\n- this->params.code.mGF = this->ar.get_arg_int({\"cde-gfield-order\", \"mGF\"});\n- else\n- this->params.code.mGF = (int)std::log2(this->params.code.N +1);\n-\nif (this->ar.exist_arg({\"cde-corr-pow\", \"T\"}))\nthis->params.code.t = this->ar.get_arg_int({\"cde-corr-pow\", \"T\"});\nelse\n- this->params.code.t = (this->params.code.N - this->params.code.K) / this->params.code.mGF;\n+ this->params.code.t = (this->params.code.N - this->params.code.K) / this->params.code.m;\n}\ntemplate <typename B, typename R, typename Q>\n@@ -72,8 +63,8 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_BCH<B,R,Q>\n{\nauto p = Launcher_BFER<B,R,Q>::header_code();\n+ p.push_back(std::make_pair(\"Galois field order (m)\", std::to_string(this->params.code.m)));\np.push_back(std::make_pair(\"Correction power (T)\", std::to_string(this->params.code.t)));\n- p.push_back(std::make_pair(\"Order of the GField (mGF)\", std::to_string(this->params.code.mGF)));\nreturn p;\n}\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/Perf/MIPP/mipp.h\"\n-#include \"Tools/Math/Algebraic/Galois.hpp\"\n+#include \"Tools/Math/Galois.hpp\"\n#include \"../Decoder.hpp\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"new_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"diff": "@@ -12,9 +12,6 @@ Encoder_BCH<B>\nconst int n_frames, const std::string name)\n: Encoder<B>(K, N, n_frames, name), m(m), g(N - K + 1), bb(N - K)\n{\n- //assert(2**m == N+1);\n- //assertion on K required\n-\n// set polynomial coefficients\nthis->g = GF.g;\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 \"Tools/Perf/MIPP/mipp.h\"\n#include \"../Encoder.hpp\"\n-#include \"Tools/Math/Algebraic/Galois.hpp\"\n+#include \"Tools/Math/Galois.hpp\"\nnamespace aff3ct\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/BCH/Simulation_BFER_BCH.cpp",
"new_path": "src/Simulation/BFER/Code/BCH/Simulation_BFER_BCH.cpp",
"diff": "@@ -17,7 +17,8 @@ using namespace aff3ct::simulation;\ntemplate <typename B, typename R, typename Q>\nSimulation_BFER_BCH<B,R,Q>\n::Simulation_BFER_BCH(const parameters& params)\n-: Simulation_BFER<B,R,Q>(params), GF(params.code.mGF, params.code.N, params.code.K, params.code.t)\n+: Simulation_BFER<B,R,Q>(params),\n+ GF(params.code.K, params.code.N, params.code.m, params.code.t)\n{\n// assertion are made in the Galois Field (GF)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/BCH/Simulation_BFER_BCH.hpp",
"new_path": "src/Simulation/BFER/Code/BCH/Simulation_BFER_BCH.hpp",
"diff": "#ifndef SIMULATION_BCH_HPP_\n#define SIMULATION_BCH_HPP_\n-#include \"Tools/Math/Algebraic/Galois.hpp\"\n+#include \"Tools/Math/Galois.hpp\"\n#include \"Simulation/BFER/Standard/STD_Simulation_BFER.hpp\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.cpp",
"new_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.cpp",
"diff": "@@ -17,7 +17,7 @@ Decoder<B,R>* Factory_decoder_BCH<B,R>\nif (params.decoder.implem == \"STD\")\ndecoder = new Decoder_BCH<B,R>(params.code.K,\nparams.code.N,\n- params.code.mGF,\n+ params.code.m,\nparams.code.t,\nGF,\nparams.simulation.inter_frame_level);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.hpp",
"new_path": "src/Tools/Factory/BCH/Factory_decoder_BCH.hpp",
"diff": "#include \"Module/Decoder/Decoder.hpp\"\n#include \"Module/Decoder/SISO.hpp\"\n#include \"Tools/params.h\"\n-#include \"Tools/Math/Algebraic/Galois.hpp\"\n+#include \"Tools/Math/Galois.hpp\"\n#include \"../Factory.hpp\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/BCH/Factory_encoder_BCH.cpp",
"new_path": "src/Tools/Factory/BCH/Factory_encoder_BCH.cpp",
"diff": "@@ -13,7 +13,7 @@ Encoder<B>* Factory_encoder_BCH<B>\n// build the encoder\nif (params.encoder.systematic)\n- encoder = new Encoder_BCH<B>(params.code.K, params.code.N, params.code.mGF, GF);\n+ encoder = new Encoder_BCH<B>(params.code.K, params.code.N, params.code.m, GF);\nreturn encoder;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/BCH/Factory_encoder_BCH.hpp",
"new_path": "src/Tools/Factory/BCH/Factory_encoder_BCH.hpp",
"diff": "#include \"Module/Encoder/Encoder.hpp\"\n#include \"Tools/params.h\"\n-#include \"Tools/Math/Algebraic/Galois.hpp\"\n+#include \"Tools/Math/Galois.hpp\"\n#include \"../Factory.hpp\"\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Math/Algebraic/Galois.cpp",
"new_path": "src/Tools/Math/Galois.cpp",
"diff": "using namespace aff3ct::tools;\nGalois\n-::Galois(const int& m, const int& N, const int& K, const int& t)\n- : m(m), K(K), N(N), t(t), d(2*t+1), alpha_to(N+1), index_of(N+1), p(m+1, 0), g(N-K+1)\n+::Galois(const int& K, const int& N, const int& m, const int& t)\n+ : K(K), N(N), m(m), t(t), d(2 * t + 1), alpha_to(N + 1), index_of(N + 1), p(m + 1, 0), g(N - K + 1)\n{\n- assert(m <= 20);\n- assert(N < 1048576); // N < 2^20\n- assert(N == ((1 << m) -1));\n- assert(K <= N);\n- assert(m == std::log2(N +1));\n+ if (N >= 1048576) // 2^20\n+ {\n+ std::cerr << bold_red(\"(EE) Galois Field: parameters invalid (N has to be smaller than 1048576)!\")\n+ << std::endl;\n+ std::exit(0);\n+ }\n+\n+ if (m != (int)std::ceil(std::log2(N +1)))\n+ {\n+ std::cerr << bold_red(\"(EE) Galois Field: parameters invalid (m has to be equal to log2(N +1))!\")\n+ << std::endl;\n+ std::exit(0);\n+ }\n+\n+ if (N != ((1 << m) -1))\n+ {\n+ std::cerr << bold_red(\"(EE) Galois Field: parameters invalid (N has to be a power of 2 minus 1)!\")\n+ << std::endl;\n+ std::exit(0);\n+ }\nSelect_Polynomial();\nGenerate_GF();\n@@ -164,7 +179,7 @@ void Galois\nif (K > N - rdncy)\n{\nstd::cerr << bold_red(\"(EE) Galois Field: parameters invalid (K seems to be too big for this \")\n- << bold_red(\"correction power (t))!\")\n+ << bold_red(\"correction power t)!\")\n<< std::endl;\nstd::exit(0);\n}\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Math/Algebraic/Galois.hpp",
"new_path": "src/Tools/Math/Galois.hpp",
"diff": "@@ -11,14 +11,14 @@ namespace tools\nclass Galois\n{\nprotected:\n- const int m; // order of the Galois Field\nconst int K;\nconst int N; // number of non-nul elements in the field : N = 2^m - 1\n+ const int m; // order of the Galois Field\nconst int t;\nconst int d;\npublic:\n- Galois(const int& m, const int& N, const int& K, const int& t);\n+ Galois(const int& K, const int& N, const int& m, const int& t);\nvirtual ~Galois();\nvoid Select_Polynomial(); // move this private section\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -51,7 +51,6 @@ struct code_parameters\nint m;\nint tail_length;\nint t;\n- int mGF;\n};\nstruct source_parameters\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Refacto + clean code + remove useless mGF parameter.
|
8,483 |
23.03.2017 11:23:03
| -3,600 |
dd42baf08ace736c0191657dae87d3ca55ae206c
|
Change name interleaver columns to random column and add an interleaver row-column
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -284,8 +284,8 @@ _aff3ct() {\n--itl-type)\nlocal params\ncase \"${simutype}\" in\n- BFER) params=\"LTE CCSDS RANDOM COLUMNS GOLDEN USER NO\" ;;\n- BFERI) params=\"LTE CCSDS RANDOM COLUMNS GOLDEN USER NO\" ;;\n+ BFER) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL GOLDEN USER NO\" ;;\n+ BFERI) params=\"LTE CCSDS RANDOM RAND_COL ROW_COL GOLDEN USER NO\" ;;\nesac\nCOMPREPLY=( $(compgen -W \"${params}\" -- ${cur}) )\n;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/RA/Launcher_BFER_RA.cpp",
"new_path": "src/Launcher/BFER/RA/Launcher_BFER_RA.cpp",
"diff": "@@ -40,7 +40,7 @@ void Launcher_BFER_RA<B,R,Q>\nthis->opt_args[{\"itl-type\"}] =\n{\"string\",\n\"specify the type of the interleaver.\",\n- \"LTE, CCSDS, RANDOM, GOLDEN, USER, COLUMNS, NO\"};\n+ \"LTE, CCSDS, RANDOM, GOLDEN, USER, RAND_COL, ROW_COL, NO\"};\nthis->opt_args[{\"itl-path\"}] =\n{\"string\",\n@@ -96,7 +96,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_RA<B,R,Q>\nif (this->params.interleaver.type == \"USER\")\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\n- if (this->params.interleaver.type == \"COLUMNS\")\n+ if (this->params.interleaver.type == \"RAND_COL\" || this->params.interleaver.type == \"ROW_COL\")\np.push_back(std::make_pair(\"Number of columns\", std::to_string(this->params.interleaver.n_cols)));\np.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.uniform ? \"on\" : \"off\")));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -70,7 +70,7 @@ void Launcher_BFER_turbo<B,R,Q,QD>\nthis->opt_args[{\"itl-type\"}] =\n{\"string\",\n\"specify the type of the interleaver.\",\n- \"LTE, CCSDS, RANDOM, GOLDEN, USER, COLUMNS, NO\"};\n+ \"LTE, CCSDS, RANDOM, GOLDEN, USER, RAND_COL, ROW_COL, NO\"};\nthis->opt_args[{\"itl-path\"}] =\n{\"string\",\n@@ -272,7 +272,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\nif (this->params.interleaver.type == \"USER\")\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\n- if (this->params.interleaver.type == \"COLUMNS\")\n+ if (this->params.interleaver.type == \"RAND_COL\" || this->params.interleaver.type == \"ROW_COL\")\np.push_back(std::make_pair(\"Number of columns\", std::to_string(this->params.interleaver.n_cols)));\np.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.uniform ? \"on\" : \"off\")));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -89,7 +89,7 @@ void Launcher_BFERI<B,R,Q>\nthis->opt_args[{\"itl-type\"}] =\n{\"string\",\n\"specify the type of the interleaver.\",\n- \"LTE, CCSDS, RANDOM, GOLDEN, USER, COLUMNS, NO\"};\n+ \"LTE, CCSDS, RANDOM, GOLDEN, USER, RAND_COL, ROW_COL, NO\"};\nthis->opt_args[{\"itl-path\"}] =\n{\"string\",\n@@ -256,7 +256,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\nif (this->params.interleaver.type == \"USER\")\np.push_back(std::make_pair(\"Path\", this->params.interleaver.path));\n- if (this->params.interleaver.type == \"COLUMNS\")\n+ if (this->params.interleaver.type == \"RAND_COL\" || this->params.interleaver.type == \"ROW_COL\")\np.push_back(std::make_pair(\"Number of columns\", std::to_string(this->params.interleaver.n_cols)));\np.push_back(std::make_pair(\"Uniform\", (this->params.interleaver.uniform ? \"on\" : \"off\")));\n"
},
{
"change_type": "RENAME",
"old_path": "src/Module/Interleaver/Columns/Interleaver_columns.hpp",
"new_path": "src/Module/Interleaver/Random_column/Interleaver_random_column.hpp",
"diff": "-#ifndef INTERLEAVER_COLUMNS_HPP\n-#define INTERLEAVER_COLUMNS_HPP\n+#ifndef INTERLEAVER_RANDOM_COLUMN_HPP\n+#define INTERLEAVER_RANDOM_COLUMN_HPP\n#include <algorithm>\n#include <time.h>\n@@ -12,7 +12,7 @@ namespace aff3ct\nnamespace module\n{\ntemplate <typename T = int>\n-class Interleaver_columns : public Interleaver<T>\n+class Interleaver_random_column : public Interleaver<T>\n{\nprivate:\nstd::random_device rd;\n@@ -22,8 +22,8 @@ private:\nint col_size;\npublic:\n- Interleaver_columns(const int size, const int n_cols, const int seed = 0,\n- const std::string name = \"Interleaver_columns\")\n+ Interleaver_random_column(const int size, const int n_cols, const int seed = 0,\n+ const std::string name = \"Interleaver_random_column\")\n: Interleaver<T>(size, 1, name), rd(), rd_engine(rd()), n_cols(n_cols)\n{\ncol_size = (size / n_cols);\n@@ -54,4 +54,4 @@ public:\n}\n}\n-#endif /* INTERLEAVER_COLUMNS_HPP */\n+#endif /* INTERLEAVER_RANDOM_COLUMNS_HPP */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Interleaver/Row_column/Interleaver_row_column.hpp",
"diff": "+#ifndef INTERLEAVER_ROW_COLUMN_HPP\n+#define INTERLEAVER_ROW_COLUMN_HPP\n+\n+#include <algorithm>\n+#include <time.h>\n+#include <random>\n+\n+#include \"../Interleaver.hpp\"\n+#include \"Tools/Math/matrix.h\"\n+\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename T = int>\n+class Interleaver_row_column : public Interleaver<T>\n+{\n+private:\n+ const int n_cols;\n+ int n_rows;\n+\n+public:\n+ Interleaver_row_column(const int size, const int n_cols, const std::string name = \"Interleaver_row_column\")\n+ : Interleaver<T>(size, 1, name), n_cols(n_cols)\n+ {\n+ n_rows = (size / n_cols);\n+ assert(n_rows * n_cols == size);\n+ gen_lookup_tables();\n+ }\n+\n+ void gen_lookup_tables()\n+ {\n+ for (auto i = 0; i < n_cols; i++)\n+ for (auto j = 0; j < n_rows; j++)\n+ this->pi[i*n_rows+j] = j*n_cols+i;\n+\n+ for (auto i = 0; i < (int)this->pi_inv.size(); i++)\n+ this->pi_inv[this->pi[i]] = i;\n+ }\n+};\n+}\n+}\n+\n+#endif /* INTERLEAVER_ROW_COLUMN_HPP */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Factory_interleaver.cpp",
"new_path": "src/Tools/Factory/Factory_interleaver.cpp",
"diff": "+#include \"Module/Interleaver/Random_column/Interleaver_random_column.hpp\"\n+#include \"Module/Interleaver/Row_column/Interleaver_row_column.hpp\"\n#include \"Module/Interleaver/LTE/Interleaver_LTE.hpp\"\n#include \"Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp\"\n#include \"Module/Interleaver/NO/Interleaver_NO.hpp\"\n-#include \"Module/Interleaver/Columns/Interleaver_columns.hpp\"\n#include \"Module/Interleaver/Golden/Interleaver_golden.hpp\"\n#include \"Module/Interleaver/Random/Interleaver_random.hpp\"\n#include \"Module/Interleaver/User/Interleaver_user.hpp\"\n@@ -24,8 +25,10 @@ Interleaver<T>* Factory_interleaver<T>\ninterleaver = new Interleaver_CCSDS<T>(size);\nelse if (params.interleaver.type == \"RANDOM\")\ninterleaver = new Interleaver_random<T>(size, seed);\n- else if (params.interleaver.type == \"COLUMNS\")\n- interleaver = new Interleaver_columns<T>(size, params.interleaver.n_cols, seed);\n+ else if (params.interleaver.type == \"RAND_COL\")\n+ interleaver = new Interleaver_random_column<T>(size, params.interleaver.n_cols, seed);\n+ else if (params.interleaver.type == \"ROW_COL\")\n+ interleaver = new Interleaver_row_column<T>(size, params.interleaver.n_cols);\nelse if (params.interleaver.type == \"GOLDEN\")\ninterleaver = new Interleaver_golden<T>(size, seed);\nelse if (params.interleaver.type == \"USER\")\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Change name interleaver columns to random column and add an interleaver row-column
|
8,490 |
24.03.2017 16:36:58
| -3,600 |
fa87a1b62b532f7b47f00219fc9aa1e9dd577fb3
|
Clean code + fix compilation warnings.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "@@ -22,8 +22,8 @@ Encoder_LDPC_from_H<B>\nstd::vector<mipp::vector<B>> H;\nbuild_H(alist_H.get_n_CN(), alist_H.get_n_VN(), alist_H.get_CN_to_VN(), H);\ntriangularization_H(H, swapped);\n- assert(H[0].size() == N);\n- assert(H[0].size()-H.size() == K);\n+ assert((int) H[0].size() == N);\n+ assert((int)(H[0].size() - H.size()) == K);\nidentity_H(H);\ntransformation_H_to_G(H, G);\ntools::real_transpose(K, N, G, this->tG);\n@@ -40,15 +40,17 @@ void Encoder_LDPC_from_H<B>\n::get_info_bits_pos(mipp::vector<B>& info_bits_pos)\n{\nassert(this->K <= (int)info_bits_pos.size());\n+\nmipp::vector<B> tmp(this->N);\n- B tmp2;\nstd::iota(tmp.begin(), tmp.begin() + this->N, 0);\n- for(unsigned int l = 1; l <= (swapped.size() / 2); l++ )\n+\n+ for (unsigned l = 1; l <= (swapped.size() / 2); l++)\n{\n- tmp2 = tmp[swapped[l*2-1]];\n+ auto tmp_val = tmp[swapped[l * 2 -1]];\ntmp[swapped[l * 2 -1]] = tmp[swapped[(l -1) * 2]];\n- tmp[swapped[(l-1)*2]] = tmp2;\n+ tmp[swapped[(l -1) * 2]] = tmp_val;\n}\n+\nstd::copy(tmp.begin() + this->N - this->K, tmp.end(), info_bits_pos.begin());\n}\n@@ -57,6 +59,7 @@ void Encoder_LDPC_from_H<B>\n::get_G(mipp::vector<B>& G)\n{\nassert(this->G.size() == G.size());\n+\nstd::copy(this->G.begin(), this->G.end(), G.begin());\n}\n@@ -66,44 +69,36 @@ void Encoder_LDPC_from_H<B>\nstd::vector<mipp::vector<B>>& H)\n{\nfor (int i = 0; i < k; i++)\n- {\nH.push_back(mipp::vector<B>(n, 0));\n- }\n- for(unsigned int i = 0; i < positions.size(); i++)\n- {\n- for(unsigned int j = 0; j < positions[i].size(); j++)\n- {\n+\n+ for (unsigned i = 0; i < positions.size(); i++)\n+ for (unsigned j = 0; j < positions[i].size(); j++)\nH[i][positions[i][j]] = 1;\n}\n- }\n-}\ntemplate <typename B>\nvoid Encoder_LDPC_from_H<B>\n::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped)\n{\n- unsigned int n(H[0].size());\n- unsigned int k(H.size());\n- int i(0);\n- bool fund(false);\n+ unsigned n = H[0].size();\n+ unsigned k = H.size();\n+ unsigned i = 0;\n+ bool fund = false;\n+\nmipp::vector<B> tmp(n, 0);\nmipp::vector<B> tmp2;\n+\nwhile (i < k -1)\n{\nif (H[i][i])\n{\n- for(int j = (i+1); j < k; j++)\n- {\n+ for (unsigned j = i +1; j < k; j++)\nif (H[j][i])\n- {\nstd::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n}\n- }\n- }\nelse\n{\n- for(int j = (i+1); j < k; j++) // find an other row which is good\n- {\n+ for (unsigned j = i +1; j < k; j++) // find an other row which is good\nif (H[j][i])\n{\ntmp = H[i];\n@@ -113,34 +108,25 @@ void Encoder_LDPC_from_H<B>\nfund = true;\nbreak;\n}\n- }\n+\nif (!fund) // if does not fund\n- {\n- for(int j = (i+1); j<n; j++) // find an other column which is good\n- {\n+ for (unsigned j = (i+1); j<n; j++) // find an other column which is good\nif( H[i][j] )\n{\nswapped.push_back(i);\nswapped.push_back(j);\n+\ntmp2.clear();\n- for(int l = 0; l < k; l++)\n- {\n- tmp2.push_back(H[l][i]);\n- }\n- for(int l = 0; l < k; l++)\n- {\n- H[l][i] = H[l][j];\n- }\n- for(int l = 0; l < k; l++)\n- {\n- H[l][j] = tmp2[l];\n- }\n+\n+ for (unsigned l = 0; l < k; l++) tmp2.push_back(H[l][i]);\n+ for (unsigned l = 0; l < k; l++) H[l][i] = H[l][j];\n+ for (unsigned l = 0; l < k; l++) H[l][j] = tmp2[l];\n+\ni--;\nfund = true;\nbreak;\n}\n- }\n- }\n+\nif (!fund) // if does not fund again this mean that the row is the null vector\n{\nH.erase(H.begin() +i);\n@@ -149,6 +135,7 @@ void Encoder_LDPC_from_H<B>\n}\nfund = false;\n}\n+\ni++;\n}\n}\n@@ -157,51 +144,43 @@ template <typename B>\nvoid Encoder_LDPC_from_H<B>\n::identity_H(std::vector<mipp::vector<B>>& H)\n{\n- unsigned int k(H.size());\n- for(int i = k-1 ; i > 0; i--)\n- {\n- for(int j = (i-1); j > -1; j--)\n- {\n+ auto k = (int)H.size();\n+ for (auto i = k -1 ; i > 0; i--)\n+ for (auto j = i -1; j >= 0; j--)\nif (H[j][i])\n- {\nstd::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n}\n- }\n- }\n-}\ntemplate <typename B>\nvoid Encoder_LDPC_from_H<B>\n::transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G)\n{\n- unsigned int n(H[0].size());\n- unsigned int k(H.size());\n- for(int i = 0; i < k; i++) // Kill of the Identity in H\n- {\n+ unsigned n = H[0].size();\n+ unsigned k = H.size();\n+\n+ for (unsigned i = 0; i < k; i++) // Kill of the Identity in H\nH[i].erase( H[i].begin(), H[i].begin() + k );\n- }\n- for(int i = k; i < n; i++) // Add identity at the end\n+\n+ for (unsigned i = k; i < n; i++) // Add identity at the end\n{\nH.push_back(mipp::vector<B>(n - k, 0));\nH[i][i - k] = 1;\n}\n- // Re-organization: column of G\n+\n+ // re-organization: column of G\nmipp::vector<B> tmp(n - k, 0);\n- for(int l = (swapped.size() / 2); l > 0; l-- )\n+ for (unsigned l = swapped.size() / 2; l > 0; l--)\n{\ntmp = H[swapped[l * 2 -1]];\nH[swapped[l * 2 -1]] = H[swapped[(l - 1) * 2]];\nH[swapped[(l - 1) * 2]] = tmp;\n}\n- // Write G matrix in G vector\n- for(int j = 0; j < n-k; j++)\n- {\n- for(int i = 0; i < n; i++)\n- {\n+\n+ // write G matrix in G vector\n+ for (unsigned j = 0; j < n - k; j++)\n+ for (unsigned i = 0; i < n; i++)\nG.push_back(H[i][j]);\n}\n- }\n-}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -19,6 +19,7 @@ class Encoder_LDPC_from_H : public Encoder_LDPC<B>\nprotected:\nmipp::vector<int> swapped;\nmipp::vector<B> G;\n+\nvoid build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\nstd::vector<mipp::vector<B>>& H);\nvoid triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Clean code + fix compilation warnings.
|
8,490 |
24.03.2017 22:43:12
| -3,600 |
7d1897487fbbe84a6bece71e48c1f9a6c5bc8bb6
|
Set the default syndrome depth to 2 (LDPC decoders).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"diff": "@@ -25,7 +25,7 @@ Launcher_BFER_LDPC<B,R,Q>\nthis->params.decoder .offset = 0.f;\nthis->params.decoder .normalize_factor = 1.f;\nthis->params.decoder .enable_syndrome = true;\n- this->params.decoder .syndrome_depth = 1;\n+ this->params.decoder .syndrome_depth = 2;\n}\ntemplate <typename B, typename R, typename Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"new_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"diff": "@@ -26,7 +26,7 @@ Launcher_BFERI_LDPC<B,R,Q>\nthis->params.decoder .offset = 0.f;\nthis->params.decoder .normalize_factor = 1.f;\nthis->params.decoder .enable_syndrome = true;\n- this->params.decoder .syndrome_depth = 1;\n+ this->params.decoder .syndrome_depth = 2;\n}\ntemplate <typename B, typename R, typename Q>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Set the default syndrome depth to 2 (LDPC decoders).
|
8,490 |
25.03.2017 10:34:35
| -3,600 |
2bd635d29b24bd449deb42dd3ab6247beca1c961
|
Fix bad includes + add the 'aff3ct.hpp' header to include all aff3ct in one include call.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA_sys.hpp",
"diff": "#ifndef DECODER_POLAR_SCL_NAIVE_CA_SYS_\n#define DECODER_POLAR_SCL_NAIVE_CA_SYS_\n+#include \"Decoder_polar_SCL_naive_CA.hpp\"\n+\nnamespace aff3ct\n{\nnamespace module\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive_sys.hpp",
"diff": "#include <vector>\n#include <set>\n-#include \"../../Decoder.hpp\"\n+\n+#include \"Decoder_polar_SCL_naive.hpp\"\n+\n#include \"../decoder_polar_functions.h\"\nnamespace aff3ct\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/aff3ct.hpp",
"diff": "+//find ./src/ -type f -follow -print | grep \"[.]h$\"\n+//#include <Tools/types.h>\n+#include <Tools/Math/matrix.h>\n+#include <Tools/Math/utils.h>\n+#include <Tools/Math/max.h>\n+#include <Tools/Perf/MIPP/math/sse_mathfun.h>\n+#include <Tools/Perf/MIPP/math/avx_mathfun.h>\n+#include <Tools/Perf/MIPP/math/neon_mathfun.h>\n+#include <Tools/Perf/MIPP/mipp_scalar_op.h>\n+#include <Tools/Perf/MIPP/mipp.h>\n+#include <Tools/Perf/Transpose/transpose_AVX.h>\n+#include <Tools/Perf/Transpose/transpose_SSE.h>\n+#include <Tools/Perf/Transpose/transpose_selector.h>\n+#include <Tools/Perf/Transpose/transpose_NEON.h>\n+#include <Tools/Display/bash_tools.h>\n+// #include <Tools/MSVC/dirent.h>\n+#include <Tools/params.h>\n+#include <Module/Decoder/Polar/decoder_polar_functions.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_inter_intra.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_intra.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_intra_8bit.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_seq.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_inter_8bit_bitpacking.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_intra_16bit.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_inter.h>\n+#include <Module/Decoder/Polar/SC/API/functions_polar_intra_32bit.h>\n+// #include <main.h>\n+\n+//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n+#include <Tools/Threads/Barrier.hpp>\n+#include <Tools/Factory/Factory_monitor.hpp>\n+#include <Tools/Factory/Polar/Factory_decoder_polar_gen.hpp>\n+#include <Tools/Factory/Polar/Factory_decoder_polar.hpp>\n+#include <Tools/Factory/Polar/Factory_encoder_polar.hpp>\n+#include <Tools/Factory/Polar/Factory_frozenbits_generator.hpp>\n+#include <Tools/Factory/Polar/Factory_puncturer_polar.hpp>\n+#include <Tools/Factory/Factory_quantizer.hpp>\n+#include <Tools/Factory/Factory_channel.hpp>\n+#include <Tools/Factory/Factory.hpp>\n+#include <Tools/Factory/Factory_terminal.hpp>\n+#include <Tools/Factory/RSC/Factory_decoder_RSC.hpp>\n+#include <Tools/Factory/RSC/Factory_encoder_RSC.hpp>\n+#include <Tools/Factory/Factory_interleaver.hpp>\n+#include <Tools/Factory/Factory_encoder_common.hpp>\n+#include <Tools/Factory/Repetition/Factory_decoder_repetition.hpp>\n+#include <Tools/Factory/Repetition/Factory_encoder_repetition.hpp>\n+#include <Tools/Factory/LDPC/Factory_decoder_LDPC.hpp>\n+#include <Tools/Factory/Coset/Factory_coset_real.hpp>\n+#include <Tools/Factory/Coset/Factory_coset_bit.hpp>\n+#include <Tools/Factory/Factory_CRC.hpp>\n+#include <Tools/Factory/Factory_source.hpp>\n+#include <Tools/Factory/Factory_modulator.hpp>\n+#include <Tools/Factory/Turbo/Factory_encoder_turbo.hpp>\n+#include <Tools/Factory/Turbo/Factory_scaling_factor.hpp>\n+#include <Tools/Factory/Turbo/Factory_decoder_turbo.hpp>\n+#include <Tools/Algo/PRNG/PRNG_MT19937_simd.hpp>\n+#include <Tools/Algo/PRNG/PRNG_MT19937.hpp>\n+#include <Tools/Algo/Predicate.hpp>\n+#include <Tools/Algo/Tree/Binary_node.hpp>\n+#include <Tools/Algo/Tree/Binary_tree.hpp>\n+#include <Tools/Algo/Tree/Binary_tree_metric.hpp>\n+#include <Tools/Algo/Predicate_ite.hpp>\n+#include <Tools/Algo/Bit_packer.hpp>\n+#include <Tools/SystemC/SC_Router.hpp>\n+#include <Tools/SystemC/SC_Dummy.hpp>\n+#include <Tools/SystemC/SC_Predicate.hpp>\n+#include <Tools/SystemC/SC_Debug.hpp>\n+#include <Tools/SystemC/SC_Duplicator.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_GA.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_file.hpp>\n+#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_TV.hpp>\n+#include <Tools/Code/Polar/Pattern_parser_polar.hpp>\n+#include <Tools/Code/LDPC/AList_reader/AList_reader.hpp>\n+#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_NO.hpp>\n+#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_constant.hpp>\n+#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_array.hpp>\n+#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor.hpp>\n+#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_seq.hpp>\n+#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_vec.hpp>\n+#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_array_fast.hpp>\n+#include <Tools/Arguments_reader.hpp>\n+#include <Tools/Perf/Reorderer/Reorderer.hpp>\n+#include <Tools/Display/Frame_trace/Frame_trace.hpp>\n+#include <Tools/Display/Terminal/Terminal.hpp>\n+#include <Tools/Display/Terminal/EXIT/Terminal_EXIT.hpp>\n+#include <Tools/Display/Terminal/BFER/Terminal_BFER_legacy.hpp>\n+#include <Tools/Display/Terminal/BFER/Terminal_BFER.hpp>\n+#include <Module/Interleaver/Random/Interleaver_random.hpp>\n+#include <Module/Interleaver/Golden/Interleaver_golden.hpp>\n+#include <Module/Interleaver/SPU_Interleaver.hpp>\n+#include <Module/Interleaver/Row_column/Interleaver_row_column.hpp>\n+#include <Module/Interleaver/SC_Interleaver.hpp>\n+#include <Module/Interleaver/User/Interleaver_user.hpp>\n+#include <Module/Interleaver/Random_column/Interleaver_random_column.hpp>\n+#include <Module/Interleaver/Interleaver.hpp>\n+#include <Module/Interleaver/NO/Interleaver_NO.hpp>\n+#include <Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp>\n+#include <Module/Interleaver/LTE/Interleaver_LTE.hpp>\n+#include <Module/Modulator/SC_Modulator.hpp>\n+#include <Module/Modulator/BPSK/Modulator_BPSK_fast.hpp>\n+#include <Module/Modulator/BPSK/Modulator_BPSK.hpp>\n+#include <Module/Modulator/PSK/Modulator_PSK.hpp>\n+#include <Module/Modulator/CPM/CPM_parameters.hpp>\n+#include <Module/Modulator/CPM/CPE/Encoder_CPE_Rimoldi.hpp>\n+#include <Module/Modulator/CPM/CPE/Encoder_CPE.hpp>\n+#include <Module/Modulator/CPM/BCJR/CPM_BCJR.hpp>\n+#include <Module/Modulator/CPM/Modulator_CPM.hpp>\n+#include <Module/Modulator/User/Modulator_user.hpp>\n+#include <Module/Modulator/QAM/Modulator_QAM.hpp>\n+#include <Module/Modulator/PAM/Modulator_PAM.hpp>\n+#include <Module/Modulator/SPU_Modulator.hpp>\n+#include <Module/Modulator/Modulator.hpp>\n+#include <Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp>\n+#include <Module/Puncturer/SPU_Puncturer.hpp>\n+#include <Module/Puncturer/Puncturer.hpp>\n+#include <Module/Puncturer/NO/Puncturer_NO.hpp>\n+#include <Module/Puncturer/SC_Puncturer.hpp>\n+#include <Module/Encoder/Encoder_sys.hpp>\n+#include <Module/Encoder/Polar/Encoder_polar.hpp>\n+#include <Module/Encoder/Polar/Encoder_polar_sys.hpp>\n+#include <Module/Encoder/AZCW/Encoder_AZCW.hpp>\n+#include <Module/Encoder/RSC/Encoder_RSC_generic_json_sys.hpp>\n+#include <Module/Encoder/RSC/Encoder_RSC_sys.hpp>\n+#include <Module/Encoder/RSC/Encoder_RSC_generic_sys.hpp>\n+#include <Module/Encoder/RSC/Encoder_RSC3_CPE_sys.hpp>\n+#include <Module/Encoder/SC_Encoder.hpp>\n+#include <Module/Encoder/SPU_Encoder.hpp>\n+#include <Module/Encoder/Repetition/Encoder_repetition_sys.hpp>\n+#include <Module/Encoder/Coset/Encoder_coset.hpp>\n+#include <Module/Encoder/User/Encoder_user.hpp>\n+#include <Module/Encoder/Encoder.hpp>\n+#include <Module/Encoder/NO/Encoder_NO.hpp>\n+#include <Module/Encoder/RA/Encoder_RA.hpp>\n+#include <Module/Encoder/Turbo/Encoder_turbo.hpp>\n+#include <Module/Encoder/Turbo/Encoder_turbo_legacy.hpp>\n+#include <Module/Channel/Channel.hpp>\n+#include <Module/Channel/Additive/AWGN/Fast/Channel_AWGN_fast_LR.hpp>\n+#include <Module/Channel/Additive/AWGN/Fast/Channel_AWGN_fast_LLR.hpp>\n+#include <Module/Channel/Additive/AWGN/Standard/Channel_AWGN_std_LLR.hpp>\n+#include <Module/Channel/Additive/AWGN/Standard/Channel_AWGN_std_LR.hpp>\n+#include <Module/Channel/Additive/AWGN/MKL/Channel_AWGN_MKL_LLR.hpp>\n+#include <Module/Channel/Additive/AWGN/MKL/Channel_AWGN_MKL_LR.hpp>\n+#include <Module/Channel/Additive/AWGN/GSL/Channel_AWGN_GSL_LLR.hpp>\n+#include <Module/Channel/Additive/AWGN/GSL/Channel_AWGN_GSL_LR.hpp>\n+#include <Module/Channel/Additive/User/Channel_additive_user.hpp>\n+#include <Module/Channel/SPU_Channel.hpp>\n+#include <Module/Channel/User/Channel_user.hpp>\n+#include <Module/Channel/Rayleigh/Channel_Rayleigh_LLR.hpp>\n+#include <Module/Channel/SC_Channel.hpp>\n+#include <Module/Channel/NO/Channel_NO.hpp>\n+#include <Module/Decoder/Decoder.hpp>\n+#include <Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp>\n+#include <Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_static_intra_32bit.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_dynamic_seq.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_static_inter.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_static_inter_8bit_bitpacking.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_static_seq.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_dynamic_inter.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_static_intra_8bit.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_static_intra_16bit.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_dynamic_inter_8bit_bitpacking.hpp>\n+#include <Module/Decoder/Polar/SC/API/API_polar_dynamic_intra.hpp>\n+#include <Module/Decoder/Polar/SC/Decoder_polar_SC_naive.hpp>\n+#include <Module/Decoder/Polar/SC/Decoder_polar_SC_naive_sys.hpp>\n+#include <Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR15.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K873813_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K54613_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K524288_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K9830_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29491_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K19661_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K64_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K32_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K27_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K2_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K4_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29492_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K614_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K3413_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K13107_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K19661_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K7_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K109227_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1229_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K614_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K107_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K4096_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1638_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1024_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K3413_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR18.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K512_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29491_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K13_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K218453_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K13_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K53_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K436907_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K109227_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K873813_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K427_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K4_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K13653_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K14746_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1638_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K3_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K3277_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K3_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4_K2_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K14746_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K427_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K32_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K6827_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K13107_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K27_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K16_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K205_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K853_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1048576_K524288_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K819_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K131072_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K256_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K22938_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27307_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K22938_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K65536_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27568_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K128_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1434_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K6554_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27568_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K512_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K262144_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K26214_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K54613_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR33.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K6827_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K8192_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N131072_K65536_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K26214_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K8_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K128_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1843_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K213_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K436907_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N65536_K32768_SNR15.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N256_K213_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N524288_K262144_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K13653_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8_K7_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K6554_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K205_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N64_K53_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K218453_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K16384_SNR18.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1024_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N512_K256_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K64_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1707_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N8192_K4096_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K29492_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1229_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32_K16_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K27307_SNR40.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K410_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1434_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K1707_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K819_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N2048_K410_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N128_K107_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K3277_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16_K8_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N4096_K2048_SNR33.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N32768_K9830_SNR25.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N1024_K853_SNR40.short.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N262144_K131072_SNR25.hpp>\n+//#include <Module/Decoder/Polar/SC/Generated/Decoder_polar_SC_fast_sys_N16384_K8192_SNR25.short.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_spc.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate0_left.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate1.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_standard.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_interface.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate0.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_rep.hpp>\n+#include <Module/Decoder/Polar/SC/Patterns/Pattern_SC_rep_left.hpp>\n+#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive_sys.hpp>\n+#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive.hpp>\n+#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA_sys.hpp>\n+#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.hpp>\n+#include <Module/Decoder/SPU_Decoder.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std_json.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic.hpp>\n+#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra.hpp>\n+#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_std.hpp>\n+#include <Module/Decoder/RSC/BCJR/Intra/Decoder_RSC_BCJR_intra_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_very_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_std.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter/Decoder_RSC_BCJR_inter_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Decoder_RSC_BCJR.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_very_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_fast.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_scan.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq.hpp>\n+#include <Module/Decoder/RSC/BCJR/Seq/Decoder_RSC_BCJR_seq_std.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x4_AVX.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_AVX.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra_fast_x2_SSE.hpp>\n+#include <Module/Decoder/RSC/BCJR/Inter_intra/Decoder_RSC_BCJR_inter_intra.hpp>\n+#include <Module/Decoder/SPU_SISO.hpp>\n+#include <Module/Decoder/SISO.hpp>\n+#include <Module/Decoder/Repetition/Decoder_repetition_fast.hpp>\n+#include <Module/Decoder/Repetition/Decoder_repetition_std.hpp>\n+#include <Module/Decoder/Repetition/Decoder_repetition.hpp>\n+#include <Module/Decoder/SC_SISO.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/ONMS/Decoder_LDPC_BP_layered_offset_normalize_min_sum.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.hpp>\n+#include <Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp>\n+#include <Module/Decoder/LDPC/BP/Flooding/Gallager/Decoder_LDPC_BP_flooding_Gallager_A.hpp>\n+#include <Module/Decoder/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/Decoder_LDPC_BP_flooding.hpp>\n+#include <Module/Decoder/Decoder_SISO.hpp>\n+#include <Module/Decoder/NO/Decoder_NO.hpp>\n+#include <Module/Decoder/RA/Decoder_RA.hpp>\n+#include <Module/Decoder/SC_Decoder.hpp>\n+#include <Module/Decoder/Turbo/Decoder_turbo_naive.hpp>\n+#include <Module/Decoder/Turbo/Decoder_turbo_fast.hpp>\n+#include <Module/Decoder/Turbo/Decoder_turbo.hpp>\n+#include <Module/Decoder/Turbo/CRC/Decoder_turbo_naive_CA.hpp>\n+#include <Module/Decoder/Turbo/CRC/Self_corrected/Decoder_turbo_naive_CA_self_corrected.hpp>\n+#include <Module/Decoder/Turbo/CRC/Decoder_turbo_fast_CA.hpp>\n+#include <Module/Coset/SPU_Coset.hpp>\n+#include <Module/Coset/Real/Coset_real.hpp>\n+#include <Module/Coset/Coset.hpp>\n+#include <Module/Coset/SC_Coset.hpp>\n+#include <Module/Coset/Bit/Coset_bit.hpp>\n+#include <Module/Source/SC_Source.hpp>\n+#include <Module/Source/Random/Source_random_fast.hpp>\n+#include <Module/Source/Random/Source_random.hpp>\n+#include <Module/Source/AZCW/Source_AZCW.hpp>\n+#include <Module/Source/SPU_Source.hpp>\n+#include <Module/Source/Source.hpp>\n+#include <Module/Source/User/Source_user.hpp>\n+#include <Module/Monitor/Standard/Monitor_reduction_mpi.hpp>\n+#include <Module/Monitor/Standard/Monitor_std.hpp>\n+#include <Module/Monitor/Standard/Monitor_reduction.hpp>\n+#include <Module/Monitor/Monitor.hpp>\n+#include <Module/Monitor/SC_Monitor.hpp>\n+#include <Module/Monitor/SPU_Monitor.hpp>\n+#include <Module/Quantizer/Fast/Quantizer_fast.hpp>\n+#include <Module/Quantizer/Standard/Quantizer_standard.hpp>\n+#include <Module/Quantizer/Quantizer.hpp>\n+#include <Module/Quantizer/SC_Quantizer.hpp>\n+#include <Module/Quantizer/Tricky/Quantizer_tricky.hpp>\n+#include <Module/Quantizer/SPU_Quantizer.hpp>\n+#include <Module/Quantizer/NO/Quantizer_NO.hpp>\n+#include <Module/CRC/SPU_CRC.hpp>\n+#include <Module/CRC/SC_CRC.hpp>\n+#include <Module/CRC/Polynomial/CRC_polynomial.hpp>\n+#include <Module/CRC/Polynomial/CRC_polynomial_double.hpp>\n+#include <Module/CRC/Polynomial/CRC_polynomial_inter.hpp>\n+#include <Module/CRC/NO/CRC_NO.hpp>\n+#include <Module/CRC/CRC.hpp>\n+#include <Module/Module.hpp>\n+#include <Launcher/EXIT/Polar/Launcher_EXIT_polar.hpp>\n+#include <Launcher/EXIT/RSC/Launcher_EXIT_RSC.hpp>\n+#include <Launcher/EXIT/Launcher_EXIT.hpp>\n+#include <Launcher/GEN/Polar/Launcher_GEN_polar.hpp>\n+#include <Launcher/GEN/Launcher_GEN.hpp>\n+#include <Launcher/BFER/Launcher_BFER.hpp>\n+#include <Launcher/BFER/Polar/Launcher_BFER_polar.hpp>\n+#include <Launcher/BFER/RSC/Launcher_BFER_RSC.hpp>\n+#include <Launcher/BFER/Repetition/Launcher_BFER_repetition.hpp>\n+#include <Launcher/BFER/LDPC/Launcher_BFER_LDPC.hpp>\n+#include <Launcher/BFER/Uncoded/Launcher_BFER_uncoded.hpp>\n+#include <Launcher/BFER/RA/Launcher_BFER_RA.hpp>\n+#include <Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp>\n+#include <Launcher/BFERI/Launcher_BFERI.hpp>\n+#include <Launcher/BFERI/RSC/Launcher_BFERI_RSC.hpp>\n+#include <Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.hpp>\n+#include <Launcher/BFERI/Uncoded/Launcher_BFERI_uncoded.hpp>\n+#include <Launcher/Launcher.hpp>\n+#include <Simulation/Simulation.hpp>\n+#include <Simulation/EXIT/Simulation_EXIT.hpp>\n+#include <Simulation/EXIT/Code/Polar/Simulation_EXIT_polar.hpp>\n+#include <Simulation/EXIT/Code/RSC/Simulation_EXIT_RSC.hpp>\n+#include <Simulation/GEN/Code/Polar/Generation_polar.hpp>\n+#include <Simulation/BFER/Standard/STD_Simulation_BFER.hpp>\n+#include <Simulation/BFER/Simulation_BFER.hpp>\n+#include <Simulation/BFER/StarPU/SPU_Simulation_BFER.hpp>\n+#include <Simulation/BFER/SystemC/SC_Simulation_BFER.hpp>\n+#include <Simulation/BFER/Code/Polar/Simulation_BFER_polar.hpp>\n+#include <Simulation/BFER/Code/RSC/Simulation_BFER_RSC.hpp>\n+#include <Simulation/BFER/Code/Repetition/Simulation_BFER_repetition.hpp>\n+#include <Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.hpp>\n+#include <Simulation/BFER/Code/Uncoded/Simulation_BFER_uncoded.hpp>\n+#include <Simulation/BFER/Code/RA/Simulation_BFER_RA.hpp>\n+#include <Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.hpp>\n+#include <Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp>\n+#include <Simulation/BFERI/SystemC/SC_Simulation_BFERI.hpp>\n+#include <Simulation/BFERI/Simulation_BFERI.hpp>\n+#include <Simulation/BFERI/Code/RSC/Simulation_BFERI_RSC.hpp>\n+#include <Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.hpp>\n+#include <Simulation/BFERI/Code/Uncoded/Simulation_BFERI_uncoded.hpp>\n+// #includrc/aff3ct.hpp>\n+#include <Generator/Polar/SC/Generator_polar_SC_sys.hpp>\n+#include <Generator/Generator.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad includes + add the 'aff3ct.hpp' header to include all aff3ct in one include call.
|
8,490 |
25.03.2017 13:37:26
| -3,600 |
44be773c117b7cadf88101dfc36ce9d02a729171
|
Replace assertions by exceptions (aff3ct::module::Coset).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "#include <sstream>\n#include <iostream>\n#include <algorithm>\n+#include <exception>\n#include <functional>\n#ifdef ENABLE_MPI\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Channel.hpp",
"new_path": "src/Module/Channel/Channel.hpp",
"diff": "@@ -46,6 +46,8 @@ public:\nChannel_i(const int N, const int n_frames = 1, const std::string name = \"Channel_i\")\n: Module(n_frames, name), N(N)\n{\n+ if (N <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Channel: \\\"N\\\" has to be greater than 0.\");\n}\n/*!\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/Bit/Coset_bit.cpp",
"new_path": "src/Module/Coset/Bit/Coset_bit.cpp",
"diff": "@@ -14,12 +14,8 @@ Coset_bit<B,D>::~Coset_bit()\n}\ntemplate <typename B, typename D>\n-void Coset_bit<B,D>::apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data)\n+void Coset_bit<B,D>::_apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data)\n{\n- assert(ref.size() == (unsigned)(this->size * this->n_frames));\n- assert(ref.size() == in_data.size());\n- assert(ref.size() == out_data.size());\n-\nfor (auto i = 0; i < (int)ref.size(); i++)\nout_data[i] = ref[i] ? !in_data[i] : in_data[i];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/Bit/Coset_bit.hpp",
"new_path": "src/Module/Coset/Bit/Coset_bit.hpp",
"diff": "@@ -20,7 +20,8 @@ public:\nvirtual ~Coset_bit();\n- virtual void apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data);\n+protected:\n+ virtual void _apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/Coset.hpp",
"new_path": "src/Module/Coset/Coset.hpp",
"diff": "#include <vector>\n#include <string>\n+#include <stdexcept>\n#include \"Tools/Perf/MIPP/mipp.h\"\n@@ -46,6 +47,8 @@ public:\nCoset_i(const int size, const int n_frames = 1, const std::string name = \"Coset_i\")\n: Module(n_frames, name), size(size)\n{\n+ if (size <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Coset: \\\"size\\\" has to be greater than 0.\");\n}\n/*!\n@@ -64,7 +67,26 @@ public:\n* \\param in_data: the input data to apply the coset on.\n* \\param out_data: the output data after the coset application.\n*/\n- virtual void apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data) = 0;\n+ void apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data)\n+ {\n+ if (ref.size() != in_data.size() || in_data.size() != out_data.size())\n+ throw std::length_error(\"aff3ct::module::Coset: \\\"ref.size()\\\" has to be equal to \\\"in_data.size()\\\" and \"\n+ \"\\\"out_data.size()\\\".\");\n+ if (this->size * this->n_frames != (int)ref.size())\n+ throw std::length_error(\"aff3ct::module::Coset: \\\"ref.size()\\\" has to be equal to \"\n+ \"\\\"size\\\" * \\\"n_frames\\\".\");\n+ if (this->size * this->n_frames != (int)in_data.size())\n+ throw std::length_error(\"aff3ct::module::Coset: \\\"in_data.size()\\\" has to be equal to \"\n+ \"\\\"size\\\" * \\\"n_frames\\\".\");\n+ if (this->size * this->n_frames != (int)out_data.size())\n+ throw std::length_error(\"aff3ct::module::Coset: \\\"out_data.size()\\\" has to be equal to \"\n+ \"\\\"size\\\" * \\\"n_frames\\\".\");\n+\n+ _apply(ref, in_data, out_data);\n+ }\n+\n+protected:\n+ virtual void _apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data) = 0;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/Real/Coset_real.cpp",
"new_path": "src/Module/Coset/Real/Coset_real.cpp",
"diff": "@@ -14,12 +14,8 @@ Coset_real<B,D>::~Coset_real()\n}\ntemplate <typename B, typename D>\n-void Coset_real<B,D>::apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data)\n+void Coset_real<B,D>::_apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data)\n{\n- assert(ref.size() == (unsigned)(this->size * this->n_frames));\n- assert(ref.size() == in_data.size());\n- assert(ref.size() == out_data.size());\n-\nfor (auto i = 0; i < (int)ref.size(); i++)\nout_data[i] = ref[i] ? -in_data[i] : in_data[i];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/Real/Coset_real.hpp",
"new_path": "src/Module/Coset/Real/Coset_real.hpp",
"diff": "@@ -20,7 +20,8 @@ public:\nvirtual ~Coset_real();\n- virtual void apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data);\n+protected:\n+ virtual void _apply(const mipp::vector<B>& ref, const mipp::vector<D> &in_data, mipp::vector<D> &out_data);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module::Coset).
|
8,490 |
25.03.2017 14:54:11
| -3,600 |
6e29c896c4465ac1b5b3e917ce23e156c1027c3d
|
Replace assertions by exceptions (aff3ct::module::CRC).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/CRC.hpp",
"new_path": "src/Module/CRC/CRC.hpp",
"diff": "#include <string>\n#include <vector>\n+#include <stdexcept>\n+\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -44,6 +46,8 @@ public:\nCRC_i(const int K, const int n_frames = 1, const std::string name = \"CRC_i\")\n: Module(n_frames, name), K(K)\n{\n+ if (K <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::CRC: \\\"K\\\" has to be greater than 0.\");\n}\n/*!\n@@ -78,7 +82,21 @@ public:\n*\n* \\return true if the CRC is verified, false otherwise.\n*/\n- virtual bool check(const mipp::vector<B>& V_K, const int n_frames = -1) = 0;\n+ bool check(const mipp::vector<B>& V_K, const int n_frames = -1)\n+ {\n+ if (this->K * n_frames > (int)V_K.size() || this->K * this->n_frames > (int)V_K.size())\n+ throw std::length_error(\"aff3ct::module::CRC: \\\"V_K.size()\\\" has to be equal or greater than \"\n+ \"\\\"K\\\" * \\\"n_frames\\\".\");\n+\n+ if (n_frames <= 0 && n_frames != -1)\n+ throw std::invalid_argument(\"aff3ct::module::CRC: \\\"n_frames\\\" has to be greater than 0 (or equal \"\n+ \"to -1).\");\n+\n+ return this->_check(V_K, n_frames);\n+ }\n+\n+protected:\n+ virtual bool _check(const mipp::vector<B>& V_K, const int n_frames = -1) = 0;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/NO/CRC_NO.cpp",
"new_path": "src/Module/CRC/NO/CRC_NO.cpp",
"diff": "@@ -30,7 +30,7 @@ void CRC_NO<B>\ntemplate <typename B>\nbool CRC_NO<B>\n-::check(const mipp::vector<B>& V_K, const int n_frames)\n+::_check(const mipp::vector<B>& V_K, const int n_frames)\n{\nreturn false;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/NO/CRC_NO.hpp",
"new_path": "src/Module/CRC/NO/CRC_NO.hpp",
"diff": "@@ -16,7 +16,9 @@ public:\nint size ( ) const;\nvoid build(mipp::vector<B>& U_K);\n- bool check(const mipp::vector<B>& V_K, const int n_frames = -1);\n+\n+protected:\n+ bool _check(const mipp::vector<B>& V_K, const int n_frames = -1);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial.cpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial.cpp",
"diff": "-#include <cassert>\n+#include <stdexcept>\n#include \"Tools/Display/bash_tools.h\"\n@@ -52,8 +52,13 @@ template <typename B>\nvoid CRC_polynomial<B>\n::build(mipp::vector<B>& U_K)\n{\n- assert(U_K.size() > (unsigned)(this->n_frames * this->size()));\n- assert(U_K.size() == (unsigned)(this->n_frames * this->K));\n+ if (U_K.size() <= (unsigned)(this->n_frames * this->size()))\n+ throw std::length_error(\"aff3ct::module::CRC_polynomial: \\\"U_K.size()\\\" has to be greater \"\n+ \"than \\\"n_frames\\\" * \\\"size\\\".\");\n+\n+ if (U_K.size() != (unsigned)(this->n_frames * this->K))\n+ throw std::length_error(\"aff3ct::module::CRC_polynomial: \\\"U_K.size()\\\" has to be equal \"\n+ \"to \\\"n_frames\\\" * \\\"K\\\".\");\nfor (auto f = 0; f < this->n_frames; f++)\nthis->_generate(U_K, U_K,\n@@ -84,10 +89,9 @@ void CRC_polynomial<B>\ntemplate <typename B>\nbool CRC_polynomial<B>\n-::check(const mipp::vector<B>& V_K, const int n_frames)\n+::_check(const mipp::vector<B>& V_K, const int n_frames)\n{\nconst int real_n_frames = (n_frames != -1) ? n_frames : this->n_frames;\n- assert(V_K.size() > (unsigned)(real_n_frames * this->size()));\nauto real_frame_size = (int)(V_K.size() / real_n_frames);\nauto i = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial.hpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial.hpp",
"diff": "@@ -25,9 +25,10 @@ public:\nstatic int size (std::string poly_key);\nvirtual int size ( ) const;\nvirtual void build(mipp::vector<B>& U_K);\n- virtual bool check(const mipp::vector<B>& V_K, const int n_frames = -1);\nprotected:\n+ virtual bool _check(const mipp::vector<B>& V_K, const int n_frames = -1);\n+\nvoid _generate(const mipp::vector<B>& U_in,\nmipp::vector<B>& U_out,\nconst int off_in,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial_double.cpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial_double.cpp",
"diff": "-#include <cassert>\n+#include <stdexcept>\n#include \"Tools/Display/bash_tools.h\"\n@@ -12,16 +12,24 @@ CRC_polynomial_double<B>\nconst std::string name)\n: CRC_polynomial<B>(K, poly_key, n_frames, name), cut_index(cut_index)\n{\n- assert(n_frames == 1);\n- assert((this->K - 2 * this->size()) > (cut_index - this->size()));\n+ if (n_frames > 1)\n+ throw std::invalid_argument(\"aff3ct::module::CRC_polynomial_double: \\\"n_frames\\\" has to be equal to 1.\");\n+\n+ if ((this->K - 2 * this->size()) <= (cut_index - this->size()))\n+ throw std::invalid_argument(\"aff3ct::module::CRC_polynomial_double: \\\"K\\\" is wrong.\");\n}\ntemplate <typename B>\nvoid CRC_polynomial_double<B>\n::build(mipp::vector<B>& U_K)\n{\n- assert(U_K.size() > (unsigned)(2 * this->size()));\n- assert(U_K.size() == (unsigned)this->K);\n+ if (U_K.size() <= (unsigned)(2 * this->size()))\n+ throw std::length_error(\"aff3ct::module::CRC_polynomial_double: \\\"U_K.size()\\\" has to be greater \"\n+ \"than 2 * \\\"size\\\".\");\n+\n+ if (U_K.size() != (unsigned)(this->n_frames * this->K))\n+ throw std::length_error(\"aff3ct::module::CRC_polynomial_double: \\\"U_K.size()\\\" has to be equal \"\n+ \"to \\\"n_frames\\\" * \\\"K\\\".\");\nfor (unsigned i = unsigned(U_K.size() - 2 * this->size() -1); i >= (unsigned)cut_index - this->size(); i--)\nU_K[i + this->size()] = U_K[i];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial_inter.cpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial_inter.cpp",
"diff": "#include <cassert>\n+#include <stdexcept>\n#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n@@ -12,15 +13,18 @@ CRC_polynomial_inter<B>\n::CRC_polynomial_inter(const int K, std::string poly_key, const int n_frames, const std::string name)\n: CRC_polynomial<B>(K, poly_key, n_frames, name)\n{\n- assert(mipp::nElmtsPerRegister<B>() == n_frames);\n+ if (mipp::nElReg<B>() != n_frames)\n+ throw std::invalid_argument(\"aff3ct::module::CRC_polynomial_inter: \\\"n_frames\\\" has to be equal to \"\n+ \"\\\"mipp::nElReg<B>()\\\".\");\n}\ntemplate <typename B>\nbool CRC_polynomial_inter<B>\n-::check(const mipp::vector<B>& V_K, const int n_frames)\n+::_check(const mipp::vector<B>& V_K, const int n_frames)\n{\n- assert(n_frames == -1 || n_frames == this->n_frames);\n- assert(V_K.size() > (unsigned)(this->n_frames * this->size()));\n+ if (n_frames != -1 && n_frames != this->n_frames)\n+ throw std::invalid_argument(\"aff3ct::module::CRC_polynomial_inter: \\\"n_frames\\\" has to be equal to \"\n+ \"\\\"this->n_frames\\\".\");\nauto real_frame_size = int(V_K.size() / this->n_frames);\nthis->_generate_INTER(V_K, this->buff_crc,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/Polynomial/CRC_polynomial_inter.hpp",
"new_path": "src/Module/CRC/Polynomial/CRC_polynomial_inter.hpp",
"diff": "@@ -17,9 +17,9 @@ public:\nconst std::string name = \"CRC_polynomial_inter\");\nvirtual ~CRC_polynomial_inter(){};\n- virtual bool check(const mipp::vector<B>& V_K, const int n_frames = -1);\n-\nprotected:\n+ virtual bool _check(const mipp::vector<B>& V_K, const int n_frames = -1);\n+\nvoid _generate_INTER(const mipp::vector<B>& U_in,\nmipp::vector<B>& U_out,\nconst int off_in,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Coset/Coset.hpp",
"new_path": "src/Module/Coset/Coset.hpp",
"diff": "@@ -82,7 +82,7 @@ public:\nthrow std::length_error(\"aff3ct::module::Coset: \\\"out_data.size()\\\" has to be equal to \"\n\"\\\"size\\\" * \\\"n_frames\\\".\");\n- _apply(ref, in_data, out_data);\n+ this->_apply(ref, in_data, out_data);\n}\nprotected:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module::CRC).
|
8,490 |
26.03.2017 10:35:29
| -7,200 |
ffde986c8e39d7557cdb0ee368d28aeacae8417e
|
Replace assertions by exceptions (aff3ct::module::Interleaver).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder.hpp",
"new_path": "src/Module/Decoder/Decoder.hpp",
"diff": "@@ -75,8 +75,6 @@ public:\nthrow std::invalid_argument(\"aff3ct::module::Decoder: \\\"K\\\" has to be greater than 0.\");\nif (N <= 0)\nthrow std::invalid_argument(\"aff3ct::module::Decoder: \\\"N\\\" has to be greater than 0.\");\n- if (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Decoder: \\\"n_frames\\\" has to be greater than 0.\");\nif (simd_inter_frame_level <= 0)\nthrow std::invalid_argument(\"aff3ct::module::Decoder: \\\"simd_inter_frame_level\\\" has to be greater \"\n\"than 0.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/SISO.hpp",
"new_path": "src/Module/Decoder/SISO.hpp",
"diff": "@@ -67,8 +67,6 @@ public:\nthrow std::invalid_argument(\"aff3ct::module::SISO: \\\"K\\\" has to be greater than 0.\");\nif (N <= 0)\nthrow std::invalid_argument(\"aff3ct::module::SISO: \\\"N\\\" has to be greater than 0.\");\n- if (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::module::SISO: \\\"n_frames\\\" has to be greater than 0.\");\nif (simd_inter_frame_level <= 0)\nthrow std::invalid_argument(\"aff3ct::module::SISO: \\\"simd_inter_frame_level\\\" has to be greater than 0.\");\nif (K > N)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/Encoder.hpp",
"new_path": "src/Module/Encoder/Encoder.hpp",
"diff": "@@ -52,8 +52,6 @@ public:\nthrow std::invalid_argument(\"aff3ct::module::Encoder: \\\"K\\\" has to be greater than 0.\");\nif (N <= 0)\nthrow std::invalid_argument(\"aff3ct::module::Encoder: \\\"N\\\" has to be greater than 0.\");\n- if (n_frames <= 0)\n- throw std::invalid_argument(\"aff3ct::module::Encoder: \\\"n_frames\\\" has to be greater than 0.\");\nif (K > N)\nthrow std::invalid_argument(\"aff3ct::module::Encoder: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/User/Encoder_user.cpp",
"new_path": "src/Module/Encoder/User/Encoder_user.cpp",
"diff": "@@ -49,10 +49,10 @@ Encoder_user<B>\n{\nfile.close();\n- std::string mess = \"aff3ct::module::Encoder_user: the number of information bits or the codeword size \"\n- \"is wrong (read: {\" + std::to_string(src_size) + \",\" + std::to_string(cw_size) + \"}\"\n- \", expected: {\" + std::to_string(this->K) + \",\" + std::to_string(this->N) + \"}).\";\n- throw std::runtime_error(mess.c_str());\n+ throw std::runtime_error(\"aff3ct::module::Encoder_user: the number of information bits or the codeword \"\n+ \"size is wrong (read: {\" + std::to_string(src_size) + \",\" +\n+ std::to_string(cw_size) + \"}, expected: {\" + std::to_string(this->K) + \",\" +\n+ std::to_string(this->N) + \"}).\");\n}\nfile.close();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp",
"new_path": "src/Module/Interleaver/CCSDS/Interleaver_CCSDS.hpp",
"diff": "#ifndef INTERLEAVER_CCSDS_HPP\n#define INTERLEAVER_CCSDS_HPP\n+#include <stdexcept>\n#include <map>\n#include \"Tools/Display/bash_tools.h\"\n@@ -50,11 +51,9 @@ public:\n}\nelse\n{\n- std::cerr << tools::bold_red(\"(EE) There is no CCSDS k_1 and k_2 parameters for size = \")\n- << tools::bold_red(std::to_string(size))\n- << tools::bold_red(\" (supported size are K = {1784, 3568, 7136, 8920}. Exiting simulation.\")\n- << std::endl;\n- exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Interleaver_CCSDS: there is no CCSDS k_1 and k_2 parameters \"\n+ \"for \\\"size\\\" = \" + std::to_string(size) + \"(supported size are K = {1784, 3568, \"\n+ \"7136, 8920}.\");\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Interleaver.hpp",
"new_path": "src/Module/Interleaver/Interleaver.hpp",
"diff": "#ifndef INTERLEAVER_HPP_\n#define INTERLEAVER_HPP_\n+#include <stdexcept>\n#include <typeinfo>\n#include <string>\n-#include <cassert>\n#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n@@ -47,6 +47,8 @@ public:\nInterleaver_i(const int size, const int n_frames = 1, const std::string name = \"Interleaver_i\")\n: Module(n_frames, name), pi(size), pi_inv(size)\n{\n+ if (size <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Interleaver: \\\"size\\\" has to be greater than 0.\");\n}\n/*!\n@@ -165,11 +167,20 @@ private:\nconst bool frame_reordering = false,\nconst int n_frames = -1) const\n{\n- assert(n_frames == -1 || n_frames > 0);\n+ if (n_frames != -1 && n_frames <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Interleaver: \\\"n_frames\\\" has to be greater than 0 \"\n+ \"(or equal to -1).\");\n+\nconst int real_n_frames = (n_frames != -1) ? n_frames : this->n_frames;\n- assert(in_vec.size() == out_vec.size());\n- assert(in_vec.size() >= lookup_table.size() * real_n_frames);\n+ if (in_vec.size() != out_vec.size())\n+ throw std::length_error(\"aff3ct::module::Interleaver: \\\"in_vec.size()\\\" has to be equal to \"\n+ \"\\\"out_vec.size()\\\".\");\n+\n+ if (in_vec.size() < lookup_table.size() * real_n_frames)\n+ throw std::length_error(\"aff3ct::module::Interleaver: \\\"in_vec.size()\\\" has to be equal or greater than \"\n+ \"\\\"lookup_table.size()\\\" * \\\"real_n_frames\\\".\");\n+\nconst auto frame_size = (int)lookup_table.size();\nif (frame_reordering)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/LTE/Interleaver_LTE.hpp",
"new_path": "src/Module/Interleaver/LTE/Interleaver_LTE.hpp",
"diff": "#ifndef INTERLEAVER_LTE_HPP\n#define INTERLEAVER_LTE_HPP\n+#include <stdexcept>\n#include <map>\n#include \"Tools/Display/bash_tools.h\"\n@@ -234,10 +235,8 @@ public:\n}\nelse\n{\n- std::cerr << tools::bold_red(\"(EE) There is no LTE f_1 and f_2 parameters for size = \")\n- << tools::bold_red(std::to_string(size))\n- << tools::bold_red(\": exiting simulation.\") << std::endl;\n- exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Interleaver_LTE: there is no LTE f_1 and f_2 parameters \"\n+ \"for \\\"size\\\" = \" + std::to_string(size) + \".\");\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Random_column/Interleaver_random_column.hpp",
"new_path": "src/Module/Interleaver/Random_column/Interleaver_random_column.hpp",
"diff": "#ifndef INTERLEAVER_RANDOM_COLUMN_HPP\n#define INTERLEAVER_RANDOM_COLUMN_HPP\n+#include <stdexcept>\n#include <algorithm>\n#include <time.h>\n#include <random>\n@@ -26,7 +27,10 @@ public:\nconst std::string name = \"Interleaver_random_column\")\n: Interleaver<T>(size, 1, name), rd(), rd_engine(rd()), n_cols(n_cols), col_size(size / n_cols)\n{\n- assert(col_size * n_cols == size);\n+ if (col_size * n_cols != size)\n+ throw std::invalid_argument(\"aff3ct::module::Interleaver_random_column: \\\"size\\\" has to be equal to \"\n+ \"\\\"n_cols\\\" * \\\"col_size\\\".\");\n+\nrd_engine.seed(seed);\ngen_lookup_tables();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Row_column/Interleaver_row_column.hpp",
"new_path": "src/Module/Interleaver/Row_column/Interleaver_row_column.hpp",
"diff": "#ifndef INTERLEAVER_ROW_COLUMN_HPP\n#define INTERLEAVER_ROW_COLUMN_HPP\n+#include <stdexcept>\n#include <algorithm>\n#include <time.h>\n#include <random>\n@@ -24,7 +25,10 @@ public:\nInterleaver_row_column(const int size, const int n_cols, const std::string name = \"Interleaver_row_column\")\n: Interleaver<T>(size, 1, name), n_cols(n_cols), n_rows(size / n_cols)\n{\n- assert(n_rows * n_cols == size);\n+ if (n_rows * n_cols != size)\n+ throw std::invalid_argument(\"aff3ct::module::Interleaver_row_column: \\\"size\\\" has to be equal to \"\n+ \"\\\"n_rows\\\" * \\\"n_cols\\\".\");\n+\ngen_lookup_tables();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"new_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"diff": "#ifndef INTERLEAVER_USER_HPP\n#define INTERLEAVER_USER_HPP\n+#include <stdexcept>\n#include <fstream>\n#include \"Tools/Display/bash_tools.h\"\n@@ -59,24 +60,20 @@ public:\nthis->pi[i] = (T)val;\nelse\n{\n- std::cerr << tools::bold_red(\"(EE) The interleaver value is wrong, it already\")\n- << tools::bold_red(\" exists elsewhere (read: \")\n- << tools::bold_red(std::to_string(val))\n- << tools::bold_red(\"), exiting.\")\n- << std::endl;\nfile.close();\n- std::exit(-1);\n+\n+ throw std::runtime_error(\"aff3ct::module::Interleaver_user: the interleaver value is \"\n+ \"wrong, it already exists elsewhere (read: \" +\n+ std::to_string(val) + \").\");\n}\n}\nelse\n{\n- std::cerr << tools::bold_red(\"(EE) The interleaver value is wrong (read: \")\n- << tools::bold_red(std::to_string(val)) << tools::bold_red(\", expected: < \")\n- << tools::bold_red(std::to_string(this->pi.size()))\n- << tools::bold_red(\"), exiting.\")\n- << std::endl;\nfile.close();\n- std::exit(-1);\n+\n+ throw std::runtime_error(\"aff3ct::module::Interleaver_user: the interleaver value is \"\n+ \"wrong (read: \" + std::to_string(val) + \", expected: < \" +\n+ std::to_string(this->pi.size()) + \").\");\n}\n}\n@@ -85,23 +82,18 @@ public:\n}\nelse\n{\n- std::cerr << tools::bold_red(\"(EE) The interleaver size is wrong (read: \")\n- << tools::bold_red(std::to_string(val))\n- << tools::bold_red(\", expected: \") << tools::bold_red(std::to_string(this->pi.size()))\n- << tools::bold_red(\"), exiting.\") << std::endl;\nfile.close();\n- std::exit(-1);\n+\n+ throw std::runtime_error(\"aff3ct::module::Interleaver_user: the interleaver value is \"\n+ \"wrong (read: \" + std::to_string(val) + \", expected: \" +\n+ std::to_string(this->pi.size()) + \").\");\n}\nfile.close();\n}\nelse\n{\n- std::cerr << tools::bold_red(\"(EE) Can't open \\\"\")\n- << tools::bold_red(filename)\n- << tools::bold_red(\"\\\" file, exiting.\")\n- << std::endl;\n- std::exit(-1);\n+ throw std::invalid_argument(\"aff3ct::module::Interleaver_user: can't open \\\"\" + filename + \"\\\" file.\");\n}\n}\n};\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module::Interleaver).
|
8,490 |
26.03.2017 12:48:21
| -7,200 |
8609b1a9a83b26dce05f59600b242e3060f45053
|
Replace assertions by exceptions (aff3ct::module::Monitor).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Monitor.hpp",
"new_path": "src/Module/Monitor/Monitor.hpp",
"diff": "#ifndef MONITOR_HPP_\n#define MONITOR_HPP_\n+#include <stdexcept>\n#include <csignal>\n#include <chrono>\n#include <vector>\n@@ -57,6 +58,13 @@ public:\nMonitor_i(const int& K, const int& N, const int& n_frames = 1, const std::string name = \"Monitor_i\")\n: Module(n_frames, name), K(K), N(N)\n{\n+ if (K <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Monitor: \\\"K\\\" has to be greater than 0.\");\n+ if (N <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Monitor: \\\"N\\\" has to be greater than 0.\");\n+ if (K > N)\n+ throw std::invalid_argument(\"aff3ct::module::Monitor: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n+\nMonitor_i<B,R>::interrupt = false;\nMonitor_i<B,R>::d_delta_interrupt = std::chrono::nanoseconds(0);\n@@ -150,7 +158,13 @@ public:\n* \\param U: the original message (from the Source or the CRC).\n* \\param V: the decoded message (from the Decoder).\n*/\n- virtual void check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V) = 0;\n+ void check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V)\n+ {\n+ if (U.size() != V.size())\n+ throw std::length_error(\"aff3ct::module::Monitor: \\\"U.size()\\\" has to be equal to \\\"V.size()\\\".\");\n+\n+ this->_check_errors(U, V);\n+ }\n/*!\n* \\brief Tells if the user asked for stopping the current computations.\n@@ -188,13 +202,16 @@ public:\n* \\param X_mod: the modulated message (from the Modulator, the input of the Channel).\n* \\param Y: the noised message (the output of the Channel).\n*/\n- virtual void check_and_track_errors(const mipp::vector<B>& U,\n+ void check_and_track_errors(const mipp::vector<B>& U,\nconst mipp::vector<B>& V,\nconst mipp::vector<B>& X,\nconst mipp::vector<R>& X_mod,\nconst mipp::vector<R>& Y)\n{\n- check_errors(U, V);\n+ if (U.size() != V.size())\n+ throw std::length_error(\"aff3ct::module::Monitor: \\\"U.size()\\\" has to be equal to \\\"V.size()\\\".\");\n+\n+ this->_check_and_track_errors(U, V, X, X_mod, Y);\n}\n/*!\n@@ -237,6 +254,18 @@ public:\nreturn std::vector<mipp::vector<R>>(0);\n}\n+protected:\n+ virtual void _check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V) = 0;\n+\n+ virtual void _check_and_track_errors(const mipp::vector<B>& U,\n+ const mipp::vector<B>& V,\n+ const mipp::vector<B>& X,\n+ const mipp::vector<R>& X_mod,\n+ const mipp::vector<R>& Y)\n+ {\n+ this->_check_errors(U, V);\n+ }\n+\nprivate:\nstatic void signal_interrupt_handler(int signal)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"diff": "@@ -18,9 +18,12 @@ Monitor_reduction<B,R>\n: Monitor_std<B,R>(K, N, max_fe, n_frames, name),\nmonitors (monitors )\n{\n- assert(monitors.size() != 0);\n+ if (monitors.size() == 0)\n+ throw std::length_error(\"aff3ct::module::Monitor_reduction: \\\"monitors.size()\\\" has to be greater than 0.\");\n+\nfor (size_t i = 0; i < monitors.size(); ++i)\n- assert(monitors[i] != nullptr);\n+ if (monitors[i] == nullptr)\n+ throw std::logic_error(\"aff3ct::module::Monitor_reduction: \\\"monitors[i]\\\" can't be null.\");\n}\ntemplate <typename B, typename R>\n@@ -127,7 +130,9 @@ void Monitor_reduction<B,R>\n// write encoder\nauto buff_enc = mon->get_buff_enc();\n- assert(buff_src.size() == buff_enc.size());\n+ if (buff_src.size() != buff_enc.size())\n+ throw std::length_error(\"aff3ct::module::Monitor_reduction: \\\"buff_src.size()\\\" has to be equal to \"\n+ \"\\\"buff_enc.size()\\\".\");\nfor (unsigned f = 0; f < buff_enc.size(); f++)\n{\nfor (unsigned b = 0; b < buff_enc[f].size(); b++)\n@@ -138,7 +143,9 @@ void Monitor_reduction<B,R>\n// write noise\nauto buff_noise = mon->get_buff_noise();\n- assert(buff_src.size() == buff_noise.size());\n+ if (buff_src.size() != buff_noise.size())\n+ throw std::length_error(\"aff3ct::module::Monitor_reduction: \\\"buff_src.size()\\\" has to be equal to \"\n+ \"\\\"buff_noise.size()\\\".\");\nfor (unsigned f = 0; f < buff_noise.size(); f++)\nfile_noise.write(reinterpret_cast<char*>(&buff_noise[f][0]), buff_noise[f].size()*sizeof(R));\n}\n@@ -155,7 +162,9 @@ void Monitor_reduction<B,R>\nstd::exit(-1);\n}\n- assert(this->get_N() == (int)itl_pi.size());\n+ if (this->get_N() != (int)itl_pi.size())\n+ throw std::length_error(\"aff3ct::module::Monitor_reduction: \\\"itl_pi.size()\\\" has to be equal to \\\"N\\\".\");\n+\nfile_itl << itl_pi.size() << std::endl << std::endl; // write length of coded frames\nfor (unsigned b = 0; b < itl_pi.size(); b++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_std.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_std.cpp",
"diff": "#include <string>\n#include <vector>\n-#include <cassert>\n+#include <stdexcept>\n#include \"Tools/Display/bash_tools.h\"\n@@ -18,7 +18,6 @@ Monitor_std<B,R>\nn_frame_errors(0),\nn_analyzed_frames(0)\n{\n- assert(n_frames > 0);\n}\ntemplate <typename B, typename R>\n@@ -37,21 +36,25 @@ void Monitor_std<B,R>\ntemplate <typename B, typename R>\nvoid Monitor_std<B,R>\n-::check_and_track_errors(const mipp::vector<B>& U,\n+::_check_and_track_errors(const mipp::vector<B>& U,\nconst mipp::vector<B>& V,\nconst mipp::vector<B>& X,\nconst mipp::vector<R>& X_mod,\nconst mipp::vector<R>& Y)\n{\n- assert(this->K * this->n_frames == (int)U .size());\n- assert(this->K * this->n_frames == (int)V .size());\n- assert(this->N * this->n_frames == (int)X .size());\n- assert(Y.size() == X_mod.size());\n+ if (this->K * this->n_frames != (int)U.size())\n+ throw std::length_error(\"aff3ct::module::Monitor_std: \\\"U.size()\\\" has to be equal to \\\"K\\\" * \\\"n_frames\\\".\");\n+ if (this->K * this->n_frames != (int)V.size())\n+ throw std::length_error(\"aff3ct::module::Monitor_std: \\\"V.size()\\\" has to be equal to \\\"K\\\" * \\\"n_frames\\\".\");\n+ if (this->N * this->n_frames != (int)X.size())\n+ throw std::length_error(\"aff3ct::module::Monitor_std: \\\"X.size()\\\" has to be equal to \\\"N\\\" * \\\"n_frames\\\".\");\n+ if (Y.size() != X_mod.size())\n+ throw std::length_error(\"aff3ct::module::Monitor_std: \\\"X_mod.size()\\\" and \\\"Y.size()\\\" have to be equal.\");\nconst int Y_size = (int)X_mod.size() / this->n_frames;\nfor (auto i = 0; i < this->n_frames; i++)\n- if (check_errors(U.data() + i * this->K, V.data() + i * this->K, this->K))\n+ if (__check_errors(U.data() + i * this->K, V.data() + i * this->K, this->K))\ncopy_bad_frame(U .data() + i * this->K,\nX .data() + i * this->N,\nX_mod.data() + i * Y_size,\n@@ -61,9 +64,21 @@ void Monitor_std<B,R>\nthis->update_n_analyzed_frames();\n}\n+template <typename B, typename R>\n+void Monitor_std<B,R>\n+::_check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V)\n+{\n+ auto n = (int)U.size() / this->n_frames;\n+\n+ for (auto i = 0; i < this->n_frames; i++)\n+ __check_errors(U.data() + i * n, V.data() + i * n, n);\n+\n+ this->update_n_analyzed_frames();\n+}\n+\ntemplate <typename B, typename R>\nbool Monitor_std<B,R>\n-::check_errors(const B* U, const B* V, const int length)\n+::__check_errors(const B* U, const B* V, const int length)\n{\nauto bit_errors_count = 0;\nfor (auto b = 0; b < length; b++)\n@@ -80,19 +95,6 @@ bool Monitor_std<B,R>\nreturn false;\n}\n-template <typename B, typename R>\n-void Monitor_std<B,R>\n-::check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V)\n-{\n- assert(U.size() == V.size());\n- auto n = (int)U.size() / this->n_frames;\n-\n- for (auto i = 0; i < this->n_frames; i++)\n- check_errors(U.data() + i * n, V.data() + i * n, n);\n-\n- this->update_n_analyzed_frames();\n-}\n-\ntemplate <typename B, typename R>\nunsigned Monitor_std<B,R>\n::get_fe_limit() const\n@@ -159,11 +161,8 @@ template <typename B, typename R>\nvoid Monitor_std<B,R>\n::dump_bad_frames(const std::string& base_path, const float snr, mipp::vector<int> itl_pi)\n{\n- std::cerr << bold_red(\"\\\"dump_bad_frames\\\" is not defined in \\\"Monitor_std\\\", please call this method on \")\n- << bold_red(\"\\\"Monitor_reduction\\\" instead.\")\n- << std::endl;\n-\n- std::exit(-1);\n+ throw std::runtime_error(\"aff3ct::module::Monitor_std: \\\"dump_bad_frames\\\" is not defined in \\\"Monitor_std\\\" \"\n+ \"class, please call this method on \\\"Monitor_reduction\\\" instead.\");\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_std.hpp",
"new_path": "src/Module/Monitor/Standard/Monitor_std.hpp",
"diff": "@@ -31,14 +31,6 @@ public:\nconst std::string name = \"Monitor_std\");\nvirtual ~Monitor_std(){};\n- virtual void check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V);\n-\n- virtual void check_and_track_errors(const mipp::vector<B>& U,\n- const mipp::vector<B>& V,\n- const mipp::vector<B>& X,\n- const mipp::vector<R>& X_mod,\n- const mipp::vector<R>& Y);\n-\nvirtual bool fe_limit_achieved();\nunsigned get_fe_limit() const;\n@@ -55,10 +47,19 @@ public:\nconst std::vector<mipp::vector<B>> get_buff_enc () const;\nconst std::vector<mipp::vector<R>> get_buff_noise() const;\n+protected:\n+ virtual void _check_errors(const mipp::vector<B>& U, const mipp::vector<B>& V);\n+\n+ virtual void _check_and_track_errors(const mipp::vector<B>& U,\n+ const mipp::vector<B>& V,\n+ const mipp::vector<B>& X,\n+ const mipp::vector<R>& X_mod,\n+ const mipp::vector<R>& Y);\n+\nprivate:\nvoid update_n_analyzed_frames();\nvoid copy_bad_frame(const B* U, const B* X, const R* X_mod, const R* Y, const int Y_size);\n- inline bool check_errors(const B* U, const B* V, const int length);\n+ inline bool __check_errors(const B* U, const B* V, const int length);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module::Monitor).
|
8,490 |
26.03.2017 13:56:51
| -7,200 |
57af0d7084633356f1f871865bcff120c8ee2145
|
Replace assertions by exceptions (aff3ct::module::Puncturer).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/NO/Puncturer_NO.cpp",
"new_path": "src/Module/Puncturer/NO/Puncturer_NO.cpp",
"diff": "+#include <stdexcept>\n+\n#include \"Puncturer_NO.hpp\"\nusing namespace aff3ct::module;\n@@ -17,18 +19,20 @@ Puncturer_NO<B,Q>\ntemplate <typename B, typename Q>\nvoid Puncturer_NO<B,Q>\n-::puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const\n+::_puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const\n{\n- assert(X_N1.size() == X_N2.size());\n+ if (X_N1.size() != X_N2.size())\n+ throw std::length_error(\"aff3ct::module::Puncturer_NO: \\\"X_N1.size()\\\" has to be equal to \\\"X_N2.size()\\\".\");\nX_N2 = X_N1;\n}\ntemplate <typename B, typename Q>\nvoid Puncturer_NO<B,Q>\n-::depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const\n+::_depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const\n{\n- assert(Y_N1.size() == Y_N2.size());\n+ if (Y_N1.size() != Y_N2.size())\n+ throw std::length_error(\"aff3ct::module::Puncturer_NO: \\\"Y_N1.size()\\\" has to be equal to \\\"Y_N2.size()\\\".\");\nY_N2 = Y_N1;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/NO/Puncturer_NO.hpp",
"new_path": "src/Module/Puncturer/NO/Puncturer_NO.hpp",
"diff": "@@ -17,8 +17,9 @@ public:\nPuncturer_NO(const int K, const int N, const int n_frames = 1, const std::string name = \"Puncturer_NO\");\nvirtual ~Puncturer_NO();\n- virtual void puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const;\n- virtual void depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const;\n+protected:\n+ void _puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const;\n+ void _depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.cpp",
"new_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.cpp",
"diff": "@@ -50,22 +50,16 @@ void Puncturer_polar_wangliu<B,Q>\ntemplate <typename B, typename Q>\nvoid Puncturer_polar_wangliu<B,Q>\n-::puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const\n+::_puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const\n{\n- assert(X_N1.size() == (unsigned) (this->N_code * this->n_frames));\n- assert(X_N2.size() == (unsigned) (this->N * this->n_frames));\n-\nfor (auto f = 0; f < this->n_frames; f++)\nstd::copy(X_N1.begin() + f * this->N_code, X_N1.begin() + f * this->N_code + this->N, X_N2.begin() + f * this->N);\n}\ntemplate <typename B, typename Q>\nvoid Puncturer_polar_wangliu<B,Q>\n-::depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const\n+::_depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const\n{\n- assert(Y_N1.size() == (unsigned) (this->N * this->n_frames));\n- assert(Y_N2.size() == (unsigned) (this->N_code * this->n_frames));\n-\nfor (auto f = 0; f < this->n_frames; f++)\nstd::copy(Y_N1.begin() + f * this->N, Y_N1.begin() + f * this->N + this->N, Y_N2.begin() + f * this->N_code);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp",
"new_path": "src/Module/Puncturer/Polar/Puncturer_polar_wangliu.hpp",
"diff": "@@ -25,8 +25,9 @@ public:\nvoid gen_frozen_bits(mipp::vector<B> &frozen_bits);\n- void puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const;\n- void depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const;\n+protected:\n+ void _puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const;\n+ void _depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Puncturer.hpp",
"new_path": "src/Module/Puncturer/Puncturer.hpp",
"diff": "#ifndef PUNCTURER_HPP_\n#define PUNCTURER_HPP_\n+#include <stdexcept>\n#include <string>\n#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n@@ -50,6 +51,16 @@ public:\nconst std::string name = \"Puncturer_i\")\n: Module(n_frames, name), K(K), N(N), N_code(N_code)\n{\n+ if (K <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"K\\\" has to be greater than 0.\");\n+ if (N <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"N\\\" has to be greater than 0.\");\n+ if (N_code <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"N_code\\\" has to be greater than 0.\");\n+ if (K > N)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"K\\\" has to be smaller than \\\"N\\\".\");\n+ if (N > N_code)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer: \\\"N_code\\\" has to be equal or greater than \\\"N\\\".\");\n}\n/*!\n@@ -63,7 +74,18 @@ public:\n* \\param X_N1: a complete/valid codeword..\n* \\param X_N2: a punctured codeword (corresponding to the frame size).\n*/\n- virtual void puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const = 0;\n+ void puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const\n+ {\n+ if (this->N_code * this->n_frames != (int)X_N1.size())\n+ throw std::length_error(\"aff3ct::module::Puncturer: \\\"X_N1.size()\\\" has to be equal to \"\n+ \"\\\"N_code\\\" * \\\"n_frames\\\".\");\n+\n+ if (this->N * this->n_frames != (int)X_N2.size())\n+ throw std::length_error(\"aff3ct::module::Puncturer: \\\"X_N2.size()\\\" has to be equal to \"\n+ \"\\\"N\\\" * \\\"n_frames\\\".\");\n+\n+ this->_puncture(X_N1, X_N2);\n+ }\n/*!\n* \\brief Depunctures a codeword.\n@@ -71,7 +93,22 @@ public:\n* \\param Y_N1: a noised and punctured codeword (corresponding to the frame size).\n* \\param Y_N2: a noised and complete/valid codeword.\n*/\n- virtual void depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const = 0;\n+ void depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const\n+ {\n+ if (this->N * this->n_frames != (int)Y_N1.size())\n+ throw std::length_error(\"aff3ct::module::Puncturer: \\\"Y_N1.size()\\\" has to be equal to \"\n+ \"\\\"N\\\" * \\\"n_frames\\\".\");\n+\n+ if (this->N_code * this->n_frames != (int)Y_N2.size())\n+ throw std::length_error(\"aff3ct::module::Puncturer: \\\"Y_N2.size()\\\" has to be equal to \"\n+ \"\\\"N_code\\\" * \\\"n_frames\\\".\");\n+\n+ this->_depuncture(Y_N1, Y_N2);\n+ }\n+\n+protected:\n+ virtual void _puncture(const mipp::vector<B>& X_N1, mipp::vector<B>& X_N2) const = 0;\n+ virtual void _depuncture(const mipp::vector<Q>& Y_N1, mipp::vector<Q>& Y_N2) const = 0;\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module::Puncturer).
|
8,490 |
27.03.2017 09:34:38
| -7,200 |
7c19482f75ab4ad6aedfa84359f4891ecac0163f
|
Replace assertions by exceptions (aff3ct::module::Quantizer).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Fast/Quantizer_fast.cpp",
"new_path": "src/Module/Quantizer/Fast/Quantizer_fast.cpp",
"diff": "-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <algorithm>\n#include <cmath>\n@@ -20,7 +20,9 @@ Quantizer_fast<R,Q>\nfixed_point_pos(fixed_point_pos),\nfactor(1 << fixed_point_pos)\n{\n- assert(sizeof(Q) * 8 > (unsigned) fixed_point_pos);\n+ if (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be smaller \"\n+ \"than \\\"sizeof(Q)\\\" * 8.\");\n}\nnamespace aff3ct\n@@ -55,11 +57,23 @@ Quantizer_fast<R,Q>\nfixed_point_pos(fixed_point_pos),\nfactor(1 << fixed_point_pos)\n{\n- assert(saturation_pos >= 2);\n- assert(fixed_point_pos <= saturation_pos);\n- assert(sizeof(Q) * 8 > (unsigned) fixed_point_pos);\n- assert(val_max <= +(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)));\n- assert(val_min >= -(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)));\n+ if (fixed_point_pos <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be greater than 0.\");\n+ if (saturation_pos <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be greater than 0.\");\n+ if (saturation_pos < 2)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be equal or greater \"\n+ \"than 2.\");\n+ if (fixed_point_pos > saturation_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be equal or greater \"\n+ \"than \\\"fixed_point_pos\\\".\");\n+ if (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be smaller \"\n+ \"than \\\"sizeof(Q)\\\" * 8.\");\n+ if (val_max > +(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"val_max\\\" value is invalid.\");\n+ if (val_min < -(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"val_min\\\" value is invalid.\");\n}\nnamespace aff3ct\n@@ -94,10 +108,10 @@ Quantizer_fast<R,Q>\ntemplate<typename R, typename Q>\nvoid Quantizer_fast<R,Q>\n-::process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n+::_process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n{\n- std::cerr << bold_red(\"(EE) Quantizer_fast only support float to short or float to signed char.\") << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"aff3ct::module::Quantizer_fast: this class only support \\\"float to short\\\" \"\n+ \"or \\\"float to signed char\\\".\");\n}\nnamespace aff3ct\n@@ -106,10 +120,8 @@ namespace module\n{\ntemplate<>\nvoid Quantizer_fast<float,short>\n-::process(const mipp::vector<float>& Y_N1, mipp::vector<short>& Y_N2)\n+::_process(const mipp::vector<float>& Y_N1, mipp::vector<short>& Y_N2)\n{\n- assert(Y_N1.size() == Y_N2.size());\n-\nauto size = (unsigned)Y_N1.size();\nauto vectorized_size = (size / mipp::nElmtsPerRegister<short>()) * mipp::nElmtsPerRegister<short>();\nvectorized_size = (vectorized_size / 2) * 2;\n@@ -140,10 +152,8 @@ namespace module\n{\ntemplate<>\nvoid Quantizer_fast<float,signed char>\n-::process(const mipp::vector<float>& Y_N1, mipp::vector<signed char>& Y_N2)\n+::_process(const mipp::vector<float>& Y_N1, mipp::vector<signed char>& Y_N2)\n{\n- assert(Y_N1.size() == Y_N2.size());\n-\nauto size = (unsigned)Y_N1.size();\nauto vectorized_size = (size / mipp::nElmtsPerRegister<signed char>()) * mipp::nElmtsPerRegister<signed char>();\nvectorized_size = (vectorized_size / 4) * 4;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Fast/Quantizer_fast.hpp",
"new_path": "src/Module/Quantizer/Fast/Quantizer_fast.hpp",
"diff": "@@ -26,7 +26,8 @@ public:\nconst std::string name = \"Quantizer_fast\");\nvirtual ~Quantizer_fast();\n- void process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n+protected:\n+ void _process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/NO/Quantizer_NO.cpp",
"new_path": "src/Module/Quantizer/NO/Quantizer_NO.cpp",
"diff": "-#include <cassert>\n#include <algorithm>\n#include <cmath>\n@@ -21,10 +20,8 @@ Quantizer_NO<R,Q>\ntemplate<typename R, typename Q>\nvoid Quantizer_NO<R,Q>\n-::process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n+::_process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n{\n- assert(Y_N1.size() == Y_N2.size());\n-\nconst auto loop_size = Y_N1.size();\nfor (unsigned i = 0; i < loop_size; i++)\nY_N2[i] = (Q)Y_N1[i];\n@@ -36,9 +33,8 @@ namespace module\n{\ntemplate<>\nvoid Quantizer_NO<float,float>\n-::process(const mipp::vector<float>& Y_N1, mipp::vector<float>& Y_N2)\n+::_process(const mipp::vector<float>& Y_N1, mipp::vector<float>& Y_N2)\n{\n- assert(Y_N1.size() == Y_N2.size());\nY_N2 = Y_N1;\n}\n}\n@@ -50,9 +46,8 @@ namespace module\n{\ntemplate<>\nvoid Quantizer_NO<double,double>\n-::process(const mipp::vector<double>& Y_N1, mipp::vector<double>& Y_N2)\n+::_process(const mipp::vector<double>& Y_N1, mipp::vector<double>& Y_N2)\n{\n- assert(Y_N1.size() == Y_N2.size());\nY_N2 = Y_N1;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/NO/Quantizer_NO.hpp",
"new_path": "src/Module/Quantizer/NO/Quantizer_NO.hpp",
"diff": "@@ -17,7 +17,8 @@ public:\nQuantizer_NO(const int N, const int n_frames = 1, const std::string name = \"Quantizer_NO\");\nvirtual ~Quantizer_NO();\n- void process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n+protected:\n+ void _process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Quantizer.hpp",
"new_path": "src/Module/Quantizer/Quantizer.hpp",
"diff": "#define QUANTIZER_HPP_\n#include <vector>\n+#include <stdexcept>\n+\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Module/Module.hpp\"\n@@ -45,6 +47,8 @@ public:\nQuantizer_i(const int N, const int n_frames = 1, const std::string name = \"Quantizer_i\")\n: Module(n_frames, name), N(N)\n{\n+ if (N <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer: \\\"N\\\" has to be greater than 0.\");\n}\n/*!\n@@ -60,7 +64,20 @@ public:\n* \\param Y_N1: a vector of floating-point data.\n* \\param Y_N2: a vector of quantized data (fixed-point representation).\n*/\n- virtual void process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2) = 0;\n+ void process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n+ {\n+ if (this->N * this->n_frames != (int)Y_N1.size())\n+ throw std::length_error(\"aff3ct::module::Quantizer: \\\"Y_N1.size()\\\" has to be equal to \"\n+ \"\\\"N\\\" * \\\"n_frames\\\".\");\n+\n+ if (this->N * this->n_frames != (int)Y_N2.size())\n+ throw std::length_error(\"aff3ct::module::Quantizer: \\\"Y_N2.size()\\\" has to be equal to \"\n+ \"\\\"N\\\" * \\\"n_frames\\\".\");\n+ this->_process(Y_N1, Y_N2);\n+ }\n+\n+protected:\n+ virtual void _process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2) = 0;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Standard/Quantizer_standard.cpp",
"new_path": "src/Module/Quantizer/Standard/Quantizer_standard.cpp",
"diff": "-#include <cassert>\n+#include <stdexcept>\n#include <algorithm>\n#include <cmath>\n@@ -18,7 +18,9 @@ Quantizer_standard<R,Q>\nfixed_point_pos(fixed_point_pos),\nfactor(1 << fixed_point_pos)\n{\n- assert(sizeof(Q) * 8 > (unsigned) fixed_point_pos);\n+ if (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"fixed_point_pos\\\" has to be smaller \"\n+ \"than \\\"sizeof(Q)\\\" * 8.\");\n}\nnamespace aff3ct\n@@ -53,11 +55,23 @@ Quantizer_standard<R,Q>\nfixed_point_pos(fixed_point_pos),\nfactor(1 << fixed_point_pos)\n{\n- assert(saturation_pos >= 2);\n- assert(fixed_point_pos <= saturation_pos);\n- assert(sizeof(Q) * 8 > (unsigned) fixed_point_pos);\n- assert(val_max <= +(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)));\n- assert(val_min >= -(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)));\n+ if (fixed_point_pos <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"fixed_point_pos\\\" has to be greater than 0.\");\n+ if (saturation_pos <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_fast: \\\"saturation_pos\\\" has to be greater than 0.\");\n+ if (saturation_pos < 2)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"saturation_pos\\\" has to be equal or greater \"\n+ \"than 2.\");\n+ if (fixed_point_pos > saturation_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"saturation_pos\\\" has to be equal or greater \"\n+ \"than \\\"fixed_point_pos\\\".\");\n+ if (sizeof(Q) * 8 <= (unsigned) fixed_point_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"fixed_point_pos\\\" has to be smaller \"\n+ \"than \\\"sizeof(Q)\\\" * 8.\");\n+ if (val_max > +(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"val_max\\\" value is invalid.\");\n+ if (val_min < -(((1 << ((sizeof(Q) * 8) -2))) + ((1 << ((sizeof(Q) * 8) -2)) -1)))\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_standard: \\\"val_min\\\" value is invalid.\");\n}\nnamespace aff3ct\n@@ -92,10 +106,8 @@ Quantizer_standard<R,Q>\ntemplate<typename R, typename Q>\nvoid Quantizer_standard<R,Q>\n-::process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n+::_process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n{\n- assert(Y_N1.size() == Y_N2.size());\n-\nauto size = Y_N1.size();\nfor (unsigned i = 0; i < size; i++)\nY_N2[i] = (Q)saturate((R)std::round((R)factor * Y_N1[i]), (R)val_min, (R)val_max);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Standard/Quantizer_standard.hpp",
"new_path": "src/Module/Quantizer/Standard/Quantizer_standard.hpp",
"diff": "@@ -31,7 +31,8 @@ public:\nconst std::string name = \"Quantizer_standard\");\nvirtual ~Quantizer_standard();\n- void process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n+protected:\n+ void _process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Tricky/Quantizer_tricky.cpp",
"new_path": "src/Module/Quantizer/Tricky/Quantizer_tricky.cpp",
"diff": "-#include <cassert>\n+#include <stdexcept>\n#include <algorithm>\n#include <cmath>\n@@ -51,7 +51,9 @@ Quantizer_tricky<R,Q>\ndelta_inv((R)0),\nsigma(sigma)\n{\n- assert(sizeof(Q) * 8 >= (unsigned) saturation_pos);\n+ if (sizeof(Q) * 8 < (unsigned) saturation_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_tricky: \\\"saturation_pos\\\" has to be equal or smaller \"\n+ \"than \\\"sizeof(Q)\\\" * 8.\");\n}\nnamespace aff3ct\n@@ -121,7 +123,9 @@ Quantizer_tricky<R,Q>\ndelta_inv((R)1.0 / ((R)std::abs(min_max) / (R)val_max)),\nsigma(sigma)\n{\n- assert(sizeof(Q) * 8 >= (unsigned) saturation_pos);\n+ if (sizeof(Q) * 8 < (unsigned) saturation_pos)\n+ throw std::invalid_argument(\"aff3ct::module::Quantizer_tricky: \\\"saturation_pos\\\" has to be equal or smaller \"\n+ \"than \\\"sizeof(Q)\\\" * 8.\");\n}\ntemplate <typename R, typename Q>\n@@ -132,10 +136,8 @@ Quantizer_tricky<R,Q>\ntemplate<typename R, typename Q>\nvoid Quantizer_tricky<R,Q>\n-::process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n+::_process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2)\n{\n- assert(Y_N1.size() == Y_N2.size());\n-\nif (delta_inv == (R)0)\n{\nmipp::vector<R> tmp(Y_N1.size());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Quantizer/Tricky/Quantizer_tricky.hpp",
"new_path": "src/Module/Quantizer/Tricky/Quantizer_tricky.hpp",
"diff": "@@ -42,7 +42,8 @@ public:\nconst std::string name = \"Quantizer_tricky\");\nvirtual ~Quantizer_tricky();\n- void process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n+protected:\n+ void _process(const mipp::vector<R>& Y_N1, mipp::vector<Q>& Y_N2);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module::Quantizer).
|
8,490 |
27.03.2017 09:56:58
| -7,200 |
4acead63107d5478d9100765986c82458a78f243
|
Replace assertions by exceptions (aff3ct::module::Source).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/AZCW/Source_AZCW.cpp",
"new_path": "src/Module/Source/AZCW/Source_AZCW.cpp",
"diff": "@@ -17,7 +17,7 @@ Source_AZCW<B>\ntemplate <typename B>\nvoid Source_AZCW<B>\n-::generate(mipp::vector<B>& U_K)\n+::_generate(mipp::vector<B>& U_K)\n{\nstd::fill(U_K.begin(), U_K.end(), 0);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/AZCW/Source_AZCW.hpp",
"new_path": "src/Module/Source/AZCW/Source_AZCW.hpp",
"diff": "@@ -19,7 +19,8 @@ public:\nvirtual ~Source_AZCW();\n- void generate(mipp::vector<B>& U_K);\n+protected:\n+ void _generate(mipp::vector<B>& U_K);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/Random/Source_random.cpp",
"new_path": "src/Module/Source/Random/Source_random.cpp",
"diff": "@@ -19,7 +19,7 @@ Source_random<B>\ntemplate <typename B>\nvoid Source_random<B>\n-::generate(mipp::vector<B>& U_K)\n+::_generate(mipp::vector<B>& U_K)\n{\nauto size = (int)U_K.size();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/Random/Source_random.hpp",
"new_path": "src/Module/Source/Random/Source_random.hpp",
"diff": "@@ -28,7 +28,8 @@ public:\nvirtual ~Source_random();\n- void generate(mipp::vector<B>& U_K);\n+protected:\n+ void _generate(mipp::vector<B>& U_K);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/Random/Source_random_fast.cpp",
"new_path": "src/Module/Source/Random/Source_random_fast.cpp",
"diff": "@@ -25,7 +25,7 @@ Source_random_fast<B>\ntemplate <typename B>\nvoid Source_random_fast<B>\n-::generate(mipp::vector<B>& U_K)\n+::_generate(mipp::vector<B>& U_K)\n{\nconst auto size = U_K.size();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/Random/Source_random_fast.hpp",
"new_path": "src/Module/Source/Random/Source_random_fast.hpp",
"diff": "@@ -24,7 +24,8 @@ public:\nSource_random_fast(const int K, const int seed = 0, const int n_frames = 1, const std::string name = \"Source_random_fast\");\nvirtual ~Source_random_fast();\n- void generate(mipp::vector<B>& U_K);\n+protected:\n+ void _generate(mipp::vector<B>& U_K);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/Source.hpp",
"new_path": "src/Module/Source/Source.hpp",
"diff": "#include <vector>\n#include <string>\n+#include <stdexcept>\n#include \"Tools/Perf/MIPP/mipp.h\"\n@@ -45,6 +46,8 @@ public:\nSource_i(const int K, const int n_frames = 1, const std::string name = \"Source_i\")\n: Module(n_frames, name), K(K)\n{\n+ if (K <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Source: \\\"K\\\" has to be greater than 0.\");\n}\n/*!\n@@ -59,7 +62,17 @@ public:\n*\n* \\param U_K: a vector of bits to fill.\n*/\n- virtual void generate(mipp::vector<B>& U_K) = 0;\n+ void generate(mipp::vector<B>& U_K)\n+ {\n+ if (this->K * this->n_frames != (int)U_K.size())\n+ throw std::length_error(\"aff3ct::module::Source: \\\"U_K.size()\\\" has to be equal to \"\n+ \"\\\"K\\\" * \\\"n_frames\\\".\");\n+\n+ this->_generate(U_K);\n+ }\n+\n+protected:\n+ virtual void _generate(mipp::vector<B>& U_K) = 0;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/User/Source_user.cpp",
"new_path": "src/Module/Source/User/Source_user.cpp",
"diff": "#include <fstream>\n+#include <stdexcept>\n#include \"Tools/Display/bash_tools.h\"\n@@ -21,7 +22,9 @@ Source_user<B>\nfile >> n_src;\nfile >> src_size;\n- assert(n_src > 0 && src_size > 0);\n+ if (n_src <= 0 || src_size <= 0)\n+ throw std::runtime_error(\"aff3ct::module::Source_user: \\\"n_src\\\", and \\\"src_size\\\" have to be \"\n+ \"greater than 0.\");\nthis->source.resize(n_src);\nfor (auto i = 0; i < n_src; i++)\n@@ -35,26 +38,22 @@ Source_user<B>\nB bit;\nfile >> bit;\n- assert(bit == 0 || bit == 1);\n- this->source[i][j] = bit;\n+ this->source[i][j] = bit != 0;\n}\n}\nelse\n{\n- std::cerr << bold_red(\"(EE) The source size is wrong (read: \") << bold_red(std::to_string(src_size))\n- << bold_red(\", expected: \") << bold_red(std::to_string(this->K))\n- << bold_red(\"), exiting.\") << std::endl;\nfile.close();\n- std::exit(-1);\n+\n+ throw std::runtime_error(\"aff3ct::module::Source_user: the size is wrong (read: \" +\n+ std::to_string(src_size) + \", expected: \" + std::to_string(this->K) + \").\");\n}\nfile.close();\n}\nelse\n{\n- std::cerr << bold_red(\"(EE) Can't open \\\"\") << bold_red(filename) << bold_red(\"\\\" file, exiting.\")\n- << std::endl;\n- std::exit(-1);\n+ throw std::invalid_argument(\"aff3ct::module::Source_user: can't open \\\"\" + filename + \"\\\" file.\");\n}\n}\n@@ -66,10 +65,8 @@ Source_user<B>\ntemplate <typename B>\nvoid Source_user<B>\n-::generate(mipp::vector<B>& U_K)\n+::_generate(mipp::vector<B>& U_K)\n{\n- assert((int)U_K.size() == this->K * this->n_frames);\n-\nfor (auto f = 0; f < this->n_frames; f++)\n{\nstd::copy(this->source[this->src_counter].begin(),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/User/Source_user.hpp",
"new_path": "src/Module/Source/User/Source_user.hpp",
"diff": "@@ -23,7 +23,8 @@ public:\nSource_user(const int K, std::string filename, const int n_frames = 1, const std::string name = \"Source_user\");\nvirtual ~Source_user();\n- void generate(mipp::vector<B>& U_K);\n+protected:\n+ void _generate(mipp::vector<B>& U_K);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module::Source).
|
8,490 |
27.03.2017 15:52:19
| -7,200 |
207afb6155d675e694548e62ad5d549f92ecb956
|
Replace assertions by exceptions (mipp).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp.h",
"new_path": "src/Tools/Perf/MIPP/mipp.h",
"diff": "@@ -70,6 +70,7 @@ SOFTWARE.\n#include <unordered_map>\n#include <typeindex>\n+#include <stdexcept>\n#include <typeinfo>\n#include <iostream>\n#include <iomanip>\n@@ -293,21 +294,22 @@ static void errorMessage(std::string instr)\ntype_names[typeid(double)] = \"double\";\nif (RegisterSizeBit == 0)\n- std::cerr << \"Undefined type of instructions, try to add -mfpu=neon, -msse4.2, -mavx, -march=native... \"\n- << \"at the compile time.\" << std::endl;\n- std::cerr << \"mipp::\" << instr << \"<\" << type_names[typeid(T)] << \"> (\" << IntructionsType << \") is undefined! \"\n- << \"Program halting...\" << std::endl;\n+ throw std::runtime_error(\"mipp: undefined type of instructions, try to add \"\n+ \"-mfpu=neon, -msse4.2, -mavx, -march=native... at the compile time.\");\n-#if defined(__GNUC__) && (defined(__linux__) || defined(__linux))\n+#if defined(MIPP_ENABLE_BACKTRACE) && defined(__GNUC__) && (defined(__linux__) || defined(__linux))\nvoid *array[5];\nsize_t size;\n// get void*'s for all entries on the stack\nsize = backtrace(array, 5);\n- std::cerr << std::endl << \"Backtrace:\" << std::endl;\n+ std::cerr << \"Backtrace:\" << std::endl;\nbacktrace_symbols_fd(array, size, STDERR_FILENO);\n#endif\n+\n+ throw std::runtime_error(\"mipp::\" + instr + \"<\" + type_names[typeid(T)] + \"> (\" +\n+ IntructionsType + \") is undefined!\");\n}\ntemplate <typename T1, typename T2>\n@@ -344,21 +346,22 @@ static void errorMessage(std::string instr)\ntype_names[typeid(double)] = \"double\";\nif (RegisterSizeBit == 0)\n- std::cerr << \"Undefined type of instructions, try to add -mfpu=neon, -msse4.2, -mavx, -march=native... \"\n- << \"at the compile time.\" << std::endl;\n- std::cerr << \"mipp::\" << instr << \"<\" << type_names[typeid(T1)] << \",\" << type_names[typeid(T2)] << \"> (\"\n- << IntructionsType << \") is undefined! Program halting...\" << std::endl;\n+ throw std::runtime_error(\"mipp: undefined type of instructions, try to add \"\n+ \"-mfpu=neon, -msse4.2, -mavx, -march=native... at the compile time.\");\n-#if defined(__GNUC__) && (defined(__linux__) || defined(__linux))\n+#if defined(MIPP_ENABLE_BACKTRACE) && defined(__GNUC__) && (defined(__linux__) || defined(__linux))\nvoid *array[5];\nsize_t size;\n// get void*'s for all entries on the stack\nsize = backtrace(array, 5);\n- std::cerr << std::endl << \"Backtrace:\" << std::endl;\n+ std::cerr << \"Backtrace:\" << std::endl;\nbacktrace_symbols_fd(array, size, STDERR_FILENO);\n#endif\n+\n+ throw std::runtime_error(\"mipp::\" + instr + \"<\" + type_names[typeid(T1)] + \",\" + type_names[typeid(T2)] + \"> (\" +\n+ IntructionsType + \") is undefined!\");\n}\ntemplate <typename T> inline reg load (const T*) { errorMessage<T>(\"load\"); exit(-1); }\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"new_path": "src/Tools/Perf/MIPP/mipp_object.hxx",
"diff": "@@ -86,8 +86,7 @@ public:\nmipp::transpose8x8<T>(rs);\nfor (auto i = 0; i < 8; i++) regs[i].r = rs[i];\n#else\n- std::cerr << \"\\\"transpose8x8\\\" static method is a non-sense in sequential mode, exiting.\" << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"mipp::Reg::transpose8x8: non-sense in sequential mode.\");\n#endif\n}\n@@ -99,8 +98,7 @@ public:\nmipp::transpose2<T>(rs);\nfor (auto i = 0; i < nElReg<T>()/2; i++) regs[i].r = rs[i];\n#else\n- std::cerr << \"\\\"transpose2\\\" static method is a non-sense in sequential mode, exiting.\" << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"mipp::Reg::transpose2: non-sense in sequential mode.\");\n#endif\n}\n@@ -112,8 +110,7 @@ public:\nmipp::transpose28x8<T>(rs);\nfor (auto i = 0; i < 8; i++) regs[i].r = rs[i];\n#else\n- std::cerr << \"\\\"transpose28x8\\\" static method is a non-sense in sequential mode, exiting.\" << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"mipp::Reg::transpose28x8: non-sense in sequential mode.\");\n#endif\n}\n@@ -251,8 +248,7 @@ public:\ntemplate <typename T2> inline Reg<T2> cvt () const { return (T2)r; }\ntemplate <typename T2> inline Reg<T2> pack(const Reg<T> v) const\n{\n- std::cerr << \"\\\"pack\\\" method is a non-sense in sequential mode, exiting.\" << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"mipp::Reg::pack: non-sense in sequential mode.\");\n}\n#endif\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (mipp).
|
8,490 |
27.03.2017 16:27:08
| -7,200 |
36ce1f16352fdfac51aeb1a287239ff9273a3f50
|
Replace assertions by exceptions (aff3ct::module, aff3ct::tools) + remove exit calls.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder.hpp",
"new_path": "src/Module/Decoder/Decoder.hpp",
"diff": "@@ -161,11 +161,8 @@ public:\nV_K.begin() + waves_off3);\n}\nelse\n- {\n- std::cerr << tools::bold_red(\"(EE) This should never happen, V_K is not a multiple of K or of N.\")\n- << std::endl;\n- std::exit(-1);\n- }\n+ throw std::runtime_error(\"aff3ct::module::Decoder: this should never happen, \\\"V_K\\\" is not \"\n+ \"a multiple of \\\"K\\\" or of \\\"N\\\".\");\n}\nthis->d_store_total += steady_clock::now() - t_store;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_interface.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_interface.hpp",
"diff": "#define PATTERN_SC_INTERFACE_HPP_\n#include <cmath>\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -56,9 +56,10 @@ protected:\nid(0),\nkey(\"\")\n{\n- assert(N > 0);\n- assert(size > 0);\n- assert(node != nullptr);\n+ if (N <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC_interface: \\\"N\\\" has to be greater than 0.\");\n+ if (node == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC_interface: \\\"node\\\" can't be null.\");\nconst int *p_size = &size;\nfor (auto i = 0; i < node->get_depth(); i++) *const_cast<int*>(p_size) >>= 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate0.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate0.hpp",
"diff": "#ifndef PATTERN_SC_YIELD0_HPP_\n#define PATTERN_SC_YIELD0_HPP_\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -63,13 +63,17 @@ public:\nvirtual int match(const int &reverse_graph_depth,\nconst tools::Binary_node<Pattern_SC_interface>* node_curr) const\n{\n- assert(reverse_graph_depth > 0);\n+ if (reverse_graph_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_0>: \\\"reverse_graph_depth\\\" has to be \"\n+ \"greater than 0.\");\nconst Pattern_SC_interface *pattern_left = node_curr->get_left ()->get_contents();\nconst Pattern_SC_interface *pattern_right = node_curr->get_right()->get_contents();\n- assert(pattern_left != nullptr);\n- assert(pattern_right != nullptr);\n+ if (pattern_left == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_0>: \\\"pattern_left\\\" can't be null.\");\n+ if (pattern_right == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_0>: \\\"pattern_right\\\" can't be null.\");\nint match_val = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate0_left.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate0_left.hpp",
"diff": "#ifndef PATTERN_SC_YIELD0_LEFT_HPP_\n#define PATTERN_SC_YIELD0_LEFT_HPP_\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -97,11 +97,14 @@ public:\nvirtual int match(const int &reverse_graph_depth,\nconst tools::Binary_node<Pattern_SC_interface>* node_curr) const\n{\n- assert(reverse_graph_depth > 0);\n+ if (reverse_graph_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_0_LEFT>: \\\"reverse_graph_depth\\\" has to be \"\n+ \"greater than 0.\");\nconst Pattern_SC_interface *pattern_left = node_curr->get_left ()->get_contents();\n- assert(pattern_left != nullptr);\n+ if (pattern_left == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_0_LEFT>: \\\"pattern_left\\\" can't be null.\");\nint match_val = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate1.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rate1.hpp",
"diff": "#ifndef PATTERN_SC_YIELD1_HPP_\n#define PATTERN_SC_YIELD1_HPP_\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -79,13 +79,17 @@ public:\nvirtual int match(const int &reverse_graph_depth,\nconst tools::Binary_node<Pattern_SC_interface>* node_curr) const\n{\n- assert(reverse_graph_depth > 0);\n+ if (reverse_graph_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_1>: \\\"reverse_graph_depth\\\" has to be \"\n+ \"greater than 0.\");\nconst Pattern_SC_interface *pattern_left = node_curr->get_left ()->get_contents();\nconst Pattern_SC_interface *pattern_right = node_curr->get_right()->get_contents();\n- assert(pattern_left != nullptr);\n- assert(pattern_right != nullptr);\n+ if (pattern_left == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_1>: \\\"pattern_left\\\" can't be null.\");\n+ if (pattern_right == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<RATE_1>: \\\"pattern_right\\\" can't be null.\");\nint match_val = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rep.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rep.hpp",
"diff": "#ifndef PATTERN_SC_REP_HPP_\n#define PATTERN_SC_REP_HPP_\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -80,13 +80,17 @@ public:\nvirtual int match(const int &reverse_graph_depth,\nconst tools::Binary_node<Pattern_SC_interface>* node_curr) const\n{\n- assert(reverse_graph_depth > 0);\n+ if (reverse_graph_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<REP>: \\\"reverse_graph_depth\\\" has to be \"\n+ \"greater than 0.\");\nconst Pattern_SC_interface *pattern_left = node_curr->get_left ()->get_contents();\nconst Pattern_SC_interface *pattern_right = node_curr->get_right()->get_contents();\n- assert(pattern_left != nullptr);\n- assert(pattern_right != nullptr);\n+ if (pattern_left == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<REP>: \\\"pattern_left\\\" can't be null.\");\n+ if (pattern_right == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<REP>: \\\"pattern_right\\\" can't be null.\");\nint match_val = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rep_left.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_rep_left.hpp",
"diff": "#ifndef PATTERN_SC_REP_LEFT_HPP_\n#define PATTERN_SC_REP_LEFT_HPP_\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -112,11 +112,14 @@ public:\nvirtual int match(const int &reverse_graph_depth,\nconst tools::Binary_node<Pattern_SC_interface>* node_curr) const\n{\n- assert(reverse_graph_depth > 0);\n+ if (reverse_graph_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<REP_LEFT>: \\\"reverse_graph_depth\\\" has to be \"\n+ \"greater than 0.\");\nconst Pattern_SC_interface *pattern_left = node_curr->get_left ()->get_contents();\n- assert(pattern_left != nullptr);\n+ if (pattern_left == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<REP_LEFT>: \\\"pattern_left\\\" can't be null.\");\nint match_val = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_spc.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_spc.hpp",
"diff": "#ifndef PATTERN_SC_SPC_HPP_\n#define PATTERN_SC_SPC_HPP_\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -112,13 +112,17 @@ public:\nvirtual int match(const int &reverse_graph_depth,\nconst tools::Binary_node<Pattern_SC_interface>* node_curr) const\n{\n- assert(reverse_graph_depth > 0);\n+ if (reverse_graph_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<SPC>: \\\"reverse_graph_depth\\\" has to be \"\n+ \"greater than 0.\");\nconst Pattern_SC_interface *pattern_left = node_curr->get_left ()->get_contents();\nconst Pattern_SC_interface *pattern_right = node_curr->get_right()->get_contents();\n- assert(pattern_left != nullptr);\n- assert(pattern_right != nullptr);\n+ if (pattern_left == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<SPC>: \\\"pattern_left\\\" can't be null.\");\n+ if (pattern_right == nullptr)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<SPC>: \\\"pattern_right\\\" can't be null.\");\nint match_val = 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_standard.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Patterns/Pattern_SC_standard.hpp",
"diff": "#ifndef PATTERN_SC_STANDARD_HPP_\n#define PATTERN_SC_STANDARD_HPP_\n-#include <cassert>\n+#include <stdexcept>\n#include <iostream>\n#include <sstream>\n#include <iomanip>\n@@ -111,7 +111,9 @@ public:\nvirtual int match(const int &reverse_graph_depth,\nconst tools::Binary_node<Pattern_SC_interface>* node_curr) const\n{\n- assert(reverse_graph_depth > 0);\n+ if (reverse_graph_depth <= 0)\n+ throw std::invalid_argument(\"aff3ct::module::Pattern_SC<STANDARD>: \\\"reverse_graph_depth\\\" has to be \"\n+ \"greater than 0.\");\nint match_val = 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/decoder_polar_functions.hxx",
"new_path": "src/Module/Decoder/Polar/decoder_polar_functions.hxx",
"diff": "#include <cmath> // min(), fabs(), copysign()...\n#include <algorithm> // min()\n#include <chrono>\n+#include <stdexcept>\n#include \"Tools/Display/bash_tools.h\"\n@@ -14,8 +15,7 @@ namespace module\ntemplate <typename R>\ninline R f_LR(const R& lambda_a, const R& lambda_b)\n{\n- std::cerr << tools::bold_red(\"(EE) f_LR work only on 64bit data, exiting.\") << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"aff3ct::module::f_LR: work only on 64bit data.\");\n}\ntemplate <>\n@@ -105,8 +105,7 @@ inline mipp::reg f_LLR_i(const mipp::reg& r_lambda_a, const mipp::reg& r_lambda_\ntemplate <typename B, typename R>\ninline R g_LR(const R& lambda_a, const R& lambda_b, const B& u)\n{\n- std::cerr << tools::bold_red(\"(EE) f_LR work only on 64bit data, exiting.\") << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"aff3ct::module::f_LR: work only on 64bit data.\");\n}\ntemplate <>\n@@ -153,8 +152,7 @@ inline mipp::reg g_LLR_i(const mipp::reg& r_lambda_a, const mipp::reg& r_lambda_\ntemplate <typename R>\ninline R g0_LR(const R& lambda_a, const R& lambda_b)\n{\n- std::cerr << tools::bold_red(\"(EE) f_LR work only on 64bit data, exiting.\") << std::endl;\n- exit(EXIT_FAILURE);\n+ throw std::runtime_error(\"aff3ct::module::f_LR: work only on 64bit data.\");\n}\ntemplate <>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/CPM/CPE/Encoder_CPE_Rimoldi.cpp",
"new_path": "src/Module/Modulator/CPM/CPE/Encoder_CPE_Rimoldi.cpp",
"diff": "@@ -101,11 +101,7 @@ void Encoder_CPE_Rimoldi<SIN, SOUT>\nthis->cpm.n_b_per_s, true)] = tr;\n}\nelse\n- {\n- std::cerr << bold_red(\"(EE) Unknown BCJR mapping scheme!\") << std::endl;\n- exit(-1);\n- }\n-\n+ throw std::runtime_error(\"aff3ct::module::Encoder_CPE_Rimoldi: unknown BCJR mapping scheme.\");\n}\ntemplate<typename SIN, typename SOUT>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction.cpp",
"diff": "@@ -79,11 +79,8 @@ void Monitor_reduction<B,R>\nstd::ofstream file_noise (path_noise, std::ios_base::binary);\nif (!file_src.is_open() || !file_enc.is_open() || !file_noise.is_open())\n- {\n- std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check file name: \\\"\")\n- << bold_red(base_path) << bold_red(\"\\\"\") << std::endl;\n- std::exit(-1);\n- }\n+ throw std::invalid_argument(\"aff3ct::module::Monitor_reduction: issue while trying to open error tracker \"\n+ \"log files, check the base path (\\\"\" + base_path + \"\\\").\");\nauto n_fe = get_n_fe();\nint Y_size = 0;\n@@ -133,6 +130,7 @@ void Monitor_reduction<B,R>\nif (buff_src.size() != buff_enc.size())\nthrow std::length_error(\"aff3ct::module::Monitor_reduction: \\\"buff_src.size()\\\" has to be equal to \"\n\"\\\"buff_enc.size()\\\".\");\n+\nfor (unsigned f = 0; f < buff_enc.size(); f++)\n{\nfor (unsigned b = 0; b < buff_enc[f].size(); b++)\n@@ -156,11 +154,8 @@ void Monitor_reduction<B,R>\nstd::ofstream file_itl(path_itl);\nif (!file_itl.is_open())\n- {\n- std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check file name: \\\"\")\n- << bold_red(base_path) << bold_red(\"\\\"\") << std::endl;\n- std::exit(-1);\n- }\n+ throw std::invalid_argument(\"aff3ct::module::Monitor_reduction: issue while trying to open error tracker \"\n+ \"log files, check the base path (\\\"\" + base_path + \"\\\").\");\nif (this->get_N() != (int)itl_pi.size())\nthrow std::length_error(\"aff3ct::module::Monitor_reduction: \\\"itl_pi.size()\\\" has to be equal to \\\"N\\\".\");\n@@ -200,13 +195,8 @@ void Monitor_reduction<B,R>\nstd::string& path_enc, std::string& path_noise, std::string& path_itl)\n{\nif (!check_path(base_path))\n- {\n- std::cerr << bold_red(\"(EE) issue while trying to open error tracker log files ; check head of the path: \\\"\")\n- << bold_red(base_path)\n- << bold_red(\"\\\" and please create yourself the needed directory.\")\n- << std::endl;\n- std::exit(-1);\n- }\n+ throw std::invalid_argument(\"aff3ct::module::Monitor_reduction: issue while trying to open error tracker \"\n+ \"log files, check the base path (\\\"\" + base_path + \"\\\").\");\nstd::stringstream snr_stream;\nsnr_stream << std::fixed << std::setprecision(3) << snr;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"diff": "#ifdef ENABLE_MPI\n#include <stddef.h>\n+#include <stdexcept>\n#include \"Tools/Display/bash_tools.h\"\n@@ -52,25 +53,16 @@ Monitor_reduction_mpi<B,R>\nblen[2] = 1; displacements[2] = offsetof(monitor_vals, n_fra); oldtypes[2] = MPI_UNSIGNED_LONG_LONG;\nif (auto ret = MPI_Type_create_struct(3, blen, displacements, oldtypes, &MPI_monitor_vals))\n- {\n- std::cerr << bold_red(\"(EE) MPI_Type_create_struct returned \\\"\") << bold_red(std::to_string(ret))\n- << bold_red(\"\\\", exiting.\") << std::endl;\n- std::exit(-1);\n- }\n+ throw std::runtime_error(\"aff3ct::module::Monitor_reduction_mpi: \\\"MPI_Type_create_struct\\\" returned \\\"\" +\n+ std::to_string(ret) + \"\\\".\");\nif (auto ret = MPI_Type_commit(&MPI_monitor_vals))\n- {\n- std::cerr << bold_red(\"(EE) MPI_Type_commit returned \\\"\") << bold_red(std::to_string(ret))\n- << bold_red(\"\\\", exiting.\") << std::endl;\n- std::exit(-1);\n- }\n+ throw std::runtime_error(\"aff3ct::module::Monitor_reduction_mpi: \\\"MPI_Type_create_struct\\\" returned \\\"\" +\n+ std::to_string(ret) + \"\\\".\");\nif (auto ret = MPI_Op_create(MPI_SUM_monitor_vals_func, true, &MPI_SUM_monitor_vals))\n- {\n- std::cerr << bold_red(\"(EE) MPI_Op_create returned \\\"\") << bold_red(std::to_string(ret))\n- << bold_red(\"\\\", exiting.\") << std::endl;\n- std::exit(-1);\n- }\n+ throw std::runtime_error(\"aff3ct::module::Monitor_reduction_mpi: \\\"MPI_Op_create\\\" returned \\\"\" +\n+ std::to_string(ret) + \"\\\".\");\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_parser_polar.cpp",
"new_path": "src/Tools/Code/Polar/Pattern_parser_polar.cpp",
"diff": "#include <cmath>\n-#include <cassert>\n#include <algorithm>\n#include <iostream>\n#include <sstream>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Replace assertions by exceptions (aff3ct::module, aff3ct::tools) + remove exit calls.
|
8,495 |
27.03.2017 16:40:02
| -7,200 |
9b0a6a3d596c8f652e071dc2cbe687ea13805bfb
|
Correction of few things: ScalingFactor for FnC and test for CRC that is necessary for FnC
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -179,7 +179,7 @@ void Launcher_BFER_turbo<B,R,Q,QD>\nif(this->ar.exist_arg({\"dec-simd\" })) this->params.decoder.simd_strategy = this->ar.get_arg ({\"dec-simd\" });\nif(this->ar.exist_arg({\"dec-max\" })) this->params.decoder.max = this->ar.get_arg ({\"dec-max\" });\n- if (this->ar.exist_arg({\"crc-type\"}))\n+ if (this->ar.exist_arg({\"crc-poly\"}))\n{\nif (this->ar.exist_arg({\"dec-sc\"}))\nthis->params.decoder.self_corrected = true;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"new_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"diff": "@@ -159,7 +159,7 @@ bool Decoder_turbo_naive_CA_flip_and_check<B,R>\n{\n// reconstruct the a posteriori information and calculate the metric associated\nfor (auto i = 0; i < this->K; i++)\n- metric[i] = std::fabs((l_en[i] + l_sen[i]));\n+ metric[i] = std::fabs((l_en[i]*0.75 + l_sen[i]));\n// get the least reliable positions\nmipp::vector<unsigned int> positions = partial_sort_indexes(metric);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Correction of few things: ScalingFactor for FnC and test for CRC that is necessary for FnC
|
8,487 |
27.03.2017 16:46:38
| -7,200 |
2434b29345a49991b1b09841fdf55197f09e7e45
|
Creation of tools 'G_tools' using in LDPC encoder and refacto
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/matrix.h\"\n+#include \"Tools/Code/LDPC/G_tools/G_tools.hpp\"\n#include \"Encoder_LDPC_from_H.hpp\"\nusing namespace aff3ct;\nusing namespace module;\n+\ntemplate <typename B>\nEncoder_LDPC_from_H<B>\n::Encoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames,\n@@ -20,12 +22,12 @@ Encoder_LDPC_from_H<B>\n: Encoder_LDPC<B>(K, N, n_frames, name)\n{\nstd::vector<mipp::vector<B>> H;\n- build_H(alist_H.get_n_CN(), alist_H.get_n_VN(), alist_H.get_CN_to_VN(), H);\n- triangularization_H(H, swapped);\n+ tools::G_tools::build_H(alist_H.get_n_CN(), alist_H.get_n_VN(), alist_H.get_CN_to_VN(), H);\n+ tools::G_tools::triangularization_H(H, swapped);\nassert((int) H[0].size() == N);\nassert((int)(H[0].size() - H.size()) == K);\n- identity_H(H);\n- transformation_H_to_G(H, G);\n+ tools::G_tools::identity_H(H);\n+ tools::G_tools::transformation_H_to_G(H, G, swapped);\ntools::real_transpose(K, N, G, this->tG);\n}\n@@ -56,130 +58,11 @@ void Encoder_LDPC_from_H<B>\ntemplate <typename B>\nvoid Encoder_LDPC_from_H<B>\n-::get_G(mipp::vector<B>& G)\n+::get_G(mipp::vector<B>& matrix_G)\n{\nassert(this->G.size() == G.size());\n- std::copy(this->G.begin(), this->G.end(), G.begin());\n-}\n-\n-template <typename B>\n-void Encoder_LDPC_from_H<B>\n-::build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\n- std::vector<mipp::vector<B>>& H)\n-{\n- for (int i = 0; i < k; i++)\n- H.push_back(mipp::vector<B>(n, 0));\n-\n- for (unsigned i = 0; i < positions.size(); i++)\n- for (unsigned j = 0; j < positions[i].size(); j++)\n- H[i][positions[i][j]] = 1;\n-}\n-\n-template <typename B>\n-void Encoder_LDPC_from_H<B>\n-::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped)\n-{\n- unsigned n = H[0].size();\n- unsigned k = H.size();\n- unsigned i = 0;\n- bool fund = false;\n-\n- mipp::vector<B> tmp(n, 0);\n- mipp::vector<B> tmp2;\n-\n- while (i < k -1)\n- {\n- if (H[i][i])\n- {\n- for (unsigned j = i +1; j < k; j++)\n- if (H[j][i])\n- std::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n- }\n- else\n- {\n- for (unsigned j = i +1; j < k; j++) // find an other row which is good\n- if (H[j][i])\n- {\n- tmp = H[i];\n- H[i] = H[j];\n- H[j] = tmp;\n- i--;\n- fund = true;\n- break;\n- }\n-\n- if (!fund) // if does not fund\n- for (unsigned j = (i+1); j<n; j++) // find an other column which is good\n- if( H[i][j] )\n- {\n- swapped.push_back(i);\n- swapped.push_back(j);\n-\n- tmp2.clear();\n-\n- for (unsigned l = 0; l < k; l++) tmp2.push_back(H[l][i]);\n- for (unsigned l = 0; l < k; l++) H[l][i] = H[l][j];\n- for (unsigned l = 0; l < k; l++) H[l][j] = tmp2[l];\n-\n- i--;\n- fund = true;\n- break;\n- }\n-\n- if (!fund) // if does not fund again this mean that the row is the null vector\n- {\n- H.erase(H.begin() +i);\n- i--;\n- k--;\n- }\n- fund = false;\n- }\n-\n- i++;\n- }\n-}\n-\n-template <typename B>\n-void Encoder_LDPC_from_H<B>\n-::identity_H(std::vector<mipp::vector<B>>& H)\n-{\n- auto k = (int)H.size();\n- for (auto i = k -1 ; i > 0; i--)\n- for (auto j = i -1; j >= 0; j--)\n- if (H[j][i])\n- std::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n-}\n-\n-template <typename B>\n-void Encoder_LDPC_from_H<B>\n-::transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G)\n-{\n- unsigned n = H[0].size();\n- unsigned k = H.size();\n-\n- for (unsigned i = 0; i < k; i++) // Kill of the Identity in H\n- H[i].erase( H[i].begin(), H[i].begin() + k );\n-\n- for (unsigned i = k; i < n; i++) // Add identity at the end\n- {\n- H.push_back(mipp::vector<B>(n - k, 0));\n- H[i][i - k] = 1;\n- }\n-\n- // re-organization: column of G\n- mipp::vector<B> tmp(n - k, 0);\n- for (unsigned l = swapped.size() / 2; l > 0; l--)\n- {\n- tmp = H[swapped[l * 2 -1]];\n- H[swapped[l * 2 -1]] = H[swapped[(l - 1) * 2]];\n- H[swapped[(l - 1) * 2]] = tmp;\n- }\n-\n- // write G matrix in G vector\n- for (unsigned j = 0; j < n - k; j++)\n- for (unsigned i = 0; i < n; i++)\n- G.push_back(H[i][j]);\n+ std::copy(this->G.begin(), this->G.end(), matrix_G.begin());\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -20,12 +20,6 @@ protected:\nmipp::vector<int> swapped;\nmipp::vector<B> G;\n- void build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\n- std::vector<mipp::vector<B>>& H);\n- void triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped);\n- void identity_H(std::vector<mipp::vector<B>>& H);\n- void transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G);\n-\npublic:\nEncoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames = 1,\nconst std::string name = \"Encoder_LDPC_from_H\");\n@@ -33,7 +27,7 @@ public:\nvirtual void get_info_bits_pos(mipp::vector<B>& info_bits_pos);\n- virtual void get_G(mipp::vector<B>& G);\n+ virtual void get_G(mipp::vector<B>& matrix_G);\n};\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Code/LDPC/G_tools/G_tools.hpp",
"diff": "+#ifndef G_TOOLS_HPP_\n+#define G_TOOLS_HPP_\n+\n+#include <fstream>\n+#include <vector>\n+#include \"Tools/Perf/MIPP/mipp.h\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+struct G_tools\n+{\n+public:\n+ template <typename B>\n+ static void build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\n+ std::vector<mipp::vector<B>>& H);\n+ template <typename B>\n+ static void triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped);\n+ template <typename B>\n+ static void identity_H(std::vector<mipp::vector<B>>& H);\n+ template <typename B>\n+ static void transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<int>& swapped);\n+};\n+}\n+}\n+\n+#include \"G_tools.hxx\"\n+\n+#endif /*G_TOOLS_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Code/LDPC/G_tools/G_tools.hxx",
"diff": "+#include <string>\n+#include <sstream>\n+#include <vector>\n+#include <algorithm>\n+\n+#include \"Tools/Display/bash_tools.h\"\n+\n+#include \"G_tools.hpp\"\n+\n+using namespace aff3ct::tools;\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+template <typename B>\n+void G_tools\n+::build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\n+ std::vector<mipp::vector<B>>& H)\n+{\n+ for (int i = 0; i < k; i++)\n+ H.push_back(mipp::vector<B>(n,0));\n+\n+ for (unsigned int i = 0; i < positions.size(); i++)\n+ for(unsigned int j = 0; j < positions[i].size(); j++)\n+ H[i][positions[i][j]] = 1;\n+}\n+\n+template <typename B>\n+void G_tools\n+::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped)\n+{\n+ unsigned n = H[0].size();\n+ unsigned k = H.size();\n+ unsigned i = 0;\n+ bool fund = false;\n+\n+ mipp::vector<B> tmp(n,0);\n+ mipp::vector<B> tmp2;\n+\n+ while ( i < k-1 )\n+ {\n+ if ( H[i][i] )\n+ {\n+ for (int j = (i+1); j < k; j++)\n+ if( H[j][i] )\n+ std::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n+ }\n+ else\n+ {\n+ for (int j = (i+1); j < k; j++) // find an other row which is good\n+ if ( H[j][i] )\n+ {\n+ tmp = H[i];\n+ H[i] = H[j];\n+ H[j] = tmp;\n+ i--;\n+ fund = true;\n+ break;\n+ }\n+\n+ if ( !fund ) // if does not fund\n+ for (int j = (i+1); j<n; j++) // find an other column which is good\n+ if ( H[i][j] )\n+ {\n+ swapped.push_back(i);\n+ swapped.push_back(j);\n+\n+ tmp2.clear();\n+\n+ for (int l = 0; l < k; l++) tmp2.push_back(H[l][i]);\n+ for (int l = 0; l < k; l++) H[l][i] = H[l][j];\n+ for (int l = 0; l < k; l++) H[l][j] = tmp2[l];\n+\n+ i--;\n+ fund = true;\n+ break;\n+ }\n+\n+ if ( !fund ) // if does not fund again this mean that the row is the null vector\n+ {\n+ H.erase( H.begin() + i );\n+ i--;\n+ k--;\n+ }\n+ fund = false;\n+ }\n+ i++;\n+ }\n+}\n+\n+template <typename B>\n+void G_tools\n+::identity_H(std::vector<mipp::vector<B>>& H)\n+{\n+ auto k = (int)H.size();\n+ for (auto i = k-1 ; i > 0; i--)\n+ for (auto j = (i-1); j > -1; j--)\n+ if ( H[j][i] )\n+ std::transform (H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n+\n+}\n+\n+template <typename B>\n+void G_tools\n+::transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<int>& swapped)\n+{\n+ unsigned n = H[0].size();\n+ unsigned k = H.size();\n+\n+ for (unsigned i = 0; i < k; i++) // Kill of the Identity in H\n+ H[i].erase( H[i].begin(), H[i].begin() + k );\n+\n+ for (unsigned i = k; i < n; i++) // Add identity at the end\n+ {\n+ H.push_back(mipp::vector<B>(n-k,0));\n+ H[i][i-k] = 1;\n+ }\n+\n+ // Re-organization: column of G\n+ mipp::vector<B> tmp(n-k,0);\n+ for (unsigned l = (swapped.size() / 2); l > 0; l-- )\n+ {\n+ tmp = H[swapped[l*2-1]];\n+ H[swapped[l*2-1]] = H[swapped[(l-1)*2]];\n+ H[swapped[(l-1)*2]] = tmp;\n+ }\n+\n+ // Write G matrix in G vector\n+ for (unsigned j = 0; j < n-k; j++)\n+ for (unsigned i = 0; i < n; i++)\n+ G.push_back(H[i][j]);\n+}\n+\n+}\n+}\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Creation of tools 'G_tools' using in LDPC encoder and refacto
|
8,495 |
27.03.2017 18:19:33
| -7,200 |
de04e5bdff1a45556a4d9d7ab60d7eca2d973853
|
Typo on completions.sh.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -173,7 +173,6 @@ _aff3ct() {\ncase \"${prev}\" in\n# awaiting random number or strings\n-<<<<<<< HEAD\n--sim-snr-min | -m | --snr-min-max | -M | --sim-snr-min | -m | \\\n--snr-min-max | -M | --sim-snr-step | -s | --sim-stop-time | \\\n--sim-threads | -t | --sim-inter-lvl | --cde-info-bits | -K | \\\n@@ -186,22 +185,8 @@ _aff3ct() {\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n--sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n+ --itl-col | \\\n--dec-fnc-q | --dec-fnc-ite-m | --dec-fnc-ite-M | --dec-fnc-ite-s )\n-=======\n- --sim-snr-min | -m | --snr-min-max | -M | --sim-snr-min | -m | \\\n- --snr-min-max | -M | --sim-snr-step | -s | --sim-stop-time | \\\n- --sim-threads | -t | --sim-inter-lvl | --cde-info-bits | -K | \\\n- --cde-size | -N | \\\n- --mod-bps | --mod-ups | --mod-cpm-L | --mod-cpm-p | --mod-cpm-k | \\\n- --qnt-dec | --qnt-bits | --qnt-range | --qnt-type | \\\n- --sim-benchs | -b | --sim-debug-limit | \\\n- --mnt-max-fe | -e | \\\n- --sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n- --dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n- -L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n- --sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n- --itl-col)\n->>>>>>> scl_dev\nCOMPREPLY=()\n;;\n@@ -209,13 +194,8 @@ _aff3ct() {\n-v | --version | -h | --help | --dmod-no-sig2 | --term-no | \\\n--sim-benchs-no-ldst | -B | --sim-debug | -d | --sim-time-report | \\\n--cde-coset | -c | enc-no-buff | --enc-no-sys | --dec-no-synd | \\\n-<<<<<<< HEAD\n- --crc-rate | --mnt-err-trk | --mnt-err-trk-rev | \\\n- --dec-partial-adaptive | --dec-fnc | --dec-sc)\n-=======\n--crc-rate | --mnt-err-trk | --mnt-err-trk-rev | --itl-uni | \\\n- --dec-partial-adaptive)\n->>>>>>> scl_dev\n+ --dec-partial-adaptive | --dec-fnc | --dec-sc )\nCOMPREPLY=( $(compgen -W \"${opts}\" -- ${cur}) )\n;;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Typo on completions.sh.
|
8,490 |
27.03.2017 20:16:18
| -7,200 |
983c5ee1d17507b132c34d75f9f0bc60d8c92a15
|
Improve the errors management in the simulations.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -57,6 +57,7 @@ Launcher<B,R,Q>\nparams.simulation .snr_type = \"EB\";\nparams.simulation .seed = 0;\nparams.interleaver.seed = 0;\n+ params.interleaver.uniform = false;\nparams.code .tail_length = 0;\nparams.source .type = \"RAND\";\nparams.source .path = \"\";\n@@ -784,7 +785,17 @@ void Launcher<B,R,Q>\nif (params.simulation.mpi_rank == 0)\nthis->print_header();\n+\n+ try\n+ {\nsimu = this->build_simu();\n+ }\n+ catch (std::exception const& e)\n+ {\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"simulation.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\nif (simu != nullptr)\n{\n@@ -801,13 +812,15 @@ void Launcher<B,R,Q>\n}\ncatch (std::exception const& e)\n{\n- std::cerr << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when running the \")\n+ << bold_red(\"simulation.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n}\nif (params.simulation.mpi_rank == 0)\nstream << \"# End of the simulation.\" << std::endl;\n}\n-}\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Interleaver.hpp",
"new_path": "src/Module/Interleaver/Interleaver.hpp",
"diff": "@@ -153,6 +153,11 @@ public:\nreturn true;\n}\n+ bool operator!=(Interleaver_i<T> &interleaver) const\n+ {\n+ return !(*this == interleaver);\n+ }\n+\n/*!\n* \\brief Generates the interleaving and deinterleaving lookup tables. This method defines the interleaver and have\n* to be called in the constructor.\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Monitor.hpp",
"new_path": "src/Module/Monitor/Monitor.hpp",
"diff": "@@ -186,6 +186,15 @@ public:\nreturn Monitor_i<B,R>::over;\n}\n+ /*!\n+ * \\brief Put Monitor_i<B,R>::interrupt and Monitor_i<B,R>::over to true.\n+ */\n+ static void stop()\n+ {\n+ Monitor_i<B,R>::interrupt = true;\n+ Monitor_i<B,R>::over = true;\n+ }\n+\n////////////////////////////////////////////////////////////////////////////////////////////////////\n// The following public methods are specific to catch the bad frames and to dump them into files. //\n// The proposed default implementation do nothing. //\n@@ -274,7 +283,7 @@ private:\n{\nMonitor_i<B,R>::d_delta_interrupt = t_now - Monitor_i<B,R>::t_last_interrupt;\nif (Monitor_i<B,R>::d_delta_interrupt < std::chrono::milliseconds(500))\n- Monitor_i<B,R>::over = true;\n+ Monitor_i<B,R>::stop();\n}\nMonitor_i<B,R>::t_last_interrupt = t_now;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "#include <algorithm>\n#include <iostream>\n#include <fstream>\n+#include <exception>\n#ifdef ENABLE_MPI\n#include \"Module/Monitor/Standard/Monitor_reduction_mpi.hpp\"\n@@ -143,13 +144,16 @@ void Simulation_BFER<B,R,Q>\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1].join();\n- if (this->params.simulation.mpi_rank == 0 && !this->params.terminal.disabled && !this->params.simulation.benchs)\n+ if (this->params.simulation.mpi_rank == 0 &&\n+ !this->params.terminal.disabled &&\n+ !this->params.simulation.benchs &&\n+ terminal != nullptr)\n{\ntime_reduction(true);\nterminal->final_report(std::cout);\n}\n- if (this->params.monitor.err_track_enable)\n+ if (this->params.monitor.err_track_enable && monitor_red != nullptr)\nmonitor_red->dump_bad_frames(this->params.monitor.err_track_path, this->snr);\n}\n@@ -232,12 +236,15 @@ void Simulation_BFER<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::Monte_Carlo_method(Simulation_BFER<B,R,Q> *simu, const int tid)\n+{\n+ try\n{\nSimulation_BFER<B,R,Q>::build_communication_chain(simu, tid);\nif (tid == 0 && simu->params.simulation.mpi_rank == 0 &&\n(!simu->params.terminal.disabled && simu->snr == simu->params.simulation.snr_min &&\n- !(simu->params.simulation.debug && simu->params.simulation.n_threads == 1) && !simu->params.simulation.benchs))\n+ !(simu->params.simulation.debug && simu->params.simulation.n_threads == 1) &&\n+ !simu->params.simulation.benchs))\nsimu->terminal->legend(std::cout);\nif (simu->params.source.type == \"AZCW\")\n@@ -267,6 +274,8 @@ void Simulation_BFER<B,R,Q>\nsimu->barrier(tid);\n+ try\n+ {\nif (simu->params.simulation.n_threads == 1 && simu->params.simulation.debug)\nSimulation_BFER<B,R,Q>::simulation_loop_debug(simu);\nelse if (simu->params.simulation.benchs)\n@@ -274,6 +283,26 @@ void Simulation_BFER<B,R,Q>\nelse\nSimulation_BFER<B,R,Q>::simulation_loop(simu, tid);\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ if (tid == 0)\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ if (tid == 0)\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"communication chain.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/StarPU/SPU_Simulation_BFER.cpp",
"diff": "@@ -93,7 +93,7 @@ void Simulation_BFER<B,R,Q>\n// launch the master thread\nthis->Monte_Carlo_method();\n- if (!this->params.terminal.disabled)\n+ if (!this->params.terminal.disabled && this->terminal != nullptr)\nterminal->final_report(std::cout);\n}\n@@ -217,6 +217,8 @@ void Simulation_BFER<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::Monte_Carlo_method()\n+{\n+ try\n{\n// launch a group of slave threads (there is \"n_threads -1\" slave threads)\nstd::vector<std::thread> threads(this->params.simulation.n_threads -1);\n@@ -247,6 +249,8 @@ void Simulation_BFER<B,R,Q>\n// launch a thread dedicated to the terminal display\nterm_thread = std::thread(Simulation_BFER<B,R,Q>::terminal_temp_report, this);\n+ try\n+ {\n// Monte Carlo simulation\nwhile (!this->monitor_red->fe_limit_achieved())\n{\n@@ -255,6 +259,15 @@ void Simulation_BFER<B,R,Q>\nstarpu_task_wait_for_all();\n}\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\nif (!this->params.terminal.disabled && this->params.terminal.frequency != std::chrono::nanoseconds(0))\n{\n@@ -263,6 +276,15 @@ void Simulation_BFER<B,R,Q>\nterm_thread.join();\n}\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"communication chain.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp",
"diff": "@@ -63,7 +63,7 @@ void Simulation_BFER<B,R,Q>\n// launch the simulation\nthis->launch_simulation();\n- if (!this->params.terminal.disabled && !this->params.simulation.benchs)\n+ if (!this->params.terminal.disabled && this->terminal != nullptr)\nthis->terminal->final_report(std::cout);\n}\n@@ -75,7 +75,6 @@ void Simulation_BFER<B,R,Q>\nif (terminal != nullptr) { delete terminal; terminal = nullptr; }\n}\n-\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::build_communication_chain()\n@@ -117,6 +116,8 @@ void Simulation_BFER<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n::launch_simulation()\n+{\n+ try\n{\nthis->build_communication_chain();\n@@ -155,9 +156,20 @@ void Simulation_BFER<B,R,Q>\nif (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\nthis->dbg_R[4] = new SC_Debug<R>(\"Channel gains... \\nH_N: \\n\", dl, \"Debug_R4\");\n+ try\n+ {\nthis->bind_sockets_debug();\nsc_core::sc_start(); // start simulation\nthis->terminal->legend(std::cout);\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\nfor (auto i = 0; i < 6; i++)\nif (this->dbg_B[i] != nullptr)\n@@ -187,9 +199,20 @@ void Simulation_BFER<B,R,Q>\n// launch a thread dedicated to the terminal display\nterm_thread = std::thread(Simulation_BFER<B,R,Q>::terminal_temp_report, this);\n+ try\n+ {\nthis->bind_sockets();\nsc_core::sc_report_handler::set_actions(sc_core::SC_INFO, sc_core::SC_DO_NOTHING);\nsc_core::sc_start(); // start simulation\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\nif (!this->params.terminal.disabled && this->params.terminal.frequency != std::chrono::nanoseconds(0))\n{\n@@ -212,6 +235,15 @@ void Simulation_BFER<B,R,Q>\nsc_core::sc_curr_simcontext = new sc_core::sc_simcontext();\nsc_core::sc_default_global_context = sc_core::sc_curr_simcontext;\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"communication chain.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFER<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -145,13 +145,13 @@ void Simulation_BFERI<B,R,Q>\nfor (auto tid = 1; tid < this->params.simulation.n_threads; tid++)\nthreads[tid -1].join();\n- if (this->params.simulation.mpi_rank == 0 && !this->params.terminal.disabled)\n+ if (this->params.simulation.mpi_rank == 0 && !this->params.terminal.disabled && terminal != nullptr)\n{\ntime_reduction(true);\nterminal->final_report(std::cout);\n}\n- if (this->params.monitor.err_track_enable)\n+ if (this->params.monitor.err_track_enable && monitor_red != nullptr)\nmonitor_red->dump_bad_frames(this->params.monitor.err_track_path, this->snr, this->interleaver[0]->get_lookup_table());\n}\n@@ -236,6 +236,8 @@ void Simulation_BFERI<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFERI<B,R,Q>\n::Monte_Carlo_method(Simulation_BFERI<B,R,Q> *simu, const int tid)\n+{\n+ try\n{\nSimulation_BFERI<B,R,Q>::build_communication_chain(simu, tid);\n@@ -269,11 +271,33 @@ void Simulation_BFERI<B,R,Q>\nsimu->barrier(tid);\n+ try\n+ {\nif (simu->params.simulation.n_threads == 1 && simu->params.simulation.debug)\nSimulation_BFERI<B,R,Q>::simulation_loop_debug(simu);\nelse\nSimulation_BFERI<B,R,Q>::simulation_loop(simu, tid);\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ if (tid == 0)\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ if (tid == 0)\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"communication chain.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFERI<B,R,Q>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp",
"diff": "@@ -64,7 +64,7 @@ void Simulation_BFERI<B,R,Q>\n// launch the simulation\nthis->launch_simulation();\n- if (!this->params.terminal.disabled && !this->params.simulation.benchs)\n+ if (!this->params.terminal.disabled && terminal != nullptr)\nterminal->final_report(std::cout);\n}\n@@ -89,7 +89,7 @@ void Simulation_BFERI<B,R,Q>\nthis->interleaver_e->rename(\"Interleaver_e\");\nthis->coset_real_i ->rename(\"Coset_real_i\" );\n- if (*this->interleaver[0] != *this->interleaver_e);\n+ if (*this->interleaver[0] != *this->interleaver_e)\nthrow std::runtime_error(\"aff3ct::simulation::Simulation_BFERI: \\\"interleaver[0]\\\" and \\\"interleaver_e\\\" \"\n\"have to be equal.\");\n@@ -129,6 +129,8 @@ void Simulation_BFERI<B,R,Q>\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFERI<B,R,Q>\n::launch_simulation()\n+{\n+ try\n{\nthis->build_communication_chain();\n@@ -176,10 +178,21 @@ void Simulation_BFERI<B,R,Q>\nif (this->params.channel.type.find(\"RAYLEIGH\") != std::string::npos)\nthis->dbg_R[3] = new SC_Debug<R>(\"Channel gains... \\nH_N: \\n\", dl, \"Debug_R3\");\n+ try\n+ {\nthis->bind_sockets_debug();\nsc_core::sc_report_handler::set_actions(sc_core::SC_INFO, sc_core::SC_DO_NOTHING);\nsc_core::sc_start(); // start simulation\nthis->terminal->legend(std::cout);\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\nfor (auto i = 0; i < 6; i++)\nif (this->dbg_B[i] != nullptr)\n@@ -209,9 +222,20 @@ void Simulation_BFERI<B,R,Q>\n// launch a thread dedicated to the terminal display\nterm_thread = std::thread(Simulation_BFERI<B,R,Q>::terminal_temp_report, this);\n+ try\n+ {\nthis->bind_sockets();\nsc_core::sc_report_handler::set_actions(sc_core::SC_INFO, sc_core::SC_DO_NOTHING);\nsc_core::sc_start(); // start simulation\n+ }\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the simulation loop.\")\n+ << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\nif (!this->params.terminal.disabled && this->params.terminal.frequency != std::chrono::nanoseconds(0))\n{\n@@ -237,6 +261,15 @@ void Simulation_BFERI<B,R,Q>\nsc_core::sc_curr_simcontext = new sc_core::sc_simcontext();\nsc_core::sc_default_global_context = sc_core::sc_curr_simcontext;\n}\n+ catch (std::exception const& e)\n+ {\n+ Monitor<B,R>::stop();\n+\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered when building the \")\n+ << bold_red(\"communication chain.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+}\ntemplate <typename B, typename R, typename Q>\nvoid Simulation_BFERI<B,R,Q>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the errors management in the simulations.
|
8,490 |
27.03.2017 22:37:21
| -7,200 |
e141982269982a4f517b4dd8c4e0049eb5340cd0
|
Improve the errors management in the launchers and in the main.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"diff": "#include <iostream>\n-#include <cassert>\n#include <cmath>\n#include \"Tools/Display/bash_tools.h\"\n@@ -124,14 +123,8 @@ Simulation* Launcher_BFER_polar<B,R,Q>\n{\n// hack for K when there is a CRC\nif (!this->params.crc.type.empty())\n- {\n- assert(this->params.code.K > module::CRC_polynomial<B>::size(this->params.crc.type));\n-\nthis->params.code.K += module::CRC_polynomial<B>::size(this->params.crc.type);\n- assert(this->params.code.K <= this->params.code.N);\n- }\n-\nreturn new Simulation_BFER_polar<B,R,Q>(this->params);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp",
"new_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp",
"diff": "#include <iostream>\n-#include <cassert>\n#include <cmath>\n#include \"Tools/Display/bash_tools.h\"\n@@ -95,11 +94,6 @@ void Launcher_GEN_polar<B,R,Q>\nthis->params.code.N_code = this->ar.get_arg_int({\"cde-size\", \"N\"});\nthis->params.code.m = (int)std::ceil(std::log2(this->params.code.N));\n- if (this->params.code.K > this->params.code.N)\n- {\n- std::cerr << bold_red(\"(EE) K have to be smaller than N, exiting.\") << std::endl;\n- exit(EXIT_FAILURE);\n- }\nif(this->ar.exist_arg({\"cde-awgn-fb-path\" })) this->params.code.awgn_fb_path = this->ar.get_arg({\"cde-awgn-fb-path\" });\nif(this->ar.exist_arg({\"cde-fb-gen-method\"})) this->params.code.fb_gen_method = this->ar.get_arg({\"cde-fb-gen-method\"});\n@@ -132,12 +126,6 @@ std::vector<std::pair<std::string,std::string>> Launcher_GEN_polar<B,R,Q>\n{\nstd::vector<std::pair<std::string,std::string>> p;\n- if (this->params.code.N != std::exp2(std::ceil(std::log2(this->params.code.N))))\n- {\n- std::cerr << bold_red(\"(EE) N isn't a power of two.\") << std::endl;\n- std::exit(-1);\n- }\n-\np.push_back(std::make_pair(\"Type\", this->params.code.type ));\np.push_back(std::make_pair(\"Info. bits (K)\", std::to_string(this->params.code.K)));\np.push_back(std::make_pair(\"Codeword size (N)\", std::to_string(this->params.code.N)));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "#include <cmath>\n#include <chrono>\n-#include <cassert>\n#include <cstdlib>\n#include <sstream>\n#include <iostream>\n#include <algorithm>\n-#include <exception>\n+#include <stdexcept>\n#include <functional>\n#ifdef ENABLE_MPI\n@@ -325,7 +324,8 @@ void Launcher<B,R,Q>\nMPI_Allreduce(&max_n_threads_local, &max_n_threads_global, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);\n- assert(max_n_threads_global > 0);\n+ if (max_n_threads_global <= 0)\n+ throw std::invalid_argument(\"aff3ct::launcher::Launcher: \\\"max_n_threads_global\\\" has to be greater than 0.\");\n// ensure that all the MPI processes have a different seed (crucial for the Monte-Carlo method)\nparams.simulation.seed = max_n_threads_global * params.simulation.mpi_rank + params.simulation.seed;\n@@ -344,11 +344,6 @@ void Launcher<B,R,Q>\nparams.code.N = ar.get_arg_int({\"cde-size\", \"N\"}); // required\nparams.code.N_code = ar.get_arg_int({\"cde-size\", \"N\"});\nparams.code.m = (int)std::ceil(std::log2(params.code.N));\n- if (params.code.K > params.code.N)\n- {\n- std::cerr << bold_red(\"(EE) K have to be smaller than N, exiting.\") << std::endl;\n- std::exit(EXIT_FAILURE);\n- }\n// -------------------------------------------------------------------------------------------------------- source\nif(ar.exist_arg({\"src-type\"})) params.source.type = ar.get_arg({\"src-type\"});\n@@ -359,11 +354,9 @@ void Launcher<B,R,Q>\n// ----------------------------------------------------------------------------------------------------- modulator\nif(ar.exist_arg({\"mod-type\"})) params.modulator.type = ar.get_arg({\"mod-type\"});\nif (params.modulator.type == \"USR\" && !(ar.exist_arg({\"mod-const-path\"})))\n- {\n- std::cerr << bold_red(\"(EE) When USR modulation type is used, a path to a file containing the constellation\")\n- << bold_red(\"symbols must be given.\") << std::endl;\n- std::exit(EXIT_FAILURE);\n- }\n+ throw std::invalid_argument(\"aff3ct::launcher::Launcher: when USR modulation type is used, a path to a file \"\n+ \"containing the constellation symbols must be given.\");\n+\nif (params.modulator.type.find(\"BPSK\") != std::string::npos || params.modulator.type == \"PAM\")\nparams.modulator.complex = false;\n@@ -384,10 +377,7 @@ void Launcher<B,R,Q>\nparams.modulator.wave_shape = \"GMSK\";\n}\nelse\n- {\n- std::cerr << bold_red(\"(EE) Unknown CPM standard!\") << std::endl;\n- exit(-1);\n- }\n+ throw std::invalid_argument(\"aff3ct::launcher::Launcher: unknown CPM standard.\");\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/SystemC/SC_Simulation_BFER.cpp",
"diff": "@@ -121,8 +121,9 @@ void Simulation_BFER<B,R,Q>\n{\nthis->build_communication_chain();\n- if ((!this->params.terminal.disabled && this->snr == this->params.simulation.snr_min &&\n- !(this->params.simulation.debug && this->params.simulation.n_threads == 1) && !this->params.simulation.benchs))\n+ if (!this->params.terminal.disabled && this->snr == this->params.simulation.snr_min &&\n+ !(this->params.simulation.debug && this->params.simulation.n_threads == 1) &&\n+ !this->params.simulation.benchs)\nthis->terminal->legend(std::cout);\nthis->duplicator[0] = new SC_Duplicator(\"Duplicator0\");\n@@ -229,9 +230,9 @@ void Simulation_BFER<B,R,Q>\nthis->duplicator[i] = nullptr;\n}\n- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n- // /!\\ VERY DIRTY WAY TO CREATE A NEW SIMULATION CONTEXT IN SYSTEMC, BE CAREFUL THIS IS NOT IN THE STANDARD! /!\\ //\n- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////\n+ // /!\\ VERY DIRTY WAY TO CREATE A NEW SIMULATION CONTEXT IN SYSTEMC, BE CAREFUL THIS IS NOT IN THE STD! /!\\ //\n+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////\nsc_core::sc_curr_simcontext = new sc_core::sc_simcontext();\nsc_core::sc_default_global_context = sc_core::sc_curr_simcontext;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/SystemC/SC_Simulation_BFERI.cpp",
"diff": "@@ -134,8 +134,9 @@ void Simulation_BFERI<B,R,Q>\n{\nthis->build_communication_chain();\n- if ((!this->params.terminal.disabled && this->snr == this->params.simulation.snr_min &&\n- !(this->params.simulation.debug && this->params.simulation.n_threads == 1) && !this->params.simulation.benchs))\n+ if (!this->params.terminal.disabled && this->snr == this->params.simulation.snr_min &&\n+ !(this->params.simulation.debug && this->params.simulation.n_threads == 1) &&\n+ !this->params.simulation.benchs)\nthis->terminal->legend(std::cout);\nPredicate_ite p(this->params.demodulator.n_ite);\n@@ -255,9 +256,9 @@ void Simulation_BFERI<B,R,Q>\ndelete this->router; this->router = nullptr;\ndelete this->predicate; this->predicate = nullptr;\n- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n- // /!\\ VERY DIRTY WAY TO CREATE A NEW SIMULATION CONTEXT IN SYSTEMC, BE CAREFUL THIS IS NOT IN THE STANDARD! /!\\ //\n- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////\n+ // /!\\ VERY DIRTY WAY TO CREATE A NEW SIMULATION CONTEXT IN SYSTEMC, BE CAREFUL THIS IS NOT IN THE STD! /!\\ //\n+ //////////////////////////////////////////////////////////////////////////////////////////////////////////////\nsc_core::sc_curr_simcontext = new sc_core::sc_simcontext();\nsc_core::sc_default_global_context = sc_core::sc_curr_simcontext;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include <cstdlib>\n#include <iostream>\n+#include <exception>\n#include <map>\n#ifdef ENABLE_MPI\n@@ -207,6 +208,8 @@ Launcher<long long,double,double>* create_exit_simu<long long, double, double, d\ntemplate <typename B, typename R, typename Q, typename QD>\nvoid start_simu(const int argc, const char **argv, std::string code_type, std::string simu_type)\n+{\n+ try\n{\nLauncher<B,R,Q> *launcher = nullptr;\n@@ -274,6 +277,12 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\nlauncher->launch();\ndelete launcher;\n}\n+ catch (std::exception const& e)\n+ {\n+ std::cerr << bold_red(\"(EE) \") << bold_red(\"An issue was encountered during the launcher.\") << std::endl\n+ << bold_red(\"(EE) \") << bold_red(e.what()) << std::endl;\n+ }\n+}\n#ifndef SYSTEMC\nint main(int argc, char **argv)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the errors management in the launchers and in the main.
|
8,490 |
28.03.2017 08:57:18
| -7,200 |
3a4d7ec5fea6580d789fd5463a478c2590ccef85
|
Improve the argument reader.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -462,8 +462,12 @@ int Launcher<B,R,Q>\nreturn EXIT_FAILURE;\n}\n- if (!ar.check_arguments())\n+ std::string error;\n+ if (!ar.check_arguments(error))\n+ {\n+ std::cerr << bold_red(\"(EE) \" + error) << std::endl;\nreturn EXIT_FAILURE;\n+ }\nreturn 0;\n}\n@@ -794,7 +798,8 @@ void Launcher<B,R,Q>\nstream << \"# The simulation is running...\" << std::endl;\n// print the warnings\nif (params.simulation.mpi_rank == 0)\n- std::clog << bold_yellow(cmd_warn);\n+ for (auto w = 0; w < (int)cmd_warn.size(); w++)\n+ std::clog << bold_yellow(\"(WW) \" + cmd_warn[w]) << std::endl;\ntry\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.hpp",
"new_path": "src/Launcher/Launcher.hpp",
"diff": "@@ -41,7 +41,7 @@ private:\nstd::unordered_map<std::type_index,std::string> type_names; /*!< An internal map to store a string associated to a type. */\nsimulation::Simulation *simu; /*!< A generic simulation pointer to allocate a specific simulation. */\nstd::string cmd_line;\n- std::string cmd_warn;\n+ std::vector<std::string> cmd_warn;\nprotected:\ntools::Arguments_reader ar; /*!< An argument reader to manage the parsing and the documentation of the command line parameters. */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.cpp",
"new_path": "src/Tools/Arguments_reader.cpp",
"diff": "@@ -32,11 +32,12 @@ bool Arguments_reader\nconst map<vector<string>, vector<string>> &optional_args,\nconst bool display_warnings)\n{\n- string warns;\n+ std::vector<std::string> warns;\nconst bool result = parse_arguments(required_args, optional_args, warns);\nif (display_warnings)\n- std::clog << bold_yellow(warns);\n+ for (auto w = 0; w < (int)warns.size(); w++)\n+ std::clog << warns[w] << std::endl;\nreturn result;\n}\n@@ -44,7 +45,7 @@ bool Arguments_reader\nbool Arguments_reader\n::parse_arguments(const map<vector<string>, vector<string>> &required_args,\nconst map<vector<string>, vector<string>> &optional_args,\n- string &warnings)\n+ std::vector<std::string> &warnings)\n{\nunsigned short int n_req_arg = 0;\n@@ -63,10 +64,7 @@ bool Arguments_reader\n}\nvalid_arg = this->sub_parse_arguments(this->m_optional_args, i) || valid_arg;\nif (!valid_arg && this->m_argv[i][0] == '-')\n- {\n- warnings += string(\"(WW) Unknown argument \\\"\") + string(this->m_argv[i]) + string(\"\\\".\");\n- warnings += \"\\n\";\n- }\n+ warnings.push_back(\"Unknown argument \\\"\" + this->m_argv[i] + \"\\\".\");\n}\nreturn n_req_arg >= required_args.size();\n@@ -306,15 +304,15 @@ void Arguments_reader\n}\nbool Arguments_reader\n-::check_arguments()\n+::check_arguments(std::string &error)\n{\nauto success = true;\nfor (auto it = this->m_args.begin(); it != this->m_args.end(); ++it)\n{\nif (this->m_required_args.find(it->first) != this->m_required_args.end())\n- success = this->check_argument(it->first, this->m_required_args);\n+ success = this->check_argument(it->first, this->m_required_args, error);\nelse if (this->m_optional_args.find(it->first) != this->m_optional_args.end())\n- success = this->check_argument(it->first, this->m_optional_args);\n+ success = this->check_argument(it->first, this->m_optional_args, error);\nelse\nsuccess = false;\n@@ -326,7 +324,7 @@ bool Arguments_reader\n}\nbool Arguments_reader\n-::check_argument(const vector<string> &tags, map<vector<string>, vector<string>> &args)\n+::check_argument(const vector<string> &tags, map<vector<string>, vector<string>> &args, string &error)\n{\n// check if the input is positive\nif (args[tags][0] == \"positive_int\")\n@@ -334,8 +332,8 @@ bool Arguments_reader\nconst auto int_num = std::stoi(this->m_args[tags]);\nif (int_num < 0)\n{\n- cerr << bold_red(\"(EE) The \\\"\") << ((tags[0].length() == 1) ? bold_red(\"-\") : bold_red(\"--\"))\n- << bold_red(tags[0]) << bold_red(\"\\\" argument have to be positive, exiting.\") << endl;\n+ error = \"The \\\"\" + ((tags[0].length() == 1) ? string(\"-\") : string(\"--\")) + tags[0] +\n+ \"\\\" argument have to be positive.\";\nreturn false;\n}\n}\n@@ -346,8 +344,8 @@ bool Arguments_reader\nconst auto float_num = std::stof(this->m_args[tags]);\nif (float_num < 0.f)\n{\n- cerr << bold_red(\"(EE) The \\\"\") << ((tags[0].length() == 1) ? bold_red(\"-\") : bold_red(\"--\"))\n- << bold_red(tags[0]) << bold_red(\"\\\" argument have to be positive, exiting.\") << endl;\n+ error = \"The \\\"\" + ((tags[0].length() == 1) ? string(\"-\") : string(\"--\")) + tags[0] +\n+ \"\\\" argument have to be positive.\";\nreturn false;\n}\n}\n@@ -374,13 +372,14 @@ bool Arguments_reader\nset += entries[i] + \"|\";\nset += entries[entries.size() -1] + \">\";\n- cerr << bold_red(\"(EE) The \\\"\") << ((tags[0].length() == 1) ? bold_red(\"-\") : bold_red(\"--\"))\n- << bold_red(tags[0]) << bold_red(\"\\\" argument have to be in the \") << bold_red(set)\n- << bold_red(\" set, exiting.\") << endl;\n+ error = \"The \\\"\" + ((tags[0].length() == 1) ? string(\"-\") : string(\"--\")) + tags[0] +\n+ \"\\\" argument have to be in the \" + set + \" set.\";\n+\nreturn false;\n}\n}\n+ error = \"\";\nreturn true;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Arguments_reader.hpp",
"new_path": "src/Tools/Arguments_reader.hpp",
"diff": "@@ -70,7 +70,7 @@ public:\nbool parse_arguments(const std::map<std::vector<std::string>, std::vector<std::string>> &required_args,\nconst std::map<std::vector<std::string>, std::vector<std::string>> &optional_args,\n- std::string &warnings);\n+ std::vector<std::string> &warnings);\n/*!\n* \\brief Searches if the tags exist.\n@@ -150,9 +150,11 @@ public:\n/*!\n* \\brief Checks if the values from the command line respect the criteria given by required_args and optional_args.\n*\n+ * \\param error: error message.\n+ *\n* \\return true if the arguments criteria are respected, false otherwise.\n*/\n- bool check_arguments();\n+ bool check_arguments(std::string &error);\nprivate:\n/*!\n@@ -178,7 +180,8 @@ private:\n* \\return true if the argument criteria are respected, false otherwise.\n*/\nbool check_argument(const std::vector<std::string> &tags,\n- std::map<std::vector<std::string>, std::vector<std::string>> &args);\n+ std::map<std::vector<std::string>, std::vector<std::string>> &args,\n+ std::string &error);\n/*!\n* \\brief Clears m_required_args, m_optional_args and m_args.\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "@@ -158,9 +158,13 @@ void read_arguments(const int argc, const char** argv, std::string &code_type, s\nstd::exit(EXIT_FAILURE);\n}\n- if (!ar.check_arguments())\n+ std::string error;\n+ if (!ar.check_arguments(error))\n+ {\n+ std::cerr << bold_red(\"(EE) \" + error) << std::endl;\nstd::exit(EXIT_FAILURE);\n}\n+}\ntemplate <typename B, typename R, typename Q, typename QD>\nLauncher<B,R,Q>* create_exit_simu(const int argc, const char **argv, std::string code_type, std::string simu_type)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the argument reader.
|
8,490 |
28.03.2017 10:19:42
| -7,200 |
7172bc39d601806a5830db09a4fcfd7ea176f01a
|
Add new exceptions.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -353,9 +353,6 @@ void Launcher<B,R,Q>\n// ----------------------------------------------------------------------------------------------------- modulator\nif(ar.exist_arg({\"mod-type\"})) params.modulator.type = ar.get_arg({\"mod-type\"});\n- if (params.modulator.type == \"USR\" && !(ar.exist_arg({\"mod-const-path\"})))\n- throw std::invalid_argument(\"aff3ct::launcher::Launcher: when USR modulation type is used, a path to a file \"\n- \"containing the constellation symbols must be given.\");\nif (params.modulator.type.find(\"BPSK\") != std::string::npos || params.modulator.type == \"PAM\")\nparams.modulator.complex = false;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp",
"new_path": "src/Module/Channel/Additive/User/Channel_additive_user.cpp",
"diff": "@@ -10,6 +10,9 @@ Channel_additive_user<R>\n::Channel_additive_user(const int N, const std::string filename, const int n_frames, const std::string name)\n: Channel<R>(N, n_frames, name), noise(), noise_counter(0)\n{\n+ if (filename.empty())\n+ throw std::invalid_argument(\"aff3ct::module::Channel_additive_user: path to the file should not be empty.\");\n+\nstd::ifstream file(filename.c_str(), std::ios::binary);\nif (file.is_open())\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Channel/User/Channel_user.cpp",
"new_path": "src/Module/Channel/User/Channel_user.cpp",
"diff": "@@ -10,6 +10,9 @@ Channel_user<R>\n::Channel_user(const int N, const std::string filename, const int n_frames, const std::string name)\n: Channel<R>(N, n_frames, name), noise(), noise_counter(0)\n{\n+ if (filename.empty())\n+ throw std::invalid_argument(\"aff3ct::module::Channel_user: path to the file should not be empty.\");\n+\nstd::ifstream file(filename.c_str(), std::ios::binary);\nif (file.is_open())\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/User/Encoder_user.cpp",
"new_path": "src/Module/Encoder/User/Encoder_user.cpp",
"diff": "@@ -10,6 +10,9 @@ Encoder_user<B>\n::Encoder_user(const int K, const int N, const std::string filename, const int n_frames, const std::string name)\n: Encoder<B>(K, N, n_frames, name), codewords(), cw_counter(0)\n{\n+ if (filename.empty())\n+ throw std::invalid_argument(\"aff3ct::module::Encoder_user: path to the file should not be empty.\");\n+\nstd::ifstream file(filename.c_str(), std::ios::in);\nif (file.is_open())\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"new_path": "src/Module/Interleaver/User/Interleaver_user.hpp",
"diff": "@@ -19,7 +19,12 @@ private:\npublic:\nInterleaver_user(int size, const std::string filename, const std::string name = \"Interleaver_user\")\n- : Interleaver<T>(size, 1, name), filename(filename), call_counter(0) { gen_lookup_tables(); }\n+ : Interleaver<T>(size, 1, name), filename(filename), call_counter(0)\n+ {\n+ if (filename.empty())\n+ throw std::invalid_argument(\"aff3ct::module::Interleaver_user: path to the file should not be empty.\");\n+ gen_lookup_tables();\n+ }\nvoid gen_lookup_tables()\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/User/Modulator_user.hxx",
"new_path": "src/Module/Modulator/User/Modulator_user.hxx",
"diff": "@@ -26,6 +26,10 @@ Modulator_user<B,R,Q,MAX>\ndisable_sig2 (disable_sig2),\nconstellation ()\n{\n+ if (const_path.empty())\n+ throw std::invalid_argument(\"aff3ct::module::Modulator_user: path to the constellation file should not \"\n+ \"be empty.\");\n+\nif (this->bits_per_symbol % 2)\nthrow std::invalid_argument(\"aff3ct::module::Modulator_user: \\\"bits_per_symbol\\\" has to be a multiple of 2.\");\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Source/User/Source_user.cpp",
"new_path": "src/Module/Source/User/Source_user.cpp",
"diff": "@@ -10,6 +10,9 @@ Source_user<B>\n::Source_user(const int K, const std::string filename, const int n_frames, const std::string name)\n: Source<B>(K, n_frames, name), source(), src_counter(0)\n{\n+ if (filename.empty())\n+ throw std::invalid_argument(\"aff3ct::module::Source_user: path to the file should not be empty.\");\n+\nstd::ifstream file(filename.c_str(), std::ios::in);\nif (file.is_open())\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add new exceptions.
|
8,490 |
28.03.2017 10:19:59
| -7,200 |
0916c15afb11f3f91e983c854eb23f6f73f9936b
|
Fix puncturing in polar codes.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Polar/Simulation_BFER_polar.cpp",
"new_path": "src/Simulation/BFER/Code/Polar/Simulation_BFER_polar.cpp",
"diff": "@@ -62,7 +62,7 @@ void Simulation_BFER_polar<B,R,Q>\nfb_generator->generate(frozen_bits);\nif (this->params.code.N != this->params.code.N_code)\n{\n- Puncturer_polar_wangliu<B,Q> punct(this->params.code.N, this->params.code.K, *fb_generator);\n+ Puncturer_polar_wangliu<B,Q> punct(this->params.code.K, this->params.code.N, *fb_generator);\npunct.gen_frozen_bits(frozen_bits);\n}\n}\n@@ -83,7 +83,7 @@ void Simulation_BFER_polar<B,R,Q>\nif (this->params.code.N != this->params.code.N_code)\n{\n- Puncturer_polar_wangliu<B,Q> punct(this->params.code.N, this->params.code.K, *fb_generator);\n+ Puncturer_polar_wangliu<B,Q> punct(this->params.code.K, this->params.code.N, *fb_generator);\npunct.gen_frozen_bits(frozen_bits);\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix puncturing in polar codes.
|
8,490 |
28.03.2017 11:03:45
| -7,200 |
fa7cc83918266436dcf2109626d4c91506b6d9ee
|
Cosmetics + renaming + fix compilation warnings.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Math/matrix.h\"\n-#include \"Tools/Code/LDPC/G_tools/G_tools.hpp\"\n+#include \"Tools/Code/LDPC/G/LDPC_G.hpp\"\n#include \"Encoder_LDPC_from_H.hpp\"\nusing namespace aff3ct;\nusing namespace module;\n-\ntemplate <typename B>\nEncoder_LDPC_from_H<B>\n::Encoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames,\n@@ -22,12 +21,12 @@ Encoder_LDPC_from_H<B>\n: Encoder_LDPC<B>(K, N, n_frames, name)\n{\nstd::vector<mipp::vector<B>> H;\n- tools::G_tools::build_H(alist_H.get_n_CN(), alist_H.get_n_VN(), alist_H.get_CN_to_VN(), H);\n- tools::G_tools::triangularization_H(H, swapped);\n+ tools::LDPC_G::build_H(alist_H.get_n_CN(), alist_H.get_n_VN(), alist_H.get_CN_to_VN(), H);\n+ tools::LDPC_G::triangularization_H(H, swapped);\nassert((int) H[0].size() == N);\nassert((int)(H[0].size() - H.size()) == K);\n- tools::G_tools::identity_H(H);\n- tools::G_tools::transformation_H_to_G(H, G, swapped);\n+ tools::LDPC_G::identity_H(H);\n+ tools::LDPC_G::transformation_H_to_G(H, G, swapped);\ntools::real_transpose(K, N, G, this->tG);\n}\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Code/LDPC/G_tools/G_tools.hpp",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hpp",
"diff": "-#ifndef G_TOOLS_HPP_\n-#define G_TOOLS_HPP_\n+#ifndef LDPC_G_HPP_\n+#define LDPC_G_HPP_\n#include <fstream>\n#include <vector>\n@@ -9,7 +9,7 @@ namespace aff3ct\n{\nnamespace tools\n{\n-struct G_tools\n+struct LDPC_G\n{\npublic:\ntemplate <typename B>\n@@ -25,6 +25,6 @@ public:\n}\n}\n-#include \"G_tools.hxx\"\n+#include \"LDPC_G.hxx\"\n#endif /*G_TOOLS_HPP_ */\n"
},
{
"change_type": "RENAME",
"old_path": "src/Tools/Code/LDPC/G_tools/G_tools.hxx",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"diff": "#include \"Tools/Display/bash_tools.h\"\n-#include \"G_tools.hpp\"\n+#include \"LDPC_G.hpp\"\nusing namespace aff3ct::tools;\n@@ -14,25 +14,25 @@ namespace aff3ct\nnamespace tools\n{\ntemplate <typename B>\n-void G_tools\n+void LDPC_G\n::build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\nstd::vector<mipp::vector<B>>& H)\n{\nfor (int i = 0; i < k; i++)\nH.push_back(mipp::vector<B>(n, 0));\n- for (unsigned int i = 0; i < positions.size(); i++)\n- for(unsigned int j = 0; j < positions[i].size(); j++)\n+ for (unsigned i = 0; i < positions.size(); i++)\n+ for (unsigned j = 0; j < positions[i].size(); j++)\nH[i][positions[i][j]] = 1;\n}\ntemplate <typename B>\n-void G_tools\n+void LDPC_G\n::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped)\n{\n- unsigned n = H[0].size();\n- unsigned k = H.size();\n- unsigned i = 0;\n+ int n = (int)H[0].size();\n+ int k = (int)H.size();\n+ int i = 0;\nbool fund = false;\nmipp::vector<B> tmp(n,0);\n@@ -42,13 +42,13 @@ void G_tools\n{\nif (H[i][i])\n{\n- for (int j = (i+1); j < k; j++)\n+ for (int j = i +1; j < k; j++)\nif( H[j][i] )\nstd::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n}\nelse\n{\n- for (int j = (i+1); j < k; j++) // find an other row which is good\n+ for (int j = i +1; j < k; j++) // find an other row which is good\nif (H[j][i])\n{\ntmp = H[i];\n@@ -60,7 +60,7 @@ void G_tools\n}\nif (!fund) // if does not fund\n- for (int j = (i+1); j<n; j++) // find an other column which is good\n+ for (int j = i +1; j < n; j++) // find an other column which is good\nif (H[i][j])\n{\nswapped.push_back(i);\n@@ -90,19 +90,19 @@ void G_tools\n}\ntemplate <typename B>\n-void G_tools\n+void LDPC_G\n::identity_H(std::vector<mipp::vector<B>>& H)\n{\nauto k = (int)H.size();\nfor (auto i = k -1 ; i > 0; i--)\n- for (auto j = (i-1); j > -1; j--)\n+ for (auto j = i -1; j > -1; j--)\nif (H[j][i])\nstd::transform (H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n}\ntemplate <typename B>\n-void G_tools\n+void LDPC_G\n::transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<int>& swapped)\n{\nunsigned n = H[0].size();\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Cosmetics + renaming + fix compilation warnings.
|
8,490 |
28.03.2017 11:50:25
| -7,200 |
ab030915d21a2ddab3fcb4548ef6e5a78c80a5db
|
Update aff3ct.hpp header file.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "#include <Tools/Factory/Factory_encoder_common.hpp>\n#include <Tools/Factory/Repetition/Factory_decoder_repetition.hpp>\n#include <Tools/Factory/Repetition/Factory_encoder_repetition.hpp>\n+#include <Tools/Factory/LDPC/Factory_encoder_LDPC.hpp>\n#include <Tools/Factory/LDPC/Factory_decoder_LDPC.hpp>\n#include <Tools/Factory/Coset/Factory_coset_real.hpp>\n#include <Tools/Factory/Coset/Factory_coset_bit.hpp>\n#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_file.hpp>\n#include <Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator_TV.hpp>\n#include <Tools/Code/Polar/Pattern_parser_polar.hpp>\n+#include <Tools/Code/LDPC/G/LDPC_G.hpp>\n#include <Tools/Code/LDPC/AList_reader/AList_reader.hpp>\n#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_NO.hpp>\n#include <Tools/Code/Turbo/Scaling_factor/Scaling_factor_constant.hpp>\n#include <Module/Encoder/SC_Encoder.hpp>\n#include <Module/Encoder/SPU_Encoder.hpp>\n#include <Module/Encoder/Repetition/Encoder_repetition_sys.hpp>\n+#include <Module/Encoder/LDPC/Encoder_LDPC.hpp>\n+#include <Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp>\n+#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp>\n+#include <Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2_constants.hpp>\n#include <Module/Encoder/Coset/Encoder_coset.hpp>\n#include <Module/Encoder/User/Encoder_user.hpp>\n#include <Module/Encoder/Encoder.hpp>\n#include <Simulation/BFERI/Code/RSC/Simulation_BFERI_RSC.hpp>\n#include <Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.hpp>\n#include <Simulation/BFERI/Code/Uncoded/Simulation_BFERI_uncoded.hpp>\n-// #includrc/aff3ct.hpp>\n+// #include <aff3ct.hpp>\n#include <Generator/Polar/SC/Generator_polar_SC_sys.hpp>\n#include <Generator/Generator.hpp>\n\\ No newline at end of file\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update aff3ct.hpp header file.
|
8,490 |
28.03.2017 13:48:31
| -7,200 |
3c350abaae7344f61ea39e5515e980da5c971eba
|
Update the aff3ct.hpp file.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n#include <Tools/Threads/Barrier.hpp>\n+#include <Tools/Math/Galois.hpp>\n#include <Tools/Factory/Factory_monitor.hpp>\n#include <Tools/Factory/Polar/Factory_decoder_polar_gen.hpp>\n#include <Tools/Factory/Polar/Factory_decoder_polar.hpp>\n#include <Tools/Factory/LDPC/Factory_decoder_LDPC.hpp>\n#include <Tools/Factory/Coset/Factory_coset_real.hpp>\n#include <Tools/Factory/Coset/Factory_coset_bit.hpp>\n+#include <Tools/Factory/BCH/Factory_encoder_BCH.hpp>\n+#include <Tools/Factory/BCH/Factory_decoder_BCH.hpp>\n#include <Tools/Factory/Factory_CRC.hpp>\n#include <Tools/Factory/Factory_source.hpp>\n#include <Tools/Factory/Factory_modulator.hpp>\n#include <Module/Encoder/Repetition/Encoder_repetition_sys.hpp>\n#include <Module/Encoder/Coset/Encoder_coset.hpp>\n#include <Module/Encoder/User/Encoder_user.hpp>\n+#include <Module/Encoder/BCH/Encoder_BCH.hpp>\n#include <Module/Encoder/Encoder.hpp>\n#include <Module/Encoder/NO/Encoder_NO.hpp>\n#include <Module/Encoder/RA/Encoder_RA.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.hpp>\n#include <Module/Decoder/LDPC/BP/Flooding/Decoder_LDPC_BP_flooding.hpp>\n+#include <Module/Decoder/BCH/Decoder_BCH.hpp>\n#include <Module/Decoder/Decoder_SISO.hpp>\n#include <Module/Decoder/NO/Decoder_NO.hpp>\n#include <Module/Decoder/RA/Decoder_RA.hpp>\n#include <Launcher/BFER/Repetition/Launcher_BFER_repetition.hpp>\n#include <Launcher/BFER/LDPC/Launcher_BFER_LDPC.hpp>\n#include <Launcher/BFER/Uncoded/Launcher_BFER_uncoded.hpp>\n+#include <Launcher/BFER/BCH/Launcher_BFER_BCH.hpp>\n#include <Launcher/BFER/RA/Launcher_BFER_RA.hpp>\n#include <Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp>\n#include <Launcher/BFERI/Launcher_BFERI.hpp>\n#include <Simulation/BFER/Code/Repetition/Simulation_BFER_repetition.hpp>\n#include <Simulation/BFER/Code/LDPC/Simulation_BFER_LDPC.hpp>\n#include <Simulation/BFER/Code/Uncoded/Simulation_BFER_uncoded.hpp>\n+#include <Simulation/BFER/Code/BCH/Simulation_BFER_BCH.hpp>\n#include <Simulation/BFER/Code/RA/Simulation_BFER_RA.hpp>\n#include <Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.hpp>\n#include <Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp>\n#include <Simulation/BFERI/Code/RSC/Simulation_BFERI_RSC.hpp>\n#include <Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.hpp>\n#include <Simulation/BFERI/Code/Uncoded/Simulation_BFERI_uncoded.hpp>\n-// #includrc/aff3ct.hpp>\n+// #include <aff3ct.hpp>\n#include <Generator/Polar/SC/Generator_polar_SC_sys.hpp>\n#include <Generator/Generator.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the aff3ct.hpp file.
|
8,490 |
28.03.2017 21:31:11
| -7,200 |
e7be2f9b189f516756ff8b58b559344b13dc74b3
|
Add exceptions in the bit packer.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Algo/Bit_packer.hpp",
"new_path": "src/Tools/Algo/Bit_packer.hpp",
"diff": "#define BIT_PACKER_HPP_\n#include <cmath>\n+#include <stdexcept>\n#include \"Tools/Perf/MIPP/mipp.h\"\n@@ -36,9 +37,14 @@ struct Bit_packer\nstatic inline void pack(const mipp::vector<B> &vec_in, mipp::vector<B> &vec_out, const int n_frames = 1,\nconst bool rev = false)\n{\n- assert((int)vec_out.size() >= static_cast<int>(std::ceil((float)vec_in.size() / (sizeof(B) * 8.f))));\n- assert(n_frames > 0);\n- assert(vec_in.size() % n_frames == 0);\n+ if (n_frames <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ if (vec_in.size() % n_frames)\n+ throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_in.size()\\\" has to be divisible by \"\n+ \"\\\"n_frame\\\".\");\n+ if ((int)vec_out.size() < (int)(std::ceil((float)vec_in.size() / (sizeof(B) * 8.f))))\n+ throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_out.size()\\\" has to be equal or greater than \"\n+ \"\\\"ceil(vec_in.size() / (sizeof(B) * 8.f))\\\".\");\nconst auto n_bits_per_frame = static_cast<int>(vec_in.size() / n_frames);\nconst auto n_bytes_per_frame = static_cast<int>(std::ceil((float)n_bits_per_frame / 8.f));\n@@ -60,8 +66,11 @@ struct Bit_packer\n*/\nstatic inline void pack(mipp::vector<B> &vec, const int n_frames = 1, const bool rev = false)\n{\n- assert(n_frames > 0);\n- assert(vec.size() % n_frames == 0);\n+ if (n_frames <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ if (vec.size() % n_frames)\n+ throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec.size()\\\" has to be divisible by \"\n+ \"\\\"n_frame\\\".\");\nconst auto n_bits_per_frame = static_cast<int>(vec.size() / n_frames);\nconst auto n_bytes_per_frame = static_cast<int>(std::ceil((float)n_bits_per_frame / 8.f));\n@@ -85,9 +94,14 @@ struct Bit_packer\nstatic inline void unpack(const mipp::vector<B> &vec_in, mipp::vector<B> &vec_out, const int n_frames = 1,\nconst bool rev = false)\n{\n- assert(vec_in.size() >= static_cast<int>(std::ceil((float)vec_out.size() / (sizeof(B) * 8.f))));\n- assert(n_frames > 0);\n- assert(vec_out.size() % n_frames == 0);\n+ if (n_frames <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ if (vec_out.size() % n_frames)\n+ throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_out.size()\\\" has to be divisible by \"\n+ \"\\\"n_frame\\\".\");\n+ if ((int)vec_in.size() < (int)(std::ceil((float)vec_out.size() / (sizeof(B) * 8.f))))\n+ throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec_in.size()\\\" has to be equal or greater than \"\n+ \"\\\"ceil(vec_out.size() / (sizeof(B) * 8.f))\\\".\");\nconst auto n_bits_per_frame = static_cast<int>(vec_out.size() / n_frames);\nconst auto n_bytes_per_frame = static_cast<int>(std::ceil((float)n_bits_per_frame / 8.f));\n@@ -109,8 +123,11 @@ struct Bit_packer\n*/\nstatic inline void unpack(mipp::vector<B> &vec, const int n_frames = 1, bool rev = false)\n{\n- assert(n_frames > 0);\n- assert(vec.size() % n_frames == 0);\n+ if (n_frames <= 0)\n+ throw std::invalid_argument(\"aff3ct::tools::Bit_packer: \\\"n_frames\\\" has to be greater than 0.\");\n+ if (vec.size() % n_frames)\n+ throw std::length_error(\"aff3ct::tools::Bit_packer: \\\"vec.size()\\\" has to be divisible by \"\n+ \"\\\"n_frame\\\".\");\nconst auto n_bits_per_frame = static_cast<int>(vec.size() / n_frames);\nconst auto n_bytes_per_frame = static_cast<int>(std::ceil((float)n_bits_per_frame / 8.f));\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add exceptions in the bit packer.
|
8,490 |
28.03.2017 22:24:17
| -7,200 |
0bb7516e427aeac48ac9b49fd36d4eab1501a899
|
Fix bench mode.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder.hpp",
"new_path": "src/Module/Decoder/Decoder.hpp",
"diff": "@@ -108,9 +108,9 @@ public:\nthrow std::length_error(\"aff3ct::module::Decoder: \\\"Y_N.size()\\\" has to be equal to \"\n\"\\\"N\\\" * \\\"n_frames\\\".\");\n- if (this->K * this->n_frames != (int)V_K.size())\n- throw std::length_error(\"aff3ct::module::Decoder: \\\"V_K.size()\\\" has to be equal to \"\n- \"\\\"K\\\" * \\\"n_frames\\\".\");\n+ if (this->N * this->n_frames < (int)V_K.size())\n+ throw std::length_error(\"aff3ct::module::Decoder: \\\"V_K.size()\\\" has to be equal or smaller than \"\n+ \"\\\"N\\\" * \\\"n_frames\\\".\");\nusing namespace std::chrono;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bench mode.
|
8,490 |
31.03.2017 12:42:04
| -7,200 |
7cf1a7e19dcd1bc527584d42f1bf70c6fcfb97a0
|
Fix the frozen bits extraction in systematic (SC, SCL and ASCL decoders).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_MEM_fast_CA_sys.hxx",
"diff": "@@ -11,7 +11,7 @@ Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, true, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nif (!tools::is_power_of_2(this->N))\n@@ -34,7 +34,7 @@ Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, true, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nif (!tools::is_power_of_2(this->N))\n@@ -65,7 +65,8 @@ void Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\nsc_decoder._hard_decode();\n// check the CRC\n- auto crc_decode_result = this->crc_check(sc_decoder.s);\n+ sc_decoder._store(this->U_test);\n+ auto crc_decode_result = this->crc.check(this->U_test, this->get_simd_inter_frame_level());\n// delete the path if the CRC result is negative\nif (!crc_decode_result && L_max > 1)\n@@ -96,8 +97,10 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_ASCL_MEM_fast_CA_sys<B,R,API_polar>\n::_store(mipp::vector<B>& V_K) const\n{\n- if (this->L == 1) sc_decoder. _store(V_K);\n- else Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>::_store(V_K);\n+ if (this->L == 1)\n+ std::copy(this->U_test.begin(), this->U_test.begin() + this->K, V_K.begin());\n+ else\n+ Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>::_store(V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/ASCL/Decoder_polar_ASCL_fast_CA_sys.hxx",
"diff": "@@ -11,7 +11,7 @@ Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_ASCL_fast_CA_sys(const int& K, const int& N, const int& L_max, const mipp::vector<B>& frozen_bits,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, true, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nif (!tools::is_power_of_2(this->N))\n@@ -33,7 +33,7 @@ Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nCRC<B>& crc, const bool is_full_adaptive, const int n_frames, const std::string name)\n: Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>(K, N, L_max, frozen_bits, polar_patterns, idx_r0, idx_r1, crc, n_frames, name),\n- sc_decoder (K, N , frozen_bits, n_frames, true, name),\n+ sc_decoder (K, N , frozen_bits, n_frames, name),\nL_max(L_max), is_full_adaptive(is_full_adaptive)\n{\nif (!tools::is_power_of_2(this->N))\n@@ -63,7 +63,8 @@ void Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\nsc_decoder._hard_decode();\n// check the CRC\n- auto crc_decode_result = this->crc.check(sc_decoder.sk, this->get_simd_inter_frame_level());\n+ sc_decoder._store(this->U_test);\n+ auto crc_decode_result = this->crc.check(this->U_test, this->get_simd_inter_frame_level());\n// delete the path if the CRC result is negative\nif (!crc_decode_result && L_max > 1)\n@@ -94,8 +95,10 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_ASCL_fast_CA_sys<B,R,API_polar>\n::_store(mipp::vector<B>& V_K) const\n{\n- if (this->L == 1) sc_decoder. _store(V_K);\n- else Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>::_store(V_K);\n+ if (this->L == 1)\n+ std::copy(this->U_test.begin(), this->U_test.begin() + this->K, V_K.begin());\n+ else\n+ Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>::_store(V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"diff": "@@ -38,22 +38,17 @@ protected:\nmipp::vector<B> s; // bits, partial sums\nmipp::vector<B> s_bis; // bits, partial sums\nconst mipp::vector<B> &frozen_bits; // frozen bits\n- const bool k_extract;\n- mipp::vector<B> sk; // K decoded bits\n- int sk_idx;\nconst tools::Pattern_polar_parser<B> polar_patterns;\npublic:\nDecoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\n- const int n_frames = 1, const bool k_extract = false,\n- const std::string name = \"Decoder_polar_SC_fast_sys\");\n+ const int n_frames = 1, const std::string name = \"Decoder_polar_SC_fast_sys\");\nDecoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- const int n_frames = 1, const bool k_extract = false,\n- const std::string name = \"Decoder_polar_SC_fast_sys\");\n+ const int n_frames = 1, const std::string name = \"Decoder_polar_SC_fast_sys\");\nvirtual ~Decoder_polar_SC_fast_sys();\n@@ -65,6 +60,10 @@ protected:\nvoid _unpack ( mipp::vector<B>& V_N) const;\nvirtual void recursive_decode(const int off_l, const int off_s, const int reverse_depth, int &node_id);\n+\n+ inline static void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n+ const mipp::vector<B> &V_N,\n+ mipp::vector<B> &V_K);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "#include \"Tools/Perf/Reorderer/Reorderer.hpp\"\n#include \"Tools/Perf/Transpose/transpose_selector.h\"\n+#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n#include \"Decoder_polar_SC_fast_sys.hpp\"\n@@ -26,8 +27,7 @@ template <typename B, typename R, class API_polar, int REV_D>\nstruct Decoder_polar_SC_fast_sys_static\n{\nstatic void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s,\n- mipp::vector<R> &l, const int off_l, const int off_s, int &node_id,\n- const bool k_extract, mipp::vector<B> &sk, int &sk_idx)\n+ mipp::vector<R> &l, const int off_l, const int off_s, int &node_id)\n{\nconstexpr int reverse_depth = REV_D;\nconstexpr int n_elmts = 1 << reverse_depth;\n@@ -52,7 +52,7 @@ struct Decoder_polar_SC_fast_sys_static\n}\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,REV_D-1>\n- ::decode(polar_patterns, s, l, off_l + n_elmts, off_s, ++node_id, k_extract, sk, sk_idx); // recursive call left\n+ ::decode(polar_patterns, s, l, off_l + n_elmts, off_s, ++node_id); // recursive call left\n// g\nswitch (node_type)\n@@ -65,7 +65,7 @@ struct Decoder_polar_SC_fast_sys_static\n}\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,REV_D-1>\n- ::decode(polar_patterns, s, l, off_l + n_elmts, off_s + n_elm_2, ++node_id, k_extract, sk, sk_idx); // recursive call right\n+ ::decode(polar_patterns, s, l, off_l + n_elmts, off_s + n_elm_2, ++node_id); // recursive call right\n// xor\nswitch (node_type)\n@@ -82,43 +82,11 @@ struct Decoder_polar_SC_fast_sys_static\n// h\nswitch (node_type)\n{\n- case tools::RATE_0:\n- // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n- API_polar::template h0<n_elmts>(s, off_s, n_elmts);\n- break;\n- case tools::RATE_1:\n- API_polar::template h<n_elmts>(s, l, off_l, off_s, n_elmts);\n- if (k_extract)\n- {\n- std::copy(s.begin() + off_s * API_polar::get_n_frames(),\n- s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n- sk.begin() + sk_idx);\n-\n- sk_idx += n_elmts * API_polar::get_n_frames();\n- }\n- break;\n- case tools::REP:\n- API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts);\n- if (k_extract)\n- {\n- std::copy(s.begin() + (off_s + n_elmts -2) * API_polar::get_n_frames(),\n- s.begin() + (off_s + n_elmts +0) * API_polar::get_n_frames(),\n- sk.begin() + sk_idx);\n-\n- sk_idx += API_polar::get_n_frames();\n- }\n- break;\n- case tools::SPC:\n- API_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts);\n- if (k_extract)\n- {\n- std::copy(s.begin() + (off_s + 1 ) * API_polar::get_n_frames(),\n- s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n- sk.begin() + sk_idx);\n-\n- sk_idx += (n_elmts -1) * API_polar::get_n_frames();\n- }\n- break;\n+ case tools::RATE_0: // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n+ API_polar::template h0 <n_elmts>(s, off_s, n_elmts); break;\n+ case tools::RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\n+ case tools::REP: API_polar::template rep<n_elmts>(s, l, off_l, off_s, n_elmts); break;\n+ case tools::SPC: API_polar::template spc<n_elmts>(s, l, off_l, off_s, n_elmts); break;\ndefault:\nbreak;\n}\n@@ -130,8 +98,7 @@ template <typename B, typename R, class API_polar>\nstruct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\n{\nstatic void decode(const tools::Pattern_polar_parser<B> &polar_patterns, mipp::vector<B> &s, mipp::vector<R> &l,\n- const int off_l, const int off_s, int &node_id,\n- const bool k_extract, mipp::vector<B> &sk, int &sk_idx)\n+ const int off_l, const int off_s, int &node_id)\n{\nconstexpr int reverse_depth = 0;\nconstexpr int n_elmts = 1 << reverse_depth;\n@@ -140,21 +107,9 @@ struct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\nswitch (node_t)\n{\n- case tools::RATE_0:\n- // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, 1))\n- API_polar::template h0<n_elmts>(s, off_s, n_elmts);\n- break;\n- case tools::RATE_1:\n- API_polar::template h<n_elmts>(s, l, off_l, off_s, n_elmts);\n- if (k_extract)\n- {\n- std::copy(s.begin() + off_s * API_polar::get_n_frames(),\n- s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n- sk.begin() + sk_idx);\n-\n- sk_idx += n_elmts * API_polar::get_n_frames();\n- }\n- break;\n+ case tools::RATE_0: // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, 1))\n+ API_polar::template h0<n_elmts>(s, off_s, n_elmts); break;\n+ case tools::RATE_1: API_polar::template h <n_elmts>(s, l, off_l, off_s, n_elmts); break;\ndefault:\nbreak;\n}\n@@ -164,16 +119,13 @@ struct Decoder_polar_SC_fast_sys_static<B,R,API_polar,0>\ntemplate <typename B, typename R, class API_polar>\nDecoder_polar_SC_fast_sys<B,R,API_polar>\n::Decoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits, const int n_frames,\n- const bool k_extract, const std::string name)\n+ const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\nm ((int)std::log2(N)),\nl (2 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<R>()),\ns (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\ns_bis (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\nfrozen_bits (frozen_bits),\n- k_extract (k_extract),\n- sk (1 * K * this->simd_inter_frame_level),\n- sk_idx (0),\npolar_patterns(N,\nfrozen_bits,\n{new tools::Pattern_polar_std,\n@@ -203,16 +155,13 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\n::Decoder_polar_SC_fast_sys(const int& K, const int& N, const mipp::vector<B>& frozen_bits,\nconst std::vector<tools::Pattern_polar_i*> polar_patterns,\nconst int idx_r0, const int idx_r1,\n- const int n_frames, const bool k_extract, const std::string name)\n+ const int n_frames, const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\nm ((int)std::log2(N)),\nl (2 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<R>()),\ns (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\ns_bis (1 * N * this->simd_inter_frame_level + mipp::nElmtsPerRegister<B>()),\nfrozen_bits (frozen_bits),\n- k_extract (k_extract),\n- sk (1 * K * this->simd_inter_frame_level),\n- sk_idx (0),\npolar_patterns(N, frozen_bits, polar_patterns, idx_r0, idx_r1)\n{\nstatic_assert(sizeof(B) == sizeof(R), \"\");\n@@ -256,8 +205,6 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\ntools::Reorderer_static<R,n_frames>::apply(frames, l.data(), this->N);\n}\n}\n-\n- sk_idx = 0;\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -280,7 +227,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n{\n// use the static version of the decoder\nDecoder_polar_SC_fast_sys_static<B,R,API_polar,static_level>\n- ::decode(polar_patterns, this->s, this->l, off_l, off_s, node_id, k_extract, this->sk, sk_idx);\n+ ::decode(polar_patterns, this->s, this->l, off_l, off_s, node_id);\n}\nelse\n{\n@@ -333,43 +280,11 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n// h\nswitch (node_type)\n{\n- case tools::RATE_0:\n- // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n- API_polar::h0(s, off_s, n_elmts);\n- break;\n- case tools::RATE_1:\n- API_polar::h(s, l, off_l, off_s, n_elmts);\n- if (k_extract)\n- {\n- std::copy(s.begin() + off_s * API_polar::get_n_frames(),\n- s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n- sk.begin() + sk_idx);\n-\n- sk_idx += n_elmts * API_polar::get_n_frames();\n- }\n- break;\n- case tools::REP:\n- API_polar::rep(s, l, off_l, off_s, n_elmts);\n- if (k_extract)\n- {\n- std::copy(s.begin() + (off_s + n_elmts -2) * API_polar::get_n_frames(),\n- s.begin() + (off_s + n_elmts +0) * API_polar::get_n_frames(),\n- sk.begin() + sk_idx);\n-\n- sk_idx += API_polar::get_n_frames();\n- }\n- break;\n- case tools::SPC:\n- API_polar::spc(s, l, off_l, off_s, n_elmts);\n- if (k_extract)\n- {\n- std::copy(s.begin() + (off_s + 1 ) * API_polar::get_n_frames(),\n- s.begin() + (off_s + n_elmts) * API_polar::get_n_frames(),\n- sk.begin() + sk_idx);\n-\n- sk_idx += (n_elmts -1) * API_polar::get_n_frames();\n- }\n- break;\n+ case tools::RATE_0: // if (!polar_patterns.exist_node_type(tools::polar_node_t::RATE_0_LEFT, REV_D+1))\n+ API_polar::h0 (s, off_s, n_elmts); break;\n+ case tools::RATE_1: API_polar::h (s, l, off_l, off_s, n_elmts); break;\n+ case tools::REP: API_polar::rep(s, l, off_l, off_s, n_elmts); break;\n+ case tools::SPC: API_polar::spc(s, l, off_l, off_s, n_elmts); break;\ndefault:\nbreak;\n}\n@@ -384,17 +299,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nconstexpr int n_frames = API_polar::get_n_frames();\nif (n_frames == 1)\n- {\n- if (k_extract)\n- V_K = sk;\n- else\n- {\n- auto k = 0;\n- for (auto j = 0; j < this->N; j++)\n- if (!frozen_bits[j])\n- V_K[k++] = s[j] ? 1 : 0;\n- }\n- }\n+ this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s, V_K);\nelse\n{\nbool fast_deinterleave = false;\n@@ -427,19 +332,15 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n#endif\nif (!fast_deinterleave)\n{\n+ this->fb_extract(this->polar_patterns.get_leaves_pattern_types(),\n+ this->s,\n+ const_cast<Decoder_polar_SC_fast_sys<B,R,API_polar>*>(this)->s_bis);\n+\n// transpose without bit packing (vectorized)\nstd::vector<B*> frames(n_frames);\nfor (auto f = 0; f < n_frames; f++)\n- frames[f] = (B*)(s_bis.data() + f*this->N);\n- tools::Reorderer_static<B,n_frames>::apply_rev(s.data(), frames, this->N);\n-\n- for (auto i = 0; i < n_frames; i++)\n- {\n- auto k = 0;\n- for (auto j = 0; j < this->N; j++)\n- if (!frozen_bits[j])\n- V_K[i * this->K + (k++)] = s_bis[i * this->N + j] ? 1 : 0;\n- }\n+ frames[f] = (B*)(V_K.data() + f*this->K);\n+ tools::Reorderer_static<B,n_frames>::apply_rev(s_bis.data(), frames, this->K);\n}\n}\n}\n@@ -518,5 +419,52 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nfor (auto j = 0; j < this->N; j++)\nV_N[i * this->N + j] = !frozen_bits[j] && V_N[i * this->N + j];\n}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SC_fast_sys<B,R,API_polar>\n+::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n+ const mipp::vector<B> &V_N,\n+ mipp::vector<B> &V_K)\n+{\n+ constexpr int n_frames = API_polar::get_n_frames();\n+\n+ auto off_s = 0;\n+ auto sk_idx = 0;\n+ for (auto l = 0; l < (int)leaves_patterns.size(); l++)\n+ {\n+ const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n+ const auto n_elmts = leaves_patterns[l].second;\n+ switch (node_type)\n+ {\n+ case tools::RATE_0:\n+ break;\n+ case tools::RATE_1:\n+ std::copy(V_N.begin() + off_s * n_frames,\n+ V_N.begin() + (off_s + n_elmts) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += n_elmts * n_frames;\n+ break;\n+ case tools::REP:\n+ std::copy(V_N.begin() + (off_s + n_elmts -1) * n_frames,\n+ V_N.begin() + (off_s + n_elmts +0) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += n_frames;\n+ break;\n+ case tools::SPC:\n+ std::copy(V_N.begin() + (off_s + 1 ) * n_frames,\n+ V_N.begin() + (off_s + n_elmts) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += (n_elmts -1) * n_frames;\n+ break;\n+ default:\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SC_fast_sys: unknown polar node type.\");\n+ break;\n+ }\n+ off_s += n_elmts;\n+ }\n+}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp",
"diff": "@@ -19,6 +19,9 @@ template <typename B = int, typename R = float,\ntools::xo_STD<B >>>\nclass Decoder_polar_SCL_MEM_fast_CA_sys : public Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n{\n+private:\n+ bool fast_store;\n+\nprotected:\nCRC<B>& crc;\nmipp::vector<B> U_test;\n@@ -37,6 +40,9 @@ public:\nprotected:\nbool crc_check (mipp::vector<B> &s);\nvirtual int select_best_path( );\n+\n+ virtual void _load (const mipp::vector<R>& Y_N);\n+ virtual void _store( mipp::vector<B>& V_K) const;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"diff": "-#include \"Tools/Algo/Bit_packer.hpp\"\n-\n#include \"Decoder_polar_SCL_MEM_fast_CA_sys.hpp\"\nnamespace aff3ct\n@@ -10,7 +8,8 @@ template <typename B, typename R, class API_polar>\nDecoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_SCL_MEM_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\nconst int n_frames, const std::string name)\n-: Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, n_frames, name), crc(crc), U_test(K)\n+: Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, n_frames, name),\n+ fast_store(false), crc(crc), U_test(K)\n{\n}\n@@ -21,7 +20,7 @@ Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nCRC<B>& crc, const int n_frames, const std::string name)\n: Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, polar_patterns, idx_r0, idx_r1, n_frames, name),\n- crc(crc), U_test(K)\n+ fast_store(false), crc(crc), U_test(K)\n{\n}\n@@ -29,57 +28,46 @@ template <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n{\n-// // extract the info bits from the codeword\n-// auto k = 0;\n-// for (auto leaf = 0; leaf < this->N; leaf++)\n-// if (!this->frozen_bits[leaf])\n-// U_test[k++] = s[leaf];\n-\n-// // check the CRC\n-// return crc.check(U_test, this->get_simd_inter_frame_level());\n-\n- // extract the info bits (packed) from the codeword\n- auto bytes = (unsigned char*)U_test.data();\n- auto leaf = 0, B_pos = 0;\n- while (leaf < this->N)\n- {\n- unsigned char byte = 0;\n- auto b = 0;\n- while (b < 8 && (leaf < this->N))\n- {\n- byte |= !this->frozen_bits[leaf] ? ((unsigned char)(s[leaf] != 0)) << b++ : 0;\n- leaf++;\n- }\n- bytes[B_pos++] = byte;\n- }\n+ this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), s, U_test);\n// check the CRC\n- return crc.check_packed(U_test, this->get_simd_inter_frame_level());\n+ return crc.check(U_test, this->get_simd_inter_frame_level());\n}\ntemplate <typename B, typename R, class API_polar>\nint Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::select_best_path()\n{\n- auto n_valid_paths = 0;\n- auto n_active_paths_cpy = this->n_active_paths;\n- for (auto i = 0; i < n_active_paths_cpy; i++)\n- {\n- const auto path = this->paths[n_valid_paths];\n+ std::sort(this->paths.begin(), this->paths.begin() + this->n_active_paths,\n+ [this](int x, int y){\n+ return this->metrics[x] < this->metrics[y];\n+ });\n- // check the CRC\n- auto decode_result = crc_check(this->s[path]);\n+ auto i = 0;\n+ while (i < this->n_active_paths && !crc_check(this->s[this->paths[i]])) i++;\n- // delete the path if the CRC result is negative\n- if (!decode_result)\n- this->delete_path(n_valid_paths, this->m);\n- else\n- n_valid_paths++;\n+ this->best_path = (i == this->n_active_paths) ? this->paths[0] : this->paths[i];\n+ fast_store = i != this->n_active_paths;\n+\n+ return this->n_active_paths -i;\n}\n- this->Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>::select_best_path();\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n+::_load(const mipp::vector<R>& Y_N)\n+{\n+ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>::_load(Y_N);\n+ fast_store = false;\n+}\n- return n_valid_paths;\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n+::_store(mipp::vector<B>& V_K) const\n+{\n+ if (fast_store)\n+ std::copy(U_test.begin(), U_test.begin() + this->K, V_K.begin());\n+ else\n+ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>::_store(V_K);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp",
"diff": "@@ -19,6 +19,9 @@ template <typename B = int, typename R = float,\ntools::xo_STD<B >>>\nclass Decoder_polar_SCL_fast_CA_sys : public Decoder_polar_SCL_fast_sys<B,R,API_polar>\n{\n+private:\n+ bool fast_store;\n+\nprotected:\nCRC<B>& crc;\nmipp::vector<B> U_test;\n@@ -37,6 +40,9 @@ public:\nprotected:\nbool crc_check (mipp::vector<B> &s );\nvirtual int select_best_path( );\n+\n+ virtual void _load (const mipp::vector<R>& Y_N);\n+ virtual void _store( mipp::vector<B>& V_K) const;\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx",
"diff": "-#include \"Tools/Algo/Bit_packer.hpp\"\n-\n#include \"Decoder_polar_SCL_fast_CA_sys.hpp\"\nnamespace aff3ct\n@@ -10,7 +8,8 @@ template <typename B, typename R, class API_polar>\nDecoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n::Decoder_polar_SCL_fast_CA_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits, CRC<B>& crc,\nconst int n_frames, const std::string name)\n-: Decoder_polar_SCL_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, n_frames, name), crc(crc), U_test(K)\n+: Decoder_polar_SCL_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, n_frames, name),\n+ fast_store(false), crc(crc), U_test(K)\n{\n}\n@@ -21,7 +20,7 @@ Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nCRC<B>& crc, const int n_frames, const std::string name)\n: Decoder_polar_SCL_fast_sys<B,R,API_polar>(K, N, L, frozen_bits, polar_patterns, idx_r0, idx_r1, n_frames, name),\n- crc(crc), U_test(K)\n+ fast_store(false), crc(crc), U_test(K)\n{\n}\n@@ -29,32 +28,10 @@ template <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n{\n-// // extract the info bits from the codeword\n-// auto k = 0;\n-// for (auto leaf = 0; leaf < this->N; leaf++)\n-// if (!this->frozen_bits[leaf])\n-// U_test[k++] = s[leaf];\n-\n-// // check the CRC\n-// return crc.check(U_test, this->get_simd_inter_frame_level());\n-\n- // extract the info bits (packed) from the codeword\n- auto bytes = (unsigned char*)U_test.data();\n- auto leaf = 0, B_pos = 0;\n- while (leaf < this->N)\n- {\n- unsigned char byte = 0;\n- auto b = 0;\n- while (b < 8 && (leaf < this->N))\n- {\n- byte |= !this->frozen_bits[leaf] ? ((unsigned char)(s[leaf] != 0)) << b++ : 0;\n- leaf++;\n- }\n- bytes[B_pos++] = byte;\n- }\n+ this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), s, U_test);\n// check the CRC\n- return crc.check_packed(U_test, this->get_simd_inter_frame_level());\n+ return crc.check(U_test, this->get_simd_inter_frame_level());\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -70,8 +47,27 @@ int Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\nwhile (i < this->n_active_paths && !crc_check(this->s[this->paths[i]])) i++;\nthis->best_path = (i == this->n_active_paths) ? this->paths[0] : this->paths[i];\n+ fast_store = i != this->n_active_paths;\nreturn this->n_active_paths -i;\n}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n+::_load(const mipp::vector<R>& Y_N)\n+{\n+ Decoder_polar_SCL_fast_sys<B,R,API_polar>::_load(Y_N);\n+ fast_store = false;\n+}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n+::_store(mipp::vector<B>& V_K) const\n+{\n+ if (fast_store)\n+ std::copy(U_test.begin(), U_test.begin() + this->K, V_K.begin());\n+ else\n+ Decoder_polar_SCL_fast_sys<B,R,API_polar>::_store(V_K);\n+}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp",
"diff": "@@ -95,6 +95,10 @@ protected:\ninline void delete_path (int path_id, const int r_d);\nvirtual inline int select_best_path( );\n+ static void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n+ const mipp::vector<B> &V_N,\n+ mipp::vector<B> &V_K);\n+\nprivate:\ninline void erase_bad_paths(const int r_d);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"diff": "@@ -463,10 +463,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::_store(mipp::vector<B>& V_K) const\n{\n- auto k = 0;\n- for (auto i = 0; i < this->N; i++)\n- if (!frozen_bits[i])\n- V_K[k++] = s[best_path][i] ? 1 : 0;\n+ this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s[best_path], V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -1278,5 +1275,52 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nelse\nk++;\n}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n+::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n+ const mipp::vector<B> &V_N,\n+ mipp::vector<B> &V_K)\n+{\n+ constexpr int n_frames = API_polar::get_n_frames();\n+\n+ auto off_s = 0;\n+ auto sk_idx = 0;\n+ for (auto l = 0; l < (int)leaves_patterns.size(); l++)\n+ {\n+ const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n+ const auto n_elmts = leaves_patterns[l].second;\n+ switch (node_type)\n+ {\n+ case tools::RATE_0:\n+ break;\n+ case tools::RATE_1:\n+ std::copy(V_N.begin() + off_s * n_frames,\n+ V_N.begin() + (off_s + n_elmts) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += n_elmts * n_frames;\n+ break;\n+ case tools::REP:\n+ std::copy(V_N.begin() + (off_s + n_elmts -1) * n_frames,\n+ V_N.begin() + (off_s + n_elmts +0) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += n_frames;\n+ break;\n+ case tools::SPC:\n+ std::copy(V_N.begin() + (off_s + 1 ) * n_frames,\n+ V_N.begin() + (off_s + n_elmts) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += (n_elmts -1) * n_frames;\n+ break;\n+ default:\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_MEM_fast_sys: unknown polar node type.\");\n+ break;\n+ }\n+ off_s += n_elmts;\n+ }\n+}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp",
"diff": "@@ -87,6 +87,10 @@ protected:\nvirtual inline int select_best_path( );\ninline int up_ref_array_idx(const int path, const int r_d); // return the array\n+ static void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n+ const mipp::vector<B> &V_N,\n+ mipp::vector<B> &V_K);\n+\nprivate:\ninline void flip_bits_r1 (const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts);\ninline void flip_bits_spc(const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"diff": "@@ -399,10 +399,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::_store(mipp::vector<B>& V_K) const\n{\n- auto k = 0;\n- for (auto i = 0; i < this->N; i++)\n- if (!frozen_bits[i])\n- V_K[k++] = s[best_path][i] ? 1 : 0;\n+ this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s[best_path], V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -1179,5 +1176,52 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\nreturn new_path;\n}\n+\n+template <typename B, typename R, class API_polar>\n+void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n+::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n+ const mipp::vector<B> &V_N,\n+ mipp::vector<B> &V_K)\n+{\n+ constexpr int n_frames = API_polar::get_n_frames();\n+\n+ auto off_s = 0;\n+ auto sk_idx = 0;\n+ for (auto l = 0; l < (int)leaves_patterns.size(); l++)\n+ {\n+ const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n+ const auto n_elmts = leaves_patterns[l].second;\n+ switch (node_type)\n+ {\n+ case tools::RATE_0:\n+ break;\n+ case tools::RATE_1:\n+ std::copy(V_N.begin() + off_s * n_frames,\n+ V_N.begin() + (off_s + n_elmts) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += n_elmts * n_frames;\n+ break;\n+ case tools::REP:\n+ std::copy(V_N.begin() + (off_s + n_elmts -1) * n_frames,\n+ V_N.begin() + (off_s + n_elmts +0) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += n_frames;\n+ break;\n+ case tools::SPC:\n+ std::copy(V_N.begin() + (off_s + 1 ) * n_frames,\n+ V_N.begin() + (off_s + n_elmts) * n_frames,\n+ V_K.begin() + sk_idx);\n+\n+ sk_idx += (n_elmts -1) * n_frames;\n+ break;\n+ default:\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_fast_sys: unknown polar node type.\");\n+ break;\n+ }\n+ off_s += n_elmts;\n+ }\n+}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_std.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_std.cpp",
"diff": "@@ -79,7 +79,7 @@ bool Monitor_std<B,R>\n{\nauto bit_errors_count = 0;\nfor (auto b = 0; b < length; b++)\n- bit_errors_count += U[b] != V[b];\n+ bit_errors_count += !U[b] != !V[b];\nif (bit_errors_count)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp",
"new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp",
"diff": "#define PATTERN_POLAR_PARSER_HPP\n#include <map>\n+#include <utility>\n#include <vector>\n#include <vector>\n@@ -38,6 +39,7 @@ protected:\nconst Pattern_polar_i *pattern_rate1; /*!< Terminal pattern when the bit is an information bit. */\nBinary_tree<Pattern_polar_i> *polar_tree; /*!< Tree of patterns. */\nstd::vector<unsigned char> pattern_types; /*!< Tree of patterns represented with a vector of pattern IDs. */\n+ std::vector<std::pair<unsigned char, int>> leaves_pattern_types;\npublic:\n/*!\n@@ -92,6 +94,8 @@ public:\n*/\nstd::vector<unsigned char> get_pattern_types() const;\n+ const std::vector<std::pair<unsigned char, int>>& get_leaves_pattern_types() const;\n+\n/*!\n* \\brief Gets a node pattern type from the id of the node.\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"diff": "@@ -25,7 +25,8 @@ Pattern_polar_parser<B>\npattern_rate0(pattern_rate0),\npattern_rate1(pattern_rate1),\npolar_tree(new Binary_tree<Pattern_polar_i>(m +1)),\n- pattern_types()\n+ pattern_types(),\n+ leaves_pattern_types()\n{\nthis->recursive_allocate_nodes_patterns(this->polar_tree->get_root());\nthis->generate_nodes_indexes (this->polar_tree->get_root());\n@@ -45,7 +46,8 @@ Pattern_polar_parser<B>\npattern_rate0(patterns[pattern_rate0_id]),\npattern_rate1(patterns[pattern_rate1_id]),\npolar_tree(new Binary_tree<Pattern_polar_i>(m +1)),\n- pattern_types()\n+ pattern_types(),\n+ leaves_pattern_types()\n{\nthis->recursive_allocate_nodes_patterns(this->polar_tree->get_root());\nthis->generate_nodes_indexes (this->polar_tree->get_root());\n@@ -121,6 +123,9 @@ void Pattern_polar_parser<B>\nthis->generate_nodes_indexes(node_curr->get_left() ); // recursive call\nthis->generate_nodes_indexes(node_curr->get_right()); // recursive call\n}\n+ else\n+ leaves_pattern_types.push_back(std::make_pair<unsigned char, int>((unsigned char)node_curr->get_c()->type(),\n+ node_curr->get_c()->get_size()));\n}\ntemplate <typename B>\n@@ -145,6 +150,13 @@ std::vector<unsigned char> Pattern_polar_parser<B>\nreturn pattern_types;\n}\n+template <typename B>\n+const std::vector<std::pair<unsigned char, int>>& Pattern_polar_parser<B>\n+::get_leaves_pattern_types() const\n+{\n+ return leaves_pattern_types;\n+}\n+\ntemplate <typename B>\npolar_node_t Pattern_polar_parser<B>\n::get_node_type(const int node_id) const\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the frozen bits extraction in systematic (SC, SCL and ASCL decoders).
|
8,490 |
05.04.2017 14:44:37
| -7,200 |
a8f9e7ee04109205a7220a7762ab7d6f11d0cefd
|
Disable load/decode/store times in time report when time their are null.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -1018,6 +1018,8 @@ void Simulation_BFER<B,R,Q>\nstream << \"# \" << bold (\"* Decoder\") << \" : \" << std::setw(9) << std::fixed << std::setprecision(3)\n<< decod_sec << \" sec (\" << std::setw(5) << std::fixed << std::setprecision(2) << decod_pc << \"%)\"\n<< std::endl;\n+ if (decod_load_pc != 0 || decod_only_pc != 0 || decod_store_pc != 0)\n+ {\nstream << \"# \" << bold_italic (\" - load\") << \" : \" << std::setw(9) << std::fixed << std::setprecision(3)\n<< decod_load_sec << \" sec (\" << std::setw(5) << std::fixed << std::setprecision(2) << decod_load_pc << \"%)\"\n<< std::endl;\n@@ -1027,6 +1029,7 @@ void Simulation_BFER<B,R,Q>\nstream << \"# \" << bold_italic (\" - store\") << \" : \" << std::setw(9) << std::fixed << std::setprecision(3)\n<< decod_store_sec<< \" sec (\" << std::setw(5) << std::fixed << std::setprecision(2) << decod_store_pc << \"%)\"\n<< std::endl;\n+ }\nif (this->params.code.coset)\nstream << \"# \" << bold (\"* Coset bit\") << \" : \" << std::setw(9) << std::fixed << std::setprecision(3)\n<< cobit_sec << \" sec (\" << std::setw(5) << std::fixed << std::setprecision(2) << cobit_pc << \"%)\"\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Disable load/decode/store times in time report when time their are null.
|
8,490 |
05.04.2017 15:45:47
| -7,200 |
6c3393924b97433aab9292460185f9d20e0f6057
|
Put default template in LDPC encoders.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"diff": "@@ -12,7 +12,7 @@ namespace aff3ct\nnamespace module\n{\n-template <typename B>\n+template <typename B = int>\nclass Encoder_LDPC_DVBS2 : public Encoder_LDPC<B>\n{\nconst dvbs2_values* dvbs2 = nullptr;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"diff": "@@ -13,7 +13,7 @@ namespace aff3ct\nnamespace module\n{\n-template <typename B>\n+template <typename B = int>\nclass Encoder_LDPC : public Encoder<B>\n{\nprotected:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -13,7 +13,7 @@ namespace aff3ct\nnamespace module\n{\n-template <typename B>\n+template <typename B = int>\nclass Encoder_LDPC_from_H : public Encoder_LDPC<B>\n{\nprotected:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Put default template in LDPC encoders.
|
8,487 |
05.04.2017 16:04:49
| -7,200 |
964e1ff46c776b2af0445a1bce87e7fb33d5931e
|
rename type of variable swapped in LDPC_H encoder
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -17,7 +17,7 @@ template <typename B>\nclass Encoder_LDPC_from_H : public Encoder_LDPC<B>\n{\nprotected:\n- mipp::vector<int> swapped;\n+ mipp::vector<unsigned> swapped;\nmipp::vector<B> G;\npublic:\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
rename type of variable swapped in LDPC_H encoder
|
8,487 |
05.04.2017 16:05:46
| -7,200 |
f5f5a439968f533a6ae1f7c1ca6705bace4e72f3
|
rename type of variable swapped in LDPC_H encoder 2
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/G/LDPC_G.hpp",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hpp",
"diff": "@@ -13,14 +13,14 @@ struct LDPC_G\n{\npublic:\ntemplate <typename B>\n- static void build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\n+ static void build_H(const unsigned k, const unsigned n, const std::vector<std::vector<unsigned>>& positions,\nstd::vector<mipp::vector<B>>& H);\ntemplate <typename B>\n- static void triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped);\n+ static void triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<unsigned>& swapped);\ntemplate <typename B>\nstatic void identity_H(std::vector<mipp::vector<B>>& H);\ntemplate <typename B>\n- static void transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<int>& swapped);\n+ static void transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<unsigned>& swapped);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
rename type of variable swapped in LDPC_H encoder 2
|
8,487 |
05.04.2017 16:06:23
| -7,200 |
adab6eb63422cc1bf4ac868ae550f0016cd19ae7
|
rename type of variable swapped in LDPC_H encoder 3
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"diff": "@@ -15,12 +15,10 @@ namespace tools\n{\ntemplate <typename B>\nvoid LDPC_G\n-::build_H(const int k, const int n, const std::vector<std::vector<unsigned int>>& positions,\n+::build_H(const unsigned k, const unsigned n, const std::vector<std::vector<unsigned>>& positions,\nstd::vector<mipp::vector<B>>& H)\n{\n- for (int i = 0; i < k; i++)\n- H.push_back(mipp::vector<B>(n, 0));\n-\n+ H.resize(k, mipp::vector<B>(n, 0));\nfor (unsigned i = 0; i < positions.size(); i++)\nfor (unsigned j = 0; j < positions[i].size(); j++)\nH[i][positions[i][j]] = 1;\n@@ -28,11 +26,11 @@ void LDPC_G\ntemplate <typename B>\nvoid LDPC_G\n-::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<int>& swapped)\n+::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<unsigned>& swapped)\n{\n- int n = (int)H[0].size();\n- int k = (int)H.size();\n- int i = 0;\n+ unsigned n = H[0].size();\n+ unsigned k = H.size();\n+ unsigned i = 0;\nbool fund = false;\nmipp::vector<B> tmp(n,0);\n@@ -42,13 +40,13 @@ void LDPC_G\n{\nif (H[i][i])\n{\n- for (int j = i +1; j < k; j++)\n+ for (unsigned j = i +1; j < k; j++)\nif( H[j][i] )\nstd::transform(H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n}\nelse\n{\n- for (int j = i +1; j < k; j++) // find an other row which is good\n+ for (unsigned j = i +1; j < k; j++) // find an other row which is good\nif (H[j][i])\n{\ntmp = H[i];\n@@ -60,7 +58,7 @@ void LDPC_G\n}\nif (!fund) // if does not fund\n- for (int j = i +1; j < n; j++) // find an other column which is good\n+ for (unsigned j = i +1; j < n; j++) // find an other column which is good\nif (H[i][j])\n{\nswapped.push_back(i);\n@@ -68,9 +66,9 @@ void LDPC_G\ntmp2.clear();\n- for (int l = 0; l < k; l++) tmp2.push_back(H[l][i]);\n- for (int l = 0; l < k; l++) H[l][i] = H[l][j];\n- for (int l = 0; l < k; l++) H[l][j] = tmp2[l];\n+ for (unsigned l = 0; l < k; l++) tmp2.push_back(H[l][i]);\n+ for (unsigned l = 0; l < k; l++) H[l][i] = H[l][j];\n+ for (unsigned l = 0; l < k; l++) H[l][j] = tmp2[l];\ni--;\nfund = true;\n@@ -93,17 +91,17 @@ template <typename B>\nvoid LDPC_G\n::identity_H(std::vector<mipp::vector<B>>& H)\n{\n- auto k = (int)H.size();\n- for (auto i = k -1 ; i > 0; i--)\n- for (auto j = i -1; j > -1; j--)\n- if (H[j][i])\n- std::transform (H[j].begin(), H[j].end(), H[i].begin(), H[j].begin(), std::not_equal_to<B>());\n+ unsigned k = H.size();\n+ for (unsigned i = k - 1 ; i > 0; i--)\n+ for (unsigned j = i; j > 0; j--)\n+ if (H[j-1][i])\n+ std::transform (H[j-1].begin(), H[j-1].end(), H[i].begin(), H[j-1].begin(), std::not_equal_to<B>());\n}\ntemplate <typename B>\nvoid LDPC_G\n-::transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<int>& swapped)\n+::transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<unsigned>& swapped)\n{\nunsigned n = H[0].size();\nunsigned k = H.size();\n@@ -111,11 +109,9 @@ void LDPC_G\nfor (unsigned i = 0; i < k; i++) // Kill of the Identity in H\nH[i].erase( H[i].begin(), H[i].begin() + k );\n+ H.resize(n, mipp::vector<B>(n-k,0));\nfor (unsigned i = k; i < n; i++) // Add identity at the end\n- {\n- H.push_back(mipp::vector<B>(n-k,0));\nH[i][i-k] = 1;\n- }\n// Re-organization: column of G\nmipp::vector<B> tmp(n - k, 0);\n@@ -127,9 +123,14 @@ void LDPC_G\n}\n// Write G matrix in G vector\n+ G.resize(n*(n-k));\n+ unsigned long long compter = 0;\nfor (unsigned j = 0; j < n - k; j++)\n+ {\n+ std::cout << j << \" \";\nfor (unsigned i = 0; i < n; i++)\n- G.push_back(H[i][j]);\n+ G[compter++] = H[i][j];\n+ }\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
rename type of variable swapped in LDPC_H encoder 3
|
8,490 |
05.04.2017 16:42:13
| -7,200 |
25d5dabe034ff992de0d27bafa4c63ad60261fe1
|
Remove useless using namespace.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Decoder.hpp",
"new_path": "src/Module/Decoder/Decoder.hpp",
"diff": "@@ -104,8 +104,6 @@ public:\nthrow std::length_error(\"aff3ct::module::Decoder: \\\"V_K.size()\\\" has to be equal to \"\n\"\\\"K\\\" * \\\"n_frames\\\".\");\n- using namespace std::chrono;\n-\nthis->d_load_total = std::chrono::nanoseconds(0);\nthis->d_decod_total = std::chrono::nanoseconds(0);\nthis->d_store_total = std::chrono::nanoseconds(0);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove useless using namespace.
|
8,487 |
06.04.2017 16:58:01
| -7,200 |
64979e2c5bf754a8757ef828371ce8e4d709609f
|
Implemente a nex methode for encode one tram, and change the type of global variable G by a new one
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "@@ -33,7 +33,6 @@ Encoder_LDPC_from_H<B>\ntools::LDPC_G::identity_H(H);\ntools::LDPC_G::transformation_H_to_G(H, G, swapped);\n- tools::real_transpose(K, N, G, this->tG);\n}\ntemplate <typename B>\n@@ -65,13 +64,15 @@ void Encoder_LDPC_from_H<B>\ntemplate <typename B>\nvoid Encoder_LDPC_from_H<B>\n-::get_G(mipp::vector<B>& matrix_G)\n+::_encode_fbf(const B *U_K, B *X_N)\n{\n- if (this->G.size() != G.size())\n- throw std::length_error(\"aff3ct::module::Encoder_LDPC_from_H: \\\"G.size()\\\" has to be equal \"\n- \"to \\\"this->G.size()\\\".\");\n-\n- std::copy(this->G.begin(), this->G.end(), matrix_G.begin());\n+ for (unsigned i = 0; i < G.size(); i++)\n+ {\n+ X_N[i] = 0;\n+ for (unsigned j = 0; j < G[i].size(); j++)\n+ X_N[i] += U_K[ G[i][j] - 1 ];\n+ X_N[i] %= 2;\n+ }\n}\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -18,7 +18,7 @@ class Encoder_LDPC_from_H : public Encoder_LDPC<B>\n{\nprotected:\nmipp::vector<unsigned> swapped;\n- mipp::vector<B> G;\n+ std::vector<mipp::vector<unsigned>> G; // position of ones by column\npublic:\nEncoder_LDPC_from_H(const int K, const int N, const tools::AList_reader &alist_H, const int n_frames = 1,\n@@ -27,7 +27,8 @@ public:\nvirtual void get_info_bits_pos(mipp::vector<B>& info_bits_pos);\n- virtual void get_G(mipp::vector<B>& matrix_G);\n+protected:\n+ virtual void _encode_fbf(const B *U_K, B *X_N);\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/G/LDPC_G.hpp",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hpp",
"diff": "@@ -20,7 +20,7 @@ public:\ntemplate <typename B>\nstatic void identity_H(std::vector<mipp::vector<B>>& H);\ntemplate <typename B>\n- static void transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<unsigned>& swapped);\n+ static void transformation_H_to_G(std::vector<mipp::vector<B>>& H, std::vector<mipp::vector<unsigned>>& G, mipp::vector<unsigned>& swapped);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"diff": "@@ -101,7 +101,7 @@ void LDPC_G\ntemplate <typename B>\nvoid LDPC_G\n-::transformation_H_to_G(std::vector<mipp::vector<B>>& H, mipp::vector<B>& G, mipp::vector<unsigned>& swapped)\n+::transformation_H_to_G(std::vector<mipp::vector<B>>& H, std::vector<mipp::vector<unsigned>>& G, mipp::vector<unsigned>& swapped)\n{\nunsigned n = H[0].size();\nunsigned k = H.size();\n@@ -122,15 +122,12 @@ void LDPC_G\nH[swapped[(l-1)*2]] = tmp;\n}\n- // Write G matrix in G vector\n- G.resize(n*(n-k));\n- unsigned long long compter = 0;\n- for (unsigned j = 0; j < n - k; j++)\n- {\n- std::cout << j << \" \";\n- for (unsigned i = 0; i < n; i++)\n- G[compter++] = H[i][j];\n- }\n+ // Write G matrix name H in G with the positions of each one by column\n+ G.resize(n, mipp::vector<unsigned>(0,0));\n+ for (unsigned i = 0; i < H.size(); i++)\n+ for (unsigned j = 0; j < H[0].size(); j++)\n+ if (H[i][j])\n+ G[i].push_back(j+1);\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Implemente a nex methode for encode one tram, and change the type of global variable G by a new one
|
8,490 |
06.04.2017 23:54:52
| -7,200 |
a3b137dc0275087367ff73416a03e02246181f3f
|
Adapt BCH encoder/decoder to the new interfaces.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.cpp",
"diff": "@@ -32,7 +32,7 @@ Decoder_BCH<B, R>\ntemplate <typename B, typename R>\nvoid Decoder_BCH<B, R>\n-::_hard_decode_fbf(const R *Y_N, B *V_K)\n+::_hard_decode(const R *Y_N, B *V_K)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\nfor (int j = 0; j < this->N; j++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"new_path": "src/Module/Decoder/BCH/Decoder_BCH.hpp",
"diff": "@@ -40,7 +40,7 @@ public:\nvirtual ~Decoder_BCH();\nprotected:\n- void _hard_decode_fbf(const R *Y_N, B *V_K);\n+ void _hard_decode(const R *Y_N, B *V_K);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"new_path": "src/Module/Encoder/BCH/Encoder_BCH.cpp",
"diff": "@@ -17,7 +17,7 @@ Encoder_BCH<B>\ntemplate <typename B>\nvoid Encoder_BCH<B>\n-::_encode_fbf(const B *U_K, B *X_N)\n+::_encode(const B *U_K, B *X_N)\n{\nregister int i, j;\nregister int feedback;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp",
"new_path": "src/Module/Encoder/BCH/Encoder_BCH.hpp",
"diff": "@@ -28,7 +28,7 @@ public:\nvirtual ~Encoder_BCH() {}\nprotected:\n- virtual void _encode_fbf(const B *U_K, B *X_N);\n+ virtual void _encode(const B *U_K, B *X_N);\n};\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Adapt BCH encoder/decoder to the new interfaces.
|
8,490 |
07.04.2017 00:05:17
| -7,200 |
98b8b94880330c91444636fede52245272efc868
|
Use the new interfaces for the LDPC encoders.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"diff": "@@ -93,7 +93,7 @@ void Encoder_LDPC_DVBS2<B>\ntemplate <typename B>\nvoid Encoder_LDPC_DVBS2<B>\n-::_encode_fbf(const B *U_K, B *X_N)\n+::_encode(const B *U_K, B *X_N)\n{\nstd::copy(U_K, U_K + this->K, X_N);\nstd::fill(X_N + this->K, X_N + this->N, 0 );\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"diff": "@@ -22,7 +22,7 @@ public:\nvirtual ~Encoder_LDPC_DVBS2();\nprotected:\n- void _encode_fbf(const B *U_K, B *X_N);\n+ void _encode(const B *U_K, B *X_N);\nprivate:\nvoid build_dvbs2();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "@@ -56,7 +56,7 @@ void Encoder_LDPC<B>\ntemplate <typename B>\nvoid Encoder_LDPC<B>\n-::_encode_fbf(const B *U_K, B *X_N)\n+::_encode(const B *U_K, B *X_N)\n{\n// Real General Matrix Multiplication\ntools::rgemm(1, this->N, this->K, U_K, tG.data(), X_N);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.hpp",
"diff": "@@ -30,7 +30,7 @@ public:\nvirtual void get_info_bits_pos(mipp::vector<B>& info_bits_pos);\nprotected:\n- virtual void _encode_fbf(const B *U_K, B *X_N);\n+ virtual void _encode(const B *U_K, B *X_N);\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "@@ -64,7 +64,7 @@ void Encoder_LDPC_from_H<B>\ntemplate <typename B>\nvoid Encoder_LDPC_from_H<B>\n-::_encode_fbf(const B *U_K, B *X_N)\n+::_encode(const B *U_K, B *X_N)\n{\nfor (unsigned i = 0; i < G.size(); i++)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.hpp",
"diff": "@@ -28,7 +28,7 @@ public:\nvirtual void get_info_bits_pos(mipp::vector<B>& info_bits_pos);\nprotected:\n- virtual void _encode_fbf(const B *U_K, B *X_N);\n+ virtual void _encode(const B *U_K, B *X_N);\n};\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Use the new interfaces for the LDPC encoders.
|
8,495 |
07.04.2017 09:22:14
| -7,200 |
08042abda9a985d075af4ad9d926615251c199ab
|
FNC with div2 and generic std::abs.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"new_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"diff": "@@ -159,7 +159,7 @@ bool Decoder_turbo_naive_CA_flip_and_check<B,R>\n{\n// reconstruct the a posteriori information and calculate the metric associated\nfor (auto i = 0; i < this->K; i++)\n- metric[i] = std::fabs((l_en[i]*0.75 + l_sen[i]));\n+ metric[i] = std::abs((div2(l_en[i]) + div4(l_en[i]) + l_sen[i]));\n// get the least reliable positions\nmipp::vector<unsigned int> positions = partial_sort_indexes(metric);\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
FNC with div2 and generic std::abs.
|
8,490 |
07.04.2017 09:53:12
| -7,200 |
366179d99ec22079fb3c02394e3d22ce40080e62
|
Fix bad interface for the build in the CRC.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/CRC/CRC.hpp",
"new_path": "src/Module/CRC/CRC.hpp",
"diff": "@@ -118,10 +118,9 @@ public:\n}\nprotected:\n- virtual bool _build(const B *V_K)\n+ virtual void _build(const B *V_K)\n{\nthrow std::runtime_error(\"aff3ct::module::CRC: \\\"_build\\\" is unimplemented.\");\n- return false;\n}\nvirtual bool _check(const B *V_K)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix bad interface for the build in the CRC.
|
8,490 |
07.04.2017 12:34:38
| -7,200 |
cda2feb20556c98a659f85bcd4347d799b8d20d7
|
Fix MPI version.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"new_path": "src/Module/Monitor/Standard/Monitor_reduction_mpi.cpp",
"diff": "#include \"Monitor_reduction_mpi.hpp\"\nusing namespace aff3ct::module;\n-using namespace aff3ct::tools;\nstruct monitor_vals\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"new_path": "src/Simulation/BFER/Standard/STD_Simulation_BFER.cpp",
"diff": "@@ -190,7 +190,7 @@ void Simulation_BFER<B,R,Q>\n// build a monitor to compute BER/FER (reduce the other monitors)\nsimu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K,\nsimu->params.code.N + simu->params.code.tail_length,\n- simu->params.code.N_mod\n+ simu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\nstd::this_thread::get_id(),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"new_path": "src/Simulation/BFERI/Standard/STD_Simulation_BFERI.cpp",
"diff": "@@ -27,19 +27,19 @@ Simulation_BFERI<B,R,Q>\nthreads(params.simulation.n_threads -1),\n- U_K (params.simulation.n_threads, mipp::vector<B>(params.code.K)),\n- X_N1(params.simulation.n_threads, mipp::vector<B>(params.code.N)),\n- X_N2(params.simulation.n_threads, mipp::vector<B>(params.code.N)),\n- X_N3(params.simulation.n_threads, mipp::vector<R>(params.code.N)),\n- H_N (params.simulation.n_threads, mipp::vector<R>(params.code.N)),\n- Y_N1(params.simulation.n_threads, mipp::vector<R>(params.code.N)),\n- Y_N2(params.simulation.n_threads, mipp::vector<R>(params.code.N)),\n- Y_N3(params.simulation.n_threads, mipp::vector<Q>(params.code.N)),\n- Y_N4(params.simulation.n_threads, mipp::vector<Q>(params.code.N)),\n- Y_N5(params.simulation.n_threads, mipp::vector<Q>(params.code.N)),\n- Y_N6(params.simulation.n_threads, mipp::vector<Q>(params.code.N)),\n- Y_N7(params.simulation.n_threads, mipp::vector<Q>(params.code.N)),\n- V_K (params.simulation.n_threads, mipp::vector<B>(params.code.K)),\n+ U_K (params.simulation.n_threads, mipp::vector<B>( params.code.K * params.simulation.inter_frame_level)),\n+ X_N1(params.simulation.n_threads, mipp::vector<B>((params.code.N + params.code.tail_length) * params.simulation.inter_frame_level)),\n+ X_N2(params.simulation.n_threads, mipp::vector<B>((params.code.N + params.code.tail_length) * params.simulation.inter_frame_level)),\n+ X_N3(params.simulation.n_threads, mipp::vector<R>( params.code.N_mod * params.simulation.inter_frame_level)),\n+ H_N (params.simulation.n_threads, mipp::vector<R>( params.code.N_mod * params.simulation.inter_frame_level)),\n+ Y_N1(params.simulation.n_threads, mipp::vector<R>( params.code.N_mod * params.simulation.inter_frame_level)),\n+ Y_N2(params.simulation.n_threads, mipp::vector<R>( params.code.N_fil * params.simulation.inter_frame_level)),\n+ Y_N3(params.simulation.n_threads, mipp::vector<Q>( params.code.N_fil * params.simulation.inter_frame_level)),\n+ Y_N4(params.simulation.n_threads, mipp::vector<Q>((params.code.N + params.code.tail_length) * params.simulation.inter_frame_level)),\n+ Y_N5(params.simulation.n_threads, mipp::vector<Q>((params.code.N + params.code.tail_length) * params.simulation.inter_frame_level)),\n+ Y_N6(params.simulation.n_threads, mipp::vector<Q>((params.code.N + params.code.tail_length) * params.simulation.inter_frame_level)),\n+ Y_N7(params.simulation.n_threads, mipp::vector<Q>((params.code.N + params.code.tail_length) * params.simulation.inter_frame_level)),\n+ V_K (params.simulation.n_threads, mipp::vector<B>( params.code.K * params.simulation.inter_frame_level)),\nmonitor_red(nullptr),\nterminal (nullptr),\n@@ -178,54 +178,27 @@ void Simulation_BFERI<B,R,Q>\n{\nSimulation_BFERI_i<B,R,Q>::build_communication_chain(simu, tid);\n- // get the real number of frames per threads (from the decoder)\n- const auto n_fra = simu->siso[tid]->get_n_frames();\n-\n- if (simu->siso[tid]->get_n_frames() != simu->decoder[tid]->get_n_frames())\n- throw std::invalid_argument(\"aff3ct::simulation::Simulation_BFERI: \\\"siso[tid]->get_n_frames()\\\" and \"\n- \"\\\"decoder[tid]->get_n_frames()\\\" have to be equal.\");\n-\n- // resize the buffers\n- const auto K = simu->params.code.K;\n- const auto N = simu->params.code.N;\n- const auto tail = simu->params.code.tail_length;\n- const auto N_mod = simu->params.code.N_mod;\n- const auto N_fil = simu->params.code.N_fil;\n-\n- if (simu->U_K [tid].size() != (unsigned) ( K * n_fra)) simu->U_K [tid].resize( K * n_fra);\n- if (simu->X_N1[tid].size() != (unsigned) ((N + tail) * n_fra)) simu->X_N1[tid].resize((N + tail) * n_fra);\n- if (simu->X_N2[tid].size() != (unsigned) ((N + tail) * n_fra)) simu->X_N2[tid].resize((N + tail) * n_fra);\n- if (simu->X_N3[tid].size() != (unsigned) ( N_mod * n_fra)) simu->X_N3[tid].resize( N_mod * n_fra);\n- if (simu->Y_N1[tid].size() != (unsigned) ( N_mod * n_fra)) simu->Y_N1[tid].resize( N_mod * n_fra);\n- if (simu->H_N [tid].size() != (unsigned) ( N_mod * n_fra)) simu->H_N [tid].resize( N_mod * n_fra);\n- if (simu->Y_N2[tid].size() != (unsigned) ( N_fil * n_fra)) simu->Y_N2[tid].resize( N_fil * n_fra);\n- if (simu->Y_N3[tid].size() != (unsigned) ( N_fil * n_fra)) simu->Y_N3[tid].resize( N_fil * n_fra);\n- if (simu->Y_N4[tid].size() != (unsigned) ((N + tail) * n_fra)) simu->Y_N4[tid].resize((N + tail) * n_fra);\n- if (simu->Y_N5[tid].size() != (unsigned) ((N + tail) * n_fra)) simu->Y_N5[tid].resize((N + tail) * n_fra);\n- if (simu->Y_N6[tid].size() != (unsigned) ((N + tail) * n_fra)) simu->Y_N6[tid].resize((N + tail) * n_fra);\n- if (simu->Y_N7[tid].size() != (unsigned) ((N + tail) * n_fra)) simu->Y_N7[tid].resize((N + tail) * n_fra);\n- if (simu->V_K [tid].size() != (unsigned) ( K * n_fra)) simu->V_K [tid].resize( K * n_fra);\n-\nsimu->barrier(tid);\nif (tid == 0)\n{\n#ifdef ENABLE_MPI\n// build a monitor to compute BER/FER (reduce the other monitors)\nsimu->monitor_red = new Monitor_reduction_mpi<B,R>(simu->params.code.K,\n- simu->params.code.N,\n+ simu->params.code.N + simu->params.code.tail_length,\n+ simu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\nstd::this_thread::get_id(),\nsimu->params.simulation.mpi_comm_freq,\n- n_fra);\n+ simu->params.simulation.inter_frame_level);\n#else\n// build a monitor to compute BER/FER (reduce the other monitors)\nsimu->monitor_red = new Monitor_reduction<B,R>(simu->params.code.K,\n- simu->params.code.N + tail,\n+ simu->params.code.N + simu->params.code.tail_length,\nsimu->params.code.N_mod,\nsimu->params.monitor.n_frame_errors,\nsimu->monitor,\n- n_fra);\n+ simu->params.simulation.inter_frame_level);\n#endif\n// build the terminal to display the BER/FER\nsimu->terminal = simu->build_terminal(tid);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp",
"new_path": "src/Simulation/GEN/Code/Polar/Generation_polar.cpp",
"diff": "#include <errno.h>\n#include \"Tools/params.h\"\n+#include \"Tools/Display/bash_tools.h\"\n#include \"Tools/Factory/Polar/Factory_frozenbits_generator.hpp\"\n#include \"Module/Decoder/Polar/SC/Patterns/Pattern_SC_standard.hpp\"\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix MPI version.
|
8,490 |
07.04.2017 18:09:02
| -7,200 |
5b084bad0880cededaad5334d9af7f2b4038ec89
|
Add a soft decoder to the non systematic SCAN decoder + fix bug in the sys SCAN decoder + replace m by N in the SCAN decoders.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "@@ -136,6 +136,11 @@ Decoder_polar_SC_fast_sys<B,R,API_polar>\nthrow std::length_error(\"aff3ct::module::Decoder_polar_SC_fast_sys: \\\"frozen_bits.size()\\\" has to be equal to \"\n\"\\\"N\\\".\");\n+ auto k = 0; for (auto i = 0; i < this->N; i++) if (frozen_bits[i] == 0) k++;\n+ if (this->K != k)\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SC_fast_sys: the number of information bits in the \"\n+ \"\\\"frozen_bits\\\" is invalid.\");\n+\nPattern_SC_interface* pattern_SC_r0 = new Pattern_SC<pattern_SC_type::RATE_0>();\nPattern_SC_interface* pattern_SC_r1 = new Pattern_SC<pattern_SC_type::RATE_1>();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_naive.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_naive.hxx",
"diff": "@@ -24,6 +24,11 @@ Decoder_polar_SC_naive<B,R,F,G,H>\nthrow std::length_error(\"aff3ct::module::Decoder_polar_SC_naive: \\\"frozen_bits.size()\\\" has to be equal to \"\n\"\\\"N\\\".\");\n+ auto k = 0; for (auto i = 0; i < this->N; i++) if (frozen_bits[i] == 0) k++;\n+ if (this->K != k)\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SC_naive: the number of information bits in the \"\n+ \"\\\"frozen_bits\\\" is invalid.\");\n+\nthis->recursive_allocate_nodes_contents(this->polar_tree.get_root(), this->N);\nthis->recursive_initialize_frozen_bits(this->polar_tree.get_root(), frozen_bits);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hpp",
"diff": "#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"../../Decoder.hpp\"\n+#include \"../../Decoder_SISO.hpp\"\n#include \"../decoder_polar_functions.h\"\nnamespace aff3ct\n@@ -13,7 +13,7 @@ namespace module\n{\ntemplate <typename B = int, typename R = float,\nproto_i<R> I = tools::init_LLR, proto_f<R> F = f_LLR, proto_v<R> V = v_LLR, proto_h<B,R> H = h_LLR>\n-class Decoder_polar_SCAN_naive : public Decoder<B,R>\n+class Decoder_polar_SCAN_naive : public Decoder_SISO<B,R>\n{\nprotected:\nconst int m; // coded bits log-length\n@@ -25,13 +25,14 @@ protected:\nstd::vector<mipp::vector<R>> soft_graph;\npublic:\n- Decoder_polar_SCAN_naive(const int &K, const int &m, const int &max_iter, const mipp::vector<B> &frozen_bits,\n+ Decoder_polar_SCAN_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCAN_naive\");\nvirtual ~Decoder_polar_SCAN_naive() {}\nprotected:\nvoid _load (const R *Y_N );\nvoid _hard_decode(const R *Y_N, B *V_K );\n+ virtual void _soft_decode(const R *Y_N1, R *Y_N2);\nvirtual void _store ( B *V_K ) const;\nvoid _load_init();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"diff": "@@ -18,12 +18,12 @@ namespace module\ntemplate <typename B, typename R,\nproto_i<R> I, proto_f<R> F, proto_v<R> V, proto_h<B,R> H>\nDecoder_polar_SCAN_naive<B,R,I,F,V,H>\n-::Decoder_polar_SCAN_naive(const int &K, const int &m, const int &max_iter, const mipp::vector<B> &frozen_bits,\n+::Decoder_polar_SCAN_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames, const std::string name)\n-: Decoder<B,R> (K, 1 << m, n_frames, 1, name),\n- m (m ),\n+: Decoder_SISO<B,R>(K, N, n_frames, 1, name),\n+ m (std::log2(N)),\nmax_iter (max_iter ),\n- layers_count (m +1 ),\n+ layers_count (this->m +1 ),\nfrozen_bits (frozen_bits ),\nfeedback_graph(layers_count),\nsoft_graph (layers_count)\n@@ -40,6 +40,11 @@ Decoder_polar_SCAN_naive<B,R,I,F,V,H>\nthrow std::invalid_argument(\"aff3ct::module::Decoder_polar_SCAN_naive: \\\"max_iter\\\" has to be greater \"\n\"than 0.\");\n+ auto k = 0; for (auto i = 0; i < this->N; i++) if (frozen_bits[i] == 0) k++;\n+ if (this->K != k)\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCAN_naive: the number of information bits in the \"\n+ \"\\\"frozen_bits\\\" is invalid.\");\n+\nfor (auto t = 0; t < layers_count; t++)\n{\nfeedback_graph[t].resize(this->N);\n@@ -141,6 +146,22 @@ void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\nthis->d_store_total += d_store;\n}\n+template <typename B, typename R,\n+ proto_i<R> I, proto_f<R> F, proto_v<R> V, proto_h<B,R> H>\n+void Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n+::_soft_decode(const R *Y_N1, R *Y_N2)\n+{\n+ // ----------------------------------------------------------------------------------------------------------- LOAD\n+ this->_load(Y_N1);\n+\n+ // --------------------------------------------------------------------------------------------------------- DECODE\n+ Decoder_polar_SCAN_naive<B,R,I,F,V,H>::_decode();\n+\n+ // ---------------------------------------------------------------------------------------------------------- STORE\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N2[i] = this->feedback_graph[0][i];\n+}\n+\n/********************************************************************/\n/** frame store **/\n/********************************************************************/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hpp",
"diff": "#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n-#include \"../../SISO.hpp\"\n#include \"Decoder_polar_SCAN_naive.hpp\"\nnamespace aff3ct\n@@ -13,22 +12,16 @@ namespace module\n{\ntemplate <typename B = int, typename R = float,\nproto_i<R> I = tools::init_LLR, proto_f<R> F = f_LLR, proto_v<R> V = v_LLR, proto_h<B,R> H = h_LLR>\n-class Decoder_polar_SCAN_naive_sys : public Decoder_polar_SCAN_naive<B,R,I,F,V,H>, public SISO<R>\n+class Decoder_polar_SCAN_naive_sys : public Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n{\npublic:\n- Decoder_polar_SCAN_naive_sys(const int &K, const int &m, const int &max_iter, const mipp::vector<B> &frozen_bits,\n+ Decoder_polar_SCAN_naive_sys(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames = 1, const std::string name = \"Decoder_polar_SCAN_naive_sys\");\nvirtual ~Decoder_polar_SCAN_naive_sys();\nprotected:\n-#ifdef __clang__\n-#pragma clang diagnostic push\n-#pragma clang diagnostic ignored \"-Woverloaded-virtual\"\n-#endif\n- void _soft_decode_fbf(const R *sys, const R *par, R *ext);\n-#ifdef __clang__\n-#pragma clang diagnostic pop\n-#endif\n+ void _soft_decode(const R *sys, const R *par, R *ext);\n+ void _soft_decode(const R *Y_N1, R *Y_N2);\nvoid _store(B *V_N) const;\n};\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive_sys.hxx",
"diff": "@@ -9,10 +9,9 @@ namespace module\ntemplate <typename B, typename R,\nproto_i<R> I, proto_f<R> F, proto_v<R> V, proto_h<B,R> H>\nDecoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n-::Decoder_polar_SCAN_naive_sys(const int &K, const int &m, const int &max_iter, const mipp::vector<B> &frozen_bits,\n+::Decoder_polar_SCAN_naive_sys(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames, const std::string name)\n-: Decoder_polar_SCAN_naive<B,R,I,F,V,H>(K, m, max_iter, frozen_bits, n_frames, name),\n- SISO<R>(K, 1 << m, n_frames, 1, name + \"_siso\")\n+: Decoder_polar_SCAN_naive<B,R,I,F,V,H>(K, N, max_iter, frozen_bits, n_frames, name)\n{\n}\n@@ -26,7 +25,7 @@ Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\ntemplate <typename B, typename R,\nproto_i<R> I, proto_f<R> F, proto_v<R> V, proto_h<B,R> H>\nvoid Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n-::_soft_decode_fbf(const R *sys, const R *par, R *ext)\n+::_soft_decode(const R *sys, const R *par, R *ext)\n{\n// ----------------------------------------------------------------------------------------------------------- LOAD\nthis->_load_init();\n@@ -49,6 +48,22 @@ void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\next[sys_idx++] = this->feedback_graph[this->layers_count -1][i];\n}\n+template <typename B, typename R,\n+ proto_i<R> I, proto_f<R> F, proto_v<R> V, proto_h<B,R> H>\n+void Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n+::_soft_decode(const R *Y_N1, R *Y_N2)\n+{\n+ // ----------------------------------------------------------------------------------------------------------- LOAD\n+ this->_load(Y_N1);\n+\n+ // --------------------------------------------------------------------------------------------------------- DECODE\n+ Decoder_polar_SCAN_naive<B,R,I,F,V,H>::_decode();\n+\n+ // ---------------------------------------------------------------------------------------------------------- STORE\n+ for (auto i = 0; i < this->N; i++)\n+ Y_N2[i] = this->feedback_graph[this->layers_count -1][i];\n+}\n+\ntemplate <typename B, typename R,\nproto_i<R> I, proto_f<R> F, proto_v<R> V, proto_h<B,R> H>\nvoid Decoder_polar_SCAN_naive_sys<B,R,I,F,V,H>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_naive.hxx",
"diff": "@@ -37,6 +37,11 @@ Decoder_polar_SCL_naive<B,R,F,G>\nthrow std::invalid_argument(\"aff3ct::module::Decoder_polar_SCL_naive: \\\"L\\\" has to be positive and a power \"\n\"of 2.\");\n+ auto k = 0; for (auto i = 0; i < this->N; i++) if (frozen_bits[i] == 0) k++;\n+ if (this->K != k)\n+ throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_naive: the number of information bits in the \"\n+ \"\\\"frozen_bits\\\" is invalid.\");\n+\nthis->active_paths.insert(0);\nfor (auto i = 0 ; i < L ; i++)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"diff": "@@ -41,7 +41,7 @@ SISO<R>* Factory_decoder_polar<B,R>\nif (params.encoder.systematic) // non-systematic encoding / decoding\nif (params.channel.domain == \"LLR\")\nif (params.decoder.type == \"SCAN\" && params.decoder.implem == \"NAIVE\")\n- siso = new Decoder_polar_SCAN_naive_sys<B, R, init_LLR<R>, f_LLR<R>, v_LLR<R>, h_LLR<B,R>>(params.code.K, params.code.m, params.decoder.n_ite, frozen_bits, params.simulation.inter_frame_level);\n+ siso = new Decoder_polar_SCAN_naive_sys<B, R, init_LLR<R>, f_LLR<R>, v_LLR<R>, h_LLR<B,R>>(params.code.K, params.code.N_code, params.decoder.n_ite, frozen_bits, params.simulation.inter_frame_level);\nreturn siso;\n}\n@@ -64,7 +64,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nif (params.decoder.type == \"SC\" && params.decoder.implem == \"NAIVE\")\ndecoder = new Decoder_polar_SC_naive <B,R,f_LLR<R>,g_LLR<B,R>,h_LLR<B,R>>(params.code.K, params.code.N_code, frozen_bits, params.simulation.inter_frame_level);\nif (params.decoder.type == \"SCAN\" && params.decoder.implem == \"NAIVE\")\n- decoder = new Decoder_polar_SCAN_naive<B,R,init_LLR<R>,f_LLR<R>,v_LLR<R>,h_LLR<B,R>>(params.code.K, params.code.m, params.decoder.n_ite, frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCAN_naive<B,R,init_LLR<R>,f_LLR<R>,v_LLR<R>,h_LLR<B,R>>(params.code.K, params.code.N_code, params.decoder.n_ite, frozen_bits, params.simulation.inter_frame_level);\nif (params.decoder.type == \"SCL\" && params.decoder.implem == \"NAIVE\" && params.crc.type.empty())\ndecoder = new Decoder_polar_SCL_naive<B,R,f_LLR<R>,g_LLR<B,R>>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\nif (params.decoder.type == \"SCL\" && params.decoder.implem == \"NAIVE\" && !params.crc.type.empty())\n@@ -85,7 +85,7 @@ Decoder<B,R>* Factory_decoder_polar<B,R>\nif (params.decoder.type == \"SC\" && params.decoder.implem == \"NAIVE\")\ndecoder = new Decoder_polar_SC_naive_sys<B, R, f_LLR<R>, g_LLR<B,R>, h_LLR<B,R>>(params.code.K, params.code.N_code, frozen_bits, params.simulation.inter_frame_level);\nif (params.decoder.type == \"SCAN\" && params.decoder.implem == \"NAIVE\")\n- decoder = new Decoder_polar_SCAN_naive_sys<B, R, init_LLR<R>, f_LLR<R>, v_LLR<R>, h_LLR<B,R>>(params.code.K, params.code.m, params.decoder.n_ite, frozen_bits, params.simulation.inter_frame_level);\n+ decoder = new Decoder_polar_SCAN_naive_sys<B, R, init_LLR<R>, f_LLR<R>, v_LLR<R>, h_LLR<B,R>>(params.code.K, params.code.N_code, params.decoder.n_ite, frozen_bits, params.simulation.inter_frame_level);\nif (params.decoder.type == \"SCL\" && params.decoder.implem == \"NAIVE\" && params.crc.type.empty())\ndecoder = new Decoder_polar_SCL_naive_sys<B,R,f_LLR<R>,g_LLR<B,R>>(params.code.K, params.code.N_code, params.decoder.L, frozen_bits, params.simulation.inter_frame_level);\nif (params.decoder.type == \"SCL\" && params.decoder.implem == \"NAIVE\" && !params.crc.type.empty())\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add a soft decoder to the non systematic SCAN decoder + fix bug in the sys SCAN decoder + replace m by N in the SCAN decoders.
|
8,490 |
07.04.2017 20:37:05
| -7,200 |
01b39f015ebfb0cfba79af723554799bb30e8eeb
|
Remove the systematic copy in the filtering process when N_mod = N_fil.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/BPSK/Modulator_BPSK.cpp",
"new_path": "src/Module/Modulator/BPSK/Modulator_BPSK.cpp",
"diff": "@@ -28,6 +28,13 @@ void Modulator_BPSK<B,R,Q>\nX_N2[i] = (R)((B)1 - (X_N1[i] + X_N1[i])); // (X_N[i] == 1) ? -1 : +1\n}\n+template <typename B,typename R, typename Q>\n+void Modulator_BPSK<B,R,Q>\n+::filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil * this->n_frames, Y_N2);\n+}\n+\ntemplate <typename B, typename R, typename Q>\nvoid Modulator_BPSK<B,R,Q>\n::demodulate(const Q *Y_N1, Q *Y_N2)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/BPSK/Modulator_BPSK.hpp",
"new_path": "src/Module/Modulator/BPSK/Modulator_BPSK.hpp",
"diff": "@@ -23,6 +23,7 @@ public:\nvirtual ~Modulator_BPSK();\nvoid modulate (const B *X_N1, R *X_N2); using Modulator<B,R,Q>::modulate;\n+ void filter (const R *Y_N1, R *Y_N2); using Modulator<B,R,Q>::filter;\nvoid demodulate (const Q *Y_N1, Q *Y_N2);\nvoid demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\nvoid demodulate (const Q *Y_N1, const Q *Y_N2, Q *Y_N3); using Modulator<B,R,Q>::demodulate;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/BPSK/Modulator_BPSK_fast.cpp",
"new_path": "src/Module/Modulator/BPSK/Modulator_BPSK_fast.cpp",
"diff": "@@ -132,6 +132,13 @@ void Modulator_BPSK_fast<signed char, float, float>\n}\n}\n+template <typename B,typename R, typename Q>\n+void Modulator_BPSK_fast<B,R,Q>\n+::filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil * this->n_frames, Y_N2);\n+}\n+\ntemplate <typename B, typename R, typename Q>\nvoid Modulator_BPSK_fast<B,R,Q>\n::demodulate(const Q *Y_N1, Q *Y_N2)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/BPSK/Modulator_BPSK_fast.hpp",
"new_path": "src/Module/Modulator/BPSK/Modulator_BPSK_fast.hpp",
"diff": "@@ -23,6 +23,7 @@ public:\nvirtual ~Modulator_BPSK_fast();\nvoid modulate(const B *X_N1, R *X_N2); using Modulator<B,R,Q>::modulate;\n+ void filter(const R *Y_N1, R *Y_N2); using Modulator<B,R,Q>::filter;\nvoid demodulate(const Q *Y_N1, Q *Y_N2);\nvoid demodulate(const Q *Y_N1, const Q *Y_N2, Q *Y_N3); using Modulator<B,R,Q>::demodulate;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/Modulator.hpp",
"new_path": "src/Module/Modulator/Modulator.hpp",
"diff": "@@ -155,9 +155,6 @@ public:\nvirtual void filter(const R *Y_N1, R *Y_N2)\n{\n- if (this->N_mod == this->N_fil)\n- std::copy(Y_N1, Y_N1 + this->N_mod * this->n_frames, Y_N2);\n- else\nfor (auto f = 0; f < this->n_frames; f++)\nthis->_filter(Y_N1 + f * this->N_mod,\nY_N2 + f * this->N_fil);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/PAM/Modulator_PAM.hpp",
"new_path": "src/Module/Modulator/PAM/Modulator_PAM.hpp",
"diff": "@@ -39,6 +39,7 @@ public:\nprotected:\nvoid _modulate (const B *X_N1, R *X_N2);\n+ void _filter (const R *Y_N1, R *Y_N2);\nvoid _demodulate (const Q *Y_N1, Q *Y_N2);\nvoid _demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\nvoid _demodulate (const Q *Y_N1, const Q *Y_N2, Q *Y_N3);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/PAM/Modulator_PAM.hxx",
"new_path": "src/Module/Modulator/PAM/Modulator_PAM.hxx",
"diff": "@@ -98,6 +98,16 @@ void Modulator_PAM<B,R,Q,MAX>\n}\n}\n+/*\n+ * Filter\n+ */\n+template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\n+void Modulator_PAM<B,R,Q,MAX>\n+::_filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil, Y_N2);\n+}\n+\n/*\n* Demodulator\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/PSK/Modulator_PSK.hpp",
"new_path": "src/Module/Modulator/PSK/Modulator_PSK.hpp",
"diff": "@@ -39,6 +39,7 @@ public:\nprotected:\nvoid _modulate (const B *X_N1, R *X_N2);\n+ void _filter (const R *Y_N1, R *Y_N2);\nvoid _demodulate (const Q *Y_N1, Q *Y_N2);\nvoid _demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\nvoid _demodulate (const Q *Y_N1, const Q *Y_N2, Q *Y_N3);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/PSK/Modulator_PSK.hxx",
"new_path": "src/Module/Modulator/PSK/Modulator_PSK.hxx",
"diff": "@@ -104,6 +104,16 @@ void Modulator_PSK<B,R,Q,MAX>\n}\n}\n+/*\n+ * Filter\n+ */\n+template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\n+void Modulator_PSK<B,R,Q,MAX>\n+::_filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil, Y_N2);\n+}\n+\n/*\n* Demodulator\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/QAM/Modulator_QAM.hpp",
"new_path": "src/Module/Modulator/QAM/Modulator_QAM.hpp",
"diff": "@@ -40,6 +40,7 @@ public:\nprotected:\nvoid _modulate (const B *X_N1, R *X_N2);\n+ void _filter (const R *Y_N1, R *Y_N2);\nvoid _demodulate (const Q *Y_N1, Q *Y_N2);\nvoid _demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\nvoid _demodulate (const Q *Y_N1, const Q *Y_N2, Q *Y_N3);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/QAM/Modulator_QAM.hxx",
"new_path": "src/Module/Modulator/QAM/Modulator_QAM.hxx",
"diff": "@@ -108,6 +108,16 @@ void Modulator_QAM<B,R,Q,MAX>\n}\n}\n+/*\n+ * Filter\n+ */\n+template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\n+void Modulator_QAM<B,R,Q,MAX>\n+::_filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil, Y_N2);\n+}\n+\n/*\n* Demodulator\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/User/Modulator_user.hpp",
"new_path": "src/Module/Modulator/User/Modulator_user.hpp",
"diff": "@@ -41,6 +41,7 @@ public:\nprotected:\nvoid _modulate (const B *X_N1, R *X_N2);\n+ void _filter (const R *Y_N1, R *Y_N2);\nvoid _demodulate (const Q *Y_N1, Q *Y_N2);\nvoid _demodulate_with_gains(const Q *Y_N1, const R *H_N, Q *Y_N2);\nvoid _demodulate (const Q *Y_N1, const Q *Y_N2, Q *Y_N3);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Modulator/User/Modulator_user.hxx",
"new_path": "src/Module/Modulator/User/Modulator_user.hxx",
"diff": "@@ -105,6 +105,16 @@ void Modulator_user<B,R,Q,MAX>\n}\n}\n+/*\n+ * Filter\n+ */\n+template <typename B,typename R, typename Q, tools::proto_max<Q> MAX>\n+void Modulator_user<B,R,Q,MAX>\n+::_filter(const R *Y_N1, R *Y_N2)\n+{\n+ std::copy(Y_N1, Y_N1 + this->N_fil, Y_N2);\n+}\n+\n/*\n* Demodulator\n*/\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Remove the systematic copy in the filtering process when N_mod = N_fil.
|
8,490 |
07.04.2017 21:21:33
| -7,200 |
e94d6c32f4b19cffb11edcf1d288d0cdf89dee30
|
Improve the store speed in the SC fast decoder.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"diff": "@@ -55,12 +55,12 @@ public:\nprotected:\nvoid _load (const R *Y_N );\nvirtual void _hard_decode(const R *Y_N, B *V_K);\n- void _store ( B *V_K) const;\n+ void _store ( B *V_K);\nvirtual void recursive_decode(const int off_l, const int off_s, const int reverse_depth, int &node_id);\ninline static void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n- const B *V_N, B *V_K);\n+ const B *V_N, B *V_K, const int n_frames = 1);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "#include <iostream>\n#include <sstream>\n+#include \"Tools/Algo/Bit_packer.hpp\"\n#include \"Tools/Perf/Reorderer/Reorderer.hpp\"\n#include \"Tools/Perf/Transpose/transpose_selector.h\"\n#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n@@ -318,7 +319,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\ntemplate <typename B, typename R, class API_polar>\nvoid Decoder_polar_SC_fast_sys<B,R,API_polar>\n-::_store(B *V_K) const\n+::_store(B *V_K)\n{\nconstexpr int n_frames = API_polar::get_n_frames();\n@@ -333,32 +334,19 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nif (!(fast_deinterleave = tools::char_itranspose((signed char*)s.data(),\n(signed char*)s_bis.data(),\n(int)this->N)))\n- {\n-\nthrow std::runtime_error(\"aff3ct::module::Decoder_polar_SC_fast_sys: unsupported \\\"N\\\" value for \"\n\"itransposition (N have to be greater or equal to 128 for SSE/NEON or to \"\n\"256 for AVX)\");\n- }\nelse\n- {\n- // bit unpacking\n- auto idx = n_frames * this->K -1;\n- for (auto i = n_frames * this->N -1; i > 0; i -= this->N)\n- for (unsigned j = (unsigned) 0; j < (unsigned) this->N; j += sizeof(B) * 8)\n- {\n- unsigned char packed_vals = (unsigned char) s_bis[(i -j) / (sizeof(B) * 8)];\n- for (auto k = 0; k < 8; k++)\n- if (!frozen_bits[(this->N -1 -j) -k])\n- V_K[idx--] = ((packed_vals >> (7-k)) & 0x01);\n- }\n- }\n+ tools::Bit_packer<B>::unpack(this->s_bis.data(), this->s.data(), this->N, n_frames);\n}\n#endif\nif (!fast_deinterleave)\n{\nthis->fb_extract(this->polar_patterns.get_leaves_pattern_types(),\nthis->s.data(),\n- const_cast<Decoder_polar_SC_fast_sys<B,R,API_polar>*>(this)->s_bis.data());\n+ this->s_bis.data(),\n+ n_frames);\n// transpose without bit packing (vectorized)\nstd::vector<B*> frames(n_frames);\n@@ -366,18 +354,23 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nframes[f] = (B*)(V_K + f*this->K);\ntools::Reorderer_static<B,n_frames>::apply_rev(s_bis.data(), frames, this->K);\n}\n+ else\n+ for (auto f = 0; f < n_frames; f++)\n+ this->fb_extract(this->polar_patterns.get_leaves_pattern_types(),\n+ this->s.data() + f * this->N,\n+ V_K + f * this->K);\n}\n}\ntemplate <typename B, typename R, class API_polar>\nvoid Decoder_polar_SC_fast_sys<B,R,API_polar>\n-::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K)\n+::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K,\n+ const int n_frames)\n{\n- constexpr int n_frames = API_polar::get_n_frames();\n-\nauto off_s = 0;\nauto sk_idx = 0;\n- for (auto l = 0; l < (int)leaves_patterns.size(); l++)\n+ const auto loop_size = (int)leaves_patterns.size();\n+ for (auto l = 0; l < loop_size; l++)\n{\nconst auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\nconst auto n_elmts = leaves_patterns[l].second;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Improve the store speed in the SC fast decoder.
|
8,490 |
07.04.2017 23:22:24
| -7,200 |
2ed7053d48d9369961755d2664218ee2e20f2f80
|
Add the polar codes in the turbo demod simu BFERI (SCAN decoder).
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -36,6 +36,7 @@ _aff3ct() {\n${codetype} == \"RA\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"LDPC\" && ${simutype} == \"BFER\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFER\" || \\\n+ ${codetype} == \"POLAR\" && ${simutype} == \"BFERI\" || \\\n${codetype} == \"RSC\" && ${simutype} == \"BFERI\" || \\\n${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" || \\\n@@ -76,12 +77,14 @@ _aff3ct() {\nfi\n# add contents of Launcher_BFERI.cpp\n- if [[ ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFERI\" || \\\n+ ${codetype} == \"RSC\" && ${simutype} == \"BFERI\" || \\\n+ ${codetype} == \"LDPC\" && ${simutype} == \"BFERI\" || \\\n${codetype} == \"UNCODED\" && ${simutype} == \"BFERI\" ]]\nthen\nopts=\"$opts --sim-benchs -b --sim-debug -d --sim-debug-limit \\\n--snr-sim-trace-path --sim-time-report --cde-coset -c --itl-type \\\n- --itl-path --itl-cols --itl-uni --dmod-ite --mnt-max-fe -e \\\n+ --itl-path --itl-cols --itl-uni --dmod-ite -I --mnt-max-fe -e \\\n--term-type\"\nfi\n@@ -106,13 +109,20 @@ _aff3ct() {\n--dec-simd --dec-max\"\nfi\n+ # add contents of Launcher_BFER_RSC.cpp\n+ if [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" || \\\n+ ${codetype} == \"POLAR\" && ${simutype} == \"BFERI\" ]]\n+ then\n+ opts=\"$opts --sim-pb-path --cde-awgn-fb-path --cde-fb-gen-method \\\n+ --cde-sigma --dec-type -D --dec-ite -i --dec-implem\"\n+ fi\n+\n# add contents of Launcher_BFER_polar.cpp\nif [[ ${codetype} == \"POLAR\" && ${simutype} == \"BFER\" ]]\nthen\n- opts=\"$opts --sim-pb-path --cde-awgn-fb-path --cde-fb-gen-method \\\n- --cde-sigma --crc-type --crc-poly --crc-rate --enc-no-sys \\\n- --dec-type -D --dec-ite -i --dec-lists -L --dec-simd \\\n- --dec-polar-nodes --dec-partial-adaptive\"\n+ opts=\"$opts --crc-type --crc-poly --crc-rate --enc-no-sys \\\n+ --dec-lists -L --dec-simd --dec-polar-nodes \\\n+ --dec-partial-adaptive\"\nfi\n# add contents of Launcher_BFER_repetition.cpp\n@@ -180,7 +190,7 @@ _aff3ct() {\n--qnt-dec | --qnt-bits | --qnt-range | --qnt-type | \\\n--sim-benchs | -b | --sim-debug-limit | \\\n--mnt-max-fe | -e | \\\n- --sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | \\\n+ --sim-siga-min | -a | --sim-siga-max | -A | --sim-siga-step | -I | \\\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n--sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n@@ -256,7 +266,7 @@ _aff3ct() {\n;;\n--dec-implem)\n- local params=\"GENERIC STD FAST VERY_FAST\"\n+ local params=\"NAIVE GENERIC STD FAST VERY_FAST\"\nif [ \"${codetype}\" == 'LDPC' ]; then\nparams=\"ONMS SPA LSPA GALA\"\nfi\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -98,7 +98,7 @@ void Launcher_BFERI<B,R,Q>\n\"enable the regeneration of the interleaver for each new frame.\"};\n// --------------------------------------------------------------------------------------------------- demodulator\n- this->opt_args[{\"dmod-ite\"}] =\n+ this->opt_args[{\"dmod-ite\", \"I\"}] =\n{\"positive_int\",\n\"number of iterations in the turbo demodulation.\"};\n@@ -166,7 +166,7 @@ void Launcher_BFERI<B,R,Q>\nif(this->ar.exist_arg({\"itl-uni\" })) this->params.interleaver.uniform = true;\n// --------------------------------------------------------------------------------------------------- demodulator\n- if(this->ar.exist_arg({\"dmod-ite\"})) this-> params.demodulator.n_ite = this->ar.get_arg_int({\"dmod-ite\"});\n+ if(this->ar.exist_arg({\"dmod-ite\", \"I\"})) this-> params.demodulator.n_ite = this->ar.get_arg_int({\"dmod-ite\", \"I\"});\n// ------------------------------------------------------------------------------------------------------- monitor\nif(this->ar.exist_arg({\"mnt-max-fe\", \"e\"})) this->params.monitor.n_frame_errors = this->ar.get_arg_int({\"mnt-max-fe\", \"e\"});\n@@ -264,7 +264,7 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFERI<B,R,Q>\n{\nauto p = Launcher<B,R,Q>::header_demodulator();\n- p.push_back(std::make_pair(\"Turbo demod. iterations\", std::to_string(this->params.demodulator.n_ite)));\n+ p.push_back(std::make_pair(\"Turbo demod. iterations (I)\", std::to_string(this->params.demodulator.n_ite)));\nreturn p;\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.cpp",
"diff": "+#include <iostream>\n+\n+#include \"Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.hpp\"\n+\n+#include \"Launcher_BFERI_polar.hpp\"\n+\n+using namespace aff3ct::tools;\n+using namespace aff3ct::simulation;\n+using namespace aff3ct::launcher;\n+\n+template <typename B, typename R, typename Q>\n+Launcher_BFERI_polar<B,R,Q>\n+::Launcher_BFERI_polar(const int argc, const char **argv, std::ostream &stream)\n+: Launcher_BFERI<B,R,Q>(argc, argv, stream)\n+{\n+ this->params.simulation.bin_pb_path = \"../lib/polar_bounds/bin/polar_bounds\";\n+ this->params.code .type = \"POLAR\";\n+ this->params.code .awgn_fb_path = \"../conf/cde/awgn_polar_codes/TV\";\n+ this->params.code .sigma = 0.f;\n+ this->params.code .fb_gen_method = \"TV\";\n+ this->params.crc .type = \"STD\";\n+ this->params.encoder .type = \"POLAR\";\n+ this->params.quantizer .n_bits = 6;\n+ this->params.quantizer .n_decimals = 1;\n+ this->params.decoder .type = \"SCAN\";\n+ this->params.decoder .implem = \"NAIVE\";\n+ this->params.decoder .n_ite = 1;\n+ this->params.decoder .L = 1;\n+ this->params.decoder .simd_strategy = \"\";\n+ this->params.decoder .polar_nodes = \"{R0,R0L,R1,REP,REPL,SPC}\";\n+ this->params.decoder .full_adaptive = true;\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Launcher_BFERI_polar<B,R,Q>\n+::build_args()\n+{\n+ Launcher_BFERI<B,R,Q>::build_args();\n+\n+ // ---------------------------------------------------------------------------------------------------- simulation\n+#ifdef ENABLE_POLAR_BOUNDS\n+ this->opt_args[{\"sim-pb-path\"}] =\n+ {\"string\",\n+ \"path of the polar bounds code generator (generates best channels to use).\"};\n+#endif\n+\n+ // ---------------------------------------------------------------------------------------------------------- code\n+ this->opt_args[{\"cde-sigma\"}] =\n+ {\"positive_float\",\n+ \"sigma value for the polar codes generation (adaptative frozen bits if sigma is not set).\"};\n+ this->opt_args[{\"cde-fb-gen-method\"}] =\n+ {\"string\",\n+ \"select the frozen bits generation method.\",\n+ \"GA, TV\"};\n+ this->opt_args[{\"cde-awgn-fb-path\"}] =\n+ {\"string\",\n+ \"path to a file or a directory containing the best channels to use for information bits.\"};\n+\n+ // ------------------------------------------------------------------------------------------------------- encoder\n+ this->opt_args[{\"enc-type\"}][2] += \", POLAR\";\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ this->opt_args[{\"dec-type\", \"D\"}].push_back(\"SCAN\");\n+ this->opt_args[{\"dec-ite\", \"i\"}] =\n+ {\"positive_int\",\n+ \"maximal number of iterations in the SCAN decoder.\"};\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Launcher_BFERI_polar<B,R,Q>\n+::store_args()\n+{\n+ Launcher_BFERI<B,R,Q>::store_args();\n+\n+ this->params.code.N_code = (int)std::exp2(this->params.code.m);\n+\n+ // ---------------------------------------------------------------------------------------------------- simulation\n+#ifdef ENABLE_POLAR_BOUNDS\n+ if(this->ar.exist_arg({\"sim-pb-path\"})) this->params.simulation.bin_pb_path = this->ar.get_arg({\"sim-pb-path\"});\n+#endif\n+\n+ // ---------------------------------------------------------------------------------------------------------- code\n+ if(this->ar.exist_arg({\"cde-sigma\" })) this->params.code.sigma = this->ar.get_arg_float({\"cde-sigma\"});\n+ if(this->ar.exist_arg({\"cde-awgn-fb-path\" })) this->params.code.awgn_fb_path = this->ar.get_arg ({\"cde-awgn-fb-path\" });\n+ if(this->ar.exist_arg({\"cde-fb-gen-method\"})) this->params.code.fb_gen_method = this->ar.get_arg ({\"cde-fb-gen-method\"});\n+\n+ // ------------------------------------------------------------------------------------------------------- decoder\n+ if(this->ar.exist_arg({\"dec-ite\", \"i\"})) this->params.decoder.n_ite = this->ar.get_arg_int ({\"dec-ite\", \"i\"});\n+\n+ // force 1 iteration max if not SCAN (and polar code)\n+ if (this->params.decoder.type != \"SCAN\") this->params.decoder.n_ite = 1;\n+}\n+\n+template <typename B, typename R, typename Q>\n+Simulation* Launcher_BFERI_polar<B,R,Q>\n+::build_simu()\n+{\n+ return new Simulation_BFERI_polar<B,R,Q>(this->params);\n+}\n+\n+template <typename B, typename R, typename Q>\n+std::vector<std::pair<std::string,std::string>> Launcher_BFERI_polar<B,R,Q>\n+::header_code()\n+{\n+ std::string sigma = (this->params.code.sigma == 0.f) ? \"adaptative\" : std::to_string(this->params.code.sigma);\n+\n+ auto p = Launcher_BFERI<B,R,Q>::header_code();\n+\n+ p.push_back(std::make_pair(\"Sigma for code gen.\", sigma ));\n+ p.push_back(std::make_pair(\"Frozen bits gen. method\", this->params.code.fb_gen_method ));\n+ if (this->params.code.fb_gen_method != \"GA\" && !this->params.code.awgn_fb_path.empty())\n+ p.push_back(std::make_pair(\"Path to the best channels\", this->params.code.awgn_fb_path));\n+\n+ return p;\n+}\n+\n+template <typename B, typename R, typename Q>\n+std::vector<std::pair<std::string,std::string>> Launcher_BFERI_polar<B,R,Q>\n+::header_decoder()\n+{\n+ auto p = Launcher_BFERI<B,R,Q>::header_decoder();\n+\n+ if (this->params.decoder.type == \"SCAN\")\n+ p.push_back(std::make_pair(\"Num. of iterations (i)\", std::to_string(this->params.decoder.n_ite)));\n+\n+ return p;\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::launcher::Launcher_BFERI_polar<B_8,R_8,Q_8>;\n+template class aff3ct::launcher::Launcher_BFERI_polar<B_16,R_16,Q_16>;\n+template class aff3ct::launcher::Launcher_BFERI_polar<B_32,R_32,Q_32>;\n+template class aff3ct::launcher::Launcher_BFERI_polar<B_64,R_64,Q_64>;\n+#else\n+template class aff3ct::launcher::Launcher_BFERI_polar<B,R,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.hpp",
"diff": "+#ifndef LAUNCHER_BFERI_POLAR_HPP_\n+#define LAUNCHER_BFERI_POLAR_HPP_\n+\n+#include \"../Launcher_BFERI.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace launcher\n+{\n+template <typename B = int, typename R = float, typename Q = R>\n+class Launcher_BFERI_polar : public Launcher_BFERI<B,R,Q>\n+{\n+public:\n+ Launcher_BFERI_polar(const int argc, const char **argv, std::ostream &stream = std::cout);\n+ virtual ~Launcher_BFERI_polar() {};\n+\n+protected:\n+ virtual void build_args();\n+ virtual void store_args();\n+ virtual simulation::Simulation* build_simu();\n+\n+ virtual std::vector<std::pair<std::string,std::string>> header_code ();\n+ virtual std::vector<std::pair<std::string,std::string>> header_decoder();\n+};\n+}\n+}\n+\n+#endif /* LAUNCHER_BFERI_POLAR_HPP_ */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.cpp",
"diff": "+#include <string>\n+#include <vector>\n+#include <chrono>\n+#include <cstdlib>\n+#include <algorithm>\n+\n+#include \"Tools/Display/Frame_trace/Frame_trace.hpp\"\n+#include \"Tools/Factory/Polar/Factory_frozenbits_generator.hpp\"\n+#include \"Tools/Factory/Polar/Factory_encoder_polar.hpp\"\n+#include \"Tools/Factory/Polar/Factory_decoder_polar.hpp\"\n+\n+#include \"Simulation_BFERI_polar.hpp\"\n+\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\n+using namespace aff3ct::simulation;\n+\n+template <typename B, typename R, typename Q>\n+Simulation_BFERI_polar<B,R,Q>\n+::Simulation_BFERI_polar(const parameters& params)\n+: Simulation_BFERI<B,R,Q>(params),\n+ frozen_bits((int)std::exp2(this->params.code.m)),\n+ fb_generator(nullptr),\n+ decoder_siso(params.simulation.n_threads, nullptr)\n+{\n+ // build the frozen bits generator\n+ fb_generator = Factory_frozenbits_generator<B>::build(params);\n+ Simulation::check_errors(fb_generator, \"Frozenbits_generator<B>\");\n+}\n+\n+template <typename B, typename R, typename Q>\n+Simulation_BFERI_polar<B,R,Q>\n+::~Simulation_BFERI_polar()\n+{\n+ if (fb_generator != nullptr) { delete fb_generator; fb_generator = nullptr; }\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Simulation_BFERI_polar<B,R,Q>\n+::launch_precompute()\n+{\n+ if (this->params.code.sigma != 0.f)\n+ fb_generator->generate(frozen_bits);\n+}\n+\n+template <typename B, typename R, typename Q>\n+void Simulation_BFERI_polar<B,R,Q>\n+::snr_precompute()\n+{\n+ // adaptative frozen bits generation\n+ if (this->params.code.sigma == 0.f)\n+ {\n+ fb_generator->set_sigma(this->sigma);\n+ fb_generator->generate(frozen_bits);\n+ }\n+\n+ if (this->params.simulation.debug)\n+ {\n+ std::clog << std::endl << \"Frozen bits:\" << std::endl;\n+ Frame_trace<B> ft(this->params.simulation.debug_limit);\n+ ft.display_bit_vector(frozen_bits);\n+ std::clog << std::endl;\n+ }\n+}\n+\n+template <typename B, typename R, typename Q>\n+Encoder<B>* Simulation_BFERI_polar<B,R,Q>\n+::build_encoder(const int tid)\n+{\n+ return Factory_encoder_polar<B>::build(this->params, frozen_bits);\n+}\n+\n+template <typename B, typename R, typename Q>\n+SISO<Q>* Simulation_BFERI_polar<B,R,Q>\n+::build_siso(const int tid)\n+{\n+ decoder_siso[tid] = Factory_decoder_polar<B,Q>::build_siso(this->params, frozen_bits);\n+ return decoder_siso[tid];\n+}\n+\n+template <typename B, typename R, typename Q>\n+Decoder<B,Q>* Simulation_BFERI_polar<B,R,Q>\n+::build_decoder(const int tid)\n+{\n+ return decoder_siso[tid];\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::simulation::Simulation_BFERI_polar<B_8,R_8,Q_8>;\n+template class aff3ct::simulation::Simulation_BFERI_polar<B_16,R_16,Q_16>;\n+template class aff3ct::simulation::Simulation_BFERI_polar<B_32,R_32,Q_32>;\n+template class aff3ct::simulation::Simulation_BFERI_polar<B_64,R_64,Q_64>;\n+#else\n+template class aff3ct::simulation::Simulation_BFERI_polar<B,R,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.hpp",
"diff": "+#ifndef SIMULATION_BFERI_POLAR_HPP_\n+#define SIMULATION_BFERI_POLAR_HPP_\n+\n+#include \"Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.hpp\"\n+\n+#include \"Module/Decoder/Decoder_SISO.hpp\"\n+\n+#include \"Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace simulation\n+{\n+template <typename B = int, typename R = float, typename Q = R>\n+class Simulation_BFERI_polar : public Simulation_BFERI<B,R,Q>\n+{\n+protected:\n+ mipp::vector<B> frozen_bits; // known bits (alias frozen bits) are set to true\n+ tools::Frozenbits_generator<B> *fb_generator;\n+ std::vector<module::Decoder_SISO<B,Q>*> decoder_siso;\n+\n+public:\n+ Simulation_BFERI_polar(const tools::parameters& params);\n+\n+ virtual ~Simulation_BFERI_polar();\n+\n+protected:\n+ void launch_precompute();\n+ void snr_precompute ();\n+ module::Encoder<B>* build_encoder (const int tid = 0);\n+ module::SISO<Q>* build_siso (const int tid = 0);\n+ module::Decoder<B,Q>* build_decoder (const int tid = 0);\n+};\n+}\n+}\n+\n+#endif /* SIMULATION_BFERI_POLAR_HPP_ */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.cpp",
"diff": "@@ -40,16 +40,17 @@ using namespace aff3ct::tools;\nusing namespace aff3ct::module;\ntemplate <typename B, typename R>\n-SISO<R>* Factory_decoder_polar<B,R>\n+Decoder_SISO<B,R>* Factory_decoder_polar<B,R>\n::build_siso(const parameters ¶ms, const mipp::vector<B> &frozen_bits)\n{\n- SISO<R> *siso = nullptr;\n+ Decoder_SISO<B,R> *siso = nullptr;\n// build the decoder\nif (params.encoder.systematic) // non-systematic encoding / decoding\nif (params.channel.domain == \"LLR\")\nif (params.decoder.type == \"SCAN\" && params.decoder.implem == \"NAIVE\")\nsiso = new Decoder_polar_SCAN_naive_sys<B, R, init_LLR<R>, f_LLR<R>, v_LLR<R>, h_LLR<B,R>>(params.code.K, params.code.N_code, params.decoder.n_ite, frozen_bits, params.simulation.inter_frame_level);\n+\nreturn siso;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Polar/Factory_decoder_polar.hpp",
"new_path": "src/Tools/Factory/Polar/Factory_decoder_polar.hpp",
"diff": "#define FACTORY_DECODER_POLAR_HPP\n#include \"Module/CRC/CRC.hpp\"\n-#include \"Module/Decoder/SISO.hpp\"\n+#include \"Module/Decoder/Decoder_SISO.hpp\"\n#include \"Module/Decoder/Decoder.hpp\"\n#include \"Tools/Perf/MIPP/mipp.h\"\n#include \"Tools/params.h\"\n@@ -16,7 +16,7 @@ namespace tools\ntemplate <typename B = int, typename R = float>\nstruct Factory_decoder_polar : public Factory\n{\n- static module::SISO<R>* build_siso(const parameters ¶ms, const mipp::vector<B> &frozen_bits);\n+ static module::Decoder_SISO<B,R>* build_siso(const parameters ¶ms, const mipp::vector<B> &frozen_bits);\nstatic module::Decoder<B,R>* build(const parameters ¶ms, const mipp::vector<B> &frozen_bits,\nmodule::CRC<B> *crc);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/main.cpp",
"new_path": "src/main.cpp",
"diff": "#include \"Launcher/BFER/Repetition/Launcher_BFER_repetition.hpp\"\n#include \"Launcher/BFER/Uncoded/Launcher_BFER_uncoded.hpp\"\n+\n+#include \"Launcher/BFERI/Polar/Launcher_BFERI_polar.hpp\"\n#include \"Launcher/BFERI/RSC/Launcher_BFERI_RSC.hpp\"\n#include \"Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.hpp\"\n#include \"Launcher/BFERI/Uncoded/Launcher_BFERI_uncoded.hpp\"\n@@ -221,6 +223,8 @@ void start_simu(const int argc, const char **argv, std::string code_type, std::s\n{\nif (simu_type == \"BFER\")\nlauncher = new Launcher_BFER_polar<B,R,Q>(argc, argv);\n+ else if (simu_type == \"BFERI\")\n+ launcher = new Launcher_BFERI_polar<B,R,Q>(argc, argv);\nelse if (simu_type == \"GEN\")\nlauncher = new Launcher_GEN_polar<B,R,Q>(argc, argv);\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the polar codes in the turbo demod simu BFERI (SCAN decoder).
|
8,490 |
07.04.2017 23:50:48
| -7,200 |
d89deb528368f4ca43aab828f26896613a5618fb
|
Move the frozen bit extractor in the Patter_polar_parser class.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hpp",
"diff": "@@ -58,9 +58,6 @@ protected:\nvoid _store ( B *V_K);\nvirtual void recursive_decode(const int off_l, const int off_s, const int reverse_depth, int &node_id);\n-\n- inline static void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns,\n- const B *V_N, B *V_K, const int n_frames = 1);\n};\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "@@ -324,7 +324,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nconstexpr int n_frames = API_polar::get_n_frames();\nif (n_frames == 1)\n- this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s.data(), V_K);\n+ this->polar_patterns.fb_extract(this->s.data(), V_K);\nelse\n{\nbool fast_deinterleave = false;\n@@ -343,10 +343,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n#endif\nif (!fast_deinterleave)\n{\n- this->fb_extract(this->polar_patterns.get_leaves_pattern_types(),\n- this->s.data(),\n- this->s_bis.data(),\n- n_frames);\n+ this->polar_patterns.fb_extract(this->s.data(), this->s_bis.data(), n_frames);\n// transpose without bit packing (vectorized)\nstd::vector<B*> frames(n_frames);\n@@ -356,55 +353,9 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n}\nelse\nfor (auto f = 0; f < n_frames; f++)\n- this->fb_extract(this->polar_patterns.get_leaves_pattern_types(),\n- this->s.data() + f * this->N,\n+ this->polar_patterns.fb_extract(this->s.data() + f * this->N,\nV_K + f * this->K);\n}\n}\n-\n-template <typename B, typename R, class API_polar>\n-void Decoder_polar_SC_fast_sys<B,R,API_polar>\n-::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K,\n- const int n_frames)\n-{\n- auto off_s = 0;\n- auto sk_idx = 0;\n- const auto loop_size = (int)leaves_patterns.size();\n- for (auto l = 0; l < loop_size; l++)\n- {\n- const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n- const auto n_elmts = leaves_patterns[l].second;\n- switch (node_type)\n- {\n- case tools::RATE_0:\n- break;\n- case tools::RATE_1:\n- std::copy(V_N + off_s * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_elmts * n_frames;\n- break;\n- case tools::REP:\n- std::copy(V_N + (off_s + n_elmts -1) * n_frames,\n- V_N + (off_s + n_elmts +0) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_frames;\n- break;\n- case tools::SPC:\n- std::copy(V_N + (off_s + 1 ) * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += (n_elmts -1) * n_frames;\n- break;\n- default:\n- throw std::runtime_error(\"aff3ct::module::Decoder_polar_SC_fast_sys: unknown polar node type.\");\n- break;\n- }\n- off_s += n_elmts;\n- }\n-}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"diff": "@@ -28,7 +28,7 @@ template <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n{\n- this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), s.data(), U_test.data());\n+ this->polar_patterns.fb_extract(s.data(), U_test.data());\n// check the CRC\nreturn crc.check(U_test, this->get_simd_inter_frame_level());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx",
"diff": "@@ -28,7 +28,7 @@ template <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n{\n- this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), s.data(), U_test.data());\n+ this->polar_patterns.fb_extract(s.data(), U_test.data());\n// check the CRC\nreturn crc.check(U_test, this->get_simd_inter_frame_level());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp",
"diff": "@@ -91,8 +91,6 @@ protected:\ninline void delete_path (int path_id, const int r_d);\nvirtual inline int select_best_path( );\n- static void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K);\n-\nprivate:\ninline void erase_bad_paths(const int r_d);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"diff": "@@ -483,7 +483,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::_store(B *V_K) const\n{\n- this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s[best_path].data(), V_K);\n+ this->polar_patterns.fb_extract(this->s[best_path].data(), V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -1272,50 +1272,5 @@ void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nelse\nk++;\n}\n-\n-template <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n-::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K)\n-{\n- constexpr int n_frames = API_polar::get_n_frames();\n-\n- auto off_s = 0;\n- auto sk_idx = 0;\n- for (auto l = 0; l < (int)leaves_patterns.size(); l++)\n- {\n- const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n- const auto n_elmts = leaves_patterns[l].second;\n- switch (node_type)\n- {\n- case tools::RATE_0:\n- break;\n- case tools::RATE_1:\n- std::copy(V_N + off_s * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_elmts * n_frames;\n- break;\n- case tools::REP:\n- std::copy(V_N + (off_s + n_elmts -1) * n_frames,\n- V_N + (off_s + n_elmts +0) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_frames;\n- break;\n- case tools::SPC:\n- std::copy(V_N + (off_s + 1 ) * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += (n_elmts -1) * n_frames;\n- break;\n- default:\n- throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_MEM_fast_sys: unknown polar node type.\");\n- break;\n- }\n- off_s += n_elmts;\n- }\n-}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hpp",
"diff": "@@ -83,8 +83,6 @@ protected:\nvirtual inline int select_best_path( );\ninline int up_ref_array_idx(const int path, const int r_d); // return the array\n- static void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K);\n-\nprivate:\ninline void flip_bits_r1 (const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts);\ninline void flip_bits_spc(const int old_path, const int new_path, const int dup, const int off_s, const int n_elmts);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"diff": "@@ -419,7 +419,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::_store(B *V_K) const\n{\n- this->fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s[best_path].data(), V_K);\n+ this->polar_patterns.fb_extract(this->s[best_path].data(), V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n@@ -1173,50 +1173,5 @@ int Decoder_polar_SCL_fast_sys<B,R,API_polar>\nreturn new_path;\n}\n-\n-template <typename B, typename R, class API_polar>\n-void Decoder_polar_SCL_fast_sys<B,R,API_polar>\n-::fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K)\n-{\n- constexpr int n_frames = API_polar::get_n_frames();\n-\n- auto off_s = 0;\n- auto sk_idx = 0;\n- for (auto l = 0; l < (int)leaves_patterns.size(); l++)\n- {\n- const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n- const auto n_elmts = leaves_patterns[l].second;\n- switch (node_type)\n- {\n- case tools::RATE_0:\n- break;\n- case tools::RATE_1:\n- std::copy(V_N + off_s * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_elmts * n_frames;\n- break;\n- case tools::REP:\n- std::copy(V_N + (off_s + n_elmts -1) * n_frames,\n- V_N + (off_s + n_elmts +0) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_frames;\n- break;\n- case tools::SPC:\n- std::copy(V_N + (off_s + 1 ) * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += (n_elmts -1) * n_frames;\n- break;\n- default:\n- throw std::runtime_error(\"aff3ct::module::Decoder_polar_SCL_fast_sys: unknown polar node type.\");\n- break;\n- }\n- off_s += n_elmts;\n- }\n-}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp",
"new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp",
"diff": "@@ -120,6 +120,8 @@ public:\n*/\nvoid release_patterns() const;\n+ inline void fb_extract(const B *V_N, B *V_K, const int n_frames = 1) const;\n+\nprivate:\nvoid recursive_allocate_nodes_patterns ( Binary_node<Pattern_polar_i>* node_curr);\nvoid generate_nodes_indexes (const Binary_node<Pattern_polar_i>* node_curr);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"diff": "+#include <stdexcept>\n#include <cmath>\n#include <algorithm>\n#include <iostream>\n@@ -214,5 +215,52 @@ const Binary_tree<Pattern_polar_i>* Pattern_polar_parser<B>\n{\nreturn polar_tree;\n}\n+\n+template <typename B>\n+void Pattern_polar_parser<B>\n+::fb_extract(const B *V_N, B *V_K, const int n_frames) const\n+{\n+ const auto leaves_patterns = this->get_leaves_pattern_types();\n+\n+ auto off_s = 0;\n+ auto sk_idx = 0;\n+\n+ const auto loop_size = (int)leaves_patterns.size();\n+ for (auto l = 0; l < loop_size; l++)\n+ {\n+ const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n+ const auto n_elmts = leaves_patterns[l].second;\n+ switch (node_type)\n+ {\n+ case tools::RATE_0:\n+ break;\n+ case tools::RATE_1:\n+ std::copy(V_N + off_s * n_frames,\n+ V_N + (off_s + n_elmts) * n_frames,\n+ V_K + sk_idx);\n+\n+ sk_idx += n_elmts * n_frames;\n+ break;\n+ case tools::REP:\n+ std::copy(V_N + (off_s + n_elmts -1) * n_frames,\n+ V_N + (off_s + n_elmts +0) * n_frames,\n+ V_K + sk_idx);\n+\n+ sk_idx += n_frames;\n+ break;\n+ case tools::SPC:\n+ std::copy(V_N + (off_s + 1 ) * n_frames,\n+ V_N + (off_s + n_elmts) * n_frames,\n+ V_K + sk_idx);\n+\n+ sk_idx += (n_elmts -1) * n_frames;\n+ break;\n+ default:\n+ throw std::runtime_error(\"aff3ct::tools::Pattern_polar_parser: unknown polar node type.\");\n+ break;\n+ }\n+ off_s += n_elmts;\n+ }\n+}\n}\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Move the frozen bit extractor in the Patter_polar_parser class.
|
8,490 |
10.04.2017 14:06:52
| -7,200 |
ae9b35006345440a0b3ccb665081f2e6e48c9613
|
Fix LDPC BP layered.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.cpp",
"diff": "@@ -49,7 +49,7 @@ Decoder_LDPC_BP_layered<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered<B,R>\n-::_soft_decode_fbf(const R *Y_N1, R *Y_N2)\n+::_soft_decode(const R *Y_N1, R *Y_N2)\n{\n// memory zones initialization\nthis->_load(Y_N1);\n@@ -87,7 +87,7 @@ void Decoder_LDPC_BP_layered<B,R>\ntemplate <typename B, typename R>\nvoid Decoder_LDPC_BP_layered<B,R>\n-::_hard_decode_fbf(const R *Y_N, B *V_K)\n+::_hard_decode(const R *Y_N, B *V_K)\n{\nauto t_load = std::chrono::steady_clock::now(); // ----------------------------------------------------------- LOAD\nthis->_load(Y_N);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp",
"diff": "@@ -45,11 +45,11 @@ public:\nprotected:\n// soft decode\n- void _soft_decode_fbf(const R *Y_N1, R *Y_N2);\n+ void _soft_decode(const R *Y_N1, R *Y_N2);\n// hard decoder (load -> decode -> store)\nvoid _load (const R *Y_N);\n- void _hard_decode_fbf(const R *Y_N, B *V_K);\n+ void _hard_decode(const R *Y_N, B *V_K);\nvoid _store (B *V_K) const;\n// BP functions for decoding\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix LDPC BP layered.
|
8,490 |
10.04.2017 15:05:04
| -7,200 |
8c9833d9b378441e1143475434a23901eb1708d5
|
Automatically switch to 1 thread in debug mode.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"new_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"diff": "@@ -117,6 +117,11 @@ void Launcher_BFER<B,R,Q>\nthis->params.simulation.debug_limit = this->ar.get_arg_int({\"sim-debug-limit\"});\n}\n+ if (this->params.simulation.debug &&\n+ !(this->ar.exist_arg({\"sim-threads\", \"t\"}) && this->ar.get_arg_int({\"sim-threads\", \"t\"}) > 0))\n+ // check if debug is asked and if n_thread kept its default value\n+ this->params.simulation.n_threads = 1;\n+\n// ---------------------------------------------------------------------------------------------------------- code\nif(this->ar.exist_arg({\"cde-coset\", \"c\"})) this->params.code.coset = true;\nif (this->params.code.coset)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -144,6 +144,11 @@ void Launcher_BFERI<B,R,Q>\nthis->params.simulation.debug_limit = this->ar.get_arg_int({\"sim-debug-limit\"});\n}\n+ if (this->params.simulation.debug &&\n+ !(this->ar.exist_arg({\"sim-threads\", \"t\"}) && this->ar.get_arg_int({\"sim-threads\", \"t\"}) > 0))\n+ // check if debug is asked and if n_thread kept its default value\n+ this->params.simulation.n_threads = 1;\n+\n// ---------------------------------------------------------------------------------------------------------- code\nif(this->ar.exist_arg({\"cde-coset\", \"c\"})) this->params.code.coset = true;\nif (this->params.code.coset)\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Automatically switch to 1 thread in debug mode.
|
8,490 |
10.04.2017 15:55:32
| -7,200 |
1f39e65e6e909ac8c3a4cd409773eeab819994af
|
Fix the error tracker.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Monitor/Monitor.hpp",
"new_path": "src/Module/Monitor/Monitor.hpp",
"diff": "@@ -306,7 +306,7 @@ protected:\nthrow std::runtime_error(\"aff3ct::module::Monitor: \\\"_check_errors\\\" is unimplemented.\");\n}\n- void _check_and_track_errors(const B *U_K, const B *V_K, const B *X_N, const R *Y_N_mod)\n+ virtual void _check_and_track_errors(const B *U_K, const B *V_K, const B *X_N, const R *Y_N_mod)\n{\nthrow std::runtime_error(\"aff3ct::module::Monitor: \\\"_check_and_track_errors\\\" is unimplemented.\");\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the error tracker.
|
8,490 |
10.04.2017 15:59:28
| -7,200 |
545e3a25535bbfff5971024b19129d09909a23e7
|
Fix complex_transpose function.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Tools/Math/matrix.hxx",
"new_path": "src/Tools/Math/matrix.hxx",
"diff": "@@ -170,9 +170,9 @@ inline void complex_transpose(const int M, const int N,\nT *B)\n{\nconst T* A_real = A;\n- const T* A_imag = A + ((M * N) >> 1);\n+ const T* A_imag = A + M * N;\nT* B_real = B;\n- T* B_imag = B + ((M * N) >> 1);\n+ T* B_imag = B + M * N;\nfor (auto i = 0; i < M; i++)\n{\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix complex_transpose function.
|
8,490 |
11.04.2017 11:23:49
| -7,200 |
a2e75d4c1bcdee991405bd72ca5baa190a12557f
|
By default, use only 1 thread when reverting the error tracking mode.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"new_path": "src/Launcher/BFER/Launcher_BFER.cpp",
"diff": "@@ -156,6 +156,10 @@ void Launcher_BFER<B,R,Q>\n// the paths are set in the Simulation class\n}\n+ if (this->params.monitor.err_track_revert &&\n+ !(this->ar.exist_arg({\"sim-threads\", \"t\"}) && this->ar.get_arg_int({\"sim-threads\", \"t\"}) > 0))\n+ this->params.simulation.n_threads = 1;\n+\n// ------------------------------------------------------------------------------------------------------ terminal\nif(this->ar.exist_arg({\"term-type\"})) this->params.terminal.type = this->ar.get_arg({\"term-type\"});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"new_path": "src/Launcher/BFERI/Launcher_BFERI.cpp",
"diff": "@@ -194,6 +194,10 @@ void Launcher_BFERI<B,R,Q>\n// the paths are set in the Simulation class\n}\n+ if (this->params.monitor.err_track_revert &&\n+ !(this->ar.exist_arg({\"sim-threads\", \"t\"}) && this->ar.get_arg_int({\"sim-threads\", \"t\"}) > 0))\n+ this->params.simulation.n_threads = 1;\n+\n// ------------------------------------------------------------------------------------------------------ terminal\nif(this->ar.exist_arg({\"term-type\"})) this->params.terminal.type = this->ar.get_arg({\"term-type\"});\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
By default, use only 1 thread when reverting the error tracking mode.
|
8,490 |
11.04.2017 11:24:17
| -7,200 |
2ea2e92a7b24d28fbe8896373bc58a2f91f21da0
|
Fix the last SNR missing.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/Launcher.cpp",
"new_path": "src/Launcher/Launcher.cpp",
"diff": "@@ -304,6 +304,8 @@ void Launcher<B,R,Q>\nparams.simulation.snr_min = ar.get_arg_float({\"sim-snr-min\", \"m\"}); // required\nparams.simulation.snr_max = ar.get_arg_float({\"sim-snr-max\", \"M\"}); // required\n+ params.simulation.snr_max += 0.0001f; // hack to avoid the miss of the last snr\n+\nif(ar.exist_arg({\"sim-type\" })) params.simulation.type = ar.get_arg ({\"sim-type\" });\nif(ar.exist_arg({\"sim-pyber\" })) params.simulation.pyber = ar.get_arg ({\"sim-pyber\" });\nif(ar.exist_arg({\"sim-snr-step\", \"s\" })) params.simulation.snr_step = ar.get_arg_float({\"sim-snr-step\", \"s\" });\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix the last SNR missing.
|
8,490 |
12.04.2017 11:26:44
| -7,200 |
961212ee15e623b12aa169b18481f41c01208108
|
First implem. of a turbo puncturer.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -26,6 +26,7 @@ Launcher_BFER_turbo<B,R,Q,QD>\nthis->params.encoder .type = \"TURBO\";\nthis->params.encoder .buffered = true;\nthis->params.encoder .poly = {013, 015};\n+ this->params.puncturer .pattern = \"111,111,111\";\nthis->params.interleaver.type = \"LTE\";\nthis->params.interleaver.path = \"\";\nthis->params.interleaver.n_cols = 4;\n@@ -84,6 +85,11 @@ void Launcher_BFER_turbo<B,R,Q,QD>\n{\"string\",\n\"the polynomials describing RSC code, should be of the form \\\"{A,B}\\\".\"};\n+ // ----------------------------------------------------------------------------------------------------- puncturer\n+ this->opt_args[{\"pct-pattern\"}] =\n+ {\"string\",\n+ \"puncturing pattern for the turbo encoder (ex: \\\"11,10,01\\\").\"};\n+\n// --------------------------------------------------------------------------------------------------- interleaver\nthis->opt_args[{\"itl-type\"}] =\n{\"string\",\n@@ -147,6 +153,8 @@ void Launcher_BFER_turbo<B,R,Q,QD>\n{\nLauncher_BFER<B,R,Q>::store_args();\n+ this->params.code.N_code = 3 * this->params.code.K;\n+\n// ---------------------------------------------------------------------------------------------------- simulation\nif(this->ar.exist_arg({\"sim-json-path\"})) this->params.simulation.json_path = this->ar.get_arg({\"sim-json-path\"});\n@@ -178,6 +186,9 @@ void Launcher_BFER_turbo<B,R,Q,QD>\n#endif\n}\n+ // ------------------------------------------------------------------------------------------------------ puncturer\n+ if(this->ar.exist_arg({\"pct-pattern\"})) this->params.puncturer.pattern = this->ar.get_arg({\"pct-pattern\"});\n+\n// --------------------------------------------------------------------------------------------------- interleaver\nif(this->ar.exist_arg({\"itl-type\"})) this->params.interleaver.type = this->ar.get_arg ({\"itl-type\"});\nif(this->ar.exist_arg({\"itl-path\"})) this->params.interleaver.path = this->ar.get_arg ({\"itl-path\"});\n@@ -311,6 +322,18 @@ std::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\nreturn p;\n}\n+template <typename B, typename R, typename Q, typename QD>\n+std::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\n+::header_puncturer()\n+{\n+ auto p = Launcher_BFER<B,R,Q>::header_puncturer();\n+\n+ if (this->params.code.N != this->params.code.N_code)\n+ p.push_back(std::make_pair(std::string(\"Pattern\"), std::string(\"{\" + this->params.puncturer.pattern) + \"}\"));\n+\n+ return p;\n+}\n+\ntemplate <typename B, typename R, typename Q, typename QD>\nstd::vector<std::pair<std::string,std::string>> Launcher_BFER_turbo<B,R,Q,QD>\n::header_decoder()\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp",
"diff": "@@ -22,6 +22,7 @@ protected:\nvirtual std::vector<std::pair<std::string,std::string>> header_simulation ();\nvirtual std::vector<std::pair<std::string,std::string>> header_crc ();\nvirtual std::vector<std::pair<std::string,std::string>> header_encoder ();\n+ virtual std::vector<std::pair<std::string,std::string>> header_puncturer ();\nvirtual std::vector<std::pair<std::string,std::string>> header_interleaver();\nvirtual std::vector<std::pair<std::string,std::string>> header_decoder ();\n};\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "+#include <stdexcept>\n+\n+#include \"Tools/general_utils.h\"\n+\n+#include \"Puncturer_turbo.hpp\"\n+\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\n+\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<B,Q>(K, N + tail_bits, 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+ throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"tail_bits\\\" has to be positive.\");\n+\n+ if (!buff_enc)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"buff_enc\\\" has to be set to true.\");\n+\n+ auto str_array = string_split(pattern, ',');\n+\n+ if (str_array.size() != 3)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"pattern\\\" should give 3 different set \"\n+ \"delimited by a comma.\");\n+\n+ if (str_array[0].size() != str_array[1].size() || str_array[0].size() != str_array[2].size())\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"pattern\\\" should give 3 different set \"\n+ \"delimited by a comma and each of those sets has to contains an equal number \"\n+ \"of bits.\");\n+\n+ auto period = (int)str_array[0].size();\n+\n+ if (this->K % period)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"K\\\" has to be a multiple of \\\"n_bits\\\".\");\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] = (bool)std::stoi(std::string(c));\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+ throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"N - tail_bits\\\" has to be equal to \"\n+ \"\\\"(K / period) * bit_count\\\".\");\n+}\n+\n+template <typename B, typename Q>\n+Puncturer_turbo<B,Q>\n+::~Puncturer_turbo()\n+{\n+}\n+\n+template <typename B, typename Q>\n+void Puncturer_turbo<B,Q>\n+::_puncture(const B *X_N1, B *X_N2) const\n+{\n+ const auto period = pattern_bits[0].size();\n+\n+ auto k = 0;\n+ for (auto j = 0; j < 3; j++)\n+ {\n+ auto p = 0;\n+ for (auto i = 0; i < this->K; i++)\n+ {\n+ if (pattern_bits[j][p])\n+ X_N2[k++] = X_N1[this->K * j +i];\n+\n+ p = (p +1) % period;\n+ }\n+ }\n+\n+ std::copy(X_N1 + 3 * this->K, X_N1 + 3 * this->K + this->tail_bits, X_N2 + k);\n+\n+ if (k + this->tail_bits != this->N)\n+ throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"k + this->tail_bits\\\" has to be equal to \"\n+ \"\\\"N\\\".\");\n+}\n+\n+template <typename B, typename Q>\n+void Puncturer_turbo<B,Q>\n+::_depuncture(const Q *Y_N1, Q *Y_N2) const\n+{\n+ const auto period = pattern_bits[0].size();\n+\n+ auto k = 0;\n+ for (auto j = 0; j < 3; j++)\n+ {\n+ auto p = 0;\n+ for (auto i = 0; i < this->K; i++)\n+ {\n+ Y_N2[this->K * j +i] = pattern_bits[j][p] ? Y_N1[k++] : (Q)0;\n+\n+ p = (p +1) % period;\n+ }\n+ }\n+\n+ std::copy(Y_N1 + k, Y_N1 + k + this->tail_bits, Y_N2 + 3 * this->K);\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template class aff3ct::module::Puncturer_turbo<B_8,Q_8>;\n+template class aff3ct::module::Puncturer_turbo<B_16,Q_16>;\n+template class aff3ct::module::Puncturer_turbo<B_32,Q_32>;\n+template class aff3ct::module::Puncturer_turbo<B_64,Q_64>;\n+#else\n+template class aff3ct::module::Puncturer_turbo<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.hpp",
"diff": "+#ifndef PUNCTURER_TURBO_HPP_\n+#define PUNCTURER_TURBO_HPP_\n+\n+#include <vector>\n+\n+#include \"../Puncturer.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace module\n+{\n+template <typename B = int, typename Q = float>\n+class Puncturer_turbo : public Puncturer<B,Q>\n+{\n+protected:\n+ std::vector<std::vector<bool>> pattern_bits;\n+ const bool buff_enc;\n+ const int tail_bits;\n+\n+public:\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+ virtual ~Puncturer_turbo();\n+\n+protected:\n+ void _puncture(const B *X_N1, B *X_N2) const;\n+ void _depuncture(const Q *Y_N1, Q *Y_N2) const;\n+};\n+}\n+}\n+\n+#endif /* PUNCTURER_TURBO_HPP_ */\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp",
"new_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.cpp",
"diff": "#include \"Tools/Factory/Factory_interleaver.hpp\"\n#include \"Tools/Factory/RSC/Factory_encoder_RSC.hpp\"\n#include \"Tools/Factory/Turbo/Factory_encoder_turbo.hpp\"\n+#include \"Tools/Factory/Turbo/Factory_puncturer_turbo.hpp\"\n#include \"Tools/Factory/Turbo/Factory_scaling_factor.hpp\"\n#include \"Tools/Factory/RSC/Factory_decoder_RSC.hpp\"\n#include \"Tools/Factory/Turbo/Factory_decoder_turbo.hpp\"\n@@ -95,6 +96,13 @@ Encoder<B>* Simulation_BFER_turbo<B,R,Q,QD>\nreturn encoder;\n}\n+template <typename B, typename R, typename Q, typename QD>\n+Puncturer<B,Q>* Simulation_BFER_turbo<B,R,Q,QD>\n+::build_puncturer(const int tid)\n+{\n+ return Factory_puncturer_turbo<B,Q>::build(this->params);\n+}\n+\ntemplate <typename B, typename R, typename Q, typename QD>\nDecoder<B,Q>* Simulation_BFER_turbo<B,R,Q,QD>\n::build_decoder(const int tid)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.hpp",
"new_path": "src/Simulation/BFER/Code/Turbo/Simulation_BFER_turbo.hpp",
"diff": "@@ -34,6 +34,7 @@ protected:\nvoid launch_precompute();\nvoid snr_precompute ();\nmodule::Encoder <B >* build_encoder (const int tid = 0);\n+ module::Puncturer <B,Q>* build_puncturer (const int tid = 0);\nmodule::Decoder <B,Q>* build_decoder (const int tid = 0);\nmodule::Interleaver<int>* build_interleaver(const int tid = 0);\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/nodes_parser.cpp",
"new_path": "src/Tools/Code/Polar/nodes_parser.cpp",
"diff": "#include \"Tools/Display/bash_tools.h\"\n-#include \"nodes_parser.h\"\n+#include \"Tools/general_utils.h\"\n-std::vector<std::string> string_split(const std::string &s, char delim)\n-{\n- std::stringstream ss(s);\n- std::string item;\n- std::vector<std::string> elems;\n- while (std::getline(ss, item, delim))\n- elems.push_back(std::move(item));\n+#include \"nodes_parser.h\"\n- return elems;\n-}\n+using namespace aff3ct::tools;\nstd::vector<aff3ct::tools::Pattern_polar_i*> aff3ct::tools::nodes_parser(const std::string &str_polar,\nint &idx_r0,\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Turbo/Factory_decoder_turbo.cpp",
"new_path": "src/Tools/Factory/Turbo/Factory_decoder_turbo.cpp",
"diff": "@@ -31,13 +31,13 @@ Decoder<B,R>* Factory_decoder_turbo<B,R>\nif (crc != nullptr && !params.crc.poly.empty())\n{\nif (params.decoder.self_corrected)\n- decoder = new Decoder_turbo_naive_CA_self_corrected<B,R>(params.code.K, params.code.N,\n+ decoder = new Decoder_turbo_naive_CA_self_corrected<B,R>(params.code.K, params.code.N_code,\nparams.decoder.n_ite,\n*interleaver, *siso_n, *siso_i,\n*scaling_factor, *crc,\nparams.encoder.buffered);\nelse if (params.decoder.fnc)\n- decoder = new Decoder_turbo_naive_CA_flip_and_check<B,R>(params.code.K, params.code.N,\n+ decoder = new Decoder_turbo_naive_CA_flip_and_check<B,R>(params.code.K, params.code.N_code,\nparams.decoder.n_ite,\n*interleaver, *siso_n, *siso_i,\n*scaling_factor, *crc,\n@@ -47,14 +47,14 @@ Decoder<B,R>* Factory_decoder_turbo<B,R>\nparams.decoder.fnc_ite_step,\nparams.encoder.buffered);\nelse\n- decoder = new Decoder_turbo_naive_CA<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n+ decoder = new Decoder_turbo_naive_CA<B,R>(params.code.K, params.code.N_code, params.decoder.n_ite,\n*interleaver, *siso_n, *siso_i, *scaling_factor, *crc,\nparams.encoder.buffered);\n}\n// there is no CRC\nelse\n- decoder = new Decoder_turbo_naive<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n+ decoder = new Decoder_turbo_naive<B,R>(params.code.K, params.code.N_code, params.decoder.n_ite,\n*interleaver, *siso_n, *siso_i, *scaling_factor,\nparams.encoder.buffered);\n}\n@@ -64,12 +64,12 @@ Decoder<B,R>* Factory_decoder_turbo<B,R>\nif (crc != nullptr && !params.crc.poly.empty())\n{\nif (params.decoder.self_corrected)\n- decoder = new Decoder_turbo_naive_CA_self_corrected<B,R>(params.code.K, params.code.N,\n+ decoder = new Decoder_turbo_naive_CA_self_corrected<B,R>(params.code.K, params.code.N_code,\nparams.decoder.n_ite, *interleaver,\n*siso_n, *siso_i, *scaling_factor, *crc,\nparams.encoder.buffered);\nelse if (params.decoder.fnc)\n- decoder = new Decoder_turbo_naive_CA_flip_and_check<B,R>(params.code.K, params.code.N,\n+ decoder = new Decoder_turbo_naive_CA_flip_and_check<B,R>(params.code.K, params.code.N_code,\nparams.decoder.n_ite,\n*interleaver, *siso_n, *siso_i,\n*scaling_factor, *crc,\n@@ -79,14 +79,14 @@ Decoder<B,R>* Factory_decoder_turbo<B,R>\nparams.decoder.fnc_ite_step,\nparams.encoder.buffered);\nelse\n- decoder = new Decoder_turbo_fast_CA<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n+ decoder = new Decoder_turbo_fast_CA<B,R>(params.code.K, params.code.N_code, params.decoder.n_ite,\n*interleaver, *siso_n, *siso_i, *scaling_factor, *crc,\nparams.encoder.buffered);\n}\n// there is no CRC\nelse\n- decoder = new Decoder_turbo_fast<B,R>(params.code.K, params.code.N, params.decoder.n_ite,\n+ decoder = new Decoder_turbo_fast<B,R>(params.code.K, params.code.N_code, params.decoder.n_ite,\n*interleaver, *siso_n, *siso_i, *scaling_factor,\nparams.encoder.buffered);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/Turbo/Factory_encoder_turbo.cpp",
"new_path": "src/Tools/Factory/Turbo/Factory_encoder_turbo.cpp",
"diff": "@@ -19,10 +19,10 @@ Encoder<B>* Factory_encoder_turbo<B>\nif (params.encoder.systematic)\n{\nif (params.encoder.buffered)\n- encoder = new Encoder_turbo<B>(params.code.K, params.code.N, *interleaver, *sub_encoder_n, *sub_encoder_i,\n+ encoder = new Encoder_turbo<B>(params.code.K, params.code.N_code, *interleaver, *sub_encoder_n, *sub_encoder_i,\nparams.simulation.inter_frame_level);\nelse\n- encoder = new Encoder_turbo_legacy<B>(params.code.K, params.code.N, *interleaver, *sub_encoder_n,\n+ encoder = new Encoder_turbo_legacy<B>(params.code.K, params.code.N_code, *interleaver, *sub_encoder_n,\nparams.simulation.inter_frame_level);\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Factory/Turbo/Factory_puncturer_turbo.cpp",
"diff": "+#include \"Factory_puncturer_turbo.hpp\"\n+#include \"Module/Puncturer/NO/Puncturer_NO.hpp\"\n+#include \"Module/Puncturer/Turbo/Puncturer_turbo.hpp\"\n+\n+using namespace aff3ct::module;\n+using namespace aff3ct::tools;\n+\n+template <typename B, typename Q>\n+Puncturer<B,Q>* Factory_puncturer_turbo<B,Q>\n+::build(const parameters ¶ms)\n+{\n+ Puncturer<B,Q> *puncturer = nullptr;\n+\n+ if (params.code.N + params.code.tail_length != params.code.N_code + params.code.tail_length)\n+ puncturer = new Puncturer_turbo<B,Q>(params.code.K,\n+ params.code.N,\n+ params.code.tail_length,\n+ params.puncturer.pattern,\n+ params.encoder.buffered,\n+ params.simulation.inter_frame_level);\n+ else\n+ puncturer = new Puncturer_NO<B,Q>(params.code.K, params.code.N, params.simulation.inter_frame_level);\n+\n+ return puncturer;\n+}\n+\n+// ==================================================================================== explicit template instantiation\n+#include \"Tools/types.h\"\n+#ifdef MULTI_PREC\n+template struct aff3ct::tools::Factory_puncturer_turbo<B_8,Q_8>;\n+template struct aff3ct::tools::Factory_puncturer_turbo<B_16,Q_16>;\n+template struct aff3ct::tools::Factory_puncturer_turbo<B_32,Q_32>;\n+template struct aff3ct::tools::Factory_puncturer_turbo<B_64,Q_64>;\n+#else\n+template struct aff3ct::tools::Factory_puncturer_turbo<B,Q>;\n+#endif\n+// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Factory/Turbo/Factory_puncturer_turbo.hpp",
"diff": "+#ifndef FACTORY_PUNCTURER_TURBO_HPP\n+#define FACTORY_PUNCTURER_TURBO_HPP\n+\n+#include \"Module/Puncturer/Puncturer.hpp\"\n+#include \"Tools/params.h\"\n+#include \"Tools/Code/Polar/Frozenbits_generator/Frozenbits_generator.hpp\"\n+\n+#include \"../Factory.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+template <typename B = int, typename Q = float>\n+struct Factory_puncturer_turbo : public Factory\n+{\n+ static module::Puncturer<B,Q>* build(const parameters ¶ms);\n+};\n+}\n+}\n+\n+#endif /* FACTORY_PUNCTURER_TURBO_HPP */\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/general_utils.cpp",
"diff": "+#include <sstream>\n+\n+#include \"general_utils.h\"\n+\n+std::vector<std::string> aff3ct::tools::string_split(const std::string &s, char delim)\n+{\n+ std::stringstream ss(s);\n+ std::string item;\n+ std::vector<std::string> elems;\n+ while (std::getline(ss, item, delim))\n+ elems.push_back(std::move(item));\n+\n+ return elems;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/general_utils.h",
"diff": "+#ifndef GENERAL_UTILS_H_\n+#define GENERAL_UTILS_H_\n+\n+#include <vector>\n+#include <string>\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+std::vector<std::string> string_split(const std::string &s, char delim);\n+}\n+}\n+\n+#endif /* GENERAL_UTILS_H_*/\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/params.h",
"new_path": "src/Tools/params.h",
"diff": "@@ -76,6 +76,11 @@ struct encoder_parameters\nstd::vector<int> poly;\n};\n+struct puncturer_parameters\n+{\n+ std::string pattern;\n+};\n+\nstruct interleaver_parameters\n{\nstd::string type;\n@@ -169,11 +174,12 @@ struct parameters\ncode_parameters code;\nsource_parameters source;\ncrc_parameters crc;\n- modulator_parameters modulator;\n- demodulator_parameters demodulator;\nencoder_parameters encoder;\n+ puncturer_parameters puncturer;\ninterleaver_parameters interleaver;\n+ modulator_parameters modulator;\nchannel_parameters channel;\n+ demodulator_parameters demodulator;\nquantizer_parameters quantizer;\ndecoder_parameters decoder;\nmonitor_parameters monitor;\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
First implem. of a turbo puncturer.
|
8,490 |
12.04.2017 12:16:05
| -7,200 |
edd99f1c834e59c102826883a42b7547261167b4
|
Update the completion script + remove useless throw.
|
[
{
"change_type": "MODIFY",
"old_path": "scripts/aff3ct_completion.sh",
"new_path": "scripts/aff3ct_completion.sh",
"diff": "@@ -138,7 +138,7 @@ _aff3ct() {\n--enc-no-buff --enc-type --enc-poly --itl-type --itl-path \\\n--itl-cols --itl-uni --dec-type -D --dec-implem --dec-ite -i \\\n--dec-sf --dec-simd --dec-max --dec-sc --dec-fnc --dec-fnc-q \\\n- --dec-fnc-ite-m --dec-fnc-ite-M --dec-fnc-ite-s\"\n+ --dec-fnc-ite-m --dec-fnc-ite-M --dec-fnc-ite-s --pct-pattern\"\nfi\n# add contents of Launcher_EXIT_RSC.cpp\n@@ -195,7 +195,7 @@ _aff3ct() {\n--dmod-ite | --cde-sigma | --dec-snr | --dec-ite |-i | --dec-lists | \\\n-L | --sim-json-path | --dec-off | --dec-norm | --term-freq | \\\n--sim-seed | --sim-mpi-comm | --sim-pyber | --dec-polar-nodes | \\\n- --itl-cols | --dec-synd-depth | \\\n+ --itl-cols | --dec-synd-depth | --pct-pattern | \\\n--dec-fnc-q | --dec-fnc-ite-m | --dec-fnc-ite-M | --dec-fnc-ite-s )\nCOMPREPLY=()\n;;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -89,10 +89,6 @@ void Puncturer_turbo<B,Q>\n}\nstd::copy(X_N1 + 3 * this->K, X_N1 + 3 * this->K + this->tail_bits, X_N2 + k);\n-\n- if (k + this->tail_bits != this->N)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"k + this->tail_bits\\\" has to be equal to \"\n- \"\\\"N\\\".\");\n}\ntemplate <typename B, typename Q>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update the completion script + remove useless throw.
|
8,490 |
13.04.2017 09:32:25
| -7,200 |
9c99e92ade3f0b25b8450066aff57d1617fd4294
|
Add the puncturing in non bufferized mode (turbo code).
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -22,9 +22,6 @@ Puncturer_turbo<B,Q>\nif (tail_bits < 0)\nthrow std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"tail_bits\\\" has to be positive.\");\n- if (!buff_enc)\n- throw std::invalid_argument(\"aff3ct::module::Puncturer_turbo: \\\"buff_enc\\\" has to be set to true.\");\n-\nauto str_array = string_split(pattern, ',');\nif (str_array.size() != 3)\n@@ -76,6 +73,8 @@ void Puncturer_turbo<B,Q>\nconst auto period = pattern_bits[0].size();\nauto k = 0;\n+ if (this->buff_enc)\n+ {\nfor (auto j = 0; j < 3; j++)\n{\nauto p = 0;\n@@ -87,6 +86,19 @@ void Puncturer_turbo<B,Q>\np = (p +1) % period;\n}\n}\n+ }\n+ else\n+ {\n+ auto p = 0;\n+ for (auto i = 0; i < this->K; i++)\n+ {\n+ if (pattern_bits[0][p]) X_N2[k++] = X_N1[i * 3 +0];\n+ if (pattern_bits[1][p]) X_N2[k++] = X_N1[i * 3 +1];\n+ if (pattern_bits[2][p]) X_N2[k++] = X_N1[i * 3 +2];\n+\n+ p = (p +1) % period;\n+ }\n+ }\nstd::copy(X_N1 + 3 * this->K, X_N1 + 3 * this->K + this->tail_bits, X_N2 + k);\n}\n@@ -98,6 +110,8 @@ void Puncturer_turbo<B,Q>\nconst auto period = pattern_bits[0].size();\nauto k = 0;\n+ if (this->buff_enc)\n+ {\nfor (auto j = 0; j < 3; j++)\n{\nauto p = 0;\n@@ -108,6 +122,19 @@ void Puncturer_turbo<B,Q>\np = (p +1) % period;\n}\n}\n+ }\n+ else\n+ {\n+ auto p = 0;\n+ for (auto i = 0; i < this->K; i++)\n+ {\n+ Y_N2[i * 3 +0] = pattern_bits[0][p] ? Y_N1[k++] : (Q)0;\n+ Y_N2[i * 3 +1] = pattern_bits[1][p] ? Y_N1[k++] : (Q)0;\n+ Y_N2[i * 3 +2] = pattern_bits[2][p] ? Y_N1[k++] : (Q)0;\n+\n+ p = (p +1) % period;\n+ }\n+ }\nstd::copy(Y_N1 + k, Y_N1 + k + this->tail_bits, Y_N2 + 3 * this->K);\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add the puncturing in non bufferized mode (turbo code).
|
8,486 |
13.04.2017 12:04:08
| -7,200 |
01f2946312dd302176cb1a53b9ac84fa6b4e9cce
|
Fix compilation error with Clang.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"diff": "@@ -129,11 +129,11 @@ void Encoder_LDPC_DVBS2<B>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class Encoder_LDPC_DVBS2<B_8>;\n-template class Encoder_LDPC_DVBS2<B_16>;\n-template class Encoder_LDPC_DVBS2<B_32>;\n-template class Encoder_LDPC_DVBS2<B_64>;\n+template class aff3ct::module::Encoder_LDPC_DVBS2<B_8>;\n+template class aff3ct::module::Encoder_LDPC_DVBS2<B_16>;\n+template class aff3ct::module::Encoder_LDPC_DVBS2<B_32>;\n+template class aff3ct::module::Encoder_LDPC_DVBS2<B_64>;\n#else\n-template class Encoder_LDPC_DVBS2<B>;\n+template class aff3ct::module::Encoder_LDPC_DVBS2<B>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"new_path": "src/Module/Encoder/LDPC/Encoder_LDPC.cpp",
"diff": "@@ -68,11 +68,11 @@ void Encoder_LDPC<B>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class Encoder_LDPC<B_8>;\n-template class Encoder_LDPC<B_16>;\n-template class Encoder_LDPC<B_32>;\n-template class Encoder_LDPC<B_64>;\n+template class aff3ct::module::Encoder_LDPC<B_8>;\n+template class aff3ct::module::Encoder_LDPC<B_16>;\n+template class aff3ct::module::Encoder_LDPC<B_32>;\n+template class aff3ct::module::Encoder_LDPC<B_64>;\n#else\n-template class Encoder_LDPC<B>;\n+template class aff3ct::module::Encoder_LDPC<B>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"new_path": "src/Module/Encoder/LDPC/From_H/Encoder_LDPC_from_H.cpp",
"diff": "@@ -78,11 +78,11 @@ void Encoder_LDPC_from_H<B>\n// ==================================================================================== explicit template instantiation\n#include \"Tools/types.h\"\n#ifdef MULTI_PREC\n-template class Encoder_LDPC_from_H<B_8>;\n-template class Encoder_LDPC_from_H<B_16>;\n-template class Encoder_LDPC_from_H<B_32>;\n-template class Encoder_LDPC_from_H<B_64>;\n+template class aff3ct::module::Encoder_LDPC_from_H<B_8>;\n+template class aff3ct::module::Encoder_LDPC_from_H<B_16>;\n+template class aff3ct::module::Encoder_LDPC_from_H<B_32>;\n+template class aff3ct::module::Encoder_LDPC_from_H<B_64>;\n#else\n-template class Encoder_LDPC_from_H<B>;\n+template class aff3ct::module::Encoder_LDPC_from_H<B>;\n#endif\n// ==================================================================================== explicit template instantiation\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix compilation error with Clang.
|
8,490 |
13.04.2017 13:42:43
| -7,200 |
901d40a2ba8954bdde268a4aa5b0b952eb12011a
|
Update header file.
|
[
{
"change_type": "MODIFY",
"old_path": "src/aff3ct.hpp",
"new_path": "src/aff3ct.hpp",
"diff": "//find ./src/ -type f -follow -print | grep \"[.]h$\"\n-// #include <Tools/types.h>\n+#include <Tools/general_utils.h>\n+#include <Tools/types.h>\n#include <Tools/Math/matrix.h>\n#include <Tools/Math/utils.h>\n#include <Tools/Math/max.h>\n#include <Tools/params.h>\n// #include <main.h>\n+\n//find ./src/ -type f -follow -print | grep \"[.]hpp$\"\n#include <Tools/Threads/Barrier.hpp>\n#include <Tools/Factory/Factory_monitor.hpp>\n#include <Tools/Factory/Factory_modulator.hpp>\n#include <Tools/Factory/Turbo/Factory_encoder_turbo.hpp>\n#include <Tools/Factory/Turbo/Factory_scaling_factor.hpp>\n+#include <Tools/Factory/Turbo/Factory_puncturer_turbo.hpp>\n#include <Tools/Factory/Turbo/Factory_decoder_turbo.hpp>\n#include <Tools/Algo/Sort/LC_sorter.hpp>\n#include <Tools/Algo/Sort/LC_sorter_simd.hpp>\n#include <Module/Puncturer/Puncturer.hpp>\n#include <Module/Puncturer/NO/Puncturer_NO.hpp>\n#include <Module/Puncturer/SC_Puncturer.hpp>\n+#include <Module/Puncturer/Turbo/Puncturer_turbo.hpp>\n#include <Module/Encoder/Encoder_sys.hpp>\n#include <Module/Encoder/Polar/Encoder_polar.hpp>\n#include <Module/Encoder/Polar/Encoder_polar_sys.hpp>\n#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hpp>\n#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hpp>\n#include <Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_naive_CA.hpp>\n-#include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N4_K2_SNR25.hpp>\n-#include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N256_K64_SNR30.hpp>\n-#include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N2048_K1755_SNR35.hpp>\n+// #include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N4_K2_SNR25.hpp>\n+// #include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N256_K64_SNR30.hpp>\n+// #include <Module/Decoder/Polar/SCL/CRC/Generated/Decoder_polar_SCL_fast_CA_sys_N2048_K1755_SNR35.hpp>\n#include <Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hpp>\n#include <Module/Decoder/SPU_Decoder.hpp>\n#include <Module/Decoder/RSC/BCJR/Seq_generic/Decoder_RSC_BCJR_seq_generic_std_json.hpp>\n#include <Module/Decoder/Turbo/CRC/Decoder_turbo_naive_CA.hpp>\n#include <Module/Decoder/Turbo/CRC/Self_corrected/Decoder_turbo_naive_CA_self_corrected.hpp>\n#include <Module/Decoder/Turbo/CRC/Decoder_turbo_fast_CA.hpp>\n+#include <Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.hpp>\n#include <Module/Coset/SPU_Coset.hpp>\n#include <Module/Coset/Real/Coset_real.hpp>\n#include <Module/Coset/Coset.hpp>\n#include <Launcher/BFER/RA/Launcher_BFER_RA.hpp>\n#include <Launcher/BFER/Turbo/Launcher_BFER_turbo.hpp>\n#include <Launcher/BFERI/Launcher_BFERI.hpp>\n+#include <Launcher/BFERI/Polar/Launcher_BFERI_polar.hpp>\n#include <Launcher/BFERI/RSC/Launcher_BFERI_RSC.hpp>\n#include <Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.hpp>\n#include <Launcher/BFERI/Uncoded/Launcher_BFERI_uncoded.hpp>\n#include <Simulation/BFERI/Standard/STD_Simulation_BFERI.hpp>\n#include <Simulation/BFERI/SystemC/SC_Simulation_BFERI.hpp>\n#include <Simulation/BFERI/Simulation_BFERI.hpp>\n+#include <Simulation/BFERI/Code/Polar/Simulation_BFERI_polar.hpp>\n#include <Simulation/BFERI/Code/RSC/Simulation_BFERI_RSC.hpp>\n#include <Simulation/BFERI/Code/LDPC/Simulation_BFERI_LDPC.hpp>\n#include <Simulation/BFERI/Code/Uncoded/Simulation_BFERI_uncoded.hpp>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Update header file.
|
8,490 |
19.04.2017 09:16:40
| -7,200 |
3dc4f8a665e1a8d5e5c23ff1c731e653576e556b
|
Use GA frozen bits generator by default.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"diff": "@@ -21,7 +21,7 @@ Launcher_BFER_polar<B,R,Q>\nthis->params.code .type = \"POLAR\";\nthis->params.code .awgn_fb_path = \"../conf/cde/awgn_polar_codes/TV\";\nthis->params.code .sigma = 0.f;\n- this->params.code .fb_gen_method = \"TV\";\n+ this->params.code .fb_gen_method = \"GA\";\nthis->params.crc .type = \"STD\";\nthis->params.encoder .type = \"POLAR\";\nthis->params.quantizer .n_bits = 6;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.cpp",
"new_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.cpp",
"diff": "@@ -17,7 +17,7 @@ Launcher_BFERI_polar<B,R,Q>\nthis->params.code .type = \"POLAR\";\nthis->params.code .awgn_fb_path = \"../conf/cde/awgn_polar_codes/TV\";\nthis->params.code .sigma = 0.f;\n- this->params.code .fb_gen_method = \"TV\";\n+ this->params.code .fb_gen_method = \"GA\";\nthis->params.crc .type = \"STD\";\nthis->params.encoder .type = \"POLAR\";\nthis->params.quantizer .n_bits = 6;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp",
"new_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp",
"diff": "@@ -17,7 +17,7 @@ Launcher_EXIT_polar<B,R,Q>\nthis->params.code .type = \"POLAR\";\nthis->params.code .awgn_fb_path = \"../conf/cde/awgn_polar_codes/TV\";\nthis->params.code .sigma = 0.3f;\n- this->params.code .fb_gen_method = \"TV\";\n+ this->params.code .fb_gen_method = \"GA\";\nthis->params.encoder .type = \"POLAR\";\nthis->params.quantizer .n_bits = 6;\nthis->params.quantizer .n_decimals = 3;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp",
"new_path": "src/Launcher/GEN/Polar/Launcher_GEN_polar.cpp",
"diff": "@@ -18,7 +18,7 @@ Launcher_GEN_polar<B,R,Q>\nthis->params.code .type = \"POLAR\";\nthis->params.code .awgn_fb_path = \"../conf/cde/awgn_polar_codes/TV\";\nthis->params.code .sigma = 0.f;\n- this->params.code .fb_gen_method = \"TV\";\n+ this->params.code .fb_gen_method = \"GA\";\nthis->params.decoder .simd_strategy = \"\";\nthis->params.decoder .type = \"SC\";\nthis->params.decoder .gen_path = \"../src/Module/Decoder/Polar/SC/Generated\";\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Use GA frozen bits generator by default.
|
8,490 |
19.04.2017 09:30:57
| -7,200 |
6272797aa8d450af811effeb8e753a4ef4b2c7d2
|
Default CRC type: FAST + default L = 8.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"new_path": "src/Launcher/BFER/Polar/Launcher_BFER_polar.cpp",
"diff": "@@ -22,14 +22,14 @@ Launcher_BFER_polar<B,R,Q>\nthis->params.code .awgn_fb_path = \"../conf/cde/awgn_polar_codes/TV\";\nthis->params.code .sigma = 0.f;\nthis->params.code .fb_gen_method = \"GA\";\n- this->params.crc .type = \"STD\";\n+ this->params.crc .type = \"FAST\";\nthis->params.encoder .type = \"POLAR\";\nthis->params.quantizer .n_bits = 6;\nthis->params.quantizer .n_decimals = 1;\nthis->params.decoder .type = \"SC\";\nthis->params.decoder .implem = \"FAST\";\nthis->params.decoder .n_ite = 1;\n- this->params.decoder .L = 1;\n+ this->params.decoder .L = 8;\nthis->params.decoder .simd_strategy = \"\";\nthis->params.decoder .polar_nodes = \"{R0,R0L,R1,REP,REPL,SPC}\";\nthis->params.decoder .full_adaptive = true;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"new_path": "src/Launcher/BFER/Turbo/Launcher_BFER_turbo.cpp",
"diff": "@@ -22,7 +22,7 @@ Launcher_BFER_turbo<B,R,Q,QD>\nthis->params.simulation .json_path = \"\";\nthis->params.code .type = \"TURBO\";\nthis->params.code .tail_length = 4 * 3;\n- this->params.crc .type = \"STD\";\n+ this->params.crc .type = \"FAST\";\nthis->params.encoder .type = \"TURBO\";\nthis->params.encoder .buffered = true;\nthis->params.encoder .poly = {013, 015};\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.cpp",
"new_path": "src/Launcher/BFERI/Polar/Launcher_BFERI_polar.cpp",
"diff": "@@ -18,14 +18,14 @@ Launcher_BFERI_polar<B,R,Q>\nthis->params.code .awgn_fb_path = \"../conf/cde/awgn_polar_codes/TV\";\nthis->params.code .sigma = 0.f;\nthis->params.code .fb_gen_method = \"GA\";\n- this->params.crc .type = \"STD\";\n+ this->params.crc .type = \"FAST\";\nthis->params.encoder .type = \"POLAR\";\nthis->params.quantizer .n_bits = 6;\nthis->params.quantizer .n_decimals = 1;\nthis->params.decoder .type = \"SCAN\";\nthis->params.decoder .implem = \"NAIVE\";\nthis->params.decoder .n_ite = 1;\n- this->params.decoder .L = 1;\n+ this->params.decoder .L = 8;\nthis->params.decoder .simd_strategy = \"\";\nthis->params.decoder .polar_nodes = \"{R0,R0L,R1,REP,REPL,SPC}\";\nthis->params.decoder .full_adaptive = true;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp",
"new_path": "src/Launcher/EXIT/Polar/Launcher_EXIT_polar.cpp",
"diff": "@@ -24,7 +24,7 @@ Launcher_EXIT_polar<B,R,Q>\nthis->params.decoder .type = \"SCAN\";\nthis->params.decoder .implem = \"NAIVE\";\nthis->params.decoder .n_ite = 1;\n- this->params.decoder .L = 1;\n+ this->params.decoder .L = 8;\nthis->params.decoder .polar_nodes = \"{R0,R1,R0L,REP,REPL,SPC4}\";\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Default CRC type: FAST + default L = 8.
|
8,490 |
19.04.2017 10:50:54
| -7,200 |
7c0205e77ea5c82794bf72eda1b4ecba7627954e
|
Fix MSVC compilation errors and warnings.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"new_path": "src/Module/Decoder/Polar/SCAN/Decoder_polar_SCAN_naive.hxx",
"diff": "@@ -21,7 +21,7 @@ Decoder_polar_SCAN_naive<B,R,I,F,V,H>\n::Decoder_polar_SCAN_naive(const int &K, const int &N, const int &max_iter, const mipp::vector<B> &frozen_bits,\nconst int n_frames, const std::string name)\n: Decoder_SISO<B,R>(K, N, n_frames, 1, name),\n- m (std::log2(N)),\n+ m ((int)std::log2(N)),\nmax_iter (max_iter ),\nlayers_count (this->m +1 ),\nfrozen_bits (frozen_bits ),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"diff": "@@ -102,7 +102,7 @@ Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nconst int n_frames, const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\n- m (std::log2(N)),\n+ m ((int)std::log2(N)),\nL (L),\nfrozen_bits (frozen_bits),\npolar_patterns(N, frozen_bits, polar_patterns, idx_r0, idx_r1),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"diff": "@@ -63,7 +63,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::Decoder_polar_SCL_fast_sys(const int& K, const int& N, const int& L, const mipp::vector<B>& frozen_bits,\nconst int n_frames, const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\n- m (std::log2(N)),\n+ m ((int)std::log2(N)),\nL (L),\nfrozen_bits (frozen_bits),\npolar_patterns(N,\n@@ -129,7 +129,7 @@ Decoder_polar_SCL_fast_sys<B,R,API_polar>\nconst int idx_r0, const int idx_r1,\nconst int n_frames, const std::string name)\n: Decoder<B,R> (K, N, n_frames, API_polar::get_n_frames(), name),\n- m (std::log2(N)),\n+ m ((int)std::log2(N)),\nL (L),\nfrozen_bits (frozen_bits),\npolar_patterns(N, frozen_bits, polar_patterns, idx_r0, idx_r1),\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"new_path": "src/Module/Decoder/Turbo/CRC/Flip_and_check/Decoder_turbo_naive_CA_flip_and_check.cpp",
"diff": "@@ -16,7 +16,7 @@ mipp::vector<unsigned int> partial_sort_indexes(const mipp::vector<R> &v)\n// initialize original index locations\nmipp::vector<unsigned int> idx(v.size());\nfor (size_t i = 0; i != idx.size(); ++i)\n- idx[i] = i;\n+ idx[i] = (unsigned int)i;\n// sort indexes based on comparing values in v\nstd::partial_sort(idx.begin(),idx.begin() + 20, idx.end(),\n[&v](size_t i1, size_t i2) {return v[i1] < v[i2];});\n@@ -31,7 +31,7 @@ Decoder_turbo_naive_CA_flip_and_check<B,R>\nconst Interleaver<int> &pi,\nSISO<R> &siso_n,\nSISO<R> &siso_i,\n- tools::Scaling_factor<R> &scaling_factor,\n+ Scaling_factor<R> &scaling_factor,\nCRC<B> &crc,\nint fnc_q, int fnc_m, int fnc_M, int fnc_s,\nconst bool buffered_encoding)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.cpp",
"diff": "@@ -108,7 +108,7 @@ void Encoder_LDPC_DVBS2<B>\nfor (int l = 0; l < dvbs2->M_LDPC; l++)\n{\n- int bit = U_K[xPos];\n+ int bit = (int)U_K[xPos];\nif (bit == 1)\n{\nfor (int q = 0; q < nbPos; q++)\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Interleaver/Interleaver.hpp",
"new_path": "src/Module/Interleaver/Interleaver.hpp",
"diff": "@@ -80,7 +80,7 @@ public:\nunsigned size() const\n{\n- return pi.size();\n+ return (unsigned)pi.size();\n}\n/*!\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"new_path": "src/Module/Puncturer/Turbo/Puncturer_turbo.cpp",
"diff": "@@ -46,7 +46,7 @@ Puncturer_turbo<B,Q>\nfor (auto j = 0; j < period; j++)\n{\nchar c[2] = {str_array[i][j], '\\0'};\n- pattern_bits[i][j] = (bool)std::stoi(std::string(c));\n+ pattern_bits[i][j] = std::stoi(std::string(c)) ? true : false;\n}\nauto bit_sys_count = 0; for (auto j = 0; j < period; j++) bit_sys_count += pattern_bits[0][j] ? 1 : 0;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"new_path": "src/Tools/Code/LDPC/G/LDPC_G.hxx",
"diff": "@@ -28,8 +28,8 @@ template <typename B>\nvoid LDPC_G\n::triangularization_H(std::vector<mipp::vector<B>>& H, mipp::vector<unsigned>& swapped)\n{\n- unsigned n = H[0].size();\n- unsigned k = H.size();\n+ unsigned n = (unsigned)H[0].size();\n+ unsigned k = (unsigned)H.size();\nunsigned i = 0;\nbool fund = false;\n@@ -91,7 +91,7 @@ template <typename B>\nvoid LDPC_G\n::identity_H(std::vector<mipp::vector<B>>& H)\n{\n- unsigned k = H.size();\n+ unsigned k = (unsigned)H.size();\nfor (unsigned i = k - 1 ; i > 0; i--)\nfor (unsigned j = i; j > 0; j--)\nif (H[j-1][i])\n@@ -103,8 +103,8 @@ template <typename B>\nvoid LDPC_G\n::transformation_H_to_G(std::vector<mipp::vector<B>>& H, std::vector<mipp::vector<unsigned>>& G, mipp::vector<unsigned>& swapped)\n{\n- unsigned n = H[0].size();\n- unsigned k = H.size();\n+ unsigned n = (unsigned)H[0].size();\n+ unsigned k = (unsigned)H.size();\nfor (unsigned i = 0; i < k; i++) // Kill of the Identity in H\nH[i].erase( H[i].begin(), H[i].begin() + k );\n@@ -115,7 +115,7 @@ void LDPC_G\n// Re-organization: column of G\nmipp::vector<B> tmp(n - k, 0);\n- for (unsigned l = (swapped.size() / 2); l > 0; l--)\n+ for (unsigned l = (unsigned)(swapped.size() / 2); l > 0; l--)\n{\ntmp = H[swapped[l*2-1]];\nH[swapped[l*2-1]] = H[swapped[(l-1)*2]];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"diff": "@@ -116,7 +116,7 @@ template <typename B>\nvoid Pattern_polar_parser<B>\n::generate_nodes_indexes(const Binary_node<Pattern_polar_i>* node_curr)\n{\n- node_curr->get_c()->set_id(pattern_types.size());\n+ node_curr->get_c()->set_id((unsigned int)pattern_types.size());\npattern_types.push_back((unsigned char)node_curr->get_c()->type());\nif (!node_curr->is_leaf()) // stop condition\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Threads/Barrier.cpp",
"new_path": "src/Tools/Threads/Barrier.cpp",
"diff": "+#include <string>\n#include <chrono>\n#include <stdexcept>\n#include <iostream>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Fix MSVC compilation errors and warnings.
|
8,490 |
19.04.2017 15:46:54
| -7,200 |
0fd18d67cc2aa78eab80fdde3e349d6ab9aad99b
|
Force the inlining of the Frozen bits extraction.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SC/Decoder_polar_SC_fast_sys.hxx",
"diff": "#include \"Tools/Code/Polar/Patterns/Pattern_polar_spc.hpp\"\n#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n+#include \"Tools/Code/Polar/fb_extract.h\"\n+\nnamespace aff3ct\n{\nnamespace module\n@@ -324,7 +326,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\nconstexpr int n_frames = API_polar::get_n_frames();\nif (n_frames == 1)\n- this->polar_patterns.fb_extract(this->s.data(), V_K);\n+ tools::fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s.data(), V_K);\nelse\n{\nbool fast_deinterleave = false;\n@@ -343,7 +345,8 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n#endif\nif (!fast_deinterleave)\n{\n- this->polar_patterns.fb_extract(this->s.data(), this->s_bis.data(), n_frames);\n+ tools::fb_extract<B,n_frames>(this->polar_patterns.get_leaves_pattern_types(),\n+ this->s.data(), this->s_bis.data());\n// transpose without bit packing (vectorized)\nstd::vector<B*> frames(n_frames);\n@@ -353,7 +356,7 @@ void Decoder_polar_SC_fast_sys<B,R,API_polar>\n}\nelse\nfor (auto f = 0; f < n_frames; f++)\n- this->polar_patterns.fb_extract(this->s.data() + f * this->N,\n+ tools::fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s.data() + f * this->N,\nV_K + f * this->K);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_MEM_fast_CA_sys.hxx",
"diff": "+#include \"Tools/Code/Polar/fb_extract.h\"\n+\n#include \"Decoder_polar_SCL_MEM_fast_CA_sys.hpp\"\nnamespace aff3ct\n@@ -28,7 +30,7 @@ template <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_MEM_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n{\n- this->polar_patterns.fb_extract(s.data(), U_test.data());\n+ tools::fb_extract(this->polar_patterns.get_leaves_pattern_types(), s.data(), U_test.data());\n// check the CRC\nreturn crc.check(U_test, this->get_simd_inter_frame_level());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/CRC/Decoder_polar_SCL_fast_CA_sys.hxx",
"diff": "+#include \"Tools/Code/Polar/fb_extract.h\"\n+\n#include \"Decoder_polar_SCL_fast_CA_sys.hpp\"\nnamespace aff3ct\n@@ -28,7 +30,7 @@ template <typename B, typename R, class API_polar>\nbool Decoder_polar_SCL_fast_CA_sys<B,R,API_polar>\n::crc_check(mipp::vector<B> &s)\n{\n- this->polar_patterns.fb_extract(s.data(), U_test.data());\n+ tools::fb_extract(this->polar_patterns.get_leaves_pattern_types(), s.data(), U_test.data());\n// check the CRC\nreturn crc.check(U_test, this->get_simd_inter_frame_level());\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_MEM_fast_sys.hxx",
"diff": "#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n#include \"Tools/Code/Polar/Pattern_polar_parser.hpp\"\n+#include \"Tools/Code/Polar/fb_extract.h\"\n#include \"Decoder_polar_SCL_fast_sys.hpp\"\n#include \"Decoder_polar_SCL_MEM_fast_sys.hpp\"\n@@ -483,7 +484,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_MEM_fast_sys<B,R,API_polar>\n::_store(B *V_K) const\n{\n- this->polar_patterns.fb_extract(this->s[best_path].data(), V_K);\n+ tools::fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s[best_path].data(), V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"new_path": "src/Module/Decoder/Polar/SCL/Decoder_polar_SCL_fast_sys.hxx",
"diff": "#include \"Tools/Code/Polar/Patterns/Pattern_polar_std.hpp\"\n#include \"Tools/Code/Polar/Pattern_polar_parser.hpp\"\n+#include \"Tools/Code/Polar/fb_extract.h\"\n#include \"Decoder_polar_SCL_fast_sys.hpp\"\n@@ -419,7 +420,7 @@ template <typename B, typename R, class API_polar>\nvoid Decoder_polar_SCL_fast_sys<B,R,API_polar>\n::_store(B *V_K) const\n{\n- this->polar_patterns.fb_extract(this->s[best_path].data(), V_K);\n+ tools::fb_extract(this->polar_patterns.get_leaves_pattern_types(), this->s[best_path].data(), V_K);\n}\ntemplate <typename B, typename R, class API_polar>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp",
"new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hpp",
"diff": "@@ -120,8 +120,6 @@ public:\n*/\nvoid release_patterns() const;\n- inline void fb_extract(const B *V_N, B *V_K, const int n_frames = 1) const;\n-\nprivate:\nvoid recursive_allocate_nodes_patterns ( Binary_node<Pattern_polar_i>* node_curr);\nvoid generate_nodes_indexes (const Binary_node<Pattern_polar_i>* node_curr);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"new_path": "src/Tools/Code/Polar/Pattern_polar_parser.hxx",
"diff": "@@ -215,52 +215,5 @@ const Binary_tree<Pattern_polar_i>* Pattern_polar_parser<B>\n{\nreturn polar_tree;\n}\n-\n-template <typename B>\n-void Pattern_polar_parser<B>\n-::fb_extract(const B *V_N, B *V_K, const int n_frames) const\n-{\n- const auto leaves_patterns = this->get_leaves_pattern_types();\n-\n- auto off_s = 0;\n- auto sk_idx = 0;\n-\n- const auto loop_size = (int)leaves_patterns.size();\n- for (auto l = 0; l < loop_size; l++)\n- {\n- const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n- const auto n_elmts = leaves_patterns[l].second;\n- switch (node_type)\n- {\n- case tools::RATE_0:\n- break;\n- case tools::RATE_1:\n- std::copy(V_N + off_s * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_elmts * n_frames;\n- break;\n- case tools::REP:\n- std::copy(V_N + (off_s + n_elmts -1) * n_frames,\n- V_N + (off_s + n_elmts +0) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += n_frames;\n- break;\n- case tools::SPC:\n- std::copy(V_N + (off_s + 1 ) * n_frames,\n- V_N + (off_s + n_elmts) * n_frames,\n- V_K + sk_idx);\n-\n- sk_idx += (n_elmts -1) * n_frames;\n- break;\n- default:\n- throw std::runtime_error(\"aff3ct::tools::Pattern_polar_parser: unknown polar node type.\");\n- break;\n- }\n- off_s += n_elmts;\n- }\n-}\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Tools/Code/Polar/fb_extract.h",
"diff": "+#ifndef FB_EXTRACT_HPP\n+#define FB_EXTRACT_HPP\n+\n+#include <string>\n+#include <vector>\n+#include <utility>\n+#include <stdexcept>\n+#include <algorithm>\n+\n+#include \"Tools/Code/Polar/Patterns/Pattern_polar_i.hpp\"\n+\n+namespace aff3ct\n+{\n+namespace tools\n+{\n+template <typename B, int N_FRAMES = 1>\n+inline void fb_extract(const std::vector<std::pair<unsigned char, int>> &leaves_patterns, const B *V_N, B *V_K)\n+{\n+ static_assert(N_FRAMES > 0, \"aff3ct::tools::fb_extract: N_FRAMES has to be bigger than 0.\");\n+\n+ auto off_s = 0;\n+ auto sk_idx = 0;\n+\n+ const auto loop_size = (int)leaves_patterns.size();\n+ for (auto l = 0; l < loop_size; l++)\n+ {\n+ const auto node_type = (tools::polar_node_t)leaves_patterns[l].first;\n+ const auto n_elmts = leaves_patterns[l].second;\n+ switch (node_type)\n+ {\n+ case tools::RATE_0:\n+ break;\n+ case tools::RATE_1:\n+ std::copy(V_N + off_s * N_FRAMES,\n+ V_N + (off_s + n_elmts) * N_FRAMES,\n+ V_K + sk_idx);\n+\n+ sk_idx += n_elmts * N_FRAMES;\n+ break;\n+ case tools::REP:\n+ std::copy(V_N + (off_s + n_elmts -1) * N_FRAMES,\n+ V_N + (off_s + n_elmts +0) * N_FRAMES,\n+ V_K + sk_idx);\n+\n+ sk_idx += N_FRAMES;\n+ break;\n+ case tools::SPC:\n+ std::copy(V_N + (off_s + 1 ) * N_FRAMES,\n+ V_N + (off_s + n_elmts) * N_FRAMES,\n+ V_K + sk_idx);\n+\n+ sk_idx += (n_elmts -1) * N_FRAMES;\n+ break;\n+ default:\n+ throw std::runtime_error(\"aff3ct::tools::fb_extract: unknown polar node type.\");\n+ break;\n+ }\n+ off_s += n_elmts;\n+ }\n+}\n+}\n+}\n+\n+#endif /* FB_EXTRACT_HPP */\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Force the inlining of the Frozen bits extraction.
|
8,490 |
21.04.2017 10:12:34
| -7,200 |
8f3262419243ab47334d3a18dd116049522ba228
|
LDPC systematic encoding on.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"new_path": "src/Launcher/BFER/LDPC/Launcher_BFER_LDPC.cpp",
"diff": "@@ -15,7 +15,7 @@ Launcher_BFER_LDPC<B,R,Q>\n{\nthis->params.code .type = \"LDPC\";\nthis->params.encoder .type = \"AZCW\";\n- this->params.encoder .systematic = false;\n+ this->params.encoder .systematic = true;\nthis->params.quantizer.n_bits = 6;\nthis->params.quantizer.n_decimals = 2;\nthis->params.decoder .type = \"BP_FLOODING\";\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"new_path": "src/Launcher/BFERI/LDPC/Launcher_BFERI_LDPC.cpp",
"diff": "@@ -15,7 +15,7 @@ Launcher_BFERI_LDPC<B,R,Q>\n{\nthis->params.code .type = \"LDPC\";\nthis->params.encoder .type = \"COSET\";\n- this->params.encoder .systematic = false;\n+ this->params.encoder .systematic = true;\nthis->params.interleaver.type = \"RANDOM\";\nthis->params.quantizer .n_bits = 6;\nthis->params.quantizer .n_decimals = 2;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/Decoder_LDPC_BP_layered.hpp",
"diff": "@@ -22,7 +22,7 @@ protected:\nconst bool enable_syndrome;\nconst int syndrome_depth;\n- // reset so C_to_V and V_to_C structures can be cleared only at the begining of the loop in iterative decoding\n+ // reset so C_to_V and V_to_C structures can be cleared only at the beginning of the loop in iterative decoding\nbool init_flag;\nconst mipp::vector<B> &info_bits_pos;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"new_path": "src/Module/Encoder/LDPC/DVBS2/Encoder_LDPC_DVBS2.hpp",
"diff": "#include <vector>\n#include \"Tools/Perf/MIPP/mipp.h\"\n+\n#include \"../Encoder_LDPC.hpp\"\n+\n#include \"Encoder_LDPC_DVBS2_constants.hpp\"\nnamespace aff3ct\n@@ -18,7 +20,7 @@ class Encoder_LDPC_DVBS2 : public Encoder_LDPC<B>\nconst dvbs2_values* dvbs2 = nullptr;\npublic:\n- Encoder_LDPC_DVBS2(const int K, const int N, const int n_frames = 1, const std::string name = \"Encoder_LDPC\");\n+ Encoder_LDPC_DVBS2(const int K, const int N, const int n_frames = 1, const std::string name = \"Encoder_LDPC_DVBS2\");\nvirtual ~Encoder_LDPC_DVBS2();\nprotected:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_decoder_LDPC.cpp",
"diff": "@@ -19,6 +19,8 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\n{\nDecoder_SISO<B,R> *decoder = nullptr;\n+ if (params.encoder.systematic)\n+ {\nif (params.decoder.type == \"BP\" || params.decoder.type == \"BP_FLOODING\")\n{\nif (params.decoder.implem == \"ONMS\")\n@@ -92,6 +94,7 @@ Decoder_SISO<B,R>* Factory_decoder_LDPC<B,R>\nparams.decoder.syndrome_depth,\nparams.simulation.inter_frame_level);\n}\n+ }\nreturn decoder;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"new_path": "src/Tools/Factory/LDPC/Factory_encoder_LDPC.cpp",
"diff": "@@ -14,12 +14,15 @@ Encoder_LDPC<B>* Factory_encoder_LDPC<B>\nEncoder_LDPC<B> *encoder = nullptr;\n// build the encoder\n+ if (params.encoder.systematic)\n+ {\nif (params.encoder.type == \"LDPC\")\nencoder = new Encoder_LDPC<B>(params.code.K, params.code.N + params.code.tail_length, AList_reader(params.encoder.path), params.simulation.inter_frame_level);\nelse if (params.encoder.type == \"LDPC_H\")\nencoder = new Encoder_LDPC_from_H<B>(params.code.K, params.code.N + params.code.tail_length, AList_reader(params.code.alist_path), params.simulation.inter_frame_level);\nelse if (params.encoder.type == \"LDPC_DVBS2\")\nencoder = new Encoder_LDPC_DVBS2<B>(params.code.K, params.code.N + params.code.tail_length, params.simulation.inter_frame_level);\n+ }\nreturn encoder;\n}\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
LDPC systematic encoding on.
|
8,490 |
21.04.2017 10:59:35
| -7,200 |
4f7b0660aa563e3d160dcf885ec574b8c804f569
|
Add exceptions when SPA is called on fixed-point LLRs.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/LSPA/Decoder_LDPC_BP_flooding_log_sum_product.cpp",
"diff": "+#include <stdexcept>\n+#include <typeinfo>\n#include <limits>\n#include \"Tools/Math/utils.h\"\n@@ -19,6 +21,9 @@ Decoder_LDPC_BP_flooding_log_sum_product<B,R>\n: Decoder_LDPC_BP_flooding<B,R>(K, N, n_ite, alist_data, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name),\nvalues(alist_data.get_CN_max_degree())\n{\n+ if (typeid(R) != typeid(float) && typeid(R) != typeid(double))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_flooding_log_sum_product: this decoder only supports \"\n+ \"floating-point numbers for the LLRs.\");\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Flooding/SPA/Decoder_LDPC_BP_flooding_sum_product.cpp",
"diff": "+#include <stdexcept>\n+#include <typeinfo>\n#include <limits>\n#include \"Tools/Math/utils.h\"\n@@ -18,6 +20,9 @@ Decoder_LDPC_BP_flooding_sum_product<B,R>\n: Decoder_LDPC_BP_flooding<B,R>(K, N, n_ite, alist_data, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name),\nvalues(alist_data.get_CN_max_degree())\n{\n+ if (typeid(R) != typeid(float) && typeid(R) != typeid(double))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_flooding_sum_product: this decoder only supports \"\n+ \"floating-point numbers for the LLRs.\");\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/LSPA/Decoder_LDPC_BP_layered_log_sum_product.cpp",
"diff": "+#include <stdexcept>\n+#include <typeinfo>\n#include <limits>\n#include <cmath>\n@@ -20,6 +22,9 @@ Decoder_LDPC_BP_layered_log_sum_product<B,R>\n: Decoder_LDPC_BP_layered<B,R>(K, N, n_ite, alist_data, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name),\ncontributions(alist_data.get_CN_max_degree()), values(alist_data.get_CN_max_degree())\n{\n+ if (typeid(R) != typeid(float) && typeid(R) != typeid(double))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_log_sum_product: this decoder only supports \"\n+ \"floating-point numbers for the LLRs.\");\n}\ntemplate <typename B, typename R>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.cpp",
"new_path": "src/Module/Decoder/LDPC/BP/Layered/SPA/Decoder_LDPC_BP_layered_sum_product.cpp",
"diff": "+#include <stdexcept>\n+#include <typeinfo>\n#include <limits>\n#include <cmath>\n@@ -20,6 +22,9 @@ Decoder_LDPC_BP_layered_sum_product<B,R>\n: Decoder_LDPC_BP_layered<B,R>(K, N, n_ite, alist_data, info_bits_pos, enable_syndrome, syndrome_depth, n_frames, name),\ncontributions(alist_data.get_CN_max_degree()), values(alist_data.get_CN_max_degree())\n{\n+ if (typeid(R) != typeid(float) && typeid(R) != typeid(double))\n+ throw std::runtime_error(\"aff3ct::module::Decoder_LDPC_BP_layered_sum_product: this decoder only supports \"\n+ \"floating-point numbers for the LLRs.\");\n}\ntemplate <typename B, typename R>\n"
}
] |
C++
|
MIT License
|
aff3ct/aff3ct
|
Add exceptions when SPA is called on fixed-point LLRs.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.