From dfe8a2c986d063a443605074962bdcaa55e4e3d0 Mon Sep 17 00:00:00 2001 From: Renato Mello Date: Thu, 31 Oct 2024 14:52:11 +0400 Subject: [PATCH] `examples/adiabatic_qml` --- .../qaml_scripts/rotational_circuit.py | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/examples/adiabatic_qml/qaml_scripts/rotational_circuit.py b/examples/adiabatic_qml/qaml_scripts/rotational_circuit.py index 384bb1cdc4..dde1a0d17c 100644 --- a/examples/adiabatic_qml/qaml_scripts/rotational_circuit.py +++ b/examples/adiabatic_qml/qaml_scripts/rotational_circuit.py @@ -4,8 +4,7 @@ from qaml_scripts.evolution import generate_schedule from scipy.integrate import quad -import qibo -from qibo.noise import DepolarizingError, NoiseModel +from qibo import Circuit, gates class rotational_circuit: @@ -203,26 +202,26 @@ def derivative_rotation_angles(self, t): def rotations_circuit(self, t): psi, theta, phi = self.rotation_angles(t) - c = qibo.models.Circuit(self.nqubits, density_matrix=True) + c = Circuit(self.nqubits, density_matrix=True) # H gate - c.add(qibo.gates.RZ(q=self.q, theta=np.pi / 2, trainable=False)) - c.add(qibo.gates.RX(q=self.q, theta=np.pi / 2, trainable=False)) - c.add(qibo.gates.RZ(q=self.q, theta=np.pi / 2, trainable=False)) + c.add(gates.RZ(q=self.q, theta=np.pi / 2, trainable=False)) + c.add(gates.RX(q=self.q, theta=np.pi / 2, trainable=False)) + c.add(gates.RZ(q=self.q, theta=np.pi / 2, trainable=False)) # RZ(psi) - c.add(qibo.gates.RZ(q=self.q, theta=psi)) + c.add(gates.RZ(q=self.q, theta=psi)) # RX(theta) - c.add(qibo.gates.RZ(q=self.q, theta=np.pi / 2, trainable=False)) - c.add(qibo.gates.RX(q=self.q, theta=-np.pi / 2, trainable=False)) - c.add(qibo.gates.RZ(q=self.q, theta=-theta)) - c.add(qibo.gates.RX(q=self.q, theta=np.pi / 2, trainable=False)) + c.add(gates.RZ(q=self.q, theta=np.pi / 2, trainable=False)) + c.add(gates.RX(q=self.q, theta=-np.pi / 2, trainable=False)) + c.add(gates.RZ(q=self.q, theta=-theta)) + c.add(gates.RX(q=self.q, theta=np.pi / 2, trainable=False)) # RZ(phi) - c.add(qibo.gates.RZ(q=self.q, theta=phi)) + c.add(gates.RZ(q=self.q, theta=phi)) - c.add(qibo.gates.M(self.q)) + c.add(gates.M(self.q)) return c