From 86de1638b5d6c8f33e6af6f7fb6f827f1a9e764a Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Wed, 23 Nov 2022 17:45:17 +0100 Subject: [PATCH] Now proximaldecoder is returning 'None' on decoding failure --- sw/decoders/proximal.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sw/decoders/proximal.py b/sw/decoders/proximal.py index 85bf4f9..f0aeb81 100644 --- a/sw/decoders/proximal.py +++ b/sw/decoders/proximal.py @@ -7,7 +7,7 @@ class ProximalDecoder: by Tadashi Wadayama, and Satoshi Takabe. """ - def __init__(self, H: np.array, K: int = 100, omega: float = 0.1, + def __init__(self, H: np.array, K: int = 1000, omega: float = 0.0002, gamma: float = 0.05, eta: float = 1.5): """Construct a new ProximalDecoder Object. @@ -75,7 +75,8 @@ 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 codeword (element of [0, 1]^n) + :return: Most probably sent codeword (element of [0, 1]^n). If + decoding fails, the returned value is 'None' """ s = np.zeros(self._n) x_hat = np.zeros(self._n) @@ -86,11 +87,11 @@ class ProximalDecoder: s = self._projection(s) # Equation (15) x_hat = np.sign(s) - + # Map the codeword from [ -1, 1]^n to [0, 1]^n x_hat = (x_hat == -1) * 1 if self._check_parity(x_hat): - break + return x_hat - return x_hat + return None