Skip to content

Port X to Operator2 - #9844

Open
comp-phys-marc wants to merge 489 commits into
mainfrom
chore/port-x-only
Open

Port X to Operator2#9844
comp-phys-marc wants to merge 489 commits into
mainfrom
chore/port-x-only

Conversation

@comp-phys-marc

@comp-phys-marc comp-phys-marc commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Context: Removes the changes involved in porting Y, Z from #9684 so we can have a PR chain that ports X, CNOT, Toffoli, MCX and not also all of the Y, Z, CY, CZ at once.

Description of the Change: Isolates the X changes and what is needed to address errors not specifically related to Y, Z.

Benefits: We can isolate some of our work.

Possible Drawbacks: Undoing stuff.

Related GitHub Issues: [sc-125488]

@PennyLaneAI PennyLaneAI deleted a comment from github-actions Bot Jul 14, 2026
@comp-phys-marc
comp-phys-marc marked this pull request as ready for review July 15, 2026 14:55
@github-actions

Copy link
Copy Markdown
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

JerryChen97 and others added 5 commits July 27, 2026 12:19
Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com>
…tion.py

Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com>
…ution.py

Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com>
Base automatically changed from fix/assert-valid-operator2-compat to main July 27, 2026 17:20
@astralcai
astralcai changed the base branch from main to fix/assert-valid-capture-decomp-rule July 27, 2026 19:38
Base automatically changed from fix/assert-valid-capture-decomp-rule to main July 27, 2026 20:32

@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.

Mostly looks good to me! :) Just had some minor questions

@@ -384,11 +384,13 @@ def compute_matrix() -> np.ndarray: # pylint: disable=arguments-differ

@staticmethod
@lru_cache

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.

Should the lru_cache stay on here? 🤔

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.

I don't see why not?

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.

I was thinking we removed it for compute_matrix because wires are now an argument, so potentially quite a few copies of this might be produced? 🤔 Shouldn't it be the same logic for compute_matrix and compute_sparse_matrix either way? :)

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.

Yeah, SX removed the lru_cache.

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.

Done

Comment thread tests/measurements/test_counts.py Outdated
Comment thread tests/ops/qubit/test_all_qubit_ops.py
Comment thread tests/ops/qubit/test_all_qubit_ops.py
Comment thread tests/pytrees/test_pytrees.py
Comment thread tests/templates/subroutines/test_qsvt.py Outdated
Comment thread tests/templates/test_subroutine.py Outdated
@astralcai
astralcai requested a review from andrijapau July 30, 2026 13:44
@astralcai
astralcai requested a review from dwierichs July 30, 2026 14:14

@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.

Looks good to me, thanks @astralcai 🎉 Just the lru_cache removal pending :)

Oh, and a changelog entry? Or is that handled at the end of the PR chain?

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

Labels

op2 migration This label is for any work related to the migration of legacy operators to the Operator2 framework.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants