-
Notifications
You must be signed in to change notification settings - Fork 733
Open
Labels
enhancement ✨New feature or requestNew feature or request
Description
Important Note
Context
We would like to add a 2-CNOT decomposition for the qml.QubitUnitary operation. This will be more efficient for some cases that currently decompose to 3 CNOT gates unnecessarily.
Implementation Details
This task is to add a new decomposition, _decompose_2_cnots, for the two-qubit decomposition for QubitUnitary. Once added, the logic in two_qubit_decomposition should be updated to dispatch to this decomposition when relevant.
The implementation should:
- Define a decomposition using 2 CNOT gates, based on this paper
- Update the logic in
_compute_num_cnotsto determine if the 2 CNOT decomposition is the best option. - Update the logic in the dispatch in the function
two_qubit_decompositionto link to the 2 CNOT case instead of the 3 CNOT case when applicable.
All functions added or modified for this task belong in the pennylane/ops/op_math/decompositions/unitary_decompositions file.
Relevant functions include:
qml.QubitUnitaryqml.ops.op_math.decompositions.unitary_decompositions._compute_num_cnotsqml.ops.op_math.decompositions.unitary_decompositions._decompose_3_cnotsqml.ops.two_qubit_decomposition
Additional Requirements
A completed PR would:
- Include a docstring for the new
_decompose_2_cnotsfunction with details about what the function does and a link to the referenced paper - Update the docstring of
_compute_num_cnotsto include a correct reference for the logic used for the 2 CNOT case - Update the docstring of
two_qubit_decompositionto reflect the change. - Include a changelog entry at
doc/releases/changelog-dev.md. Make sure to include your name in the list of contributors at the bottom! - Add tests to the file
tests/ops/op_math/test_decompositions.py. The tests should include an adequate suite of both unit and integration tests. - Pass all existing tests including black and pylint checks
Metadata
Metadata
Assignees
Labels
enhancement ✨New feature or requestNew feature or request