Need help regarding ldpc codes simulation

help me regarding simulation of ldpc codes

Hi @Chandrasekhar_K, According to my knowledge LDPC (Low Density Parity Check) contains mostly 0’s and a low density of 1’s which is considered as a sparse matrix in tensorflow. To find the parity equation we need to find the indices of the 1’s in the sparse matrix. For example:

st1 = tf.sparse.SparseTensor(indices=[[0, 3], [2, 4]],
                      values=[1 , 1],
                      dense_shape=[3, 10])

The above code will create a sparse matrix with shape (3,10), where [0,3],[2,4] indices will have only values 1.

To find the indices which contain values

def pprint_sparse_tensor(st):
  s = "<SparseTensor shape=%s \n values={" % (st.dense_shape.numpy().tolist(),)
  for (index, value) in zip(st.indices, st.values):
    s += f"\n  %s: %s" % (index.numpy().tolist(), value.numpy().tolist())
  return s + "}>"
<SparseTensor shape=[3, 10] 
  [0, 3]: 1
  [2, 4]: 1}>

I hope this helps. Thank You.