From 3e7dd378274f33b3a75a4deb905059246e28f826 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Mon, 7 Nov 2022 13:59:13 +0100 Subject: [PATCH] Now using an R matrix for decoding in the soft decision decoder --- sw/decoders/naive_soft_decision.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sw/decoders/naive_soft_decision.py b/sw/decoders/naive_soft_decision.py index 5cc507b..439d01b 100644 --- a/sw/decoders/naive_soft_decision.py +++ b/sw/decoders/naive_soft_decision.py @@ -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)])