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

Make Prod compatible with qutrit operators #5400

Merged
merged 2 commits into from
Mar 18, 2024
Merged

Make Prod compatible with qutrit operators #5400

merged 2 commits into from
Mar 18, 2024

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Mar 18, 2024

[sc-59010]

The tests/devices/test_default_qutrit.py tests were failing due to Prod.eigvals(). The eigenvalues were not defined for Tensor, but now Prod gives it its best effort. Unfortunately, Prod's best effort was not sufficient.

This change improves qml.utils.expand_vector so it is compatible with qudit operators.

Copy link
Contributor

@lillian542 lillian542 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 to me!

@albi3ro albi3ro merged commit 357b365 into ham-tests Mar 18, 2024
26 of 37 checks passed
@albi3ro albi3ro deleted the prod-qutrit branch March 18, 2024 19:08
mudit2812 added a commit that referenced this pull request Apr 12, 2024
**Context:**
Measuring and applying operation functionality have been added to the
`qutrit_mixed` module, these tests ensure that these operations are
differentiable.
Since support for qml.prod for qutrits has been implemented from
[PR](#5400). It will be
possible to change the method of state measurement without issue.
The way expectation value measurement was done may have been overly
complicated so this reducing that complication, while still allowing for
product type observables.

**Description of the Change:**
Tests have been added that ensure that the `apply_operation` and
`measure` functions retain differentiability for the new qutrit
mixed-state device.
Expectation value measurements have been changed to use diagonalizing
gates and eigenvalues instead of trace.

**Benefits:**
Shows that the `apply_operation` and `measure` functions are
differentiable.

**Possible Drawbacks:**
This PR does not remove the abstractions made in apply_operations to
make the trace based measure expectation value work so there is some
code left that may be overly abstract.

**Related GitHub Issues:**
N/A

---------

Co-authored-by: Gabe PC <bottrill@student.ubc.ca>
Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai>
Co-authored-by: Thomas R. Bromley <49409390+trbromley@users.noreply.github.com>
Co-authored-by: Christina Lee <chrissie.c.l@gmail.com>
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
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.

3 participants