qiskit_qec.linear.rref¶
- rref(matrix)[source]¶
Computes the Row Reduced Echelon Form for a GF(2) matrix.
- Parameters:
matrix (
ndarray
) – Input GF(2) matrix- Return type:
ndarray
- Returns:
Row Reduced Echelon Form 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 = rref(matrix) >>> r.astype(int) array([[1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 1, 1, 0, 0, 0, 1], [0, 0, 0, 0, 1, 0, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1]])
See Also: _rref, rref_complete, _rref_complete