Closed antalszava closed 3 years ago
Hi! I would like to work on this issue.
Hi @nahumsa, great! :slightly_smiling_face: Thank you for your interest :tada:
Feel free to go for it and open a work in progress pull request whenever you have a draft version. Also, feel free to ask any questions along the way! :slightly_smiling_face:
Sure! Thanks for the quick reply!
I was looking at the pennylane/ops/qubit.py
and verified that there is an implementation of ControlledPhaseShift that looks exactly like the CPhase gate.
Does it need to be reimplemented or would just add an alias for the CPhase command?
Hey @nahumsa, great catch, thanks for pointing this out! Indeed, it seems that this gate already exists. @antalszava was there a difference you had in mind?
I added the CPhase
gate on a PR because just in case, but I could easily convert the PR to become an alias of the ControlledPhaseShift
, or delete it if necessary.
Thanks @nahumsa! To avoid the code duplication, I think it would make sense to have it be an alias (as you rightly point out in the PR!)
This issue has been tagged for contributions during unitaryHACK
Context We would like to define a new diagonal operation called
CPhase
, see further details here.Steps to take
This would involve the following steps to be completed:
A. Adding the operation
CPhase
class and its attributes topennylane/ops/qubit.py
. This class would inherit fromDiagonalOperation
. Complete its docstring in a similar fashion as for other operations. Make sure the class is accessible throughqml.CPhase
.tests/ops/test_qubit_ops.py
file,In these steps, having a look at how
class PhaseShift
is defined can help. Also, see the operation as defined in thePennyLane-Cirq
plugin as a basis.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, theCPHASE
can be removed from theoperations
dictionary fordefault.qubit.autograd
anddefault.qubit.tf
.