Fix: Error in circuit visualization of decomposable gates#210
Fix: Error in circuit visualization of decomposable gates#210ryanhill1 merged 3 commits intoqBraid:mainfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
|
Thanks for fixing this @vinayswamik ! While testing out the code I see that the gates are unrolled by default - from pyqasm import loads
from pyqasm.printer import mpl_draw
qasm = """
OPENQASM 3.0;
qubit[2] q1;
qreg q[3];
creg c[3];
ccx q[0], q[1], q1[0];
crx (0.1) q[0], q[1];
rccx q[0], q[1], q1[0];
cz q[0], q[1];
"""
circ = loads(qasm)
mpl_draw(circ, filename = 'test.png')Can you see why this is happening? Ideally we should represent the gates as is, unless an |
|
The reason is |
|
Hmm, ideally it should be |
That's true. actually we can open it as new issue. |
|
Let's move that into a separate issue as current changes look fine to me |
|
Can you also add a |
|
Regarding changelog reminders, we can also port over this workflow from qBraid-SDK: https://github.com/qBraid/qBraid/blob/main/.github/workflows/pr-compliance.yml |
aafee7c to
8415c0c
Compare
- Added import for numpy to handle axes flattening. - Updated axes handling to support both numpy arrays and plt.Axes instances, ensuring compatibility with different subplot configurations.
- Introduced a new test case `test_draw_qasm3_decomposable_gate` to validate the drawing of a decomposable gate in QASM 3.0.
8415c0c to
a52cfe8
Compare

Fixes #209
Summary of changes