qat.lang.build_gate

qat.lang.build_gate(name, signature, arity=None)

A wrapper class lifting functions into AbstractGates with a circuit implementation.

Parameters

func (function) – an annotated function returning a QRoutine

Note

Calling the decorated function will return an AbstractGate.

The underlying QRoutine can be referred to by using a tilde before the function:

@build_gate
def my_gate(a : int) -> 'FOO':
    rout = QRoutine()
    return rout

my_gate(10) # will return an AbstractGate object, instantiated
            # with parameter 10
(~my_gate)(10) # will return a QRoutine object