| 11 | |
| 12 | template<typename B, typename R> |
| 13 | Decoder_chase_std<B, R>::Decoder_chase_std(const int K, |
| 14 | const int N, |
| 15 | const Encoder<B>& encoder, |
| 16 | const uint32_t max_flips, |
| 17 | const bool hamming) |
| 18 | : Decoder_SIHO<B, R>(K, N) |
| 19 | , encoder(encoder.clone()) |
| 20 | , best_X_N(N) |
| 21 | , less_reliable_llrs(N) |
| 22 | , max_flips(max_flips) |
| 23 | , hamming(hamming) |
| 24 | , min_euclidean_dist(std::numeric_limits<float>::max()) |
| 25 | , min_hamming_dist(std::numeric_limits<uint32_t>::max()) |
| 26 | , best_test(0) |
| 27 | { |
| 28 | const std::string name = "Decoder_chase_std"; |
| 29 | this->set_name(name); |
| 30 | for (auto& t : this->tasks) |
| 31 | t->set_replicability(true); |
| 32 | |
| 33 | if (max_flips > (uint32_t)N) |
| 34 | { |
| 35 | std::stringstream message; |
| 36 | message << "'max_flips' has to be smaller than 'N' ('max_flips' = " << max_flips << ", 'N' = " << N << ")."; |
| 37 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 38 | } |
| 39 | |
| 40 | if (max_flips > 31) |
| 41 | { |
| 42 | std::stringstream message; |
| 43 | message << "'max_flips' has to be smaller or equal to 31 ('max_flips' = " << max_flips << ")."; |
| 44 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | template<typename B, typename R> |
| 49 | Decoder_chase_std<B, R>* |