Now proximaldecoder is returning 'None' on decoding failure
This commit is contained in:
parent
d6ce89cbeb
commit
86de1638b5
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user