Now using an R matrix for decoding in the soft decision decoder

This commit is contained in:
Andreas Tsouchlos 2022-11-07 13:59:13 +01:00
parent 0ea297ad45
commit 3e7dd37827

View File

@ -9,14 +9,17 @@ class SoftDecisionDecoder:
one with the largest correlation.
"""
def __init__(self, G: np.array, H: np.array):
# TODO: What is the proper name for 'R'? Is it actually 'decoding matrix'?
def __init__(self, G: np.array, H: np.array, R: np.array):
"""Construct a new SoftDecisionDecoder object.
:param G: Generator matrix
:param H: Parity check matrix
:param R: Decoding matrix
"""
self._G = G
self._H = H
self._R = R
self._datawords, self._codewords = self._gen_codewords()
self._codewords_bpsk = self._codewords * 2 - 1 # The codewords, but mapped to [-1, 1]^n
@ -47,4 +50,4 @@ class SoftDecisionDecoder:
"""
correlations = np.dot(self._codewords_bpsk, y)
return self._datawords[numpy.argmax(correlations)]
return np.dot(self._R, self._codewords[numpy.argmax(correlations)])