Correlators
alqorithms
provides the class InfiniteTemperatureCorrelator
to create qoqo QuantumPrograms to
perform quantum simulations of two-point correlators in the infinite temperature state.
Infinite Temperature State Preparation
We want to measure correlators of the form \(\langle A(t)B \rangle\) with respect to the infinite-temperature state, represented by the maximally-mixed density matrix
\[ \hat \rho_0 = \frac{1}{2^N} \hat 1 . \]
There are different ways to achieve this. The default initialization is all_initial_states
, which
measures the infinite temperature operator \( A \) by running the correlation measurement over all
possible time-evolved eigenstates of the \( B \) operator. With this option, the number of
circuits and measurements scales exponentially with the number of qubits. It has, however, the least
requirements for the quantum computer. Other ways to prepare the infinite-temperature state can
require active-reset or mid-circuit measurement operations.
The other available initializations are:
-
active_reset
: Uses an initialisation that prepares the infinite-temperature state by dephasing after applying Hadamard gates. Assumes the \( B \) operator only acts on one qubitq
. Actively resets the qubit the \( B \) operator is acting on and adds two measurement circuits:- One where the qubit is set to 0 and the output of a virtual qubit is set to zero
- One where the qubit is set to 1 and the output of a virtual qubit is set to zero
This avoids measuring inside the circuit which is more efficient. This can only be applied when the \( B \) operator is a sum of local operators and the number of measurements is comparable to the dimension of the Hilbert space of the system. The sequence is: Hadamard on all qubits -> ActiveReset on
q
-> Two Circuits: One whereq
is 0 one whereq
is 1 -> Rotate back from \( B \) basis. -
local_operator_measurement
: Uses an initialisation that prepares the infinite-temperature state by applying Hadamard gates and using the measurement that is normally necessary to extract the correlator with the \( B \) correlation operator. This can only be applied when the \( B \) operator is a sum of local operators and the number of measurements is comparable to the dimension of the Hilbert space of the system. The sequence is: Hadamard on all qubits -> Measure -> Rotate back from \( B \) basis. It is recommended to only use this on an experimental basis. -
measurement
: Uses an initialization that prepares the infinite-temperature state by measuring after a Hadamard gate. This can only be applied when the number of measurements is comparable to the dimension of the Hilbert space of the system. The sequence is: Hadamard on all qubits -> Measure -> Rotate into \( B \) basis -> Measure -> Rotate back from \( B \) basis. It is recommended to only use this on an experimental basis. -
dephasing
: Uses an initialization that prepares the infinite-temperature state by dephasing after applying Hadamard gates. This can only be applied when the number of measurements is comparable to \(2^N \) where \(N\) is the number of qubits the \( B \) operator acts on. The sequence is: Hadamard on all qubits -> Let system dephase -> Rotate into \( B \) basis -> Measure -> Rotate back from \( B \) basis. It is recommended to only use this on an experimental basis.
Usage
Once initialized, the class InfiniteTemperatureCorrelator
provides three methods to compute the
desired correlator:
time_correlation_measurement
: Run the measurement for a single correlator.time_correlation_measurement_multiple_left
: Run the measurement for a list of correlators that have different left operators \( A \). It works liketime_correlation_measurement
, but a list of left operators is passed as input instead of a single operator. The outputQuantumProgram
has a symbolic parameter for the evolution time.time_correlation_measurement_multiple_left_fixed_timestep
: Similar to the method above, but allows to pass a fixed trotter timestep. The outputQuantumProgram
has a symbolic parameter for the number of trotter steps.
The following example in Python shows how to initialize the InfiniteTemperatureCorrelator
class
and use it to compute the correlator \( \langle Y_0(t) Z_1 \rangle \).
from py_alqorithms import InfiniteTemperatureCorrelator
from struqture_py import SpinSystem, SpinHamiltonianSystem
number_spins = 3
# Set up Hamiltonian for time evolution
hamiltonian = SpinHamiltonianSystem()
for i in range(number_spins-1):
hamiltonian.add_operator_product(f"X{i}X{i + 1}", 1.0)
for i in range(number_spins):
hamiltonian.add_operator_product(f"Z{i}", 1.0)
print(f"Hamiltonian: \n{hamiltonian}\n")
# Define right and left operators to correlate
left_op = SpinSystem()
left_op.add_operator_product("Y0", 1.0)
print(f"Left operator: \n{left_op}\n")
right_op = SpinSystem()
right_op.add_operator_product("Z1", 1.0)
print(f"Right operator: \n{right_op}\n")
# Initialize correlator class
correlator = InfiniteTemperatureCorrelator(number_trottersteps=100)
correlator.algorithm = "ParityBased"
correlator.number_measurements = 10000
correlator.initialisation = "all_initial_states"
print("Correlator: ", correlator)
# Construct quantum program
measurement = correlator.time_correlation_measurement(left_op, hamiltonian, right_op)
program = QuantumProgram(measurement, [])