Closed antalszava closed 3 years ago
Hello! I would like to solve this issue
Hi @aglitoiu, that's great to hear, thanks for your interest! :slightly_smiling_face: Feel free to go for it and open a draft PR in the process. We could have a look even during it's being worked on or go for a review whenever ready.
Created the draft PR and made some commits. I would like an advice on where should I search for the decomposition "formulae"
Sure! For the decomposition there are two possibilities to explore:
1) Either going with the one that's provided in the Braket plugin.
The decomposition can be verified by computing using the matrices of CNOT
and RX
, where is the parameter to RX
and the subscripts refer to the qubits the operations act on.
2) Depending on PauliRot
by including qml.PauliRot(param, "XX", wires=[wire0, wire1])
where param
is the parameter, wire0
and wire1
are the wires provided to qml.XX
. In this case PennyLane will further decompose qml.PauliRot
if need be.
This issue has been tagged for contributions during unitaryHACK
Context
We would like to define a new operation called
XX
, as defined in the PennyLane-Braket plugin.Steps to take
A. Adding the operation
XX
class and its attributes topennylane/ops/qubit.py
. Complete its docstring in a similar fashion as for other operations. Make sure the class is accessible throughqml.XX
.tests/ops/test_qubit_ops.py
file,Note:
XX
is a special case forPauliRot
for the"XX"
Pauli word. Therefore, the decomposition ofXX
can directly depend on usingPauliRot
, which further decomposes into elementary gates. Inheriting fromPauliRot
could also be considered.B. Adding
default.qubit
supportdefault.qubit
device,default.qubit
in thetests/devices/test_default_qubit.py
file.Bonus: Add support to the interface-specific
default.qubit
devices too:default.qubit.autograd
anddefault.qubit.tf
. This will require the operation to be defined in a framework-specific way. These devices inherit the supported operations fromdefault.qubit
, so if this step is not tackled, theXX
can be removed from theoperations
dictionary fordefault.qubit.autograd
anddefault.qubit.tf
.