Skip to content

Transpiler pass that converts a generic circuit to PBC #15502

Merged
alexanderivrii merged 79 commits intoQiskit:mainfrom
ShellyGarion:pbc_transformation
Mar 8, 2026
Merged

Transpiler pass that converts a generic circuit to PBC #15502
alexanderivrii merged 79 commits intoQiskit:mainfrom
ShellyGarion:pbc_transformation

Conversation

@ShellyGarion
Copy link
Copy Markdown
Member

@ShellyGarion ShellyGarion commented Jan 4, 2026

Summary

close #15451

For each of the standard 1-qubit and 2-qubit gates, that do not have parameters, or have only one parameter,
we currently map the gate to a list of equivalent Pauli rotations and a global phase.
Each element of the list is of the form ((Pauli string, phase rescale factor, [qubit indices]), global phase).
For gates that didn't have a phase (e.g. X)
the phase rescale factor is simply the phase of the rotation gate. The convention is
original_gate = PauliEvolutionGate(pauli, phase) * e^{i global_phase * phase}
The transpiler pass will output the corresponding PauliEvolutionGate.

Details and comments

@ShellyGarion ShellyGarion added this to the 2.4.0 milestone Jan 4, 2026
@ShellyGarion ShellyGarion added Rust This PR or issue is related to Rust code in the repository fault tolerance related to fault tolerance compilation labels Jan 4, 2026
@github-project-automation github-project-automation Bot moved this to Ready in Qiskit 2.4 Jan 4, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 4, 2026

Pull Request Test Coverage Report for Build 22140508833

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 260 of 272 (95.59%) changed or added relevant lines in 6 files are covered.
  • 1198 unchanged lines in 38 files lost coverage.
  • Overall coverage increased (+0.03%) to 87.996%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/transpiler/src/passes/pbc_transformation.rs 249 261 95.4%
Files with Coverage Reduction New Missed Lines %
crates/cext/build.rs 1 96.77%
crates/cext/src/transpiler/passes/basis_translator.rs 1 94.74%
crates/cext/src/transpiler/passes/consolidate_blocks.rs 1 96.15%
crates/cext/src/transpiler/passes/elide_permutations.rs 1 95.45%
crates/cext/src/transpiler/passes/inverse_cancellation.rs 1 90.0%
crates/cext/src/transpiler/passes/split_2q_unitaries.rs 1 96.55%
crates/cext/src/transpiler/transpile_layout.rs 1 99.37%
crates/synthesis/src/clifford/bm_synthesis.rs 2 99.16%
crates/cext/src/transpiler/passes/remove_identity_equiv.rs 3 85.0%
crates/cext/src/circuit_library/iqp.rs 4 82.35%
Totals Coverage Status
Change from base Build 21468038257: 0.03%
Covered Lines: 100547
Relevant Lines: 114263

💛 - Coveralls

Comment thread crates/transpiler/src/passes/pbc_transformation.rs Outdated
@ShellyGarion ShellyGarion moved this from Ready to In development in Qiskit 2.4 Jan 5, 2026
@alexanderivrii
Copy link
Copy Markdown
Member

Thanks Shelly for working on this. Some quick comments:

  • The pass should handle circuits with standard Z-measurements. Of course, it would leave them unchanged.
  • Maybe it can also trivially handle barriers.
  • Can we find a better name than PBCTransformation (since LitinskiTransformation is also a PBC transformation), maybe something like DirectPBCTranslation or TranslateToPBC?

@Cryoris Cryoris self-assigned this Jan 21, 2026
@ShellyGarion ShellyGarion added the Changelog: Added Add an "Added" entry in the GitHub Release changelog. label Jan 22, 2026
Copy link
Copy Markdown
Member

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Huge thanks Shelly for working on this, this pass is shaping up quite nicely. I haven't fully checked the heart of the pass (i.e. which Pauli-based decompositions we construct for different gates, and whether these can be improved), for now I have just left a few high-level comments that may help you finalize the rust code;

  • please see my previous comments here, I don't think all are fully addressed yet
  • we should support parameterized gates (as we have methods to multiply a parameter expression by a float factor)
  • we should try to deduplicate the code (combine common logic when possible)
  • we should avoid panic! and unreachable! when it makes sense

