Exemplo n.º 1
0
    return GateFactory(gtype.U(theta, phi, _lambda))


# exp
def Expia(theta):
    _assert_is_number(theta)
    return GateFactory(gtype.ExpiI(theta))


def Expiz(theta):
    _assert_is_number(theta)
    return GateFactory(gtype.ExpiZ(theta))


# utility
this.SH = ConstGateFactory(gtype.SH())


class ComposedGateFactory:
    def __init__(self, gate_type):
        self.gate = model.ComposedGate(gate_type)

    @property
    def Adj(self):
        self.gate.set_adjoint(True)
        return self

    def __call__(self, *gatelist):
        gatelist = _expand_args(gatelist)
        self.gate.set_gatelist(gatelist)
        self.gate.check_constraints()
Exemplo n.º 2
0
 def SH(self):
     return self.create(gtype.SH())
Exemplo n.º 3
0
def sh(qreg):
    sh = model.Gate(gtype.SH())
    sh.set_qreg(qreg)
    return sh