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(x):
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 1])
qml.RY(0.4, wires=[0])
qml.RZ(-0.2, wires=[1])
return qml.expval(qml.PauliX(0)), qml.expval(qml.PauliZ(1))
def circuit(x):
qml.RX(x, wires=[1])
return qml.expval(qml.PauliZ(0))
def classifier_circuit(in_data, x):
qml.RX(in_data, wires=[0])
qml.CNOT(wires=[0, 1])
qml.RY(-1.6, wires=[0])
qml.RY(in_data, wires=[1])
qml.CNOT(wires=[1, 0])
qml.RX(x, wires=[0])
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(0))
def circuit(x):
qml.RX(0.5, wires=[0])
return qml.expval(qml.PauliZ(0))
def circuit(*inp):
template(*inp, **hyperp)
return qml.expval(qml.Identity(0))
def circuit(x):
qml.RX(x, wires=[0])
ex = qml.expval(qml.PauliZ(wires=1))
qml.RY(0.5, wires=[0])
return qml.expval(qml.PauliZ(wires=0))
def func(x, y):
"""Reference QNode"""
qml.BasisState(in_state, wires=list(range(w)))
qml.RY(x, wires=0)
qml.RX(y, wires=1)
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(1))
def circuit_tria(varphi):
Interferometer(theta, phi, varphi, mesh='triangular', beamsplitter='clements', wires=wires)
return [qml.expval(qml.NumberOperator(w)) for w in wires]
def circuit(params, A=None):
# repeatedly apply each layer in the circuit
for j in range(nr_layers):
layer(params, j)
# returns the expectation of the input matrix A on the first qubit
return qml.expval(qml.Hermitian(A, wires=0))
# Controlled Z operator at position j. If j = -1, apply the identity.
if j != -1:
qml.CZ(wires=[ancilla_idx, j])
# Unitary U_b associated to the problem vector |b>.
U_b()
# Controlled application of Adjoint(A_lp).
# In this specific example Adjoint(A_lp) = A_lp.
CA(lp)
# Second Hadamard gate applied to the ancillary qubit.
qml.Hadamard(wires=ancilla_idx)
# Expectation value of Z for the ancillary qubit.
return qml.expval(qml.PauliZ(wires=ancilla_idx))