Comment and formatting changes

This commit is contained in:
Andreas Tsouchlos 2022-11-07 11:07:24 +01:00
parent 78fd8bf95c
commit 2f1497b1b8

View File

@ -2,13 +2,14 @@ import numpy as np
class ProximalDecoder:
"""Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes" by Tadashi
Wadayama, and Satoshi Takabe.
"""Class implementing the Proximal Decoding algorithm. See "Proximal Decoding for LDPC Codes"
by Tadashi Wadayama, and Satoshi Takabe.
"""
# TODO: How large should K be?
# TODO: How large should eta be?
# TODO: How large should step_size be?
def __init__(self, H: np.array, K: int = 100, step_size: float = 0.5, gamma: float = 0.05, eta: float = 1.1):
def __init__(self, H: np.array, K: int = 100, step_size: float = 0.5, gamma: float = 0.05,
eta: float = 1.1):
"""Construct a new ProximalDecoder Object.
:param H: Parity Check Matrix
@ -25,7 +26,9 @@ class ProximalDecoder:
@staticmethod
def _L_awgn(s: np.array, y: np.array) -> np.array:
"""Variation of the negative log-likelihood for the special case of AWGN noise. See 4.1, p. 4."""
"""Variation of the negative log-likelihood for the special case of AWGN noise.
See 4.1, p. 4.
"""
return s - y
# TODO: Is this correct?
@ -84,9 +87,11 @@ class ProximalDecoder:
def decode(self, y: np.array) -> np.array:
"""Decode a received signal. The algorithm is detailed in 3.2, p.3.
This function assumes a BPSK-like modulated signal ([-1, 1]^n instead of [0, 1]^n) and an AWGN channel.
This function assumes a BPSK-like modulated signal ([-1, 1]^n instead of [0, 1]^n)
and an AWGN channel.
:param y: Vector of received values. (y = x + n, where 'x' is element of [-1, 1]^m and 'n' is noise)
:param y: Vector of received values. (y = x + w, where 'x' is element of [-1, 1]^n
and 'w' is noise)
:return: Most probably sent symbol
"""
s = 0