Removed TODOs; Formatting; Changed test_decoder() default SNR array

This commit is contained in:
Andreas Tsouchlos 2022-11-10 10:04:31 +01:00
parent 23e318609c
commit bef9c8ee3a
4 changed files with 3 additions and 6 deletions

View File

@ -3,7 +3,6 @@ import numpy as np
import itertools import itertools
# TODO: Unify the interface regarding [0, 1]^n and [-1, 1]^n
class MLDecoder: class MLDecoder:
"""This class naively implements a soft decision decoder. The decoder calculates """This class naively implements a soft decision decoder. The decoder calculates
the correlation between the received signal and each codeword and then chooses the the correlation between the received signal and each codeword and then chooses the

View File

@ -1,7 +1,6 @@
import numpy as np import numpy as np
# TODO: Unify the interface regarding [0, 1]^n and [-1, 1]^n
class ProximalDecoder: class ProximalDecoder:
"""Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes" """Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes"
by Tadashi Wadayama, and Satoshi Takabe. by Tadashi Wadayama, and Satoshi Takabe.

View File

@ -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: def get_systematic_H(G: np.array) -> np.array:
"""Compute the H matrix for a systematic code. """Compute the H matrix for a systematic code.
@ -239,8 +238,8 @@ def get_systematic_H(G: np.array) -> np.array:
P = G[:, k:] 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] = P.T
H[:, k:] = np.identity(n-k) H[:, k:] = np.identity(n - k)
return H return H

View File

@ -20,7 +20,7 @@ def count_bit_errors(d: np.array, d_hat: np.array) -> int:
def test_decoder(x: np.array, def test_decoder(x: np.array,
decoder: typing.Any, 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, target_bit_errors: int = 100,
N_max: int = 10000) \ N_max: int = 10000) \
-> typing.Tuple[np.array, np.array]: -> typing.Tuple[np.array, np.array]: