Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper func apply_operation for default mixed #6379

Merged
merged 116 commits into from
Nov 1, 2024

Conversation

JerryChen97
Copy link
Contributor

@JerryChen97 JerryChen97 commented Oct 10, 2024

Context:
Before getting into the implementation of new default_mixed we need to separate most of the useful logics from the older version one. One of the most important things is the apply_operation. Basically, what we want to do is to condensate everything into a new sub-module under qml/devices/qubit_mixed such that previous empirical heuristics regarding how to select between einsum and tensordot can be carried over and wrapped independently.

Description of the Change:
New script containing the helper funcs as described above.

Benefits:
Better modularization. Getting ready for the implementaion of a new default_mixed in the future.

Possible Drawbacks:

Related GitHub Issues:

Related Shortcut Stories
[sc-73319]

Copy link
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 JerryChen97 self-assigned this Oct 10, 2024
@JerryChen97 JerryChen97 added the WIP 🚧 Work-in-progress label Oct 10, 2024
@JerryChen97 JerryChen97 changed the title Add helper func apply_operation for default mixed [WIP] Add helper func apply_operation for default mixed Oct 10, 2024
@JerryChen97
Copy link
Contributor Author

RN I've done the implementation of both einsum and tensordot.

  • The einsum method is directly adopted from current qutrit mixed module
  • The tensordot method is from the default_mixed but several necessary modifications are applied.

Due to the fact that there are quite some other shortcuting regeisters for many special cases to implement, currently I would like to put this as draft without the full CI. After all the other registers complete I will load the CI along with more tests.

@JerryChen97
Copy link
Contributor Author

In previous devices.default_mixed the apply_operation even includes some state preparation. Apparently this is a wrong scope and i will create another story for this

@JerryChen97
Copy link
Contributor Author

The following methods involve additional stories and will be neglected for now:

  • snapshot: this involves measurement submodule, missing for now
  • evolve: this involves extra refinement over how the odeint can be applied onto a density matrix

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

Looks good. I've left a few more tidiness related suggestions for the actual implementation. I noticed some gaps in testing, so I've left suggestions for that as well. But overall, looks great, and very close to approval!

pennylane/devices/qubit_mixed/apply_operation.py Outdated Show resolved Hide resolved
pennylane/devices/qubit_mixed/apply_operation.py Outdated Show resolved Hide resolved
pennylane/devices/qubit_mixed/apply_operation.py Outdated Show resolved Hide resolved
pennylane/devices/qubit_mixed/apply_operation.py Outdated Show resolved Hide resolved
pennylane/devices/qubit_mixed/apply_operation.py Outdated Show resolved Hide resolved
@JerryChen97 JerryChen97 requested a review from mudit2812 November 1, 2024 13:56
@JerryChen97
Copy link
Contributor Author

All resolved! @mudit2812

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

One final comment, otherwise ready to approve. Thanks for being patient with the reviews :)

pennylane/devices/qubit_mixed/apply_operation.py Outdated Show resolved Hide resolved
@JerryChen97 JerryChen97 enabled auto-merge (squash) November 1, 2024 22:29
@JerryChen97 JerryChen97 merged commit bee380f into master Nov 1, 2024
39 checks passed
@JerryChen97 JerryChen97 deleted the add-apply-operation-mixed branch November 1, 2024 22:47
mudit2812 added a commit that referenced this pull request Nov 11, 2024
**Context:**
Before getting into the implementation of new `default_mixed` we need to
separate most of the useful logics from the older version one. One of
the most important things is the `apply_operation`. Basically, what we
want to do is to condensate everything into a new sub-module under
`qml/devices/qubit_mixed` such that previous empirical heuristics
regarding how to select between `einsum` and `tensordot` can be carried
over and wrapped independently.

**Description of the Change:**
New script containing the helper funcs as described above.

**Benefits:**
Better modularization. Getting ready for the implementaion of a new
`default_mixed` in the future.

**Possible Drawbacks:**

**Related GitHub Issues:**

**Related Shortcut Stories**
[sc-73319]

---------

Co-authored-by: Mudit Pandey <[email protected]>
Co-authored-by: Astral Cai <[email protected]>
Co-authored-by: Christina Lee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants