peropq.commutators#
Module Contents#
Functions#
|
Calculate the commutator of any two pauli tensors. |
- peropq.commutators.get_commutator_pauli_tensors(left_pauli_string, right_pauli_string)#
Calculate the commutator of any two pauli tensors.
:param left_pauli_string left side of commutator :param right_pauli_string right side of commutator.
The general formula for A = c(A_1 x … A_n), B = d(B_1 x … x B_N) is [A, B] = 1 - (-1)^k cd(A_1 B_1 x … x A_N B_N) where x is the tensor product, and k is the number of anti-commuting Pauli pairs.
- Returns:
None if the strings commute, otherwise the commutator as a PauliString
- Parameters:
left_pauli_string (peropq.pauli.PauliString) –
right_pauli_string (peropq.pauli.PauliString) –
- Return type:
peropq.pauli.PauliString | Literal[0]