qrisp.QuantumCircuit.from_qiskit#
- classmethod QuantumCircuit.from_qiskit(qiskit_qc)[source]#
Class method to create QuantumCircuits from Qiskit QuantumCircuits.
- Parameters:
- qiskit_qcQiskit QuantumCircuit
The Qiskit QuantumCircuit to convert.
- Returns:
- QuantumCircuit
The converted QuantumCircuit.
Examples
We construct a fan-out QuantumCircuit in Qiskit:
>>> from qiskit import QuantumCircuit as QiskitQuantumCircuit >>> qc_2 = QiskitQuantumCircuit(4) >>> qc_2.cx(0, range(1,4)) >>> print(qc_2)
q_0: ──■────■────■── ┌─┴─┐ │ │ q_1: ┤ X ├──┼────┼── └───┘┌─┴─┐ │ q_2: ─────┤ X ├──┼── └───┘┌─┴─┐ q_3: ──────────┤ X ├ └───┘
Note that we don’t need to create a QuantumCircuit object first as this is a class method.
>>> qrisp_qc_2 = QuantumCircuit.from_qiskit(qc_2) >>> print(qrisp_qc_2)
qb_8: ──■────■────■── ┌─┴─┐ │ │ qb_9: ┤ X ├──┼────┼── └───┘┌─┴─┐ │ qb_10: ─────┤ X ├──┼── └───┘┌─┴─┐ qb_11: ──────────┤ X ├ └───┘