All problems
Parity-Check Syndrome
Problem
Compute the syndrome of a received binary vector with respect to a parity-check matrix: syndrome = H * received mod 2. Row i of the returned list is the XOR of the received bits selected by row i of H.
Hint
Work in GF(2): multiply and add are AND and XOR.
Test cases
case 1
in: [[1,0,1],[[1,1,0],[0,1,1]]]
expected: [1,1]
case 2
in: [[1,1,1],[[1,1,0],[0,1,1]]]
expected: [0,0]
case 3
in: [[0,0,0],[[1,1,0],[0,1,1]]]
expected: [0,0]
case 4
in: [[1,0,1,0],[[1,0,1,0],[0,1,0,1],[1,1,1,1]]]
expected: [0,0,0]
Starter codePython
def parity_check_syndrome(received, h_matrix):
# Your code here
pass4 test cases · run your code against them in the editor