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
| Format | Notes |
|---|---|
| Qiskit (Python) | Emits a QuantumCircuit with gate calls. Optional epilogue prints statevector or probabilities using your Qubi display settings. |
| OpenQASM 2.0 | Includes qelib1.inc. Multi-controlled gates use c3x/c4x when needed. Loops unroll when QASM 2 has no for. |
| OpenQASM 3.0 | Uses for loops where Qubi has LOOP, and ctrl @ modifiers for multi-controlled gates. |
Export
- Fix validation errors so the circuit compiles.
- Choose scope: entire main file or a selection (when supported).
- Pick the target language and click Refresh to preview.
- Optional Include settings mirrors
#settingsand adds result printing (Qiskit) or comments (OpenQASM). - Download saves
.pyor.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/c4xoracle expansions, not just bareccx. - OpenQASM
forloops map toLOOPwhen the range is numeric. - Apply to editor replaces or inserts the generated Qubi in the main layer. Redundant
#include standard/all.qubilines 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.