- class qiskit.algorithms.time_evolvers.trotterization.TrotterQRTE(product_formula=None, estimator=None, num_timesteps=1)#
Quantum Real Time Evolution using Trotterization. Type of Trotterization is defined by a
from qiskit.opflow import PauliSumOp from qiskit.quantum_info import Pauli, SparsePauliOp from qiskit import QuantumCircuit from qiskit.algorithms import TimeEvolutionProblem from qiskit.algorithms.time_evolvers import TrotterQRTE from qiskit.primitives import Estimator operator = PauliSumOp(SparsePauliOp([Pauli("X"), Pauli("Z")])) initial_state = QuantumCircuit(1) time = 1 evolution_problem = TimeEvolutionProblem(operator, time, initial_state) # LieTrotter with 1 rep estimator = Estimator() trotter_qrte = TrotterQRTE(estimator=estimator) evolved_state = trotter_qrte.evolve(evolution_problem).evolved_state
Noneprovided, the Lie-Trotter first order product formula with a single repetition is used.
repsshould be 1 to obtain a number of time-steps equal to
num_timestepsand an evaluation of
TimeEvolutionProblem.aux_operatorsat every time-step. If
repsis larger than 1, the true number of time-steps will be
num_timesteps * reps.
Returns an estimator.
Returns the number of timesteps.
Returns a product formula.
Evolves a quantum state for a given time using the Trotterization method based on a product formula provided. The result is provided in the form of a quantum circuit. If auxiliary operators are included in the
evolution_problem, they are evaluated on the
init_stateand on the evolved state at every step (
num_timestepstimes) using an estimator primitive provided.
evolution_problem (TimeEvolutionProblem) – Instance defining evolution problem. For the included Hamiltonian,
PauliSumOpare supported by TrotterQRTE.
Evolution result that includes an evolved state as a quantum circuit and, optionally, auxiliary operators evaluated for a resulting state on an estimator primitive.
ValueError – If
t_paramis not set to
TimeEvolutionProblem(feature not currently supported).
ValueError – If
aux_operatorsprovided in the time evolution problem but no estimator provided to the algorithm.
ValueError – If the
initial_stateis not provided in the
ValueError – If an unsupported Hamiltonian type is provided.
- Return type: