-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**Context:** Currently `qml.matrix` breaks when the input is a catalyst-compiled QNode instead of a plain QNode, and the QNode need to be manually retrieved by the user: PennyLaneAI/catalyst#765 It would be beneficial to do this "unwrap" in `qml.matrix` , like those in qml.draw: https://github.com/PennyLaneAI/pennylane/blob/59a1e0586e707d057a0c92d4239036afa5312b73/pennylane/drawer/draw.py#L213-L214 **Description of the Change:** 1. in `pennylane/ops/functions/matrix.py`, in `qml.matrix(op)`, if the input `op` is a catalyst.qjit compiled function, dispatches the behavior to be `qml.matrix(op.user_function)`. 2. Added a test in `tests/ops/functions/test_matrix.py` **Benefits:** a qjit compiled qnode can be passed into `qml.matrix` directly to query the matrix representation of the circuit **Related GitHub Issues:** PennyLaneAI/catalyst#765 [sc-64247]
- Loading branch information
Showing
5 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters