예제 #1
0
파일: script.py 프로젝트: drmaruyama/qgate
        return factory.Adj

    def __call__(self, qreg):
        g = model.Gate(self.gate_type)
        g.set_qreg(qreg)
        g.check_constraints()
        return g


# // idle gate (identity)
# gate id a { U(0,0,0) a; }
this.I = ConstGateFactory(gtype.ID())

# // 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; }
예제 #2
0
파일: script.py 프로젝트: drmaruyama/qgate
 def H(self):
     return self.create(gtype.H())
예제 #3
0
def h(qreg):
    h = model.Gate(gtype.H())
    h.set_qreg(qreg)
    return h