Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QasmModule Circuit Drawer #122

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7fac964
basic one qubit drawer
arulandu Jan 11, 2025
40688bf
controlled gates + swap gate
arulandu Jan 11, 2025
197f309
.draw() on module
arulandu Jan 11, 2025
cd6d5eb
measurement
arulandu Jan 11, 2025
c79b46d
moment based drawing
arulandu Jan 11, 2025
cbd9293
pad label
arulandu Jan 11, 2025
9baed7b
multi control
arulandu Jan 14, 2025
0ff03af
custom test
arulandu Jan 14, 2025
56ae343
fix double draw
arulandu Jan 16, 2025
dbc5f3e
angle font
arulandu Jan 17, 2025
d9c27f8
idle wires option
arulandu Jan 17, 2025
0076925
add barrier support
arulandu Jan 17, 2025
77d6897
group cregs + measure style
arulandu Jan 17, 2025
5d61b1a
sections + idle wires order
arulandu Jan 17, 2025
ada2513
overflow wrap + idle wires order fix
arulandu Jan 17, 2025
4a7848c
linting
arulandu Jan 17, 2025
a66a3fa
merge main
arulandu Jan 17, 2025
5575332
fix kwargs
arulandu Jan 17, 2025
f6d4d77
phase placeholder
arulandu Jan 17, 2025
11eeb84
global phase
arulandu Jan 20, 2025
8170919
Merge branch 'main' into draw
TheGupta2012 Jan 28, 2025
8d8bfec
reset + labels + linting
arulandu Feb 14, 2025
871750a
Merge branch 'main' into draw
ryanhill1 Feb 14, 2025
6750d22
build, static type checking, user interface
ryanhill1 Feb 14, 2025
f8e06c8
Merge branch 'qBraid:main' into draw
arulandu Feb 18, 2025
c2cb5de
standalone measurement
arulandu Feb 18, 2025
0528696
add tests
ryanhill1 Feb 20, 2025
02ca6cb
add mpl to test extra
ryanhill1 Feb 20, 2025
705cc48
try pytest-mpl
ryanhill1 Feb 20, 2025
d5ae252
clean up tests
ryanhill1 Feb 20, 2025
d20d8ea
Merge branch 'main' into draw
ryanhill1 Feb 21, 2025
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
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# -- Project information -----------------------------------------------------

project = "qBraid"
copyright = "2024, qBraid Development Team"
copyright = "2025, qBraid Development Team"
author = "qBraid Development Team"

# The full version, including alpha/beta/rc tags
Expand All @@ -41,7 +41,7 @@
# set_type_checking_flag = True
autodoc_member_order = "bysource"
autoclass_content = "both"
autodoc_mock_imports = ["openqasm3"]
autodoc_mock_imports = ["openqasm3", "matplotlib"]
napoleon_numpy_docstring = False
todo_include_todos = True
mathjax_path = "https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ classifiers = [
"Operating System :: Unix",
"Operating System :: MacOS",
]

dependencies = ["numpy", "openqasm3[parser]>=1.0.0,<2.0.0"]

[project.urls]
Expand All @@ -40,9 +41,10 @@ dependencies = ["numpy", "openqasm3[parser]>=1.0.0,<2.0.0"]

[project.optional-dependencies]
cli = ["typer>=0.12.1", "rich>=10.11.0", "typing-extensions"]
test = ["pytest", "pytest-cov"]
test = ["pytest", "pytest-cov", "pytest-mpl", "matplotlib"]
lint = ["black", "isort>=6.0.0", "pylint", "mypy", "qbraid-cli>=0.10.2"]
docs = ["sphinx>=7.3.7,<8.2.0", "sphinx-autodoc-typehints>=1.24,<3.1", "sphinx-rtd-theme>=2.0.0,<4.0.0", "docutils<0.22", "sphinx-copybutton"]
visualization = ["matplotlib"]

[tool.setuptools.package-data]
pyqasm = ["py.typed", "*.pyx"]
Expand Down
3 changes: 3 additions & 0 deletions src/pyqasm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
loads
dump
dumps
draw

Classes
---------
Expand Down Expand Up @@ -58,6 +59,7 @@
from .entrypoint import dump, dumps, load, loads
from .exceptions import PyQasmError, QasmParsingError, ValidationError
from .modules import Qasm2Module, Qasm3Module, QasmModule
from .printer import draw

__all__ = [
"PyQasmError",
Expand All @@ -67,6 +69,7 @@
"loads",
"dump",
"dumps",
"draw",
"QasmModule",
"Qasm2Module",
"Qasm3Module",
Expand Down
15 changes: 15 additions & 0 deletions src/pyqasm/maps/gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#
# THERE IS NO WARRANTY for PyQASM, as per Section 15 of the GPL v3.


# pylint: disable=too-many-lines

"""
Expand Down Expand Up @@ -1193,6 +1194,20 @@ def map_qasm_inv_op_to_callable(op_name: str):
raise ValidationError(f"Unsupported / undeclared QASM operation: {op_name}")


REV_CTRL_GATE_MAP = {
"cx": "x",
"cy": "y",
"cz": "z",
"crx": "rx",
"cry": "ry",
"crz": "rz",
"cp": "p",
"ch": "h",
"cu": "u",
"cswap": "swap",
"ccx": "cx",
}

CTRL_GATE_MAP = {
"x": "cx",
"y": "cy",
Expand Down
Loading