#!/bin/sh

# Example of decoding a (7,4) Hamming code using exhaustive enumeration and
# probability propagation, with an Additive White Gaussian Noise channel with 
# noise standard deviation of 0.5, for which Eb/N0 = 5.44 dB.
#
# Testing is done by transmitting zero blocks, which is sufficient because 
# both the channel and the decoding procedure are symmetrical.  Decoding is 
# done three, once minimizing block error probability, once minimizing 
# bit error probability, and once by up to 200 iterations of probability 
# propagation.

set -x -e # Echo commands as they are executed; stop if an error occurs

make-pchk ham7a.pchk 3 7 0:0 0:3 0:4 0:5 1:1 1:3 1:4 1:6 2:2 2:4 2:5 2:6
make-gen  ham7a.pchk ham7a.gen dense
transmit  7x100000 ham7a.rec 1 awgn 0.5
decode    ham7a.pchk ham7a.rec ham7a.dec-blk awgn 0.5 enum-block ham7a.gen
verify    ham7a.pchk ham7a.dec-blk ham7a.gen 
decode    ham7a.pchk ham7a.rec ham7a.dec-bit awgn 0.5 enum-bit ham7a.gen
verify    ham7a.pchk ham7a.dec-bit ham7a.gen 
decode    ham7a.pchk ham7a.rec ham7a.dec-prp awgn 0.5 prprp 200
verify    ham7a.pchk ham7a.dec-prp ham7a.gen 
