Korean
언어
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.converters.circuit_to_instruction

circuit_to_instruction(circuit, parameter_map=None, equivalence_library=None, label=None)[소스]

Build an Instruction object from a QuantumCircuit.

The instruction is anonymous (not tied to a named quantum register), and so can be inserted into another circuit. The instruction will have the same string name as the circuit.

매개변수
  • circuit (QuantumCircuit) – the input circuit.

  • parameter_map (dict) – For parameterized circuits, a mapping from parameters in the circuit to parameters to be used in the instruction. If None, existing circuit parameters will also parameterize the instruction.

  • equivalence_library (EquivalenceLibrary) – Optional equivalence library where the converted instruction will be registered.

  • label (str) – Optional instruction label.

예외 발생

QiskitError – if parameter_map is not compatible with circuit

반환

an instruction equivalent to the action of the input circuit. Upon decomposition, this instruction will yield the components comprising the original circuit.

반환 형식

qiskit.circuit.Instruction

예제

from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
from qiskit.converters import circuit_to_instruction

q = QuantumRegister(3, 'q')
c = ClassicalRegister(3, 'c')
circ = QuantumCircuit(q, c)
circ.h(q[0])
circ.cx(q[0], q[1])
circ.measure(q[0], c[0])
circ.rz(0.5, q[1]).c_if(c, 2)
circuit_to_instruction(circ)
Instruction(name='circuit-85', num_qubits=3, num_clbits=3, params=[])