Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-109

LDPC Sparsity Stats

Problem

Return [rows, columns, number_of_ones] for a parity-check matrix given as a list of rows.

Hint

Sparse parity-check matrices have far fewer ones than entries.

Test cases

case 1
in: [[[1,1,0],[0,1,1]]]
expected: [2,3,4]
case 2
in: [[[1,1,0,0],[0,1,1,0],[0,0,1,1]]]
expected: [3,4,6]
case 3
in: [[[0,0],[0,0]]]
expected: [2,2,0]
case 4
in: [[[1,1,1,1,1]]]
expected: [1,5,5]
Starter codePython
def ldpc_sparsity_stats(h_matrix):
    # Your code here
    pass

4 test cases · run your code against them in the editor