CirqCircuit._convert_to_line_qubits merges NamedQubits whose names share an index
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
從 CirqCircuit._convert_to_line_qubits 開始,並將其行為與 #1534 中描述的 cirq_to_braket 規則進行比較。尋找涵蓋 populate_idle_qubits 的現有測試,並為衝突標籤和不符合 Cirq 順序的標籤新增回歸案例。完成意味著轉換會保留 Cirq 順序中的不同 qubit,且不改變電路。
由索引模型根據 Issue 內容生成。
描述
Problem
CirqCircuit._convert_to_line_qubits maps each NamedQubit to LineQubit(<integer in its name>). Distinct qubits with the same number collapse onto one LineQubit. populate_idle_qubits calls it for any circuit with a NamedQubit. Two registers imported from QASM (a_0, b_0) are enough to trigger it:
import cirq
from qbraid.programs.gate_model.cirq import CirqCircuit
a0, b0 = cirq.NamedQubit("a_0"), cirq.NamedQubit("b_0")
program = CirqCircuit(cirq.Circuit(cirq.H(a0), cirq.CNOT(a0, b0)))
program.populate_idle_qubits()
ValueError: Duplicate qids for <cirq.CNOT>. Expected unique qids but got <(cirq.LineQubit(0), cirq.LineQubit(0))>.
When the colliding qubits' gates are in different moments, nothing raises. Circuit(Moment(H(a_0)), Moment(X(b_0))) becomes H then X on LineQubit(0), so the circuit changes without an error. Labels that are distinct but out of Cirq's order (a_1, b_0) permute the qubits.
cirq_to_braket had the same collision and was fixed in #1534. It keeps the integer labels only when they are non-negative and rise strictly in Cirq's sorted order, and otherwise numbers the qubits 0..n-1 in that order.
Expected
_convert_to_line_qubits keeps qubits distinct and in Cirq's order. One way is to apply the same rule cirq_to_braket uses.
- 主要語言
- Python
- 星號
- 117
- 分支
- 66
- 平均合併
- 1 天 10 小時
- 30 天內合併 PR
- 22
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
qBraid/qBraid 的其他 Issue
-
Test order: test_run_forbidden_kwarg leaves Mock registered as a program type可能已有人在做 @VanshajPoonia 於 3 天前認領。 未關閉bug 🐛 testing 🧪
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
bug 🐛
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
enhancement ✨ results 📋
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
Pasqal: a {"sequence_builder": ...} payload sent as a string reaches Pasqal still wrapped可能已有人在做 @ryanhill1 於 22 天前認領。 未關閉bug 🐛
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
bug 🐛 transpiler 🚊
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
相似的 Issue
-
docs(contributing): the two things that silently block a PR可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉available documentation good first issue
難度 1/5 1-3 小時 新手友好度 95/100
Nixitov/Riptide-Native#944 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 88/100
JTHCode/secretguard#24 ·
維護者通常 1 天內回覆
-
area: middleware documentation good first issue
難度 2/5 1-3 小時 新手友好度 88/100
-
enhancement good first issue
難度 2/5 1-3 小時 新手友好度 88/100
維護者通常 1 天內回覆
-
good first issue
難度 1/5 1 小時以內 新手友好度 95/100
omarelshamy25x/shamy-hijri#63 ·
維護者通常 1 天內回覆