Skip to content

docs: compare exact and alias PauliLCU backends - #92

Open
wsttiger wants to merge 4 commits into
NVIDIA:mainfrom
wsttiger:codex/v02-01-pauli-lcu-exact-vs-alias
Open

wsttiger wants to merge 4 commits into
NVIDIA:mainfrom
wsttiger:codex/v02-01-pauli-lcu-exact-vs-alias

Conversation

@wsttiger

@wsttiger wsttiger commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Extends the existing PauliLCU walkthrough with exact and alias PREPARE/SELECT for the same two-qubit Hamiltonian at mu=2, 3, and 4. The default output tells the accuracy/resource story: an approximation-error table, the demonstrations actually executed, the complete gate/qubit inventory, and a small measured-moment table. The guide and examples page use the same narrative and observed values.

On this fixture mu=2 and mu=3 give the same rounded Hamiltonian (operator error 0.04516); mu=4 reduces it to 0.01734, about 2.6 times smaller, with 19 total qubits. Action executes for every backend; Walk/QSVT execute for exact and mu=2/3. The mu=4 consumer runs are skipped for CPU runtime.

All independent NumPy, alias-table, probability-bound, and gate-accounting checks remain active at their existing tolerances. Successful checks are silent by default; --verbose prints the individual diagnostics. Failures print diagnostics and raise in both modes. Coefficient-rounding error is distinguished from circuit/reference agreement.

Validation on Python 3.12.3 / CUDA-Q 0.16.0, fp64 qpp-cpu:

  • Default standalone run: passed in 26.30 s; verbose run: passed in 26.10 s.
  • Existing test_examples.py -k pauli_lcu_demo: 1 passed, 17 deselected (26.46 s).
  • Default and verbose scientific summaries match; all 40 detailed diagnostics appear under --verbose.
  • Silent success, visible failure, and NaN rejection checked directly; the guide's example table matches observed output.
  • YAPF 0.43.0, git diff --check, and Sphinx -W --keep-going: passed.

Independent plan 01 PR targeting main, with development in wsttiger/cudaq-algorithms. Replaces #85, where the earlier review discussion remains available.

Signed-off-by: Scott Thornton <wsttiger@gmail.com>
The backend comparison in pauli_lcu_demo.py builds the alias encoding at
mu=2, 3 and 4. The walk and QSVT circuits run at mu=2 and mu=3; the
19-qubit mu=4 encoding is priced, compared as an operator and applied
once, since its walk and QSVT circuits took about 70 s of the example's
80 s on a two-thread CPU simulator. Including mu=3 shows the rounding
behaviour the guide describes: its tables coincide with the mu=2 tables
on this Hamiltonian, so the operator error stays at 4.5e-2 while the bound
halves. The table now prints the bound beside the error.

The resource table counted only X-type controlled gates, so the exact
SELECT's controlled Y and Z (ccy, ccz, cz) and the alias circuit's cx and
Hadamard gates were missing from the comparison. The row now lists
rotations, uncontrolled single-qubit gates, singly, doubly and
higher-controlled Paulis and Fredkins, and checks that these families sum
to the estimator's total gate count.

The guide and examples page describe the executed precisions and the
table columns accordingly.

Signed-off-by: Scott Thornton <wsttiger@gmail.com>
Signed-off-by: Scott Thornton <wsttiger@gmail.com>
@wsttiger
wsttiger marked this pull request as ready for review November 10, 2026 18:47
Signed-off-by: Scott Thornton <wsttiger@gmail.com>

This branch has not been deployed

No deployments
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.

1 participant