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; }
def H(self): return self.create(gtype.H())
def h(qreg): h = model.Gate(gtype.H()) h.set_qreg(qreg) return h