-
Notifications
You must be signed in to change notification settings - Fork 627
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
Qutrit Rotations #2 (TRY) #2846
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2846 +/- ##
=======================================
Coverage 99.77% 99.77%
=======================================
Files 340 340
Lines 30518 30560 +42
=======================================
+ Hits 30450 30492 +42
Misses 68 68
|
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
…into qutrit_nops#4
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca>
… into qutrit_param#1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, just a few small things
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳 🥳 (assuming tests pass)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, @mudit2812 ! 🎉 Very easy review, now that TRX
is in.
Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com>
… into qutrit_param#2
* Adding tests for tensor observables * Added tests for tensor sample * Updated tests * Apply suggestions from code review * Partition device apply ops test case. * Run black * Fix pylint * Update pennylane/devices/default_qutrit.py * black and pylint * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated test_default_qutrit.py * Updated _apply_tadd documentation * Added eigvals method for TSWAP * Reverted TSWAP eigval changes * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/devices/default_qutrit.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added TSWAP eigvals * Updated changelog-dev.md to include GellMannObs * Removed empty file * Added linting comments * Updated tests to use gate_data * Updated test parameter names to be more accurate * Remove unused file * Updated GellMannObs doc-string * Update changelog-dev.md * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added changes to GellMann to address PR comments * Updated test * Reformatting * Trying out changes to Gell-Mann docstring * Updated Changelog * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Testing LaTeX align * Added non-diag tests * Added diag, complex case for tensor sample * Added example to doc string * Fixed label test * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added tests for controlled qutrit unitary * Fix broadcasting, finish tests for CQutritUnitary * Added TRX and created skeleton files * Adding tests for TRX * Fixed broadcasting issue in controlled qutrit unitary * Fixed broadcasting issue with ControlledQutritUnitary * Fixed broadcasting issue in TRX * Updated TRX documentation * Added tests * Added tests for TRX * Removed unused imports * Removed unused imports, linting changes * Added TRX parameter frequencies * Updated matrix dtype for TRX generator * Added test for param frequencies * Added param-shift capability for qutrit devices * Updated changelog * Update changelog * Added change for TRX generator * Updated utils.py to support higher dimensions * Added tests for updated utils.sparse_hamiltonian * Added Identity as supported obs * Updated TRX docstring * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added ControlledQutritUnitary * Update changelog-dev.md * Removed empty files * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated to address PR * Fixed uncommented lines in test suite * Added complex values to state * Updated test_mixed_polarity_controls * Fixed QutritUnitary._controlled * Updated test_controlled for matrix ops * Updated ControlledQutritUnitary._controlled * Reformatting * Update pennylane/ops/qutrit/matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated ControlledQutritUnitary and tests * Addressing PR review * Updated sparse_hamiltonian, fixed TRX docstring * Addressing PR review * Refactoring * Fixed changelog * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/test_qnode.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Reverted changes to sparse_hamiltonian * Fixed sparse_hamiltonian test * Updated changelog * Updated TRX documentation * Fixed generator * Adding levels to sparse_hamiltonian * Updated test sparse hamiltonian * Fixed sparse hamiltonian test * Fixed constant level kwarg * Updated changelog, added test coverage * Fixed coverage * Updated test suite * Updated files to address PR review * Updated tests to include subspace error tests * Added TRX tests for parameter shift * Update doc/releases/changelog-dev.md Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update utils.py to remove trailing whitespace * Updated to address PR review * Fixed class/object confusion bug * Testing changes to adjust lines changed in PR * Fixing changes * Fixing changes * Resetting problem files * Fixing changes * updated TRX docs * Fixed TRX docs * Updated TRX docs * Fixed PR too many lines changed issue * Updated subspace error tests * Tweaked THadamard docs to fix rendering * Test dos2unix * Fixed subspace testing * Merge changes * Started adding tests for grad * Updated tests to parametrize diff-method * Linted tests * Fiex tests using in-place inversion * Added diff tests * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Fixed formatting * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated TRY and tests * Updated utils.py * Fixed TRX generator * Updated generator TRY * Updated subspace validation for TRY * Updated subspace validation * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Reverted `validate_subspace` changes * Updated test * Added parameter shift test * Fixed test * Update doc/releases/changelog-dev.md * Update changelog * Updated grad tests * Apply suggestions from code review Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated subspace docstring --------- Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@protonmail.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Matthew Silverman <ma.silv11@gmail.com>
* Change seed setting in spsa_grad. * Update changelog. * Adapt tests. Note that lots of tests still set a global seed! * Update pennylane/gradients/spsa_gradient.py Co-authored-by: Christina Lee <christina@xanadu.ai> * Update pennylane/gradients/spsa_gradient.py Co-authored-by: Christina Lee <christina@xanadu.ai> * use Shots class in gradients module (#4152) * linting * add num_copies property to shots * change gradients to use new Shots class * fix missing update in vjp * fix stacking and single-shots in shot_adaptive * remove unneeded cast to tuple * type-hints and touch-ups * code review feedback * changelog --------- Co-authored-by: Romain Moyard <rmoyard@gmail.com> * Qutrit Rotations #2 (TRY) (#2846) * Adding tests for tensor observables * Added tests for tensor sample * Updated tests * Apply suggestions from code review * Partition device apply ops test case. * Run black * Fix pylint * Update pennylane/devices/default_qutrit.py * black and pylint * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated test_default_qutrit.py * Updated _apply_tadd documentation * Added eigvals method for TSWAP * Reverted TSWAP eigval changes * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/devices/default_qutrit.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added TSWAP eigvals * Updated changelog-dev.md to include GellMannObs * Removed empty file * Added linting comments * Updated tests to use gate_data * Updated test parameter names to be more accurate * Remove unused file * Updated GellMannObs doc-string * Update changelog-dev.md * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added changes to GellMann to address PR comments * Updated test * Reformatting * Trying out changes to Gell-Mann docstring * Updated Changelog * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Testing LaTeX align * Added non-diag tests * Added diag, complex case for tensor sample * Added example to doc string * Fixed label test * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added tests for controlled qutrit unitary * Fix broadcasting, finish tests for CQutritUnitary * Added TRX and created skeleton files * Adding tests for TRX * Fixed broadcasting issue in controlled qutrit unitary * Fixed broadcasting issue with ControlledQutritUnitary * Fixed broadcasting issue in TRX * Updated TRX documentation * Added tests * Added tests for TRX * Removed unused imports * Removed unused imports, linting changes * Added TRX parameter frequencies * Updated matrix dtype for TRX generator * Added test for param frequencies * Added param-shift capability for qutrit devices * Updated changelog * Update changelog * Added change for TRX generator * Updated utils.py to support higher dimensions * Added tests for updated utils.sparse_hamiltonian * Added Identity as supported obs * Updated TRX docstring * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added ControlledQutritUnitary * Update changelog-dev.md * Removed empty files * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated to address PR * Fixed uncommented lines in test suite * Added complex values to state * Updated test_mixed_polarity_controls * Fixed QutritUnitary._controlled * Updated test_controlled for matrix ops * Updated ControlledQutritUnitary._controlled * Reformatting * Update pennylane/ops/qutrit/matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated ControlledQutritUnitary and tests * Addressing PR review * Updated sparse_hamiltonian, fixed TRX docstring * Addressing PR review * Refactoring * Fixed changelog * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/test_qnode.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Reverted changes to sparse_hamiltonian * Fixed sparse_hamiltonian test * Updated changelog * Updated TRX documentation * Fixed generator * Adding levels to sparse_hamiltonian * Updated test sparse hamiltonian * Fixed sparse hamiltonian test * Fixed constant level kwarg * Updated changelog, added test coverage * Fixed coverage * Updated test suite * Updated files to address PR review * Updated tests to include subspace error tests * Added TRX tests for parameter shift * Update doc/releases/changelog-dev.md Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update utils.py to remove trailing whitespace * Updated to address PR review * Fixed class/object confusion bug * Testing changes to adjust lines changed in PR * Fixing changes * Fixing changes * Resetting problem files * Fixing changes * updated TRX docs * Fixed TRX docs * Updated TRX docs * Fixed PR too many lines changed issue * Updated subspace error tests * Tweaked THadamard docs to fix rendering * Test dos2unix * Fixed subspace testing * Merge changes * Started adding tests for grad * Updated tests to parametrize diff-method * Linted tests * Fiex tests using in-place inversion * Added diff tests * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Fixed formatting * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated TRY and tests * Updated utils.py * Fixed TRX generator * Updated generator TRY * Updated subspace validation for TRY * Updated subspace validation * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Reverted `validate_subspace` changes * Updated test * Added parameter shift test * Fixed test * Update doc/releases/changelog-dev.md * Update changelog * Updated grad tests * Apply suggestions from code review Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated subspace docstring --------- Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@protonmail.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * jax integration for for DefaultQubit2 (#4137) * copy-paste autograd test file * port to jax in tests; update shots in jax interface * add argnums when needed; skip tests that do not work with jax * use pytest imports to skip * pylint tests * changelog * take shots change from Christina's PR * Update doc/releases/changelog-dev.md Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> * copy changes to autograd as well * rename to indicate bool; slight autograd fixup --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> * Treat identities as equivalent in `pauli.are_identical_pauli_words` (#4161) * fix hamiltonian grouping indices bug * Update doc/releases/changelog-dev.md * Take wire ordering in the `wires` argument to `qml.density_matrix` into account (#4072) * include wire ordering, test for that, raise error for broadcasting, test for that * reduce * changelog * add test for qinfo transform * more tests for math module * lint math tests * lint * black * introduce, use and test input_is_dm kwarg to reduced_dm * tmp * reverting * seed fix --------- Co-authored-by: Edward Jiang <34989448+eddddddy@users.noreply.github.com> * CY inherits from ControlledOp (#4116) `qml.CY` has been moved from `qml.ops.qubit.non_parametric_ops` to `qml.ops.op_math.controlled_ops` and now inherits from `qml.ops.op_math.ControlledOp`. --------- Co-authored-by: Matthew Silverman <matthews@xanadu.ai> Co-authored-by: Christina Lee <christina@xanadu.ai> * Empty hamiltonians are compatible with `qml.pauli_sentence()` (#4171) * fix ps rep for empty hamiltonian * changelog * Update doc/releases/changelog-dev.md Co-authored-by: Utkarsh <utkarshazad98@gmail.com> --------- Co-authored-by: Utkarsh <utkarshazad98@gmail.com> * Update tests/interfaces/test_torch_qnode.py Co-authored-by: Christina Lee <christina@xanadu.ai> * Python 3.8 compatibility and increase num_directions, since spsa_grad, with num_directions=1, fails sometimes, depending on the seed. * Fix failing tests * Fix docs. * Fix unsupported NoneType import * Undo irrelevant change. * Fix failing tests. Still not reliable. * Fix tolerance issue with SPSA second derivative. * Increase tolerance. This test has also been failing spontaneously on the master branch 3468885 * Switch to sampler_rng kwarg and fix tolerance issues. * More migration to sampler_rng * Migrate more tests to sampler_rng * Migrate legacy tests to sampler_rng * black * Deprecated the sampler_seed argument * black * Increase tolerance for test_hamiltonian_expansion_finite_shots tests. * Fix tol * Pin autoray for CI * Set num_directions=20 in all hamiltonian_expansion_finite_shots tests. * Make black and pylint happy * Set device seed for DQ2 tests. * Add tests for new return type system. * Fix bug * Adapt dq2 tests for spsa * Remove qml.disable_return() * Change DQ2 tests to new seed setting system. * Fix bug * Fix failing tests. TF tests pass locally. Not sure what the problem is. * Fix missing grad_kwarg * black * Increase tol * Increase num_directions * Apply suggestions from code review Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> * Update pennylane/gradients/spsa_gradient.py Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> * Copy TestRademacherSampler into new tests * Make docs more precise and add tests for rng kwarg of samplers. * black * black * Fix error message in _spsa_grad_legacy * pylint * Update changelog-dev.md * black * Increase num_directions for Hessian test. --------- Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Matthew Silverman <matthews@xanadu.ai> Co-authored-by: Romain Moyard <rmoyard@gmail.com> Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@protonmail.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> Co-authored-by: Edward Jiang <34989448+eddddddy@users.noreply.github.com> Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
* Change seed setting in spsa_grad. * Update changelog. * Adapt tests. Note that lots of tests still set a global seed! * Update pennylane/gradients/spsa_gradient.py Co-authored-by: Christina Lee <christina@xanadu.ai> * Update pennylane/gradients/spsa_gradient.py Co-authored-by: Christina Lee <christina@xanadu.ai> * use Shots class in gradients module (PennyLaneAI#4152) * linting * add num_copies property to shots * change gradients to use new Shots class * fix missing update in vjp * fix stacking and single-shots in shot_adaptive * remove unneeded cast to tuple * type-hints and touch-ups * code review feedback * changelog --------- Co-authored-by: Romain Moyard <rmoyard@gmail.com> * Qutrit Rotations PennyLaneAI#2 (TRY) (PennyLaneAI#2846) * Adding tests for tensor observables * Added tests for tensor sample * Updated tests * Apply suggestions from code review * Partition device apply ops test case. * Run black * Fix pylint * Update pennylane/devices/default_qutrit.py * black and pylint * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated test_default_qutrit.py * Updated _apply_tadd documentation * Added eigvals method for TSWAP * Reverted TSWAP eigval changes * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/devices/default_qutrit.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added TSWAP eigvals * Updated changelog-dev.md to include GellMannObs * Removed empty file * Added linting comments * Updated tests to use gate_data * Updated test parameter names to be more accurate * Remove unused file * Updated GellMannObs doc-string * Update changelog-dev.md * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added changes to GellMann to address PR comments * Updated test * Reformatting * Trying out changes to Gell-Mann docstring * Updated Changelog * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Testing LaTeX align * Added non-diag tests * Added diag, complex case for tensor sample * Added example to doc string * Fixed label test * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added tests for controlled qutrit unitary * Fix broadcasting, finish tests for CQutritUnitary * Added TRX and created skeleton files * Adding tests for TRX * Fixed broadcasting issue in controlled qutrit unitary * Fixed broadcasting issue with ControlledQutritUnitary * Fixed broadcasting issue in TRX * Updated TRX documentation * Added tests * Added tests for TRX * Removed unused imports * Removed unused imports, linting changes * Added TRX parameter frequencies * Updated matrix dtype for TRX generator * Added test for param frequencies * Added param-shift capability for qutrit devices * Updated changelog * Update changelog * Added change for TRX generator * Updated utils.py to support higher dimensions * Added tests for updated utils.sparse_hamiltonian * Added Identity as supported obs * Updated TRX docstring * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added ControlledQutritUnitary * Update changelog-dev.md * Removed empty files * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated to address PR * Fixed uncommented lines in test suite * Added complex values to state * Updated test_mixed_polarity_controls * Fixed QutritUnitary._controlled * Updated test_controlled for matrix ops * Updated ControlledQutritUnitary._controlled * Reformatting * Update pennylane/ops/qutrit/matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated ControlledQutritUnitary and tests * Addressing PR review * Updated sparse_hamiltonian, fixed TRX docstring * Addressing PR review * Refactoring * Fixed changelog * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/test_qnode.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Reverted changes to sparse_hamiltonian * Fixed sparse_hamiltonian test * Updated changelog * Updated TRX documentation * Fixed generator * Adding levels to sparse_hamiltonian * Updated test sparse hamiltonian * Fixed sparse hamiltonian test * Fixed constant level kwarg * Updated changelog, added test coverage * Fixed coverage * Updated test suite * Updated files to address PR review * Updated tests to include subspace error tests * Added TRX tests for parameter shift * Update doc/releases/changelog-dev.md Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update utils.py to remove trailing whitespace * Updated to address PR review * Fixed class/object confusion bug * Testing changes to adjust lines changed in PR * Fixing changes * Fixing changes * Resetting problem files * Fixing changes * updated TRX docs * Fixed TRX docs * Updated TRX docs * Fixed PR too many lines changed issue * Updated subspace error tests * Tweaked THadamard docs to fix rendering * Test dos2unix * Fixed subspace testing * Merge changes * Started adding tests for grad * Updated tests to parametrize diff-method * Linted tests * Fiex tests using in-place inversion * Added diff tests * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Fixed formatting * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated TRY and tests * Updated utils.py * Fixed TRX generator * Updated generator TRY * Updated subspace validation for TRY * Updated subspace validation * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Reverted `validate_subspace` changes * Updated test * Added parameter shift test * Fixed test * Update doc/releases/changelog-dev.md * Update changelog * Updated grad tests * Apply suggestions from code review Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated subspace docstring --------- Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@protonmail.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * jax integration for for DefaultQubit2 (PennyLaneAI#4137) * copy-paste autograd test file * port to jax in tests; update shots in jax interface * add argnums when needed; skip tests that do not work with jax * use pytest imports to skip * pylint tests * changelog * take shots change from Christina's PR * Update doc/releases/changelog-dev.md Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> * copy changes to autograd as well * rename to indicate bool; slight autograd fixup --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> * Treat identities as equivalent in `pauli.are_identical_pauli_words` (PennyLaneAI#4161) * fix hamiltonian grouping indices bug * Update doc/releases/changelog-dev.md * Take wire ordering in the `wires` argument to `qml.density_matrix` into account (PennyLaneAI#4072) * include wire ordering, test for that, raise error for broadcasting, test for that * reduce * changelog * add test for qinfo transform * more tests for math module * lint math tests * lint * black * introduce, use and test input_is_dm kwarg to reduced_dm * tmp * reverting * seed fix --------- Co-authored-by: Edward Jiang <34989448+eddddddy@users.noreply.github.com> * CY inherits from ControlledOp (PennyLaneAI#4116) `qml.CY` has been moved from `qml.ops.qubit.non_parametric_ops` to `qml.ops.op_math.controlled_ops` and now inherits from `qml.ops.op_math.ControlledOp`. --------- Co-authored-by: Matthew Silverman <matthews@xanadu.ai> Co-authored-by: Christina Lee <christina@xanadu.ai> * Empty hamiltonians are compatible with `qml.pauli_sentence()` (PennyLaneAI#4171) * fix ps rep for empty hamiltonian * changelog * Update doc/releases/changelog-dev.md Co-authored-by: Utkarsh <utkarshazad98@gmail.com> --------- Co-authored-by: Utkarsh <utkarshazad98@gmail.com> * Update tests/interfaces/test_torch_qnode.py Co-authored-by: Christina Lee <christina@xanadu.ai> * Python 3.8 compatibility and increase num_directions, since spsa_grad, with num_directions=1, fails sometimes, depending on the seed. * Fix failing tests * Fix docs. * Fix unsupported NoneType import * Undo irrelevant change. * Fix failing tests. Still not reliable. * Fix tolerance issue with SPSA second derivative. * Increase tolerance. This test has also been failing spontaneously on the master branch 3468885 * Switch to sampler_rng kwarg and fix tolerance issues. * More migration to sampler_rng * Migrate more tests to sampler_rng * Migrate legacy tests to sampler_rng * black * Deprecated the sampler_seed argument * black * Increase tolerance for test_hamiltonian_expansion_finite_shots tests. * Fix tol * Pin autoray for CI * Set num_directions=20 in all hamiltonian_expansion_finite_shots tests. * Make black and pylint happy * Set device seed for DQ2 tests. * Add tests for new return type system. * Fix bug * Adapt dq2 tests for spsa * Remove qml.disable_return() * Change DQ2 tests to new seed setting system. * Fix bug * Fix failing tests. TF tests pass locally. Not sure what the problem is. * Fix missing grad_kwarg * black * Increase tol * Increase num_directions * Apply suggestions from code review Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> * Update pennylane/gradients/spsa_gradient.py Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> * Copy TestRademacherSampler into new tests * Make docs more precise and add tests for rng kwarg of samplers. * black * black * Fix error message in _spsa_grad_legacy * pylint * Update changelog-dev.md * black * Increase num_directions for Hessian test. --------- Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Matthew Silverman <matthews@xanadu.ai> Co-authored-by: Romain Moyard <rmoyard@gmail.com> Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@protonmail.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> Co-authored-by: Edward Jiang <34989448+eddddddy@users.noreply.github.com> Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
* Change seed setting in spsa_grad. * Update changelog. * Adapt tests. Note that lots of tests still set a global seed! * Update pennylane/gradients/spsa_gradient.py Co-authored-by: Christina Lee <christina@xanadu.ai> * Update pennylane/gradients/spsa_gradient.py Co-authored-by: Christina Lee <christina@xanadu.ai> * use Shots class in gradients module (#4152) * linting * add num_copies property to shots * change gradients to use new Shots class * fix missing update in vjp * fix stacking and single-shots in shot_adaptive * remove unneeded cast to tuple * type-hints and touch-ups * code review feedback * changelog --------- Co-authored-by: Romain Moyard <rmoyard@gmail.com> * Qutrit Rotations #2 (TRY) (#2846) * Adding tests for tensor observables * Added tests for tensor sample * Updated tests * Apply suggestions from code review * Partition device apply ops test case. * Run black * Fix pylint * Update pennylane/devices/default_qutrit.py * black and pylint * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated test_default_qutrit.py * Updated _apply_tadd documentation * Added eigvals method for TSWAP * Reverted TSWAP eigval changes * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/devices/default_qutrit.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added TSWAP eigvals * Updated changelog-dev.md to include GellMannObs * Removed empty file * Added linting comments * Updated tests to use gate_data * Updated test parameter names to be more accurate * Remove unused file * Updated GellMannObs doc-string * Update changelog-dev.md * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added changes to GellMann to address PR comments * Updated test * Reformatting * Trying out changes to Gell-Mann docstring * Updated Changelog * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Testing LaTeX align * Added non-diag tests * Added diag, complex case for tensor sample * Added example to doc string * Fixed label test * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/devices/test_default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Added tests for controlled qutrit unitary * Fix broadcasting, finish tests for CQutritUnitary * Added TRX and created skeleton files * Adding tests for TRX * Fixed broadcasting issue in controlled qutrit unitary * Fixed broadcasting issue with ControlledQutritUnitary * Fixed broadcasting issue in TRX * Updated TRX documentation * Added tests * Added tests for TRX * Removed unused imports * Removed unused imports, linting changes * Added TRX parameter frequencies * Updated matrix dtype for TRX generator * Added test for param frequencies * Added param-shift capability for qutrit devices * Updated changelog * Update changelog * Added change for TRX generator * Updated utils.py to support higher dimensions * Added tests for updated utils.sparse_hamiltonian * Added Identity as supported obs * Updated TRX docstring * Update tests/ops/qutrit/test_qutrit_non_parametric_ops.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Update pennylane/ops/qutrit/observables.py Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> * Added ControlledQutritUnitary * Update changelog-dev.md * Removed empty files * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated to address PR * Fixed uncommented lines in test suite * Added complex values to state * Updated test_mixed_polarity_controls * Fixed QutritUnitary._controlled * Updated test_controlled for matrix ops * Updated ControlledQutritUnitary._controlled * Reformatting * Update pennylane/ops/qutrit/matrix_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated ControlledQutritUnitary and tests * Addressing PR review * Updated sparse_hamiltonian, fixed TRX docstring * Addressing PR review * Refactoring * Fixed changelog * Update pennylane/devices/default_qutrit.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/test_qnode.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Reverted changes to sparse_hamiltonian * Fixed sparse_hamiltonian test * Updated changelog * Updated TRX documentation * Fixed generator * Adding levels to sparse_hamiltonian * Updated test sparse hamiltonian * Fixed sparse hamiltonian test * Fixed constant level kwarg * Updated changelog, added test coverage * Fixed coverage * Updated test suite * Updated files to address PR review * Updated tests to include subspace error tests * Added TRX tests for parameter shift * Update doc/releases/changelog-dev.md Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update utils.py to remove trailing whitespace * Updated to address PR review * Fixed class/object confusion bug * Testing changes to adjust lines changed in PR * Fixing changes * Fixing changes * Resetting problem files * Fixing changes * updated TRX docs * Fixed TRX docs * Updated TRX docs * Fixed PR too many lines changed issue * Updated subspace error tests * Tweaked THadamard docs to fix rendering * Test dos2unix * Fixed subspace testing * Merge changes * Started adding tests for grad * Updated tests to parametrize diff-method * Linted tests * Fiex tests using in-place inversion * Added diff tests * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Update tests/ops/qutrit/test_qutrit_parametric_ops.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Fixed formatting * Update pennylane/utils.py Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated TRY and tests * Updated utils.py * Fixed TRX generator * Updated generator TRY * Updated subspace validation for TRY * Updated subspace validation * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Update pennylane/ops/qutrit/parametric_ops.py Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * Reverted `validate_subspace` changes * Updated test * Added parameter shift test * Fixed test * Update doc/releases/changelog-dev.md * Update changelog * Updated grad tests * Apply suggestions from code review Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> * Updated subspace docstring --------- Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@protonmail.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> * jax integration for for DefaultQubit2 (#4137) * copy-paste autograd test file * port to jax in tests; update shots in jax interface * add argnums when needed; skip tests that do not work with jax * use pytest imports to skip * pylint tests * changelog * take shots change from Christina's PR * Update doc/releases/changelog-dev.md Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> * copy changes to autograd as well * rename to indicate bool; slight autograd fixup --------- Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> * Treat identities as equivalent in `pauli.are_identical_pauli_words` (#4161) * fix hamiltonian grouping indices bug * Update doc/releases/changelog-dev.md * Take wire ordering in the `wires` argument to `qml.density_matrix` into account (#4072) * include wire ordering, test for that, raise error for broadcasting, test for that * reduce * changelog * add test for qinfo transform * more tests for math module * lint math tests * lint * black * introduce, use and test input_is_dm kwarg to reduced_dm * tmp * reverting * seed fix --------- Co-authored-by: Edward Jiang <34989448+eddddddy@users.noreply.github.com> * CY inherits from ControlledOp (#4116) `qml.CY` has been moved from `qml.ops.qubit.non_parametric_ops` to `qml.ops.op_math.controlled_ops` and now inherits from `qml.ops.op_math.ControlledOp`. --------- Co-authored-by: Matthew Silverman <matthews@xanadu.ai> Co-authored-by: Christina Lee <christina@xanadu.ai> * Empty hamiltonians are compatible with `qml.pauli_sentence()` (#4171) * fix ps rep for empty hamiltonian * changelog * Update doc/releases/changelog-dev.md Co-authored-by: Utkarsh <utkarshazad98@gmail.com> --------- Co-authored-by: Utkarsh <utkarshazad98@gmail.com> * Update tests/interfaces/test_torch_qnode.py Co-authored-by: Christina Lee <christina@xanadu.ai> * Python 3.8 compatibility and increase num_directions, since spsa_grad, with num_directions=1, fails sometimes, depending on the seed. * Fix failing tests * Fix docs. * Fix unsupported NoneType import * Undo irrelevant change. * Fix failing tests. Still not reliable. * Fix tolerance issue with SPSA second derivative. * Increase tolerance. This test has also been failing spontaneously on the master branch 3468885 * Switch to sampler_rng kwarg and fix tolerance issues. * More migration to sampler_rng * Migrate more tests to sampler_rng * Migrate legacy tests to sampler_rng * black * Deprecated the sampler_seed argument * black * Increase tolerance for test_hamiltonian_expansion_finite_shots tests. * Fix tol * Pin autoray for CI * Set num_directions=20 in all hamiltonian_expansion_finite_shots tests. * Make black and pylint happy * Set device seed for DQ2 tests. * Add tests for new return type system. * Fix bug * Adapt dq2 tests for spsa * Remove qml.disable_return() * Change DQ2 tests to new seed setting system. * Fix bug * Fix failing tests. TF tests pass locally. Not sure what the problem is. * Fix missing grad_kwarg * black * Increase tol * Increase num_directions * Apply suggestions from code review Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> * Update pennylane/gradients/spsa_gradient.py Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> * Copy TestRademacherSampler into new tests * Make docs more precise and add tests for rng kwarg of samplers. * black * black * Fix error message in _spsa_grad_legacy * pylint * Update changelog-dev.md * black * Increase num_directions for Hessian test. --------- Co-authored-by: Christina Lee <christina@xanadu.ai> Co-authored-by: Matthew Silverman <matthews@xanadu.ai> Co-authored-by: Romain Moyard <rmoyard@gmail.com> Co-authored-by: Mudit Pandey <mudit.pandey@xanadu.ai> Co-authored-by: Olivia Di Matteo <2068515+glassnotes@users.noreply.github.com> Co-authored-by: Olivia Di Matteo <dimatteo.olivia@protonmail.com> Co-authored-by: Jay Soni <jbsoni@uwaterloo.ca> Co-authored-by: Christina Lee <chrissie.c.l@gmail.com> Co-authored-by: Matthew Silverman <ma.silv11@gmail.com> Co-authored-by: David Wierichs <david.wierichs@xanadu.ai> Co-authored-by: Edward Jiang <34989448+eddddddy@users.noreply.github.com> Co-authored-by: Utkarsh <utkarshazad98@gmail.com>
Context:
There are very few simulators available today that offer qudit simulation. One notable example is Google's Cirq, which includes support for qudit operations. However, the simulator is far from complete, and a key drawback is the lack of operations available, which creates a need for users to define operations themselves. Popular libraries such as Qiskit and QuTiP also include some qudit manipulation capabilities, but with few use cases. Beyond these libraries, qudit simulation solutions are quite limited. Moreover, qudit simulation is a feature that is already in demand, as seen in this issue on the PennyLane repository.
This PR builds on previous PR's working on qutrit simulation by adding a parametrized Y rotation operation. This change builds the foundation for making parametrized qutrit circuits, and thus, allows testing variational qutrit algorithms with PennyLane.
Description of the Change:
TRY()
operation, which applies an Y rotation to a subspace specified by the user. The subspace determines which 2 of 3 one-qutrit basis states the operation applies to.Benefits:
Possible Drawbacks:
Related GitHub Issues:
#2190