-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a transform to split sums to QJITDevice preprocess (#927)
**Context:** Some backends do not natively support sums of observables (e.g. `qml.expval(X(0) + Y(1))`). This is already taken care of by the `split_non_commuting` transform if the backend in question also doesn't support non-commuting observables, but applying `split_non_commuting` to handle sums on for devices that support non-commuting measurements will result in unnecessarily splitting executions into multiple tapes. **Description of the Change:** If `split_non_commuting` is not being added to the transform program already, and the device does not support sum observables, we add the transform `split_to_single_terms`, which splits the sums but leaves them all on a single tape. Supporting either `Hamiltonian` or `Sum` is taken to indicate support for summed observables.
- Loading branch information
1 parent
1e5c6d6
commit 1f2afab
Showing
4 changed files
with
119 additions
and
30 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