QuantumRegister#
- class qiskit.circuit.QuantumRegister(size=None, name=None, bits=None)[ソース]#
ベースクラス:
Register
Implement a quantum register.
Create a new generic register.
Either the
size
or thebits
argument must be provided. Ifsize
is not None, the register will be pre-populated with bits of the correct type.- パラメータ:
- 例外:
CircuitError – if both the
size
andbits
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(3)#
- name#
Get the register name.
- name_format = re.compile('[a-z][a-zA-Z0-9_]*')#
- prefix = 'q'#
- size#
Get the register size.
Methods
- index(bit)#
Find the index of the provided bit within this register.
- qasm()[ソース]#
Return OPENQASM string for this register.
バージョン 0.23.0 で非推奨: The method
qiskit.circuit.quantumregister.QuantumRegister.qasm()
is deprecated as of qiskit-terra 0.23.0. It will be removed no earlier than 3 months after the release date. 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.