예제 #1
0
    def test_evolution_operations(self, time, hamiltonian, steps, gates):
        """Tests that the sequence of gates implemented in the ApproxTimeEvolution template is correct"""

        n_wires = 2

        with qml._queuing.OperationRecorder() as rec:
            ApproxTimeEvolution(hamiltonian, time, steps)

        for i, gate in enumerate(rec.operations):
            prep = [gate.parameters, gate.wires]
            target = [gates[i].parameters, gates[i].wires]

            assert prep == target
예제 #2
0
 def circuit():
     ApproxTimeEvolution(hamiltonian, time, steps)
     return [qml.expval(qml.PauliZ(wires=i)) for i in range(n_wires)]