Fixed usages of x, x_hat, y
This commit is contained in:
@@ -48,22 +48,22 @@ class ProximalDecoder:
|
||||
|
||||
return result
|
||||
|
||||
def _projection(self, x):
|
||||
def _projection(self, v):
|
||||
"""Project a vector onto [-eta, eta]^n in order to avoid numerical instability.
|
||||
Detailed in 3.2, p. 3 (Equation (15)).
|
||||
|
||||
:param x: Vector to project
|
||||
:param v: Vector to project
|
||||
:return: x clipped to [-eta, eta]^n
|
||||
"""
|
||||
return np.clip(x, -self._eta, self._eta)
|
||||
return np.clip(v, -self._eta, self._eta)
|
||||
|
||||
def _check_parity(self, y_hat: np.array) -> bool:
|
||||
def _check_parity(self, x_hat: np.array) -> bool:
|
||||
"""Perform a parity check for a given codeword.
|
||||
|
||||
:param y_hat: codeword to be checked (element of [0, 1]^n)
|
||||
:param x_hat: codeword to be checked (element of [0, 1]^n)
|
||||
:return: True if the parity check passes, i.e. the codeword is valid. False otherwise
|
||||
"""
|
||||
syndrome = np.dot(self._H, y_hat) % 2
|
||||
syndrome = np.dot(self._H, x_hat) % 2
|
||||
return not np.any(syndrome)
|
||||
|
||||
def decode(self, y: np.array) -> np.array:
|
||||
|
||||
Reference in New Issue
Block a user