diff --git a/pyproject.toml b/pyproject.toml index a0d86e4..826b83a 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 0000000..e69de29 diff --git a/python_test/test_qcodes.py b/python_test/test_qcodes.py index 93a2f4f..1a1bc96 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 e5561c0..d3ac6ec 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;