Formatting

This commit is contained in:
Andreas Tsouchlos 2022-11-24 12:40:15 +01:00
parent 86de1638b5
commit 47482b55e4

View File

@ -5,6 +5,7 @@ from decoders import proximal
class CheckParityTestCase(unittest.TestCase):
"""Test case for the check_parity function."""
def test_check_parity(self):
# Hamming(7,4) code
G = np.array([[1, 1, 1, 0, 0, 0, 0],
@ -39,7 +40,9 @@ class CheckParityTestCase(unittest.TestCase):
class GradientTestCase(unittest.TestCase):
"""Test case for the calculation of the gradient of the code-constraint-polynomial."""
"""Test case for the calculation of the gradient of the
code-constraint-polynomial."""
def test_grad_h(self):
"""Test the gradient of the code-constraint polynomial."""
# Hamming(7,4) code
@ -56,7 +59,8 @@ class GradientTestCase(unittest.TestCase):
[0, 0, 0, 0, 0, 0, 1]])
x = np.array([1, 2, -1, -2, 2, 1, -1]) # Some randomly chosen vector
expected_grad_h = np.array([4, 26, -8, -36, 38, 28, -32]) # Manually calculated result
expected_grad_h = np.array(
[4, 26, -8, -36, 38, 28, -32]) # Manually calculated result
decoder = proximal.ProximalDecoder(H, R)
grad_h = decoder._grad_h(x)