Skip to content

Add missing term to trotter error loose bounds#1359

Merged
arettig merged 3 commits into
quantumlib:mainfrom
arettig:trotter_errorbounds
Jun 15, 2026
Merged

Add missing term to trotter error loose bounds#1359
arettig merged 3 commits into
quantumlib:mainfrom
arettig:trotter_errorbounds

Conversation

@arettig

@arettig arettig commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

This fixes #819. The loose error bound for trotter decomposition is currently implemented as equation 16 from this paper:

$$\Delta E_{\text{loose}} = 4 \sum_{\alpha}\lVert H_{\alpha} \rVert \bigg(\sum_{\beta}' \lVert H_{\beta} \rVert\bigg)^2 \Delta t^2$$

In the paper they mention this is only an upper bound on the second term of equation 6, but we should be giving an upper bound of both terms. I've changed the loose error bound to account for both terms:

$$\Delta E_{\text{loose}} =4 \sum_{\alpha} \lVert H_{\alpha} \rVert \left( \sum_{\beta}' \lVert H_{\beta} \rVert \right)^2 \Delta t^2 + 4 \sum_{\alpha} \lVert H_{\alpha} \rVert^2\sum_{\beta}' \lVert H_{\beta} \rVert \Delta t^2$$

The loose error bound unit test is also changed accordingly.

The loose error bound for trotter decomposition was missing
a term that lead to underestimation of the error in some systems.
The loose error bound unit test is also changed accordingly.
@arettig arettig requested a review from mhucka June 12, 2026 01:31

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the error_bound function in trotter_error.py by documenting the mathematical formulas for the tight and loose bounds in LaTeX and adding a missing term to the loose error bound calculation. It also updates the corresponding test in trotter_error_test.py. The reviewer pointed out that the loose error bound is overestimated by a factor of 12 because the coefficients used (4.0) do not account for the correct scaling factors from the second-order Trotter error expansion. The reviewer suggested scaling both terms by 1.0 / 3.0 instead of 4.0 and updating the test assertions accordingly.

Comment thread src/openfermion/circuits/trotter/trotter_error.py Outdated
Comment thread src/openfermion/circuits/trotter/trotter_error_test.py

@mhucka mhucka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like there may be some opportunities for efficiency improvements.

Comment thread src/openfermion/circuits/trotter/trotter_error.py Outdated
Comment thread src/openfermion/circuits/trotter/trotter_error.py
Comment on lines 163 to 172
if coefficient_a:
error_a = 0.0

for beta in range(alpha + 1, len(terms)):
term_b = terms[beta]
(coefficient_b,) = term_b.terms.values()
if not (
trivially_commutes(term_a, term_b) or commutator(term_a, term_b) == zero
):
error_a += abs(coefficient_b)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, upon further examination, it looks like the use of a doubly-nested loop is not necessary. The value computed by the inner loop does not depend on coefficient_a, which implies error_a could be computed in a separate pass, turning this O(N²) algorithm into O(N).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have to keep the nested loop here unfortunately. The commutation check in the inner loop depends on both alpha and beta.

Reduces the number of arithmetic operations when computing the
Trotter loose error bounds.

@mhucka mhucka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@mhucka

mhucka commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

@arettig I'll leave it to you to merge this when you're ready.

@arettig arettig added this pull request to the merge queue Jun 15, 2026
Merged via the queue into quantumlib:main with commit abaae38 Jun 15, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Bounds on Trotter Error

2 participants