From bef9c8ee3a837de63e9f3cceda59aacb88fde274 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Thu, 10 Nov 2022 10:04:31 +0100 Subject: [PATCH] Removed TODOs; Formatting; Changed test_decoder() default SNR array --- sw/decoders/maximum_likelihood.py | 1 - sw/decoders/proximal.py | 1 - sw/utility/codes.py | 5 ++--- sw/utility/simulations.py | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sw/decoders/maximum_likelihood.py b/sw/decoders/maximum_likelihood.py index 23db856..f78e7d2 100644 --- a/sw/decoders/maximum_likelihood.py +++ b/sw/decoders/maximum_likelihood.py @@ -3,7 +3,6 @@ import numpy as np import itertools -# TODO: Unify the interface regarding [0, 1]^n and [-1, 1]^n class MLDecoder: """This class naively implements a soft decision decoder. The decoder calculates the correlation between the received signal and each codeword and then chooses the diff --git a/sw/decoders/proximal.py b/sw/decoders/proximal.py index c368847..eff012a 100644 --- a/sw/decoders/proximal.py +++ b/sw/decoders/proximal.py @@ -1,7 +1,6 @@ import numpy as np -# TODO: Unify the interface regarding [0, 1]^n and [-1, 1]^n class ProximalDecoder: """Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes" by Tadashi Wadayama, and Satoshi Takabe. diff --git a/sw/utility/codes.py b/sw/utility/codes.py index 1e2a20d..af34ba0 100644 --- a/sw/utility/codes.py +++ b/sw/utility/codes.py @@ -225,7 +225,6 @@ Gs = {'Hamming_7_4': np.array([[1, 0, 0, 0, 0, 1, 1], # -# TODO: Are n and k switched around or correct? def get_systematic_H(G: np.array) -> np.array: """Compute the H matrix for a systematic code. @@ -239,8 +238,8 @@ def get_systematic_H(G: np.array) -> np.array: P = G[:, k:] - H = np.zeros(shape=(n-k, k + n-k)) + H = np.zeros(shape=(n - k, k + n - k)) H[:, :k] = P.T - H[:, k:] = np.identity(n-k) + H[:, k:] = np.identity(n - k) return H diff --git a/sw/utility/simulations.py b/sw/utility/simulations.py index 465dfa3..75ed831 100644 --- a/sw/utility/simulations.py +++ b/sw/utility/simulations.py @@ -20,7 +20,7 @@ def count_bit_errors(d: np.array, d_hat: np.array) -> int: def test_decoder(x: np.array, decoder: typing.Any, - SNRs: typing.Sequence[float] = np.linspace(1, 4, 7), + SNRs: typing.Sequence[float] = np.linspace(1, 7, 7), target_bit_errors: int = 100, N_max: int = 10000) \ -> typing.Tuple[np.array, np.array]: