Skip to main contentIBM Quantum Documentation

QuantumRegister

qiskit.circuit.QuantumRegister(size=None, name=None, bits=None) GitHub(opens in a new tab)

Bases: Register

Implement a quantum register.

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

Raises

  • CircuitError – if both the size and bits arguments are provided, or if neither are.
  • CircuitError – if size is not valid.
  • CircuitError – if name is not a valid name according to the OpenQASM spec.
  • CircuitError – if bits contained duplicated bits.
  • CircuitError – if bits contained bits of an incorrect type.

Attributes

instances_counter

= count(5)

name

Get the register name.

prefix

= 'q'

size

Get the register size.


Methods

index

index(bit)

Find the index of the provided bit within this register.

Was this page helpful?