Skip to content

Commit

Permalink
Implement assert equal for operators (PennyLaneAI#5780)
Browse files Browse the repository at this point in the history
**Context:**
PennyLane currently has a `qml.equal` function which can be used to
check the equality of operators, measurements, and tapes. New framework
`assert_equal` has been developed which along with checking equality
tells the reason for equality failure.

**Description of the Change:**
- Implement support for `assert_equal` for different type of operators
mentioned in
[PennyLaneAI#5644](PennyLaneAI#5644) and
[PennyLaneAI#5648](PennyLaneAI#5648)
- Implementation for the above has been changed such that the negative
paths return error messages.
- Existing unit tests have been updated to verify the error message.

**Benefits:**
`assert_equals` for mentioned operators above return more granular
reason of failure. This eases debugging of tests.

**Possible Drawbacks:**
More maintenance 

**Related GitHub Issues:**
Fixes PennyLaneAI#5644 
Fixes PennyLaneAI#5648

---------

Co-authored-by: Thomas R. Bromley <[email protected]>
  • Loading branch information
Tarun-Kumar07 and trbromley committed Jun 12, 2024
1 parent d5f6313 commit 45f8d4a
Show file tree
Hide file tree
Showing 3 changed files with 450 additions and 108 deletions.
3 changes: 3 additions & 0 deletions doc/releases/changelog-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@
* `qml.QutritDepolarizingChannel` has been added, allowing for depolarizing noise to be simulated on the `default.qutrit.mixed` device.
[(#5502)](https://github.com/PennyLaneAI/pennylane/pull/5502)

* Implement support in `assert_equal` for `Operator`, `Controlled`, `Adjoint`, `Pow`, `Exp`, `SProd`, `ControlledSequence`, `Prod`, `Sum`, `Tensor` and `Hamiltonian`
[(#5780)](https://github.com/PennyLaneAI/pennylane/pull/5780)

* `qml.QutritChannel` has been added, enabling the specification of noise using a collection of (3x3) Kraus matrices on the `default.qutrit.mixed` device.
[(#5793)](https://github.com/PennyLaneAI/pennylane/issues/5793)

Expand Down
Loading

0 comments on commit 45f8d4a

Please sign in to comment.