Symmetrization
The py_alqorithms.symmetrization
module provides functions to symmetrize a spin system by
conjugating the Hamiltonian with Pauli \( \sigma^x \) operators.
Pure Spin System
For pure systems, the following two functions are provided:
-
create_symmetrized_spin_circuit
: Creates a quantum circuit implementing the trotterized time evolution with the Hamiltonian\[ \tilde H = \left( \bigotimes_i \sigma_i^x \right) H \left( \bigotimes_i \sigma_i^x \right) \]
where \( H \) is the input spin Hamiltonian.
-
apply_symmetrization_spins
: Similar to the function above, but additionally applies aPauliX
gate to every qubit to switch the definition of \( | 0 \rangle \) and \( | 1 \rangle \), both before and after the circuit implementing the trotterized time evolution with the symmetrized Hamiltonian.
Example
A minimal example describing the use of apply_symmetrization_spins
function.
The hamiltonian is given by
\[ H = \frac{1}{2} \sigma_0^z + \sigma_1^z. \]
Figure 1 illustrates the time evolution circuit of \(H\) with two trotter steps.
import py_alqorithms
from struqture_py.spins import SpinHamiltonianSystem, PauliProduct
# Parameters
algorithm = "ParityBased"
trotterization_order = 1
number_trottersteps = 2
time = 5.0
# Initizaling spin hamiltonian
hamiltonian = SpinHamiltonianSystem(2)
hamiltonian.add_operator_product(PauliProduct().z(0), 0.5)
hamiltonian.add_operator_product(PauliProduct().z(1), 1.0)
# Symmetrizing spin circuit
circuit = py_alqorithms.apply_symmetrization_spins(
algorithm,
hamiltonian,
trotterization_order,
number_trottersteps,
time
)
Figure 1: Trotterized time evolution of spin hamiltonian
System-Bath
For system-bath algorithms, the following functions are provided:
create_symmetrized_system_bath_circuit
: Similar tocreate_symmetrized_spin_circuit
, only applying the transformation to the system qubits. Together with the resulting circuit created by the selected algorithm, it also returns the list of qubits that constitute the system.apply_symmetrization_system_bath
- Similar toapply_symmetrization_spins
, only applying the transformation to system qubits.
Example
A minimal example describing the symmetrization of a system-bath circuit. The hamiltonian is given by
\[ H = \frac{1}{2} \sigma_{0,s}^z + \frac{1}{2} \sigma_{1,s}^x \sigma_{0,b}^x + \sigma_{1, b}^z. \]
Figure 2 illustrates a single trotter step time evolution of the system-bath hamiltonian.
import py_alqorithms
from struqture_py.spins import PauliProduct
from struqture_py.mixed_systems import MixedHamiltonianSystem, HermitianMixedProduct
# Parameters
algorithm = "ParityBased"
number_trottersteps = 1
time = 5.0
remapping = ([0,1], [2,3,4,5], None)
use_bath_as_control = False
# Initializing the system bath hamiltonian
hamiltonian = MixedHamiltonianSystem([2,2], [], [])
hamiltonian.add_operator_product(
HermitianMixedProduct(
[PauliProduct().z(0), PauliProduct()],
[],
[]
),
0.5
)
hamiltonian.add_operator_product(
HermitianMixedProduct(
[PauliProduct().x(1), PauliProduct().x(0)],
[],
[]
),
0.5
)
hamiltonian.add_operator_product(
HermitianMixedProduct(
[PauliProduct(), PauliProduct().z(1)],
[],
[]
),
1.0
)
# Symmetrizing system-bath circuit
circuit = py_alqorithms.apply_symmetrization_system_bath(
algorithm,
hamiltonian,
number_trottersteps,
time,
use_bath_as_control,
remapping
)
Figure 2: Trotterized time evolution of system-bath hamiltonian