qdk_chemistry.algorithms.time_evolution.builder.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.time_evolution.builder.trotter.Trotter(order=1, *, target_accuracy=0.0, num_divisions=0, error_bound='commutator', weight_threshold=1e-12)[source]
Bases:
TimeEvolutionBuilderTrotter decomposition builder.
- Parameters:
- __init__(order=1, *, target_accuracy=0.0, num_divisions=0, error_bound='commutator', weight_threshold=1e-12)[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\)
- Parameters:
order (int) – The order of the Trotter decomposition (currently only first order is supported). Defaults to 1.
target_accuracy (float) – Target accuracy for automatic step computation. Must be positive to enable automatic computation. Use 0.0 (default) to disable.
num_divisions (int) – Explicit number of divisions within a Trotter step. When both num_divisions and target_accuracy are given the larger value is used. Use 0 (default) for automatic determination.
error_bound (str) – Strategy for computing the Trotter error bound when target_accuracy is set. Either
"commutator"(default, tighter) or"naive".weight_threshold (float) – Absolute threshold for filtering small Hamiltonian coefficients. Defaults to 1e-12.
- class qdk_chemistry.algorithms.time_evolution.builder.trotter.TrotterSettings[source]
Bases:
SettingsSettings 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.