TimeEvolutionTrajectory¶
- class TimeEvolutionTrajectory(hamiltonian, time_points, *, backend, trotterization_strategy=None, n_steps=1, order=1, initial_state=None, observable=None, seed=None, **kwargs)[source]¶
Bases:
ProgramEnsembleRun TimeEvolution across multiple time points in parallel.
Creates one
TimeEvolutionprogram per time point, executes them viaProgramEnsemble(with optional batch-merged circuit submission), and aggregates results into a time-ordered mapping.Example:
trajectory = TimeEvolutionTrajectory( hamiltonian=to_spo({"XI": 1.0, "IX": 1.0}), time_points=[0.0, 0.5, 1.0, 1.5], backend=backend, ) trajectory.create_programs() trajectory.run(blocking=True) results = trajectory.aggregate_results() # results: {0.0: {...}, 0.5: {...}, 1.0: {...}, 1.5: {...}}
Initialize TimeEvolutionTrajectory.
- Parameters:
hamiltonian (
SparsePauliOp) – Hamiltonian to evolve under.time_points (
Sequence[float]) – List of evolution times. One program is created per time point.backend (
CircuitRunner) – Quantum circuit execution backend.trotterization_strategy (
TrotterizationStrategy|None) – Strategy for term selection (ExactTrotterization,QDrift). Defaults toExactTrotterization(). Deep-copied per program for thread safety.n_steps (
int) – Number of Trotter steps.order (
int) – Suzuki-Trotter order (1 or even).initial_state (
InitialState|None) – Initial state preparation (InitialStateinstance). Defaults toZerosState()if None.observable (
SparsePauliOp|None) – If None, measure probabilities; else expectation value.**kwargs – Forwarded verbatim to every per-time-point
TimeEvolution. Use this forgrouping_strategy,shot_distribution,precision, and any otherQuantumProgram/ObservableMeasuringMixinkwarg that should apply uniformly across the trajectory.program_idandprogress_queueare set internally and must not be passed here.
Methods Summary
Aggregate results into a time-ordered mapping.
Create one TimeEvolution program per time point.
Plot the expectation-value trajectory over time.
Methods Documentation
- visualize_results()[source]¶
Plot the expectation-value trajectory over time.
Requires that the trajectory was run with an
observable.- Raises:
RuntimeError – If no observable was set (probability mode).