qdk_chemistry.algorithms.hamiltonian_unitary_builder.time_evolution.trotter module
QDK/Chemistry implementation of the Trotter decomposition Builder.
References
Childs, A. M., et al. “Theory of Trotter Error with Commutator Scaling.” Physical Review X 11.1 (2021): 011020.
Strang, G. “On the construction and comparison of difference schemes.” SIAM Journal on Numerical Analysis 5.3 (1968): 506-517.
Suzuki, M. “General theory of higher-order decomposition of exponential operators and symplectic integrators.” Physics Letters A 165.5-6 (1992): 387-395.
- class qdk_chemistry.algorithms.hamiltonian_unitary_builder.time_evolution.trotter.Trotter(order=1, *, time=0.0, target_accuracy=0.0, num_divisions=0, error_bound='commutator', weight_threshold=1e-12, power=1, power_strategy='repeat')[source]
Bases:
TimeEvolutionBuilderTrotter decomposition builder.
- Parameters:
- __init__(order=1, *, time=0.0, target_accuracy=0.0, num_divisions=0, error_bound='commutator', weight_threshold=1e-12, power=1, power_strategy='repeat')[source]
Initialize Trotter builder with specified Trotter decomposition settings.
The Trotter decomposition approximates the time evolution operator \(e^{-iHt}\) when the Hamiltonian \(H\) can be expressed as a sum of terms \(H = \sum_j \alpha_j P_j\) where \(P_j\) are Pauli strings and \(\alpha_j\) are scalar coefficients. Rather than exponentiating the full Hamiltonian at once, the Trotter method constructs an approximation by exponentiating each term separately and combining them in a product formula. For example, the first-order Trotter formula approximates the time evolution operator as
\(e^{-iHt} \approx S_1^N(t) = \left[\prod_j e^{-i\alpha_j P_j t/N}\right]^N\), where \(N\) is the number of divisions.
The number of divisions N can be determined automatically from target_accuracy, fixed explicitly via num_divisions, or both (in which case the larger value is used).
The error associated with the Trotter decomposition, \(S_k^N(t)\), can be expressted in terms of the spectral norm of the difference between the exact and approximate time evolution operators:
\(\lVert e^{-iHt} - S_k^N(t) \rVert \leq \epsilon\)
However, the cost of computing this norm is equivalent to computing the exact exponential itself. For this reason, we provide two approximate error-bound strategies to determine the number of divisions required to achieve a target accuracy at a particular Trotter order (used only when target_accuracy is set):
"commutator"(default, tighter): uses the commutator-based bound from Childs et al. (2021). \(N = \lceil \frac{t^{2}}{2\epsilon} \sum_{j<k}\lVert[\alpha_jP_j,\alpha_kP_k]\rVert \rceil\)"naive": uses the triangle-inequality bound. \(N = \lceil (\sum_j|\alpha_j|)^{2}t^{2}/\epsilon \rceil\)
When the input
QubitOperatorcarries a populatedterm_partition, the builder consumes it directly for schedule-level grouping. When no partition is present, each Pauli term is exponentiated as its own group.- Parameters:
order (int) – Trotter decomposition order (1, 2, or any positive even integer). Defaults to 1.
time (float) – The evolution time. Defaults to 0.0.
target_accuracy (float) – Target accuracy for auto step computation. Use 0.0 (default) to disable.
num_divisions (int) – Divisions per Trotter step. Max of this and auto value is used. Defaults to 0.
error_bound (str) – Error bound strategy:
"commutator"(default) or"naive".weight_threshold (float) – Threshold for filtering small coefficients. Defaults to 1e-12.
power (int) – The power to raise the unitary to. Defaults to 1.
power_strategy (str) – Strategy for U^power:
"rescale"or"repeat"(default).
- class qdk_chemistry.algorithms.hamiltonian_unitary_builder.time_evolution.trotter.TrotterSettings[source]
Bases:
TimeEvolutionSettingsSettings for Trotter decomposition builder.
- __init__()[source]
Initialize TrotterSettings with default values.
- order
The order of the Trotter decomposition (currently only first order is supported).
- target_accuracy
Target accuracy for automatic step computation (0.0 means disabled).
- num_divisions
Explicit number of divisions within a Trotter step (0 means automatic).
- error_bound
Strategy for computing the Trotter error bound (“commutator” or “naive”).
- weight_threshold
The absolute threshold for filtering small coefficients.