Renamed naive soft decision to maximum likelihood; Removed reference to R matrix

This commit is contained in:
2022-11-10 08:40:25 +01:00
parent 5865a8683f
commit f29c2e71de
4 changed files with 10 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
import unittest
import numpy as np
from decoders import naive_soft_decision
from decoders import maximum_likelihood
class CodewordGenerationTestCase(unittest.TestCase):
@@ -14,12 +14,8 @@ class CodewordGenerationTestCase(unittest.TestCase):
H = np.array([[1, 0, 1, 0, 1, 0, 1],
[0, 1, 1, 0, 0, 1, 1],
[0, 0, 0, 1, 1, 1, 1]])
R = np.array([[0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 0, 0, 1, 0],
[0, 0, 0, 0, 0, 0, 1]])
decoder = naive_soft_decision.SoftDecisionDecoder(G, H, R)
decoder = maximum_likelihood.MLDecoder(G, H)
expected_datawords = np.array([[0, 0, 0, 0],
[0, 0, 0, 1],

View File

@@ -58,23 +58,6 @@ class CodesTestCase(unittest.TestCase):
self.assertEqual(np.array_equal(expected_H, H), True)
def test_get_systematic_R(self):
# Hamming(7,4) code
G = np.array([[1, 0, 0, 0, 0, 1, 1],
[0, 1, 0, 0, 1, 0, 1],
[0, 0, 1, 0, 1, 1, 0],
[0, 0, 0, 1, 1, 1, 1]])
expected_R = G = np.array([[1, 0, 0, 0, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0],
[0, 0, 1, 0, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0]])
R = codes.get_systematic_R(G)
self.assertEqual(np.array_equal(expected_R, R), True)
if __name__ == '__main__':
unittest.main()