Computer algebra package for quantum mechanics and photonic quantum networks
Python Makefile
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.



QNET on the Python Package Index Join the chat at Travis Continuous Integration Coveralls Documentation Status MIT License

Computer algebra package for quantum mechanics and photonic quantum networks

Development of QNET happens on Github.


  • Extensible computer algebra system for quantum operators, quantum states, super operators
  • Building on SymPy for scalar symbolic algebra
  • Implementation of Gough and James' SLH algebra for photonic quantum circuits
  • Designed for use within the Jupyter notebook
  • Publication-ready, configurable rendering of mathematical formulas
  • Conversion to QuTiP objects for numerical simulation

Note that version 2.0 of QNET is a major redesign. See :ref:`History <history>` for details.


  • Python version 3.5 or higher. The last version of QNET to support Python 2 is 1.4.3.
  • The SymPy symbolic algebra Python package to implement symbolic 'scalar' algebra, i.e., the coefficients of state, operator or super-operator expressions can be symbolic SymPy expressions as well as pure python numbers.
  • The NumPy package for numerical calculations
  • Optional: QuTiP python package as an extremely useful, efficient and full featured numerical backend. Operator expressions where all symbolic scalar parameters have been replaced by numeric ones, can be converted to (sparse) numeric matrix representations, which are then used to solve for the system dynamics using the tools provided by QuTiP.
  • Optional: The PyX python package for visualizing circuit expressions as box/flow diagrams.

A convenient way of obtaining Python as well as some of the packages listed here (SymPy, SciPy, NumPy) is to download Anaconda Python Distribution, which is free for academic use. A highly recommended way of working with QNET and QuTiP, or scientific python codes in general is through the excellent IPython command-line shell, or the very polished browser-based Jupyter notebook interface.


To install the latest released version of QNET, run this command in your terminal:

$ pip install qnet

This is the preferred method to install QNET, as it will always install the most recent stable release.

If you don't have pip installed, this Python installation guide can guide you through the process.

To install the latest development version of QNET from Github.

$ pip install git+


To use QNET in a project:

import qnet