Skip to content

Commit

Permalink
examples/adiabatic_qml
Browse files Browse the repository at this point in the history
  • Loading branch information
renatomello committed Oct 31, 2024
1 parent e24949a commit dfe8a2c
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions examples/adiabatic_qml/qaml_scripts/rotational_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit dfe8a2c

Please sign in to comment.