qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Light Cone Transpiler Pass

Open MarcDrudis opened this issue 1 year ago • 2 comments

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 .

MarcDrudis avatar Jul 25 '24 13:07 MarcDrudis

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

qiskit-bot avatar Jul 25 '24 13:07 qiskit-bot

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.

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 Coverage Status
Change from base Build 13635545005: 0.03%
Covered Lines: 75616
Relevant Lines: 86681

💛 - Coveralls

coveralls avatar Jul 25 '24 13:07 coveralls

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 16 '24 10:12 CLAassistant

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?

MarcDrudis avatar Feb 12 '25 09:02 MarcDrudis

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 🙂

Cryoris avatar Feb 18 '25 14:02 Cryoris

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

qiskit-bot avatar Feb 19 '25 08:02 qiskit-bot