Displacement gate input

I am little confused
In strawberry Fields the displacement gate takes only one input the alpha parameter but in pennylane you can pass two inputs

i was wrong iā€™m sorry strawberry fields does support 2 inputs
my bad

In Strawberry Fields, since we are in a Python environment where function argument types do not need to be declared, we do allow the displacement gate to be used in two ways:

# passing one complex value representing alpha
Dgate(1+2j) | q[0]
# passing two real values r, phi where alpha = e^{i*phi}
Dgate(np.sqrt(2), np.pi/4) | q[0]

Both the above displacement operations are equivalent.

In PennyLane, however, we only allow the second case, where two real values are passed.

1 Like