qat.pbo.AbstractRegister

class qat.pbo.AbstractRegister(constant_list=None)

This class is used to define abstract register. Please use this function if the name of your gate can match with gates having different arities.

Example of use:
>>> # Creates a new abstract register
>>> register = AbstractRegister()
...
>>> # Gets the first qubit of the register
>>> sub_register_1 = register[0]
...
>>> # Gets the qubit positioned at the middle of the register
>>> sub_register_2 = register[register.len() // 2]
len()

Return the length of the AbstractRegister

Returns

length of the register

Return type

VAR

undirected()

Set the abstract register undirected. Please call this function if order of qubits does not matter.

Returns

this method returns the object to allow writing compact code. For instance, in the following example, First case and Second case are equivalent:

register = AbstractRegister()

# Fist case
register.undirected()
pattern = [("SWAP", register)]

# Second case
pattern = [("SWAP", register.undirected())]

Return type

AbstractRegister