qml.grouping.is_qwc

is_qwc(pauli_vec_1, pauli_vec_2)[source]

Checks if two Pauli words in the binary vector representation are qubit-wise commutative.

Parameters
  • pauli_vec_1 (Union[list, tuple, array]) – first binary vector argument in qubit-wise commutator

  • pauli_vec_2 (Union[list, tuple, array]) – second binary vector argument in qubit-wise commutator

Returns

returns True if the input Pauli words are qubit-wise commutative, returns False otherwise

Return type

bool

Raises

ValueError – if the input vectors are of different dimension, if the vectors are not of even dimension, or if the vector components are not strictly binary

Example

>>> is_qwc([1,0,0,1,1,0],[1,0,1,0,1,0])
False
>>> is_qwc([1,0,1,1,1,0],[1,0,0,1,1,0])
True