OpenQASM import and export

Aperta
#11 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python, rust
Ambito
api, backend

Direzione di ricerca

Start with src/circuit.rs, especially Label and how instructions retain names and angles; inspect the circuit API for import and export entry points. The issue outlines OpenQASM 2 and 3 edge cases, unsupported import statements, and unitary decomposition, so first map the supported gates and conditions. Done means circuits can be imported from and exported to the described QASM versions with clear errors for unsupported cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
What you want to do

Move circuits between qsengine and Qiskit, other simulators, or hardware. Today there is no way
in or out except rebuilding the circuit gate by gate.

Implementation notes
  • Each instruction already keeps its name and angles (Label in src/circuit.rs, described as
    kept "for drawing and later for export").
  • OpenQASM 2 limits:
    • if (c == v) compares the whole register, but qsengine conditions on any subset of bits.
      Export conditions only when they cover the whole register; otherwise raise and point to version 3.
    • p / cp are u1 / cu1 in qelib1.inc.
  • unitary gates have no name in QASM. Export them as U(θ,φ,λ) from a ZYZ decomposition
    (record the global phase as gphase in QASM 3). Controlled unitary gates need a controlled-U
    decomposition, or should raise.
  • Import: parse the subset qsengine supports, and give a clear error naming the first unsupported
    statement (custom gate definitions, loops and so on).
What it could look like
qc = qsengine.QuantumCircuit.from_qasm(open("bell.qasm").read())
print(qc.to_qasm())            # OpenQASM 3 by default
print(qc.to_qasm(version=2))
Contributing
  • I would like to open a pull request for this (see CONTRIBUTING.md).
Lingua principale
Rust
Stelle
1
Fork
0
Merge medio
12m
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kaiwave/qsengine

Tutte le issue di kaiwave/qsengine

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.