# // C3 gate: sqrt(S) phase gate # gate t a { u1(pi/4) a; } this.T = ConstGateFactory(gtype.T()) # // Pauli gate: bit-flip # gate x a { u3(pi,0,pi) a; } this.X = ConstGateFactory(gtype.X()) # // Pauli gate: bit and phase flip # gate y a { u3(pi,pi/2,pi/2) a; } this.Y = ConstGateFactory(gtype.Y()) # // Pauli gate: phase flip # gate z a { u1(pi) a; } this.Z = ConstGateFactory(gtype.Z()) # // Rotation around X-axis # gate rx(theta) a { u3(theta,-pi/2,pi/2) a; } def Rx(theta): _assert_is_number(theta) return GateFactory(gtype.RX(theta)) # // rotation around Y-axis # gate ry(theta) a { u3(theta,0,0) a; } def Ry(theta): _assert_is_number(theta) return GateFactory(gtype.RY(theta))
def Z(self): return self.create(gtype.Z())
def z(qreg): z = model.Gate(gtype.Z()) z.set_qreg(qreg) return z