Is your feature request related to a problem? Please describe.
Currently, when using circuit.to_qasm() to export a Qibo circuit to QASM format, the conversion fails if the circuit contains multi-controlled gates (e.g., gates generated via the controlled_by method). This prevents correct export and subsequent loading of the circuit in other frameworks such as Qiskit.
Describe the solution you'd like
In Qibo's to_qasm, when a multi-controlled gate is detected, automatically invoke a generic decomposition routine:
Input: a list of control qubits and the target gate type.
Output: a sequence of elementary QASM gates (e.g., CX, single-qubit rotations, and ancilla-assisted operations).
Describe alternatives you've considered
In specific modes, directly map to the target framework's native multi-controlled gate:
Qiskit → MCXGate
tket → MultiControlledUnitary
Advantages: Leverages the framework’s optimized implementation, reducing performance overhead from decomposition.
Disadvantages: Sacrifices cross-framework portability—circuits can only run within the specific target framework.
Additional context
Below is an example of to_qasm() for a circuit containing a multi-controlled gate.


Is your feature request related to a problem? Please describe.
Currently, when using circuit.to_qasm() to export a Qibo circuit to QASM format, the conversion fails if the circuit contains multi-controlled gates (e.g., gates generated via the controlled_by method). This prevents correct export and subsequent loading of the circuit in other frameworks such as Qiskit.
Describe the solution you'd like
In Qibo's to_qasm, when a multi-controlled gate is detected, automatically invoke a generic decomposition routine:
Input: a list of control qubits and the target gate type.
Output: a sequence of elementary QASM gates (e.g., CX, single-qubit rotations, and ancilla-assisted operations).
Describe alternatives you've considered
In specific modes, directly map to the target framework's native multi-controlled gate:
Qiskit → MCXGate
tket → MultiControlledUnitary
Advantages: Leverages the framework’s optimized implementation, reducing performance overhead from decomposition.
Disadvantages: Sacrifices cross-framework portability—circuits can only run within the specific target framework.
Additional context

Below is an example of to_qasm() for a circuit containing a multi-controlled gate.