diff --git a/sw/decoders/naive_soft_decision.py b/sw/decoders/naive_soft_decision.py index 439d01b..9bb2ff9 100644 --- a/sw/decoders/naive_soft_decision.py +++ b/sw/decoders/naive_soft_decision.py @@ -9,7 +9,7 @@ class SoftDecisionDecoder: one with the largest correlation. """ - # TODO: What is the proper name for 'R'? Is it actually 'decoding matrix'? + # TODO: Is 'R' actually called 'decoding matrix'? def __init__(self, G: np.array, H: np.array, R: np.array): """Construct a new SoftDecisionDecoder object. diff --git a/sw/decoders/proximal.py b/sw/decoders/proximal.py index 4265150..d1c72f7 100644 --- a/sw/decoders/proximal.py +++ b/sw/decoders/proximal.py @@ -5,20 +5,23 @@ class ProximalDecoder: """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: Is 'R' actually called 'decoding matrix'? # 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, R: 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 + :param R: Decoding matrix :param K: Max number of iterations to perform when decoding :param step_size: Step size for the gradient descent process :param gamma: Positive constant. Arises in the approximation of the prior PDF :param eta: Positive constant slightly larger than one. See 3.2, p. 3 """ self._H = H + self._R = R self._K = K self._step_size = step_size self._gamma = gamma @@ -92,7 +95,7 @@ class ProximalDecoder: :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 + :return: Most probably sent dataword (element of [0, 1]^k) """ s = 0 x_hat = 0 @@ -107,4 +110,4 @@ class ProximalDecoder: if self._check_parity(x_hat): break - return x_hat + return np.dot(self._R, x_hat)