Using the HQS Noise App
In this section, we outline how the HQS Noise App can be used to simulate quantum systems with noisy quantum computers. The HQS Noise App works together with the HQS struqture library. In this regard, we will first briefly show how to create Hamiltonians and open quantum systems using struqture. Then, we will illustrate how to study noise models using the HQS Noise App. Furthermore, we will discuss the different backends that the HQS Noise App provides for running numerical simulations.
Struqture
struqture is a library enabling compact representation of quantum mechanical operators, Hamiltonians, and open quantum systems. The library supports the construction of spin, fermionic and bosonic objects, as well as combinations thereof (mixed systems). Here we demonstrate its usage with simple spin systems. For more complicated examples, please check the user documentation of struqture.
Creating Spin Hamiltonians
Let us now create a spin Hamiltonian using the struqture library.
Here, arbitrary spin operators are built from PauliProduct
operators.
As the name implies, these are products of single-spin Pauli operators.
Each Pauli operator in the PauliProduct
operates on a different qubit.
Not all qubits need to be represented in a PauliProduct
(such qubits contribute via identity operators).
For instance, let us create a transverse-field Ising model,
\[ H= \sum_{i=0}^9 3\sigma_{i}^z + \sum_{i=0}^8 2\sigma_{i}^x\sigma_{i+1}^x , , \]
which is created by:
from struqture_py import spins
number_spins = 10
transverse_field = 3.0
spin_coupling = 2.0
hamiltonian = spins.PauliHamiltonian()
for site in range(number_spins):
hamiltonian.add_operator_product(spins.PauliProduct().z(site), transverse_field)
for site in range(number_spins - 1):
hamiltonian.add_operator_product(spins.PauliProduct().x(site).x(site + 1), spin_coupling)
Information can be accessed using the following functions:
hamiltonian.keys() # operator keys (Pauli products / strings)
hamiltonian.get("0X1X") # front factor of Pauli product "0X1X"
hamiltonian.current_number_spins() # number of spins in the system
Creating Pauli Lindblad Noise Operators
Let us now create the Lindblad noise operators for a system of spins with the aid of struqture. Such noise operators are important to describe the noise part of the the Lindblad master equation, see the modeling section, for more information.
To describe the pure noise part of the Lindblad equation \( \sum_{i,j}M_{i,j} \left( A_{i}\rho
A_{j}^{\dagger} - \frac{1}{2} \lbrace A_j^{\dagger} A_i, \rho \rbrace \right)\), we use
DecoherenceProducts
as the operator base. The object PauliLindbladNoiseOperator
is given by a
HashMap
or dictionary with the tuple (DecoherenceProduct
, DecoherenceProduct
) as keys and the
entries in the rate matrix \(M_{j,k} \) as values. Similarly to PauliOperators
,
For instance, take \( A_0 = A_1 = \sigma_0^{x} \sigma_2^{z} \) with coefficient 1.0: \( 1.0 \left( A_0 \rho A_1^{\dagger} - \frac{1}{2} \lbrace A_1^{\dagger} A_0, \rho \rbrace \right) \)
from struqture_py import spins
import scipy.sparse as sp
system = spins.PauliLindbladNoiseOperator()
dp = spins.DecoherenceProduct().x(0).z(2)
system.add_operator_product((dp, dp), 1.0)
# Accessing information:
system.current_number_spins() # Result: 2
system.get((dp, dp)) # Result: CalculatorFloat(2)
system.keys() # Result: [("0Z1X", "0Z1X")]
dimension = 4**system.current_number_spins()
matrix = sp.coo_matrix(
system.sparse_matrix_superoperator_coo(system.current_number_spins()),
shape=(dimension, dimension)
)