Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,55 @@ Types of changes:

### Added
- Added logic to `bump-version.yml` workflow that automatically updates `CITATION.cff` upon new release ([#147](https://github.com/qBraid/pyqasm/pull/147))
- Added `pyqasm.draw()` function that draws quantum circuit ([#122](https://github.com/qBraid/pyqasm/pull/122)):

```python
from pyqasm import draw

qasm = """
OPENQASM 3.0;
include "stdgates.inc";

qubit[3] q;
bit[3] b;

h q[0];
z q[1];
rz(pi/1.1) q[0];
cx q[0], q[1];
swap q[0], q[1];
ccx q[0], q[1], q[2];
b = measure q;
"""

draw(qasm, output='mpl')
```

![Screenshot 2025-03-17 at 2 23 14 PM](https://github.com/user-attachments/assets/9f7cdf35-997e-4858-8f79-016b449c68a4)

\- Currently, only the `mpl` (matplotlib) output format is supported.

\- Use `draw(..., idle_wires=False)` to draw circuit without empty qubit/classical bit registers.

\- Save the visualization to a file by specifying `output='mpl'` and a `filename`:
```python
draw(..., output='mpl', filename='/path/to/circuit.png')
```

\- The draw method accepts either a `str` (QASM source) or a `QasmModule`. The following are equivalent:

```python
from pyqasm import loads, draw
from pyqasm.printer import mpl_draw

module = loads(qasm_str)

draw(module, output='mpl')
draw(qasm_str, output='mpl')

draw(module)
draw(qasm_str)
```

### Improved / Modified

Expand Down