qrisp.QuantumCircuit.to_op#
- QuantumCircuit.to_op(name=None)[source]#
Method to return an Operation object generated out of this QuantumCircuit.
Operation objects can be appended to other QuantumCircuits.
An alias for Qiskit compatibility is the
to_gate
method.- Parameters:
- namestring, optional
The name of the gate. By default, the QuantumCircuit’s name will be used.
- Returns:
- Operation
The Operation defined by this QuantumCircuit.
Examples
>>> from qrisp import QuantumCircuit >>> qc_0 = QuantumCircuit(4) >>> qc_0.x(qc.qubits) >>> operation = qc_0.to_gate() >>> qc_1 = QuantumCircuit(4) >>> qc_1.append(operation, qc_1.qubits)