Exemple #1
0
 def X(self):
     return self.create(gtype.X())
Exemple #2
0
def x(qreg):
    x = model.Gate(gtype.X())
    x.set_qreg(qreg)
    return x
Exemple #3
0
# // Clifford gate: Hadamard
# gate h a { u2(0,pi) a; }
this.H = ConstGateFactory(gtype.H())

# // Clifford gate: sqrt(Z) phase gate
# gate s a { u1(pi/2) a; }
this.S = ConstGateFactory(gtype.S())

# // 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))
Exemple #4
0
def cx(control, target):
    g = model.Gate(gtype.X())
    g.set_ctrllist([control])
    g.set_qreg(target)
    return g