Important Note
⚠️ This issue is part of an internal assignment and not meant for external contributors.
Context
Recently, there has been an effort to add decompositions to PennyLane's templates which are compatible with PennyLane's new graph decomposition system. The QDrift graph decomposition has not yet been added. In order to add this one, since it involves gates taken from a random sample, the resources must be inexact, meaning they represent the worst-case scenario or the most resources possible to be used (details below).
Implementation Details
The selection of a decomposition is driven by its resource cost, which is currently a direct measure of the number of gates required. At a high-level, migrating an operator or template to the new system requires the following,
- Implement QDrift current decompositionas a stand-alone function.
- Calculate the correct amount of resources required (based on it's decomposition algorithm) and register it to the function. With this being a stochastic template, the resources can be calculated to be the worst case scenario.
- Register the new decomposition with the RandomLayers template.
- Add testing to ensure feature parity with the legacy system.
Additional Requirements
A completed PR would:
- Use
_test_decomposition_rule to validate the new decomposition rule added.
- Pass all tests (with 100% test coverage for the patch).
- Pass all formatting (black and pylint) and documentation checks.
- Include a changelog entry at
doc/releases/changelog-dev.md (make sure to include your name in the list of contributors at the bottom).
Relevant Examples
Some examples of similar graph decompositions can be found in the following closed PRs:
Important Note
Context
Recently, there has been an effort to add decompositions to PennyLane's templates which are compatible with PennyLane's new graph decomposition system. The
QDriftgraph decomposition has not yet been added. In order to add this one, since it involves gates taken from a random sample, the resources must be inexact, meaning they represent the worst-case scenario or the most resources possible to be used (details below).Implementation Details
The selection of a decomposition is driven by its resource cost, which is currently a direct measure of the number of gates required. At a high-level, migrating an operator or template to the new system requires the following,
Additional Requirements
A completed PR would:
_test_decomposition_ruleto validate the new decomposition rule added.doc/releases/changelog-dev.md(make sure to include your name in the list of contributors at the bottom).Relevant Examples
Some examples of similar graph decompositions can be found in the following closed PRs: