TrotterQRTE¶
- class TrotterQRTE(product_formula=None, estimator=None, num_timesteps=1, *, transpiler=None, transpiler_options=None, insert_barriers=False)[source]¶
Bases:
RealTimeEvolverQuantum Real Time Evolution using Trotterization.
The type of Trotterization is defined by the
ProductFormulaprovided to the algorithm.Examples
from qiskit.quantum_info import Pauli, SparsePauliOp from qiskit import QuantumCircuit from qiskit_algorithms import TrotterQRTE, TimeEvolutionProblem from qiskit.primitives import StatevectorEstimator operator = SparsePauliOp([Pauli("X"), Pauli("Z")]) initial_state = QuantumCircuit(1) time = 1 evolution_problem = TimeEvolutionProblem(operator, time, initial_state) # LieTrotter with 1 rep estimator = StatevectorEstimator() trotter_qrte = TrotterQRTE(estimator=estimator) evolved_state = trotter_qrte.evolve(evolution_problem).evolved_state
- Parameters:
product_formula (ProductFormula | None) – A Lie-Trotter-Suzuki product formula. If
Noneprovided (default), theLieTrotterfirst order product formula with a single repetition is used.repsshould be 1 to obtain a number of time-steps equal tonum_timestepsand an evaluation ofTimeEvolutionProblem.aux_operatorsat every time-step. Ifrepsis larger than 1, the true number of time-steps will benum_timesteps * reps.estimator (BaseEstimatorV2 | None) – An estimator primitive used for calculating expectation values of
TimeEvolutionProblem.aux_operators.num_timesteps (int) – The number of time-steps the full evolution time is divided into (repetitions of
product_formula).transpiler (Transpiler | None) – An optional object with a run method allowing to transpile the circuits that are produced within this algorithm. If set to None, these won’t be transpiled.
transpiler_options (dict[str, Any] | None) – A dictionary of options to be passed to the transpiler’s run method as keyword arguments.
insert_barriers (bool) – If True, insert a barrier after the initial state and after each Trotter step.
Attributes
- estimator¶
Returns an estimator.
- num_timesteps¶
Returns the number of timesteps.
- product_formula¶
Returns a product formula.
Methods
- evolve(evolution_problem)[source]¶
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 theinit_stateand on the evolved state at every step (num_timestepstimes) using an estimator primitive provided.- Parameters:
evolution_problem (TimeEvolutionProblem) – Instance defining evolution problem. For the included Hamiltonian,
PauliorSparsePauliOpare supported by TrotterQRTE.- Returns:
Evolution result that includes an evolved state as a quantum circuit and, optionally, auxiliary operators evaluated for a resulting state on an estimator primitive.
- Raises:
ValueError – If
t_paramis not set toNonein theTimeEvolutionProblem(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 theTimeEvolutionProblem.ValueError – If an unsupported Hamiltonian type is provided.
- Return type: