Skip to main content
IBM Quantum Platform
Esta página pertenece a una versión antigua de Qiskit SDK y no existe en la versión más reciente. Te recomendamos que actualices a la última versión. Consulta las notas de la versión para obtener más información.

AncillaRegister

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

GitHub

Bases: QuantumRegister

Implement an ancilla 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

Valor predeterminado: count(0)

name

Get the register name.

name_format

Valor predeterminado: re.compile('[a-z][a-zA-Z0-9_]*')

prefix

Valor predeterminado: 'a'

size

Get the register size.


Methods

index

index(bit)

Find the index of the provided bit within this register.

qasm

qasm()

Return OPENQASM string for this register.

Deprecated since version 0.23.0

The method qiskit.circuit.quantumregister.QuantumRegister.qasm() is deprecated as of qiskit-terra 0.23.0. It will be removed in the Qiskit 1.0 release. Correct exporting to OpenQASM 2 is the responsibility of a larger exporter; it cannot safely be done on an object-by-object basis without context. No replacement will be provided, because the premise is wrong.

¿Le ha resultado útil esta página?
Informe de un error, de una errata o solicite contenido en GitHub.