Register
class qiskit.circuit.Register(size=None, name=None, bits=None)
Bases: object
Implement a generic register.
Note
This class should not be instantiated directly. This is just a superclass for ClassicalRegister and QuantumRegister.
Create a new generic register.
Either the size or the bits argument must be provided. If size is not None, the register will be pre-populated with bits of the correct type.
Parameters
- size (int) – Optional. The number of bits to include in the register.
- name (str) – Optional. The name of the register. If not provided, a unique name will be auto-generated from the register type.
- bits (list[Bit]) – Optional. A list of Bit() instances to be used to populate the register.
Raises
- CircuitError – if both the
sizeandbitsarguments are provided, or if neither are. - CircuitError – if
sizeis not valid. - CircuitError – if
nameis not a valid name according to the OpenQASM spec. - CircuitError – if
bitscontained duplicated bits. - CircuitError – if
bitscontained bits of an incorrect type.
Attributes
bit_type
Valor predeterminado: None
instances_counter
Valor predeterminado: count(0)
name
Get the register name.
name_format
Valor predeterminado: re.compile('[a-z][a-zA-Z0-9_]*')
prefix
Valor predeterminado: 'reg'
size
Get the register size.
Methods
index
index(bit)
Find the index of the provided bit within this register.
¿Le ha resultado útil esta página?
Informe de un error, de una errata o solicite contenido en GitHub.