transpile¶
-
transpile
(self, backend=None, **kwargs)[source]¶ Transpile the circuit.
If the circuit has a target_backend assigned and backend=None then the target backend is used for transpilation. All other transpile functionality remains unchanged.
- Parameters
backend (BaseBackend) – Backend to transpile for.
kwargs – any other transpiler kwargs.
- Returns
Transpiled quantum circuit.
- Return type
QuantumCircuit
Example
from qiskit import QuantumCircuit import kaleidoscope.qiskit from kaleidoscope.qiskit.services import Simulators qc = QuantumCircuit(5) >> Simulators.aer_vigo_simulator qc.h(0) qc.cx(0, range(1,5)) new_qc = qc.transpile() new_qc.draw('mpl')
Traceback [1;36m(most recent call last)[0m: File [0;32m"<ipython-input-1-02b2282ac9a8>"[0m, line [0;32m5[0m, in [0;35m<module>[0m qc = QuantumCircuit(5) >> Simulators.aer_vigo_simulator [1;36m File [1;32m"/opt/miniconda3/envs/qiskit/lib/python3.9/site-packages/kaleidoscope/qiskit/services/_simulators.py"[1;36m, line [1;32m190[1;36m, in [1;35m__getattr__[1;36m[0m [1;33m raise AttributeError("Couldn't load {}.".format(attr))[0m [1;31mAttributeError[0m[1;31m:[0m Couldn't load aer_vigo_simulator. Use %tb to get the full traceback.