peropq.commutators_bitstrings¶
Functions¶
|
Calculate the commutator of any two pauli tensors. |
Module Contents¶
- peropq.commutators_bitstrings.get_commutator_pauli_tensors(left_pauli_string, right_pauli_string)¶
Calculate the commutator of any two pauli tensors.
- Parameters:
left_pauli_string (peropq.pauli_bitstring.PauliString) – left side of commutator
right_pauli_string (peropq.pauli_bitstring.PauliString) – right side of commutator.
- Return type:
peropq.pauli_bitstring.PauliString | Literal[0]
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_bitstring.PauliString)
right_pauli_string (peropq.pauli_bitstring.PauliString)
- Return type:
peropq.pauli_bitstring.PauliString | Literal[0]