Skip to content

Commit bd47de1

Browse files
committed
Bug fix in ldpc_bp_decode
The sparse-matrix structure could change during the decoding process leading to unexpected behaviour. That's why we only work on the `data` field preserving the sparse structure.
1 parent c169079 commit bd47de1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

commpy/channelcoding/ldpc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ def ldpc_bp_decode(llr_vec, ldpc_code_params, decoder_algorithm, n_iters):
241241

242242
# Variable Node Update
243243
msg_sum = np.array(message_matrix.sum(0)).squeeze()
244-
message_matrix *= -1
245-
message_matrix += parity_check_matrix.multiply(msg_sum + llr_vec[i_start:i_stop])
244+
message_matrix.data *= -1
245+
message_matrix.data += parity_check_matrix.multiply(msg_sum + llr_vec[i_start:i_stop]).data
246246

247247
out_llrs = msg_sum + llr_vec[i_start:i_stop]
248248
np.signbit(out_llrs, out=dec_word[i_start:i_stop])

0 commit comments

Comments
 (0)