In Pennylane, we can create a custom operation by creating a class inheriting pennylane.operation.Operation.
One point is that it is then possible to draw this operation as a block in a given circuit.
However, the operation I am working on is a modular multiplication that takes as input one register for an operand, another for the other operand, a third one for the result, a fourth one for a modulo and a fifth one for the auxiliary qubits. I could also add a control qubit…
I want to implement this operation but the way to specify these registers is problematic.
I already saw 2 possibilities to do that, however they are not satisfying:
- Put everything in the wires but as each register can have a varying size it may not work (we don’t know which wire does what)
- Add the registers sizes as parameters, but the problem is that when I draw my operation, all these sizes will appear and if there is a real parameter (e.g. an angle) to display it will be lost in the crowd
How could I do ?
Thanks.