コード例 #1
0
 def circuit():
     """4-qubit circuit with layers of randomly selected gates and random connections for
     multi-qubit gates."""
     qml.BasisState(np.array([1, 0, 0, 0]),
                    wires=[0, 1, 2, 3])
     for gates in gates_per_layers:
         for gate in gates:
             if gate.name in dev.operations:
                 qml.apply(gate)
     return qml.expval(obs)
コード例 #2
0
 def circuit():
     qml.PauliX(wires=[0])
     qml.BasisState(np.array([0, 1, 0, 1]), wires=list(range(self.num_subsystems)))
     return qml.expval.PauliZ(0)
コード例 #3
0
 def circuit():
     qml.BasisState(bits_to_flip, wires=list(range(self.num_subsystems-1)))
     return qml.expval.PauliZ(0), qml.expval.PauliZ(1), qml.expval.PauliZ(2), qml.expval.PauliZ(3)
コード例 #4
0
ファイル: test_qnode.py プロジェクト: wuben3125/pennylane
 def qf(x):
     qml.BasisState(np.array([x, 0]), [0, 1])
     qml.RX(x, [0])
     return qml.expval.PauliZ(0)
コード例 #5
0
 def circuit(x, y, input_state=np.array([0, 0])):
     qml.BasisState(input_state, wires=[0, 1])
     qml.RX(x, wires=[0])
     qml.RY(y, wires=[0])
     return qml.expval(qml.PauliZ(0))
コード例 #6
0
ファイル: test_template.py プロジェクト: ycchen1989/pennylane
 def circuit(weights, x=None):
     qml.BasisState(x, wires=range(num_wires))
     qml.template.StronglyEntanglingCircuit(
         weights, True, wires=range(num_wires))
     return qml.expval.PauliZ(0)