From c438126b872116d65395054c20e09df88c1cd09a Mon Sep 17 00:00:00 2001 From: Joschka Roffe Date: Tue, 17 Jun 2025 19:26:18 +0100 Subject: [PATCH] chore: bump version to 2.3.7 in pyproject.toml; update ms_scaling_factor handling in bp.hpp; add empty test file for bp_serial --- pyproject.toml | 2 +- python_test/test_bp_serial.py | 0 python_test/test_qcodes.py | 4 ++-- src_cpp/bp.hpp | 13 +++++++------ 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 python_test/test_bp_serial.py diff --git a/pyproject.toml b/pyproject.toml index a0d86e40..826b83a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,7 @@ dependencies = [ "sinter>=1.12.0", "pymatching" ] -version = "2.3.6" +version = "2.3.7" [project.urls] Documentation = "https://software.roffe.eu/ldpc" diff --git a/python_test/test_bp_serial.py b/python_test/test_bp_serial.py new file mode 100644 index 00000000..e69de29b diff --git a/python_test/test_qcodes.py b/python_test/test_qcodes.py index 93a2f4fc..1a1bc961 100644 --- a/python_test/test_qcodes.py +++ b/python_test/test_qcodes.py @@ -239,7 +239,7 @@ def test_400_16_6_hgp(): error_rate=error_rate, max_iter=max_iter, bp_method="ms", - ms_scaling_factor=0, + ms_scaling_factor=-1, schedule="parallel", bits_per_step=1, lsd_order=0, @@ -260,7 +260,7 @@ def test_400_16_6_hgp(): error_rate=error_rate, max_iter=max_iter, bp_method="ms", - ms_scaling_factor=0, + ms_scaling_factor=-1, schedule="serial", bits_per_step=1, lsd_order=0, diff --git a/src_cpp/bp.hpp b/src_cpp/bp.hpp index e5561c06..d3ac6eca 100644 --- a/src_cpp/bp.hpp +++ b/src_cpp/bp.hpp @@ -207,10 +207,10 @@ namespace ldpc { } else if (this->bp_method == MINIMUM_SUM) { double alpha; - if(this->ms_scaling_factor == 0.0) { - alpha = 1.0 - std::pow(2.0, -1.0*it); - } - else { + if(this->ms_scaling_factor < 0.0) { + double damping_factor = std::abs(this->ms_scaling_factor); + alpha = 1.0 - std::pow(2.0, -1.0*it/damping_factor); + } else { alpha = this->ms_scaling_factor; } @@ -444,8 +444,9 @@ namespace ldpc { for (int it = 1; it <= maximum_iterations; it++) { double alpha; - if(this->ms_scaling_factor == 0.0) { - alpha = 1.0 - std::pow(2.0, -1.0*it); + if(this->ms_scaling_factor < 0.0) { + double damping_factor = std::abs(this->ms_scaling_factor); + alpha = 1.0 - std::pow(2.0, -1.0*it/damping_factor); } else { alpha = this->ms_scaling_factor;