Skip to content

Add dense matrix support for PauliProductRotation#15927

Closed
Adithyaphani wants to merge 1 commit intoQiskit:mainfrom
Adithyaphani:fix-ppr-matrix-clean
Closed

Add dense matrix support for PauliProductRotation#15927
Adithyaphani wants to merge 1 commit intoQiskit:mainfrom
Adithyaphani:fix-ppr-matrix-clean

Conversation

@Adithyaphani
Copy link
Copy Markdown

@Adithyaphani Adithyaphani commented Mar 31, 2026

AI tool used: ChatGPT (OpenAI GPT-5.4 Thinking) for understanding the issue clearly and not relying on it completely.

Fixes #15869.

Summary

This PR adds the missing dense Pauli-matrix helper required by the existing PauliProductRotation::matrix() implementation.

Details and comments

This PR is intentionally minimal and limited to:

  • crates/circuit/src/gate_matrix.rs

It adds pauli_zx_to_matrix(z, x) so the existing PauliProductRotation::matrix() path in operations.rs can construct the dense Pauli-product matrix and return the dense rotation matrix correctly.

The resulting matrix follows:

cos(theta / 2) * I - i * sin(theta / 2) * P

Validation run locally:

  • cargo fmt --all
  • cargo check -p qiskit-circuit --lib --all-features
  • cargo clippy -p qiskit-circuit --lib --all-features -- -D warnings

@Adithyaphani Adithyaphani requested a review from a team as a code owner March 31, 2026 18:47
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Mar 31, 2026
@qiskit-bot
Copy link
Copy Markdown
Collaborator

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

@Adithyaphani
Copy link
Copy Markdown
Author

Hi @ShellyGarion , just a gentle reminder on this PR whenever you have a chance to review it.

This is a follow-up focused only on the required PauliProductRotation matrix fix, with unrelated changes removed from the earlier attempt.

Thank you.

@Adithyaphani Adithyaphani force-pushed the fix-ppr-matrix-clean branch from 4b5e7a0 to 27d8136 Compare April 1, 2026 17:53
@Adithyaphani
Copy link
Copy Markdown
Author

Adithyaphani commented Apr 1, 2026

@1ucian0 and @ShellyGarion I’ve pushed a fix that clears the macOS CI failure. Could you please Re-run all jobs for this PR.

@Adithyaphani
Copy link
Copy Markdown
Author

@1ucian0 thanks for the rerun. At this point the remaining failure appears limited to the macOS-15 / Python 3.10 install-dependencies step.

The log shows a runner/setup-side conflict while installing Rust tooling (clippy-preview-aarch64-apple-darwin / cargo-clippy) and then reports that it cannot find a Rust compiler, before the Python tests actually run.

I restored the accidental workflow-file change and have not made further source or workflow edits to avoid widening the PR scope again. If helpful, I’d appreciate another rerun or any guidance on the next step from your side. Thank you.

@Adithyaphani
Copy link
Copy Markdown
Author

Adithyaphani commented Apr 3, 2026

@1ucian0 .Unfortunately, the PR was closed earlier, but I have now reopened it. All required checks are passing in the latest commit. For reference, I’ve attached a screenshot in the comments.

Leaving this as a gentle follow-up for review whenever convenient. I hope the branch can be successfully merged after this re-run. If any further changes are needed, I’d be happy to make them.

Thank you.
Screenshot 2026-04-03 075510

@Adithyaphani Adithyaphani reopened this Apr 3, 2026
@github-project-automation github-project-automation Bot moved this from Done to Tagged but unassigned in Contributor Monitoring Apr 3, 2026
@ShellyGarion
Copy link
Copy Markdown
Member

This PR does not address the functionality requested in #15869 and does not add a to_matrix support to PauliProductRotation.
The suggested functionallyity in this PR (converting Paulis into a matrix) already exists in qiskit/crates/quantum_info/src/sparse_pauli_op.rs and is already implemented there in an efficient way, as alreay pointed out in the review of #15879.
The Qiskit team will handle issue #15869, so you're kindly asked not to open further PRs on this issue.

@github-project-automation github-project-automation Bot moved this from Tagged but unassigned to Done in Contributor Monitoring Apr 3, 2026
@Adithyaphani
Copy link
Copy Markdown
Author

@ShellyGarion ,I’ll ensure better efficiency in future fixes. Thanks for your guidance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PR PRs from contributors that are not 'members' of the Qiskit repo

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add PauliProductRotation matrix handling in Rust

3 participants