Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def circuit(a):
qml.Displacement(a, 0, wires=0)
return qml.expval(qml.X(wires=0))
def circuit(a, phi):
qml.Displacement(a, phi, wires=1)
return qml.probs(wires=1)
def circuit(n, a):
qml.ThermalState(n, wires=0)
qml.Displacement(a, 0, wires=0)
return qml.var(qml.NumberOperator(0))
def circuit(x):
"""Test quantum function"""
qml.Displacement(x, 0, wires=0)
return qml.expval(qml.X(0))
def circuit(x):
qml.Displacement(x, 0, wires=0)
return qml.expval(qml.NumberOperator(0))
def circuit(x):
qml.Displacement(x, 0, wires=0)
if cls.par_domain == "A":
cls(U, wires=w)
else:
cls(wires=w)
return qml.expval(qml.X(0))
def qf(x, y):
qml.Displacement(x, 0, wires=[0])
qml.Displacement(1.2, y, wires=[1])
qml.Beamsplitter(0.2, 1.7, wires=[0, 1])
qml.Rotation(1.9, wires=[0])
qml.Kerr(0.3, wires=[1]) # nongaussian succeeding both x and y due to the beamsplitter
return qml.expval(qml.X(0)), qml.expval(qml.X(1))
def mean_photon_gaussian(mag_alpha, phase_alpha, phi):
qml.Displacement(mag_alpha, phase_alpha, wires=0)
qml.Rotation(phi, wires=0).inv()
return qml.expval(qml.NumberOperator(0))
def mean_photon_gaussian(mag_alpha, phase_alpha, phi):
qml.Displacement(mag_alpha, phase_alpha, wires=0)
qml.Rotation(phi, wires=0)
return qml.expval(qml.NumberOperator(0))
def layer(w):
""" Single layer of the continuous-variable quantum neural net."""
# Bias
qml.Displacement(w[0], w[1], [0])
# Matrix multiplication of input layer
qml.Rotation(w[2], [0])
qml.Squeezing(w[3], w[4], [0])
qml.Rotation(w[5], [0])
# Element-wise nonlinear transformation
qml.Kerr(w[6], [0])