Language Conversion

Export validated Qubi to Qiskit Python or OpenQASM, or import foreign code back into the editor. Open the modal from the header Export → As another language… or Import → As another language….

Supported formats

FormatNotes
Qiskit (Python)Emits a QuantumCircuit with gate calls. Optional epilogue prints statevector or probabilities using your Qubi display settings.
OpenQASM 2.0Includes qelib1.inc. Multi-controlled gates use c3x/c4x when needed. Loops unroll when QASM 2 has no for.
OpenQASM 3.0Uses for loops where Qubi has LOOP, and ctrl @ modifiers for multi-controlled gates.

Export

  1. Fix validation errors so the circuit compiles.
  2. Choose scope: entire main file or a selection (when supported).
  3. Pick the target language and click Refresh to preview.
  4. Optional Include settings mirrors #settings and adds result printing (Qiskit) or comments (OpenQASM).
  5. Download saves .py or .qasm. High-level calls (Grover, QFT, Bell, GHZ) may appear as reconstructed code plus comments when a flat gate list would be unreadable.

ANNOTATE and LABEL lines become comments in the exported text. Warnings (unsupported gates, approximate decompositions) appear in the modal footer.

Import

Paste OpenQASM or Qiskit source into the import pane. The converter maps primitive gates back to Qubi, absorbs Grover/QFT/oracle blocks when export comments or gate patterns match, and lists anything it could not reconstruct.

  • Grover round-trips recognize multi-controlled c3x/c4x oracle expansions, not just bare ccx.
  • OpenQASM for loops map to LOOP when the range is numeric.
  • Apply to editor replaces or inserts the generated Qubi in the main layer. Redundant #include standard/all.qubi lines are stripped when the prepended layer already provides them.

Practical notes

Export always runs through the same executor as the simulator, so the foreign code reflects the scheduled circuit, not just a textual rewrite of your source file. Very deep multi-controlled gates may warn and use approximate expansions in OpenQASM 2; prefer OpenQASM 3 for exact ctrl forms. After import, run the circuit and compare probabilities to confirm the round-trip.