Formatting
This commit is contained in:
parent
86de1638b5
commit
47482b55e4
@ -5,6 +5,7 @@ from decoders import proximal
|
|||||||
|
|
||||||
class CheckParityTestCase(unittest.TestCase):
|
class CheckParityTestCase(unittest.TestCase):
|
||||||
"""Test case for the check_parity function."""
|
"""Test case for the check_parity function."""
|
||||||
|
|
||||||
def test_check_parity(self):
|
def test_check_parity(self):
|
||||||
# Hamming(7,4) code
|
# Hamming(7,4) code
|
||||||
G = np.array([[1, 1, 1, 0, 0, 0, 0],
|
G = np.array([[1, 1, 1, 0, 0, 0, 0],
|
||||||
@ -39,7 +40,9 @@ class CheckParityTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class GradientTestCase(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):
|
def test_grad_h(self):
|
||||||
"""Test the gradient of the code-constraint polynomial."""
|
"""Test the gradient of the code-constraint polynomial."""
|
||||||
# Hamming(7,4) code
|
# Hamming(7,4) code
|
||||||
@ -56,7 +59,8 @@ class GradientTestCase(unittest.TestCase):
|
|||||||
[0, 0, 0, 0, 0, 0, 1]])
|
[0, 0, 0, 0, 0, 0, 1]])
|
||||||
|
|
||||||
x = np.array([1, 2, -1, -2, 2, 1, -1]) # Some randomly chosen vector
|
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)
|
decoder = proximal.ProximalDecoder(H, R)
|
||||||
grad_h = decoder._grad_h(x)
|
grad_h = decoder._grad_h(x)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user