Skip to main content
IBM Quantum Platform
Diese Seite stammt aus einer alten Version von Qiskit SDK und ist in der aktuellen Version nicht mehr vorhanden. Wir empfehlen Ihnen, auf die neueste Version umzusteigen. Weitere Informationen finden Sie in den Versionshinweisen.

QuantumRegister

class qiskit.circuit.QuantumRegister(size=None, name=None, bits=None)

GitHub

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

  • 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 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

Standardwert: count(5)

name

Get the register name.

prefix

Standardwert: 'q'

size

Get the register size.


Methods

index

index(bit)

GitHub

Find the index of the provided bit within this register.

War diese Seite hilfreich?
Melden Sie auf GitHub einen Fehler, einen Tippfehler oder fordern Sie Inhalte an.