QASM Import & Execution¶
Overview¶
QuantumRingsLib supports both OpenQASM 2.0 and OpenQASM 3.0 for composing and executing quantum circuits.
OpenQASM 2.0 — best for existing circuits and straightforward workflows.
OpenQASM 3.0 — best for complex circuits that require control flow.
Depending on the circuit type, different execution paths can be used.
Choosing an execution path¶
BackendV2.run accepts both QASM 2.0 and QASM 3.0 files directly and works in all
scenarios. The import methods QuantumCircuit.from_qasm_file and QuantumCircuit.from_qasm_str
accept files and strings, respectively, and are available when you need a QuantumCircuit object to
inspect or modify before running. The helper classes qasm2 (OpenQASM 2.0) and OpenQASM (OpenQASM 3.0)
also create QuantumCircuit objects.
Standard |
Circuit contains… |
Supported methods |
|---|---|---|
2.0 |
Any circuit |
|
|
||
|
||
3.0 |
No control flow; measurements at end |
|
|
||
|
||
3.0 |
Loops or conditionals; measurements at end; classical bits not referenced after measure |
|
|
||
|
||
3.0 |
Loops or conditionals that reference mid-circuit measured classical bits |
|