コード例 #1
0
ファイル: script.py プロジェクト: drmaruyama/qgate
 def I(self):
     return self.create(gtype.ID())
コード例 #2
0
def a(qreg):
    s = model.Gate(gtype.ID())
    s.set_qreg(qreg)
    return s
コード例 #3
0
ファイル: script.py プロジェクト: drmaruyama/qgate
    @property
    def Adj(self):
        factory = GateFactory(self.gate_type)
        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; }
コード例 #4
0
def ca(control, target):
    g = model.Gate(gtype.ID())
    g.set_ctrllist([control])
    g.set_qreg(target)
    return g