Tutorial - The Sum-Product Algorithm
Tutorial - The Sum-Product Algorithm
Use a small parity-check matrix H and make sure that the sum-product algorithm works
appropriately before simulating communication systems with larger and more complex LDPC
codes (i.e. codes corresponding to a large matrix H).
Use for example the small matrix H (which we considered during the lecture):
1 0 1 0 1 0 1 0
1 0 0 1 0 1 0 1
H
0 1 1 0 0 1 1 0
0 1 0 1 1 0 0 1
Start by constructing the codeword c that we want to transmit. For all linear block codes, the
all zero codeword is a valid codeword, hence we assume that we want to transmit the message
(the structure of the parity check matrix H above indicates that the information message
consists of 4 elements and the codeword of 8 elements):
With respect to this assumption, we do not need the generator matrix G (which would be the
case if the elements of m would be different).
For example, assume that BPSK modulation is used and that all codeword bits are assigned
values +1 or -1 before transmission over the channel (these values +1 and -1 are related to the
location of the codeword symbols in the signal space after BPSK modulation). After
modulation and with respect to the mapping [0,1] → [-1,+1], the all zero codeword
corresponds to:
Given r and the description of the sum-product algorithm (see the documentation on the
course website), the output of the steps 1-5 should approximately be as follows:
Assume transmission over an AWGN channel with normalized channel variance N0/2 = 1.
v = -2r / (N0/2)2 = [5.0935 -0.4716 2.7859 6.0574 3.6580 2.3535 3.8867 0.2305]
(The first time the variables send their probability of being in a specific state, the messages
simply correspond to the values v from Step 1, since no messages have been received from
the checks which will be the case for the subsequent iterations.)
Since not all satisfaction values of the checks are > 0, we do not have a valid codeword and
hence the iteration continues.
Output of Step 4 (1st iteration) (see equation (5)):
Since not all satisfaction values of the checks are > 0, we do not have a valid codeword and
hence the iteration continues.
Output of Step 4 (2nd iteration) (see equation (5)):
All satisfaction values of the checks are > 0, we have found a valid codeword! The next step
is to obtain the binary representation of the codeword and the message.
Output of Step 5:
and the hard decisions with respect to these values give us the received codeword (see
equation (7))
c = [0 0 0 0 0 0 0 0].
Finally, given the assumption that the first part of the codeword corresponds to the message
m, we get m as
m = [0 0 0 0].
Comparing the received message sequence to the transmitted message, we observe that no
error occurred (however, recall that the algorithm can converge to a codeword that is valid but
not equal to the transmitted codeword, and thus the received message may contain errors
although the sum-product algorithm stops iterating due to a fulfilled stopping criterion).
HINT:
The sum-product algorithm consists of an inverse hyperbolic tangent (i.e. tanh-1) computation.
Since tanh-1(x) approaches +/- infinity as x goes to +/- 1, there is a potential risk of error in
MATLAB due to limitations of the numerical precision. Hence, in order to avoid that
MATLAB returns +/- infinity when making the tanh-1 computation, it is suitable to include a
limitation similar to the pseudo code (note: tanh-1(0.9999) ≈ 5):
if (-0.9999 < x) & (x < 0.9999)
% perform the atanh computation as specified in the
% sum-product algorithm
else
atanh_computation = 5*sign(tanh-1(x));
end