I am using dv = 4, dc = 5, n = 20, which gives k = 7.
I generate a message of length 7, encode them using ldpc encode, with snr=100000 [since I don't want to add noise]. I then simulate errors in communication by randomly flipping 1 bit of the encoded message.
But, I am unable to decode this message correctly!
Here's the code:
`seed = np.random.RandomState(42)
H, G = make_ldpc(n, d_v, d_c, systematic=True, sparse=True)
input_msg = np.random.randint(2, size=k)
enc_msg = encode(G, input_msg, snr, seed=seed)
dec_msg = get_message(G, decode(H, enc_msg, snr)) # works correctly
Hello
I am using dv = 4, dc = 5, n = 20, which gives k = 7. I generate a message of length 7, encode them using ldpc encode, with snr=100000 [since I don't want to add noise]. I then simulate errors in communication by randomly flipping 1 bit of the encoded message. But, I am unable to decode this message correctly!
Here's the code: `seed = np.random.RandomState(42)
H, G = make_ldpc(n, d_v, d_c, systematic=True, sparse=True)
input_msg = np.random.randint(2, size=k)
enc_msg = encode(G, input_msg, snr, seed=seed)
dec_msg = get_message(G, decode(H, enc_msg, snr)) # works correctly
flip_ind = np.random.randint(0, len(enc_msg) - 1 )
enc_msg[flip_ind] = -1.0 * enc_msg[flip_ind] # change 1 to -1 and vice versa, to simulate bit flip due to communication errors
flipped_dec_msg = get_message(G, decode(H, enc_msg, snr)) # this is wrong `