Aug-19-2021, 10:32 AM
Hello everyone, especially to @jefsummers
I will try to explain the algorithm:
Here is the update of my code:
I will try to explain the algorithm:
- I have M = [0 1 1 0 1 1] and the value will be taken individually later.
- The explanation of B_j is the same as in my previous reply.
- In the loop of j in range 4 and i in range 6, I will do the equation E[j, i] = XOR of all M[i'].
For example: when j = 0, i = 0, B_0 = 0, 1, 3, i' = 0, 1, 3, E[0, 0] = M[1] ^ M[3] (M[0] is not included because i' = i).
Same thing also happened in i = 1 at E[0, 1] = M[0] ^ M[3] (M[1] is not included because i' = i)
But when j = 0, i = 2, E[0, 2] = M[0] ^ M[1] ^ M[3]. How to implement this condition in python?
Here is the update of my code:
import numpy as np #declaration of parity-check matrix H = np.array([[1, 1, 0, 1, 0, 0], [0, 1, 1, 0, 1, 0], [1, 0, 0, 0, 1, 1], [0, 0, 1, 1, 0, 1]]) #setting the input and output of the LDPC c = np.array([0, 0, 1, 0, 1, 1]) y = np.array([0, 1, 1, 0, 1, 1]) #initialization of bit flipping decoding w_r = 2 w_c = 3 m = np.size(H,0) N = np.size(H,1) E = np.zeros((m, N)) #Code for obtain each value of matrix M M = np.hsplit(y[::].copy(), N) #initializing value of B B_j = np.where(H == 1) B = B_j[1].reshape(m, w_c) for j in range (m): for i in range (N): for i_prime in B[j]: print (i_prime) #this part is supposed to be for line 11 of the algorithm and I am stuck at it if i_prime != i: E[j, i] = M[i_prime != i] ^ M[i_prime != i]