| 161 | |
| 162 | template<typename B, typename Q, class API_polar> |
| 163 | module::Decoder_SIHO<B, Q>* |
| 164 | Decoder_polar ::_build(const std::vector<bool>& frozen_bits, |
| 165 | const module::CRC<B>* crc, |
| 166 | module::Encoder<B>* /*encoder*/) const |
| 167 | { |
| 168 | if (!this->systematic) // non-systematic encoding |
| 169 | { |
| 170 | if (this->implem == "NAIVE") |
| 171 | { |
| 172 | if (crc != nullptr && std::unique_ptr<module::CRC<B>>(crc->clone())->get_size() > 0) |
| 173 | { |
| 174 | if (this->type == "SCF") |
| 175 | return new module:: |
| 176 | Decoder_polar_SCF_naive<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>, tools::h_LLR<B, Q>>( |
| 177 | this->K, this->N_cw, frozen_bits, *crc, this->flips); |
| 178 | if (this->type == "SCL") |
| 179 | return new module::Decoder_polar_SCL_naive_CA<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>>( |
| 180 | this->K, this->N_cw, this->L, frozen_bits, *crc); |
| 181 | } |
| 182 | |
| 183 | if (this->type == "SC") |
| 184 | return new module:: |
| 185 | Decoder_polar_SC_naive<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>, tools::h_LLR<B, Q>>( |
| 186 | this->K, this->N_cw, frozen_bits); |
| 187 | if (this->type == "SCAN") |
| 188 | return new module::Decoder_polar_SCAN_naive<B, Q, tools::f_LLR<Q>, tools::v_LLR<Q>, tools::h_LLR<B, Q>>( |
| 189 | this->K, this->N_cw, this->n_ite, frozen_bits); |
| 190 | if (this->type == "SCL") |
| 191 | return new module::Decoder_polar_SCL_naive<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>>( |
| 192 | this->K, this->N_cw, this->L, frozen_bits); |
| 193 | } |
| 194 | } |
| 195 | else // systematic encoding |
| 196 | { |
| 197 | if (this->implem == "NAIVE") |
| 198 | { |
| 199 | if (crc != nullptr && std::unique_ptr<module::CRC<B>>(crc->clone())->get_size() > 0) |
| 200 | { |
| 201 | if (this->type == "SCF") |
| 202 | return new module:: |
| 203 | Decoder_polar_SCF_naive_sys<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>, tools::h_LLR<B, Q>>( |
| 204 | this->K, this->N_cw, frozen_bits, *crc, this->flips); |
| 205 | if (this->type == "SCL") |
| 206 | return new module::Decoder_polar_SCL_naive_CA_sys<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>>( |
| 207 | this->K, this->N_cw, this->L, frozen_bits, *crc); |
| 208 | } |
| 209 | |
| 210 | if (this->type == "SC") |
| 211 | return new module:: |
| 212 | Decoder_polar_SC_naive_sys<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>, tools::h_LLR<B, Q>>( |
| 213 | this->K, this->N_cw, frozen_bits); |
| 214 | if (this->type == "SCAN") |
| 215 | return new module:: |
| 216 | Decoder_polar_SCAN_naive_sys<B, Q, tools::f_LLR<Q>, tools::v_LLR<Q>, tools::h_LLR<B, Q>>( |
| 217 | this->K, this->N_cw, this->n_ite, frozen_bits); |
| 218 | if (this->type == "SCL") |
| 219 | return new module::Decoder_polar_SCL_naive_sys<B, Q, tools::f_LLR<Q>, tools::g_LLR<B, Q>>( |
| 220 | this->K, this->N_cw, this->L, frozen_bits); |