OpenQASM import and export

オープン
#11 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python, rust
領域
api, backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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).
主要言語
Rust
スター
1
フォーク
0
平均マージ
12分
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

kaiwave/qsengine のほかの issue

kaiwave/qsengine の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。