8000 Release PyQASM 0.3.0 · qBraid/pyqasm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

PyQASM 0.3.0

Compare
Choose a tag to compare
@ryanhill1 ryanhill1 released this 18 Mar 16:35
· 38 commits to main since this release
28c4140

Release 0.3.0 (Mar 18, 2025)

Summary

Added

  • Added logic to bump-version.yml workflow that automatically updates CITATION.cff upon new release (#147)
  • Added pyqasm.draw() function that draws quantum circuit (#122):
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

- 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:

draw(..., output='mpl', filename='/path/to/circuit.png')

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

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)

Fixed

  • Fixed bug in release workflow(s) that caused discrepancy between pyqasm.__version__ and importlib.metadata.version (#147)
  • Fixed a bug in broadcast operation for duplicate qubits so that the following -
OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
qubit[2] q2;
cx q[0], q[1], q[1], q[2];
cx q2, q2;

will unroll correctly to -

OPENQASM 3.0;
include "stdgates.inc";
qubit[3] q;
qubit[2] q2;
// cx q[0], q[1], q[1], q[2];
cx q[0], q[1];
cx q[1], q[2];

// cx q2, q2;
cx q2[0], q2[1];
cx q2[0], q2[1];

The logic for duplicate qubit detection is moved out of the QasmVisitor._get_op_bits into Qasm3Analyzer class and is executed post gate broadcast operation (#155).

Other

  • Updated license from GPL-3.0 to Apache-2.0 (#158)
  • Added GitHub actions for publishing to GitHub pages, and updated docs pages from Readthedocs to GitHub pages links. (#158)

PRs Merged

Full Changelog: v0.2.1...v0.3.0

0