qiskit
qiskit copied to clipboard
Light Cone Transpiler Pass
Summary
When measuring or sampling a subset of the qubits of our circuit there will be some gates in our circuit that will not affect the outcome of the measurement. One can thus compute the causal light cone of the circuit and measurement, i.e. the set of gates that does affect the measurement. This transpiler pass provides an easy tool to reduce the number of gates in our circuit provided a Pauli observable to be measured or a subset of measurements in the Z basis. This PR adresses #12792
Details and comments
This code takes inspiration from an implementation done by @aeddins-ibm. Before finishing the unit-tests for this PR it would be interesting to solve #12790 .
Thank you for opening a new pull request.
Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.
While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.
One or more of the following people are relevant to this code:
@Qiskit/terra-core
Pull Request Test Coverage Report for Build 13636110765
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.
- For more information on this, see Tracking coverage changes with pull request builds.
- To avoid this issue with future PRs, see these Recommended CI Configurations.
- For a quick fix, rebase this PR at GitHub. Your next report should be accurate.
Details
- 78 of 80 (97.5%) changed or added relevant lines in 2 files are covered.
- 5 unchanged lines in 1 file lost coverage.
- Overall coverage increased (+0.03%) to 87.235%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| qiskit/transpiler/passes/optimization/light_cone.py | 58 | 60 | 96.67% |
| <!-- | Total: | 78 | 80 |
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| crates/qasm2/src/lex.rs | 5 | 91.98% |
| <!-- | Total: | 5 |
| Totals | |
|---|---|
| Change from base Build 13635545005: | 0.03% |
| Covered Lines: | 75616 |
| Relevant Lines: | 86681 |
💛 - Coveralls
I created a test that creates the lightcone of a large Pauli string and it is not passing. This is linked to #13828. How should we proceed? Do we wait until the issue is fixed for merging this PR, or should we just throw a warning for now if the Pauli string gets too big?
You could comment out the test case saying that it requires #13828 to be fixed, but I wouldn't add a custom warning, since that's extra cleanup work once the bug has been fixed. The expected behavior is for this to work 🙂
Thank you for opening a new pull request.
Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.
While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.
One or more of the following people are relevant to this code:
@Qiskit/terra-core