| 134 | |
| 135 | template<typename B> |
| 136 | module::Encoder_LDPC<B>* |
| 137 | Encoder_LDPC ::build(const tools::Sparse_matrix& G, const tools::Sparse_matrix& H) const |
| 138 | { |
| 139 | if (this->type == "LDPC") return new module::Encoder_LDPC<B>(this->K, this->N_cw, G); |
| 140 | if (this->type == "LDPC_H") |
| 141 | return new module::Encoder_LDPC_from_H<B>(this->K, this->N_cw, H, this->G_method, this->G_save_path, true); |
| 142 | if (this->type == "LDPC_QC") return new module::Encoder_LDPC_from_QC<B>(this->K, this->N_cw, H); |
| 143 | if (this->type == "LDPC_IRA") return new module::Encoder_LDPC_from_IRA<B>(this->K, this->N_cw, H); |
| 144 | if (this->type == "LDPC_5G") |
| 145 | { |
| 146 | auto base_graph = tools::build_5G_base_graph(this->K, this->N); |
| 147 | std::string G_path = this->G_path; |
| 148 | if (G_path.empty()) |
| 149 | { |
| 150 | G_path = "conf/enc/LDPC/5G/NR_" + std::to_string(base_graph.Bg) + "_" + |
| 151 | std::to_string(base_graph.index_list) + "_" + std::to_string(base_graph.Zc) + ".txt"; |
| 152 | G_path = cli::modify_path<cli::Is_file>(G_path); |
| 153 | } |
| 154 | return new module::Encoder_LDPC_QC_fast<B>( |
| 155 | this->K, base_graph.N_LDPC, base_graph.Zc, G_path.c_str(), base_graph.K_LDPC); |
| 156 | } |
| 157 | |
| 158 | throw spu::tools::cannot_allocate(__FILE__, __LINE__, __func__); |
| 159 | } |
| 160 | |
| 161 | template<typename B> |
| 162 | module::Encoder_LDPC<B>* |
nothing calls this directly
no outgoing calls
no test coverage detected