From 46153c59b2b8017e3ca249e2f4e6dc62d326c2fb Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Sun, 28 Dec 2025 10:15:55 +0100 Subject: [PATCH] renamed and updated Bhattacharyya code construction --- polar_sequence.hh | 8 ++++---- tests/pac_list_regression_test.cc | 4 ++-- tests/polar_list_regression_test.cc | 4 ++-- tests/polar_parity_regression_test.cc | 4 ++-- tests/polar_regression_test.cc | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/polar_sequence.hh b/polar_sequence.hh index 511129d..90a3096 100644 --- a/polar_sequence.hh +++ b/polar_sequence.hh @@ -6,12 +6,12 @@ Copyright 2023 Ahmet Inan #pragma once -#include +#include "sort.hh" namespace CODE { template -class PolarSeqConst0 +class BhattacharyyaSequence { void compute(double pe, int i, int h) { @@ -23,7 +23,7 @@ class PolarSeqConst0 } } double prob[1< sort; public: void operator()(int *sequence, int level, double erasure_probability = std::exp(-1.)) { @@ -32,7 +32,7 @@ public: compute(erasure_probability, 0, length / 2); for (int i = 0; i < length; ++i) sequence[i] = i; - std::sort(sequence, sequence+length, [this](int a, int b){ return prob[a] > prob[b]; }); + sort(sequence, length, [this](int a, int b){ return prob[a] > prob[b]; }); } }; diff --git a/tests/pac_list_regression_test.cc b/tests/pac_list_regression_test.cc index 8fe7b56..be4e209 100644 --- a/tests/pac_list_regression_test.cc +++ b/tests/pac_list_regression_test.cc @@ -54,8 +54,8 @@ int main() double design_SNR = 10 * std::log10(-std::log(erasure_probability)); std::cerr << "design SNR: " << design_SNR << std::endl; if (1) { - auto construct = new CODE::PolarSeqConst0; - std::cerr << "sizeof(PolarSeqConst0) = " << sizeof(CODE::PolarSeqConst0) << std::endl; + auto construct = new CODE::BhattacharyyaSequence; + std::cerr << "sizeof(BhattacharyyaSequence) = " << sizeof(CODE::BhattacharyyaSequence) << std::endl; double better_SNR = design_SNR + 1.59175; std::cerr << "better SNR: " << better_SNR << std::endl; double probability = std::exp(-pow(10.0, better_SNR / 10)); diff --git a/tests/polar_list_regression_test.cc b/tests/polar_list_regression_test.cc index 95437c3..e1d9c72 100644 --- a/tests/polar_list_regression_test.cc +++ b/tests/polar_list_regression_test.cc @@ -56,8 +56,8 @@ int main() double design_SNR = 10 * std::log10(-std::log(erasure_probability)); std::cerr << "design SNR: " << design_SNR << std::endl; if (1) { - auto construct = new CODE::PolarSeqConst0; - std::cerr << "sizeof(PolarSeqConst0) = " << sizeof(CODE::PolarSeqConst0) << std::endl; + auto construct = new CODE::BhattacharyyaSequence; + std::cerr << "sizeof(BhattacharyyaSequence) = " << sizeof(CODE::BhattacharyyaSequence) << std::endl; double better_SNR = design_SNR + 1.59175; std::cerr << "better SNR: " << better_SNR << std::endl; double probability = std::exp(-pow(10.0, better_SNR / 10)); diff --git a/tests/polar_parity_regression_test.cc b/tests/polar_parity_regression_test.cc index e4a22a3..d02ebb1 100644 --- a/tests/polar_parity_regression_test.cc +++ b/tests/polar_parity_regression_test.cc @@ -54,8 +54,8 @@ int main() double design_SNR = 10 * std::log10(-std::log(erasure_probability)); std::cerr << "design SNR: " << design_SNR << std::endl; if (1) { - auto construct = new CODE::PolarSeqConst0; - std::cerr << "sizeof(PolarSeqConst0) = " << sizeof(CODE::PolarSeqConst0) << std::endl; + auto construct = new CODE::BhattacharyyaSequence; + std::cerr << "sizeof(BhattacharyyaSequence) = " << sizeof(CODE::BhattacharyyaSequence) << std::endl; double better_SNR = design_SNR + 1.59175; std::cerr << "better SNR: " << better_SNR << std::endl; double probability = std::exp(-pow(10.0, better_SNR / 10)); diff --git a/tests/polar_regression_test.cc b/tests/polar_regression_test.cc index 3e1dafa..c006bec 100644 --- a/tests/polar_regression_test.cc +++ b/tests/polar_regression_test.cc @@ -56,8 +56,8 @@ int main() delete freeze; } else { auto sequence = new int[N]; - auto construct = new CODE::PolarSeqConst0; - std::cerr << "sizeof(PolarSeqConst0) = " << sizeof(CODE::PolarSeqConst0) << std::endl; + auto construct = new CODE::BhattacharyyaSequence; + std::cerr << "sizeof(BhattacharyyaSequence) = " << sizeof(CODE::BhattacharyyaSequence) << std::endl; (*construct)(sequence, M, probability); delete construct; for (int i = 0; i < N / 32; ++i)