qnet package exposes all of QNET’s functionality for easy
interactive or programmative use.
Specifically, the subpackages for the following parts of QNET are directly available:
- Symbolic quantum and circuit algebra as
- Printers for symbolic symbolic expressions as
- A library of circuit components as
qnet.cc(as a shorthand for the
- Conversion utilities to Sympy and Numpy as
- Parsing utilities for the QHDL language, as
- Miscellaneous additional tools, as
For interactive usage, the package should be initialized as follows:
>>> import qnet >>> qnet.init_printing()
Note that most subpackages in turn expose their functionality through a “flat” API. That is, instead of
from qnet.algebra.operator_algebra import LocalOperator from qnet.circuit_components.displace_cc import Displace
the two objects may be more succintly imported from a higher level namespace as
import qnet # required for qnet.cc to work from qnet.algebra import LocalOperator from qnet.cc import Displace
In an interactive context (and only there!), a star import such as
from qnet.algebra import *
may be useful.
The flat API is defined via the __all__ attribute of each subpackage (see each package’s documentation).
Internally, the flat API (or star imports) must never be used.