Skip to content

refactor: promote RZ / CRZ / SelectPauliRot phase gradient decomps to transforms/decompositions - #9928

Open
andrijapau wants to merge 22 commits into
mainfrom
refactor/move-labs-phase-grad-decomps
Open

refactor: promote RZ / CRZ / SelectPauliRot phase gradient decomps to transforms/decompositions#9928
andrijapau wants to merge 22 commits into
mainfrom
refactor/move-labs-phase-grad-decomps

Conversation

@andrijapau

@andrijapau andrijapau commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Context:

These decompositions are used in OFC workflows and should therefore be CI tested during any migration.

Description of the Change:

Promote them out of labs.

Benefits: CI/CD tested.

Possible Drawbacks: None that I am aware of.

[sc-126092]

@andrijapau andrijapau added WIP 🚧 Work-in-progress labs 🧑‍🔬 This includes changes to `qml.labs` source code op2 migration This label is for any work related to the migration of legacy operators to the Operator2 framework. labels Jul 29, 2026
@andrijapau andrijapau changed the title REFACTOR: move phase gradient decomps to main PL REFACTOR: promote RZ/CRZ/SelectPauliRot phase gradient decomps to transforms/decompositions Jul 29, 2026
@andrijapau andrijapau changed the title REFACTOR: promote RZ/CRZ/SelectPauliRot phase gradient decomps to transforms/decompositions REFACTOR: promote RZ / CRZ / SelectPauliRot phase gradient decomps to transforms/decompositions Jul 29, 2026
@andrijapau andrijapau changed the title REFACTOR: promote RZ / CRZ / SelectPauliRot phase gradient decomps to transforms/decompositions refactor: promote RZ / CRZ / SelectPauliRot phase gradient decomps to transforms/decompositions Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.46%. Comparing base (21ec2df) to head (81df4a2).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #9928    +/-   ##
========================================
  Coverage   99.46%   99.46%            
========================================
  Files         605      608     +3     
  Lines       67423    67552   +129     
========================================
+ Hits        67059    67191   +132     
+ Misses        364      361     -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Had to add additional test coverage

@dwierichs dwierichs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just some minor stuff :)

Comment thread pennylane/labs/transforms/select_pauli_rot_phase_gradient.py Outdated
@@ -226,17 +226,14 @@ def _resource_fn(num_wires, rot_axis):
match rot_axis:
case "X":
change_basis_rep_basis_adapted = change_op_basis_resource_rep(
qp.Hadamard, change_basis_rep, qp.Hadamard
qp.Hadamard, change_basis_rep, _adjoint_abstract(qp.Hadamard)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, yeah we no longer need this.

Comment thread tests/transforms/decompositions/test_rz_phase_gradient.py Outdated

# This should verify the decomp structure annd make sure that the resources match the
# decomposition, giving us enough coverage
_test_decomposition_rule(op, custom_decomp)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This does not change whether the basis change is the wrong way around, for example.
Might be worth to actually go for some numerical test? 🤔
Coverage is way better already with this PR, so it almost feels like a nit pick 😅

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let me think of a better way.

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

Labels

labs 🧑‍🔬 This includes changes to `qml.labs` source code op2 migration This label is for any work related to the migration of legacy operators to the Operator2 framework. WIP 🚧 Work-in-progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants