From 453ec053b817d51e3db39495a92dbe63b394a41c Mon Sep 17 00:00:00 2001 From: lucas Date: Sun, 7 Apr 2024 20:06:21 +0200 Subject: [PATCH 1/3] use shared ptrs for global maps --- cpp_test/TestLsd.cpp | 115 +++++++++++++++++++++++-------------------- src_cpp/lsd.hpp | 41 ++++++++------- 2 files changed, 86 insertions(+), 70 deletions(-) diff --git a/cpp_test/TestLsd.cpp b/cpp_test/TestLsd.cpp index 22d563a..8f783b7 100644 --- a/cpp_test/TestLsd.cpp +++ b/cpp_test/TestLsd.cpp @@ -15,9 +15,10 @@ using namespace ldpc::sparse_matrix_util; TEST(LsdCluster, init1){ auto pcm = ldpc::gf2codes::ring_code(10); - auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary - auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary - +// auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary +// auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary + auto gbm = std::make_shared>(std::vector(pcm.n)); + auto gcm = std::make_shared>(std::vector(pcm.m)); auto syndrome_index = 0; auto cl = ldpc::lsd::LsdCluster(pcm, syndrome_index, gcm, gbm); @@ -35,12 +36,12 @@ TEST(LsdCluster, init1){ ASSERT_EQ(expected_check_nodes, cl.check_nodes); ASSERT_EQ(expected_boundary_check_nodes, cl.boundary_check_nodes); ASSERT_EQ(expected_enclosed_syndromes, cl.enclosed_syndromes); - ASSERT_EQ(gcm[syndrome_index], &cl); + ASSERT_EQ(gcm->at(syndrome_index), &cl); ASSERT_EQ(expected_cluster_check_idx_to_pcm_check_idx, cl.cluster_check_idx_to_pcm_check_idx); ASSERT_EQ(expected_pcm_check_idx_to_cluster_check_idx, cl.pcm_check_idx_to_cluster_check_idx); - delete gbm; - delete gcm; +// delete gbm; +// delete gcm; } @@ -48,9 +49,10 @@ TEST(LsdCluster, init1){ TEST(LsdCluster, add_bitANDadd_check_add){ auto pcm = ldpc::gf2codes::ring_code(10); - auto gbm = new ldpc::lsd::LsdCluster *[pcm.n]; //global bit dictionary - auto gcm = new ldpc::lsd::LsdCluster *[pcm.m]; //global check dictionary - +// auto gbm = new ldpc::lsd::LsdCluster *[pcm.n]; //global bit dictionary +// auto gcm = new ldpc::lsd::LsdCluster *[pcm.m]; //global check dictionary + auto gbm = std::make_shared>(std::vector(pcm.n)); + auto gcm = std::make_shared>(std::vector(pcm.m)); auto syndrome_index = 1; auto cl = ldpc::lsd::LsdCluster(pcm, syndrome_index, gcm, gbm); @@ -69,13 +71,13 @@ TEST(LsdCluster, add_bitANDadd_check_add){ auto expected_pcm_check_idx_to_cluster_check_idx = tsl::robin_map{{1, 0},{2,1}}; ASSERT_EQ(expected_bit_nodes, cl.bit_nodes); - ASSERT_EQ(cl.global_bit_membership[2], &cl); + ASSERT_EQ(cl.global_bit_membership.get()->at(2), &cl); ASSERT_EQ(cl.cluster_bit_idx_to_pcm_bit_idx[0], 2); ASSERT_EQ(expected_check_nodes, cl.check_nodes); ASSERT_EQ(expected_cluster_check_idx_to_pcm_check_idx, cl.cluster_check_idx_to_pcm_check_idx); ASSERT_EQ(expected_pcm_check_idx_to_cluster_check_idx, cl.pcm_check_idx_to_cluster_check_idx); - ASSERT_EQ(cl.global_check_membership[1], &cl); - ASSERT_EQ(cl.global_check_membership[2], &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(1), &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(2), &cl); // Test adding existing checks and bits @@ -83,13 +85,13 @@ TEST(LsdCluster, add_bitANDadd_check_add){ cl.add_check(2,true); ASSERT_EQ(expected_bit_nodes, cl.bit_nodes); - ASSERT_EQ(cl.global_bit_membership[2], &cl); + ASSERT_EQ(cl.global_bit_membership.get()->at(2), &cl); ASSERT_EQ(cl.cluster_bit_idx_to_pcm_bit_idx[0], 2); ASSERT_EQ(expected_check_nodes, cl.check_nodes); ASSERT_EQ(expected_cluster_check_idx_to_pcm_check_idx, cl.cluster_check_idx_to_pcm_check_idx); ASSERT_EQ(expected_pcm_check_idx_to_cluster_check_idx, cl.pcm_check_idx_to_cluster_check_idx); - ASSERT_EQ(cl.global_check_membership[1], &cl); - ASSERT_EQ(cl.global_check_membership[2], &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(1), &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(2), &cl); //check that bit is remove from boundary check node is removed from boundary check nodes cl.compute_growth_candidate_bit_nodes(); @@ -102,8 +104,8 @@ TEST(LsdCluster, add_bitANDadd_check_add){ auto expected_boundary_check_nodes = tsl::robin_set{1}; ASSERT_EQ(expected_boundary_check_nodes, cl.boundary_check_nodes); - delete gbm; - delete gcm; +// delete gbm; +// delete gcm; } @@ -111,9 +113,10 @@ TEST(LsdCluster, add_bit_node_to_cluster){ auto pcm = ldpc::gf2codes::ring_code(10); - auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary - auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary - +// auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary +// auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary + auto gbm = std::make_shared>(std::vector(pcm.n)); + auto gcm = std::make_shared>(std::vector(pcm.m)); auto syndrome_index = 1; auto cl = ldpc::lsd::LsdCluster(pcm, syndrome_index, gcm, gbm); @@ -122,7 +125,7 @@ TEST(LsdCluster, add_bit_node_to_cluster){ ASSERT_EQ(expected_candidate_bit_nodes, cl.candidate_bit_nodes); - auto bit_membership = cl.global_bit_membership[0]; + auto bit_membership = cl.global_bit_membership.get()->at(0); // add bit 2 to the cluster cl.add_bit_node_to_cluster(2); @@ -133,13 +136,13 @@ TEST(LsdCluster, add_bit_node_to_cluster){ auto expected_pcm_check_idx_to_cluster_check_idx = tsl::robin_map{{1, 0},{2,1}}; ASSERT_EQ(expected_bit_nodes, cl.bit_nodes); - ASSERT_EQ(cl.global_bit_membership[2], &cl); + ASSERT_EQ(cl.global_bit_membership.get()->at(2), &cl); ASSERT_EQ(cl.cluster_bit_idx_to_pcm_bit_idx[0], 2); ASSERT_EQ(expected_check_nodes, cl.check_nodes); ASSERT_EQ(expected_cluster_check_idx_to_pcm_check_idx, cl.cluster_check_idx_to_pcm_check_idx); ASSERT_EQ(expected_pcm_check_idx_to_cluster_check_idx, cl.pcm_check_idx_to_cluster_check_idx); - ASSERT_EQ(cl.global_check_membership[1], &cl); - ASSERT_EQ(cl.global_check_membership[2], &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(1), &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(2), &cl); cl.compute_growth_candidate_bit_nodes(); auto expected_boundary_check_nodes = tsl::robin_set{1,2}; @@ -170,13 +173,13 @@ TEST(LsdCluster, add_bit_node_to_cluster){ expected_pcm_check_idx_to_cluster_check_idx = tsl::robin_map{{1, 0},{2,1},{0,2}}; ASSERT_EQ(expected_bit_nodes, cl.bit_nodes); - ASSERT_EQ(cl.global_bit_membership[1], &cl); + ASSERT_EQ(cl.global_bit_membership.get()->at(1), &cl); ASSERT_EQ(cl.cluster_bit_idx_to_pcm_bit_idx[0], 2); ASSERT_EQ(expected_check_nodes, cl.check_nodes); ASSERT_EQ(expected_cluster_check_idx_to_pcm_check_idx, cl.cluster_check_idx_to_pcm_check_idx); ASSERT_EQ(expected_pcm_check_idx_to_cluster_check_idx, cl.pcm_check_idx_to_cluster_check_idx); - ASSERT_EQ(cl.global_check_membership[0], &cl); - ASSERT_EQ(cl.global_check_membership[2], &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(0), &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(2), &cl); //check the cluster pcm expected_column = std::vector{0,1}; @@ -186,8 +189,8 @@ TEST(LsdCluster, add_bit_node_to_cluster){ expected_column = std::vector{2,0}; ASSERT_EQ(expected_column, cl.cluster_pcm[1]); - delete gbm; - delete gcm; +// delete gbm; +// delete gcm; } @@ -196,16 +199,17 @@ TEST(LsdCluster, grow_cluster){ auto pcm = ldpc::gf2codes::ring_code(10); - auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary - auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary - +// auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary +// auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary + auto gbm = std::make_shared>(std::vector(pcm.n)); + auto gcm = std::make_shared>(std::vector(pcm.m)); auto syndrome_index = 5; auto cl = ldpc::lsd::LsdCluster(pcm, syndrome_index, gcm, gbm); cl.compute_growth_candidate_bit_nodes(); auto expected_candidate_bit_nodes = tsl::robin_set{5, 6}; ASSERT_EQ(expected_candidate_bit_nodes, cl.candidate_bit_nodes); - auto bit_membership = cl.global_bit_membership[5]; + auto bit_membership = cl.global_bit_membership.get()->at(5); ASSERT_EQ(bit_membership, nullptr); cl.grow_cluster(); @@ -216,14 +220,14 @@ TEST(LsdCluster, grow_cluster){ auto expected_pcm_check_idx_to_cluster_check_idx = tsl::robin_map{{5, 0},{4,1},{6,2}}; ASSERT_EQ(expected_bit_nodes, cl.bit_nodes); - ASSERT_EQ(cl.global_bit_membership[5], &cl); + ASSERT_EQ(cl.global_bit_membership.get()->at(5), &cl); ASSERT_EQ(cl.cluster_bit_idx_to_pcm_bit_idx[0], 5); ASSERT_EQ(expected_check_nodes, cl.check_nodes); ASSERT_EQ(expected_cluster_check_idx_to_pcm_check_idx, cl.cluster_check_idx_to_pcm_check_idx); ASSERT_EQ(expected_pcm_check_idx_to_cluster_check_idx, cl.pcm_check_idx_to_cluster_check_idx); - ASSERT_EQ(cl.global_check_membership[4], &cl); - ASSERT_EQ(cl.global_check_membership[5], &cl); - ASSERT_EQ(cl.global_check_membership[6], &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(4), &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(5), &cl); + ASSERT_EQ(cl.global_check_membership.get()->at(6), &cl); cl.compute_growth_candidate_bit_nodes(); auto expected_boundary_check_nodes = tsl::robin_set{4,6}; @@ -240,8 +244,8 @@ TEST(LsdCluster, grow_cluster){ expected_column = std::vector{0,2}; ASSERT_EQ(expected_column, cl.cluster_pcm[1]); - delete gbm; - delete gcm; +// delete gbm; +// delete gcm; } @@ -250,10 +254,11 @@ TEST(LsdCluster, merge_clusters_test){ auto pcm = ldpc::gf2codes::rep_code(5); - auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary - auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary - +// auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary +// auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary // auto syndrome_index = 0; + auto gbm = std::make_shared>(std::vector(pcm.n)); + auto gcm = std::make_shared>(std::vector(pcm.m)); auto cl1 = ldpc::lsd::LsdCluster(pcm, 0, gcm, gbm); auto cl2 = ldpc::lsd::LsdCluster(pcm, 3, gcm, gbm); @@ -275,15 +280,17 @@ TEST(LsdCluster, merge_clusters_test){ ASSERT_TRUE(cl2.valid); - delete gbm; - delete gcm; +// delete gbm; +// delete gcm; } TEST(LsdCluster, merge_clusters_otf_test){ auto pcm = ldpc::gf2codes::rep_code(5); - auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary - auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary +// auto gbm = new ldpc::lsd::LsdCluster *[pcm.n](); //global bit dictionary +// auto gcm = new ldpc::lsd::LsdCluster *[pcm.m](); //global check dictionary + auto gbm = std::make_shared>(std::vector(pcm.n)); + auto gcm = std::make_shared>(std::vector(pcm.m)); auto cl1 = ldpc::lsd::LsdCluster(pcm, 0, gcm, gbm); auto cl2 = ldpc::lsd::LsdCluster(pcm, 2, gcm, gbm); @@ -318,8 +325,8 @@ TEST(LsdCluster, merge_clusters_otf_test){ ASSERT_EQ(decoding_syndrome,expected_syndrome); - delete gbm; - delete gcm; +// delete gbm; +// delete gcm; } @@ -370,11 +377,12 @@ TEST(LsdDecoder, lsdw_decode) { auto bp = ldpc::bp::BpDecoder(pcm, std::vector(pcm.n, 0.1)); bp.maximum_iterations = 2; auto lsd = LsdDecoder(pcm); + lsd.lsd_order = 3; for (int i = 0; i < std::pow(2, hamming_code_rank); i++) { // std::cout << i << std::endl; auto syndrome = ldpc::util::decimal_to_binary(i, hamming_code_rank); bp.decode(syndrome); - auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true, 3); + auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true); auto decoding_syndrome = pcm.mulvec(decoding); ASSERT_TRUE(syndrome == decoding_syndrome); } @@ -389,12 +397,12 @@ TEST(LsdDecoder, lsdw_decode_ring_code) { auto bp = ldpc::bp::BpDecoder(pcm, std::vector(pcm.n, 0.1)); bp.maximum_iterations = 3; auto lsd = LsdDecoder(pcm); - + lsd.lsd_order = 5; for (int i = 0; i < std::pow(2, length); i++) { auto error = ldpc::util::decimal_to_binary(i, length); auto syndrome = pcm.mulvec(error); bp.decode(syndrome); - auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true, 5); + auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true); auto decoding_syndrome = pcm.mulvec(decoding); ASSERT_TRUE(syndrome == decoding_syndrome); } @@ -428,8 +436,9 @@ TEST(LsdDecoder, test_fail_case){ //setup the BP decoder with only 2 iterations auto bp = ldpc::bp::BpDecoder(pcm, channel_probabilities, 100, ldpc::bp::MINIMUM_SUM, ldpc::bp::PARALLEL, 0.625); auto lsd = LsdDecoder(pcm); + lsd.lsd_order = 5; bp.decode(syndrome); - auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true, 5); + auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true); auto decoding_syndrome = pcm.mulvec(decoding); ASSERT_TRUE(bp.converge == false); ASSERT_TRUE(syndrome == decoding_syndrome); @@ -444,7 +453,7 @@ TEST(LsdDecoder, test_cluster_stats) { lsd.set_do_stats(true); auto syndrome = std::vector({1, 1, 0, 0, 0}); lsd.setLsdMethod(ldpc::osd::OsdMethod::EXHAUSTIVE); - auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true, 0); + auto decoding = lsd.lsd_decode(syndrome, bp.log_prob_ratios, 1, true); auto stats = lsd.statistics; std::cout << stats.toString() << std::endl; diff --git a/src_cpp/lsd.hpp b/src_cpp/lsd.hpp index 6614a22..03d4043 100644 --- a/src_cpp/lsd.hpp +++ b/src_cpp/lsd.hpp @@ -39,8 +39,9 @@ namespace ldpc::lsd { tsl::robin_set boundary_check_nodes; tsl::robin_set candidate_bit_nodes; tsl::robin_set enclosed_syndromes; - LsdCluster **global_check_membership; // store which cluster a check belongs to - LsdCluster **global_bit_membership; // store which cluster a bit belongs to + std::shared_ptr> global_check_membership; // store which cluster a check belongs to + std::shared_ptr> global_bit_membership; // store which cluster a check belongs to +// LsdCluster **global_bit_membership; // store which cluster a bit belongs to tsl::robin_set merge_list; gf2dense::CscMatrix cluster_pcm; std::vector cluster_pcm_syndrome; @@ -58,8 +59,8 @@ namespace ldpc::lsd { LsdCluster(ldpc::bp::BpSparse &parity_check_matrix, int syndrome_index, - LsdCluster **ccm, // global check cluster membership - LsdCluster **bcm, // global bit cluster membership + std::shared_ptr> ccm , // global check cluster membership + std::shared_ptr> bcm, // global bit cluster membership bool on_the_fly = false) : pcm(parity_check_matrix) { this->active = true; @@ -70,7 +71,7 @@ namespace ldpc::lsd { this->global_check_membership = ccm; this->global_bit_membership = bcm; this->check_nodes.insert(syndrome_index); - this->global_check_membership[syndrome_index] = this; + this->global_check_membership->at(syndrome_index) = this; this->cluster_pcm_syndrome.clear(); this->pcm_check_idx_to_cluster_check_idx.insert( std::pair{syndrome_index, 0}); @@ -173,7 +174,7 @@ namespace ldpc::lsd { bool erase = true; for (auto &e: this->pcm.iterate_row(check_index)) { // if bit is not in this cluster, add it to the candidate list. - if (this->global_bit_membership[e.col_index] != this) { + if (this->global_bit_membership->at(e.col_index) != this) { candidate_bit_nodes.insert(e.col_index); erase = false; } @@ -194,7 +195,7 @@ namespace ldpc::lsd { * @return true if the bit was added to the cluster, false otherwise. */ bool add_bit_node_to_cluster(const int bit_index, const bool in_merge = false) { - auto bit_membership = this->global_bit_membership[bit_index]; + auto bit_membership = this->global_bit_membership->at(bit_index); //if the bit is already in the cluster return. if (bit_membership == this) { // bit already in current cluster @@ -271,11 +272,11 @@ namespace ldpc::lsd { } auto inserted = this->check_nodes.insert(check_index); if (!inserted.second) { - this->global_check_membership[check_index] = this; + this->global_check_membership->at(check_index) = this; return this->pcm_check_idx_to_cluster_check_idx[check_index]; } - this->global_check_membership[check_index] = this; + this->global_check_membership->at(check_index) = this; this->cluster_check_idx_to_pcm_check_idx.push_back(check_index); int local_idx = this->cluster_check_idx_to_pcm_check_idx.size() - 1; this->pcm_check_idx_to_cluster_check_idx.insert( @@ -292,7 +293,7 @@ namespace ldpc::lsd { if (!inserted.second) { return; } - this->global_bit_membership[bit_index] = this; + this->global_bit_membership->at(bit_index) = this; // also add to cluster pcm this->cluster_bit_idx_to_pcm_bit_idx.push_back(bit_index); } @@ -306,7 +307,7 @@ namespace ldpc::lsd { std::vector col; for (auto &e: this->pcm.iterate_column(bit_index)) { int check_index = e.row_index; - auto check_membership = this->global_check_membership[check_index]; + auto check_membership = this->global_check_membership->at(check_index); if (check_membership == this) { // if already in cluster, add to cluster_pcm column of the bit and go to next // an index error on the map here indicates an error in the program logic. @@ -544,8 +545,10 @@ namespace ldpc::lsd { std::vector clusters; std::vector invalid_clusters; - auto **global_bit_membership = new LsdCluster *[pcm.n](); - auto **global_check_membership = new LsdCluster *[pcm.m](); + auto global_bit_membership = std::make_shared>(std::vector(this->pcm.n)); + auto global_check_membership = std::make_shared>(std::vector(this->pcm.m)); +// auto **global_bit_membership = new LsdCluster *[pcm.n](); +// auto **global_check_membership = new LsdCluster *[pcm.m](); // timestep to added bits history for stats auto *global_timestep_bits_history = new std::unordered_map>>{}; auto timestep = 0; @@ -606,7 +609,7 @@ namespace ldpc::lsd { } } } - delete cl; //delete the cluster now that we have the solution. +// delete cl; //delete the cluster now that we have the solution. } } else { this->statistics.lsd_order = lsd_order; @@ -614,8 +617,7 @@ namespace ldpc::lsd { this->apply_lsdw(clusters, lsd_order, bit_weights); } auto end_time = std::chrono::high_resolution_clock::now(); - delete[] global_bit_membership; - delete[] global_check_membership; + if (do_stats) { this->statistics.global_timestep_bit_history = *global_timestep_bits_history; @@ -623,7 +625,12 @@ namespace ldpc::lsd { // always take time this->statistics.elapsed_time = std::chrono::duration_cast( end_time - start_time).count(); - + // cleanup + for (auto cl: clusters){ + delete cl; + } + global_bit_membership->clear(); + global_check_membership->clear(); return this->decoding; } From e1c5b58bab35ad10faf9dd6d61199bf7cd8efffd Mon Sep 17 00:00:00 2001 From: lucas Date: Tue, 9 Apr 2024 13:53:51 +0200 Subject: [PATCH 2/3] minor fix --- src_cpp/lsd.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_cpp/lsd.hpp b/src_cpp/lsd.hpp index 03d4043..e279e12 100644 --- a/src_cpp/lsd.hpp +++ b/src_cpp/lsd.hpp @@ -620,7 +620,6 @@ namespace ldpc::lsd { if (do_stats) { this->statistics.global_timestep_bit_history = *global_timestep_bits_history; - } // always take time this->statistics.elapsed_time = std::chrono::duration_cast( @@ -631,6 +630,7 @@ namespace ldpc::lsd { } global_bit_membership->clear(); global_check_membership->clear(); + delete global_timestep_bits_history; return this->decoding; } From 95b8eac55ba1ac8c819a80460ed2c74d88ce33a9 Mon Sep 17 00:00:00 2001 From: lucas Date: Fri, 26 Apr 2024 09:26:56 +0200 Subject: [PATCH 3/3] remove commented out code --- src_cpp/lsd.hpp | 6 +----- src_python/ldpc/bplsd_decoder/__init__.pyi | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src_cpp/lsd.hpp b/src_cpp/lsd.hpp index e279e12..e090972 100644 --- a/src_cpp/lsd.hpp +++ b/src_cpp/lsd.hpp @@ -28,7 +28,7 @@ namespace ldpc::lsd { return indices; } - // TODO this should probably become a class + // TODO this should probably become a class? struct LsdCluster { ldpc::bp::BpSparse &pcm; int cluster_id; @@ -41,7 +41,6 @@ namespace ldpc::lsd { tsl::robin_set enclosed_syndromes; std::shared_ptr> global_check_membership; // store which cluster a check belongs to std::shared_ptr> global_bit_membership; // store which cluster a check belongs to -// LsdCluster **global_bit_membership; // store which cluster a bit belongs to tsl::robin_set merge_list; gf2dense::CscMatrix cluster_pcm; std::vector cluster_pcm_syndrome; @@ -547,8 +546,6 @@ namespace ldpc::lsd { std::vector invalid_clusters; auto global_bit_membership = std::make_shared>(std::vector(this->pcm.n)); auto global_check_membership = std::make_shared>(std::vector(this->pcm.m)); -// auto **global_bit_membership = new LsdCluster *[pcm.n](); -// auto **global_check_membership = new LsdCluster *[pcm.m](); // timestep to added bits history for stats auto *global_timestep_bits_history = new std::unordered_map>>{}; auto timestep = 0; @@ -609,7 +606,6 @@ namespace ldpc::lsd { } } } -// delete cl; //delete the cluster now that we have the solution. } } else { this->statistics.lsd_order = lsd_order; diff --git a/src_python/ldpc/bplsd_decoder/__init__.pyi b/src_python/ldpc/bplsd_decoder/__init__.pyi index a8b564c..ee5b7e7 100644 --- a/src_python/ldpc/bplsd_decoder/__init__.pyi +++ b/src_python/ldpc/bplsd_decoder/__init__.pyi @@ -122,7 +122,7 @@ class BpLsdDecoder(BpDecoderBase): @lsd_method.setter def lsd_method(self, method: Union[str, int, float]) -> None: """ - Sets the OSD method used. + Sets the LSD method used. That is, the OSD method per cluster. Parameters ---------- @@ -135,7 +135,7 @@ class BpLsdDecoder(BpDecoderBase): @property def lsd_order(self) -> int: """ - The OSD order used. + The LSD order used. Returns ------- @@ -147,7 +147,7 @@ class BpLsdDecoder(BpDecoderBase): @lsd_order.setter def lsd_order(self, order: int) -> None: """ - Set the order for the OSD method. + Set the order for the LSD method. Parameters ---------- @@ -162,7 +162,7 @@ class BpLsdDecoder(BpDecoderBase): Warns ----- UserWarning - If the OSD method is 'OSD_E' and the order is greater than 15. + If the LSD method is 'OSD_E' and the order is greater than 15. """