TrotterQRTE
class TrotterQRTE(product_formula=None, estimator=None)
Bases: qiskit.algorithms.time_evolvers.real_time_evolver.RealTimeEvolver
Quantum Real Time Evolution using Trotterization. Type of Trotterization is defined by a ProductFormula
provided.
Examples
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
Parameters
- product_formula (ProductFormula | None) – A Lie-Trotter-Suzuki product formula. If
None
provided, the Lie-Trotter first order product formula with a single repetition is used. - estimator (BaseEstimator | None) – An estimator primitive used for calculating expectation values of
TimeEvolutionProblem.aux_operators
.
Methods
evolve
TrotterQRTE.evolve(evolution_problem)
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 an evolved state using an estimator primitive provided.
Time-dependent Hamiltonians are not supported.
Parameters
evolution_problem (TimeEvolutionProblem
) – Instance defining evolution problem. For the included Hamiltonian, Pauli
or PauliSumOp
are supported by TrotterQRTE.
Return type
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_param
is not set toNone
in theTimeEvolutionProblem
(feature not currently supported). - ValueError – If
aux_operators
provided in the time evolution problem but no estimator provided to the algorithm. - ValueError – If the
initial_state
is not provided in theTimeEvolutionProblem
. - ValueError – If an unsupported Hamiltonian type is provided.
supports_aux_operators
classmethod TrotterQRTE.supports_aux_operators()
Whether computing the expectation value of auxiliary operators is supported.
Return type
bool
Returns
True
if aux_operators
expectations in the TimeEvolutionProblem
can be evaluated, False
otherwise.