qiskit_qec.linear.rank

rank(matrix)[source]

Computes the rank of the GF(2) matrix

Parameters:

matrix (ndarray) – Input GF(2) matrix

Return type:

int

Returns:

Rank of input matrix

Examples

>>> matrix = numpy.array([[1,0,0,1,0,0,1,0],
                          [0,1,1,1,0,0,0,1],
                          [1,1,1,0,1,0,0,0],
                          [1,0,0,1,0,1,0,1]], dtype=np.bool_)
>>> r = rank(matrix)
>>>
4

See Also: _rank