Comment thread crates/transpiler/src/passes/pbc_transformation.rs Outdated
Comment thread crates/transpiler/src/passes/pbc_transformation.rs Outdated
Comment thread crates/transpiler/src/passes/pbc_transformation.rs Outdated
Comment thread crates/transpiler/src/passes/pbc_transformation.rs Outdated
Comment thread test/python/transpiler/test_convert_to_pauli_rotations.py Outdated
@alexanderivrii
Copy link
Copy Markdown
Member

Thanks for the hard work, Shelly. If it's not too much to ask, could you please update using PauliEvolutionGate with PauliProductRotationGate, as done in #15753 for the Litinski transform.

@ShellyGarion
Copy link
Copy Markdown
Member Author

ShellyGarion commented Mar 5, 2026

failing tests are due to an error with binding parameters for parmatrized PauliProductRotationGate.
should be fixed after #15763 is merged.

Copy link
Copy Markdown
Member

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thanks Shelly for the quick updates to use PPRs. I have a few minor nitpicks about the comments + the docstrings, otherwise it is completely ready.

Comment on lines +33 to +34
/// Map gates to a list of equivalent Pauli product rotations and a global phase.
/// Each element of the list is of the form ((pauli, phase, [qubit indices]), global_phase).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you please update this comment something like that this writes a standard gate $S$ as a product of evolutions $S = e^{-i \phi_1 P_1} \dots e^{i \phi_k P_k}$, but for pauli rotation gates the convention is to divide the phase by $2$.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in 737156f

Comment on lines +277 to +278
/// Map gates with more than one parameter to a list of equivalent Pauli product rotations and a global phase.
/// Each element of the list is of the form ((pauli, phase, [qubit indices]), global_phase).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here: add a comment about the factor of 2 for pauli product rotations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in done in 737156f

Comment thread crates/transpiler/src/passes/convert_to_pauli_rotations.rs Outdated
Comment thread crates/transpiler/src/passes/convert_to_pauli_rotations.rs Outdated
Comment thread crates/transpiler/src/passes/convert_to_pauli_rotations.rs Outdated
Comment thread crates/transpiler/src/passes/convert_to_pauli_rotations.rs Outdated
Comment thread crates/transpiler/src/passes/convert_to_pauli_rotations.rs Outdated
Comment thread crates/transpiler/src/passes/convert_to_pauli_rotations.rs Outdated
Comment thread qiskit/transpiler/passes/optimization/convert_to_pauli_rotations.py Outdated
Comment on lines +6 to +8
standard gates, barriers and measurements, into an equivalent list of
:class:`.PauliProductRotationGate` and a global phase, as well as
:class:`.PauliProductMeasurement`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same comment here: the pass converts a circuit to a circuit, not to a list.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done in 737156f

ShellyGarion and others added 8 commits March 8, 2026 09:18
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
…ns.py

Co-authored-by: Alexander Ivrii <alexi@il.ibm.com>
Copy link
Copy Markdown
Member

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thanks for the quick updates, LGTM!

@alexanderivrii alexanderivrii added this pull request to the merge queue Mar 8, 2026
Merged via the queue into Qiskit:main with commit 2463cda Mar 8, 2026
23 checks passed
@github-project-automation github-project-automation Bot moved this from In development to Done in Qiskit 2.4 Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changelog: Added Add an "Added" entry in the GitHub Release changelog. fault tolerance related to fault tolerance compilation Rust This PR or issue is related to Rust code in the repository

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Support generic circuit to PBC transformation

6 participants