qiskit_qec.linear.all_commute

all_commute(matrix)[source]

Determines if each possible pair of different rows of the GF(2) symplectic matrix have zero symplectic product. If the rows represent Pauli operators then the this method determines if the operators defined by the matrix generate an abelian subgroup.

Parameters:

matrix (ndarray) – Input GF(2) symplectic matrix

Return type:

bool

Returns:

True if operators mutually commute - have zero symplectic product

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=numpy.bool_)
>>> all_commute(matrix)
False
>>> matrix = np.array([[1,0,0,0,0,0,0,0],
                       [0,1,0,0,0,0,0,0],
                       [0,0,1,0,0,0,0,0],
                       [1,0,0,0,0,0,0,1]], dtype=numpy.bool_)
>>> all_commute(matrix)
True