Displacement gate input


#1

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


#2

i was wrong i’m sorry strawberry fields does support 2 inputs
my bad


#3

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.