"""Decoding module.""" /* H: decoding matrix as shape (m, n) array * m: number of equations represented by H * n: number of code words * y: received message in codeword space, length n * * out: output array of length n where the solutions in codeword space will be written * * maxiter: Maximum iteration number */ int decode(uint8_t H[], const int m, n, uint8_t y[], uint8_t out[], int maxiter) { /* fixme: preprocess the following. def bitsandnodes(H): """Return bits and nodes of a parity-check matrix H.""" bits_indices, bits = scipy.sparse.find(H)[:2] nodes_indices, nodes = scipy.sparse.find(H.T)[:2] bits_histogram = np.bincount(bits_indices) nodes_histogram = np.bincount(nodes_indices) return bits_histogram, bits, nodes_histogram, nodes bits_hist, bits_values, nodes_hist, nodes_values = utils.bitsandnodes(H) */ float Lq[m*n]; float Lr[m*n]; float L_posteriori[n]; for (int n_iter=0; n_iter