def __init__(self, size, name=None):
        """Create a new generic register.
        """

        if name is None:
            name = '%s%i' % (self.prefix, next(self.instances_counter))

        if not isinstance(name, str):
            raise QiskitError("The circuit name should be a string "
                              "(or None for autogenerate a name).")

        test = re.compile('[a-z][a-zA-Z0-9_]*')
        if test.match(name) is None:
            raise QiskitError("%s is an invalid OPENQASM register name." % name)

        self.name = name
        self.size = size
        if size <= 0:
            raise QiskitError("register size must be positive")
def __init__ ( self , size , name = None ) : if name is None : name = '%s%i' % ( self . prefix , next ( self . instances_counter ) ) if not isinstance ( name , str ) : raise QiskitError ( "The circuit name should be a string " "(or None for autogenerate a name)." ) test = re . compile ( '[a-z][a-zA-Z0-9_]*' ) if test . match ( name ) is None : raise QiskitError ( "%s is an invalid OPENQASM register name." % name ) self . name = name self . size = size if size <= 0 : raise QiskitError ( "register size must be positive" )
Create a new generic register.