QuantumRegister
QuantumRegister(size, name=None)
Implement a quantum register.
Create a new generic register.
Attributes
instances_counter
= count(0)
name
Get the register name.
prefix
= 'q'
size
Get the register size.
Methods
__getitem__
QuantumRegister.__getitem__(key)
Arg:
bit_type (Qubit or Clbit): a constructor type return element/s. key (int or slice or list): index of the clbit to be retrieved.
Returns
a Qubit or Clbit instance if key is int. If key is a slice, returns a list of these instances.
Return type
Qubit or Clbit or list(Qubit) or list(Clbit)
Raises
- CircuitError – if the key is not an integer.
- QiskitIndexError – if the key is not in the range (0, self.size).
__len__
QuantumRegister.__len__()
Return register size.
qasm
QuantumRegister.qasm()
Return OPENQASM string for this register.
Was this page helpful?
Report a bug or request content on GitHub.