CNOT Algorithm
System-Only CNOT Algorithm
The CNOTAlgorithm is used to generate quantum circuits that implement the exponentials of
PauliProducts. It assumes full connectivity between the qubits, or at least that a CNOT gate is
natively available on each pair of qubits. For each term in the PauliProduct, the following
operations are applied:
- The appropriate basis rotation is applied to transform it to the Pauli basis
- A sequence of CNOT gates is applied between each qubits that appear in the Pauli string
- A
RotateZis applied to the last qubit in thePauliProduct - The sequence of CNOTs is applied in reverse
- The basis rotations are undone
For example, the CNOT decomposition for the term is given by the following circuit

and similarly for

For the term
we need basis rotations with Hadamard gates

System-Bath CNOT Algorithm
The SystemBathCNOTAlgorithm generalizes the CNOTAlgorithm to the case of a spin system coupled
to a spin bath.
The use_bath_as_control boolean flag is used to decide which one between the system qubit and the
bath qubit involved in a two-qubit interaction term should be the control, and which should be the
target, and therefore also on which of the two the single qubit rotation is applied.
All system-only or bath-only terms are implemented using the CNOTAlgorithm, while the two-qubit
interaction terms between system and bath are implemented with the following logic:
- If the bath operator is Pauli , then the system basis is rotated to the Pauli basis,
and CNOTs are added as in the
CNOTAlgorithm, with the single-qubit rotation involved beingRotateX(applied on the bath qubit or the system qubit depending onuse_bath_as_control). - If the bath operator is not Pauli , the same logic as the
CNOTAlgorithmis used, again withuse_bath_as_controldeciding on which qubit theRotateZis applied.