Skip to main content

Open source library for hafnian calculation

Project description

Tests Codecov coverage CodeFactor Grade Read the Docs PyPI - Python Version JOSS - The Journal of Open Source Software

A library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling. For more information, please see the documentation.

Features

  • Fast calculation of hafnians, loop hafnians, and torontonians of general and certain structured matrices.

  • An easy to use interface to use the loop hafnian for Gaussian quantum state calculations.

  • Sampling algorithms for hafnian and torontonians of graphs.

  • Efficient classical methods for approximating the hafnian of non-negative matrices.

  • Easy to use implementations of the multidimensional Hermite polynomials, which can also be used to calculate hafnians of all reductions of a given matrix.

Installation

The Walrus requires Python version 3.10, 3.11, or 3.12. Installation of The Walrus, as well as all dependencies, can be done using pip:

pip install thewalrus

Compiling from source

The Walrus has the following dependencies:

You can compile the latest development version by cloning the git repository, and installing using pip in development mode.

$ git clone https://github.com/XanaduAI/thewalrus.git
$ cd thewalrus && python -m pip install -e .

Software tests

To ensure that The Walrus library is working correctly after installation, the test suite can be run locally using pytest.

Additional packages are required to run the tests. These dependencies can be found in requirements-dev.txt and can be installed using pip:

$ pip install -r requirements-dev.txt

To run the tests, navigate to the source code folder and run the command

$ make test

Documentation

The Walrus documentation is available online on Read the Docs.

Additional packages are required to build the documentation locally as specified in doc/requirements.txt. These packages can be installed using:

$ sudo apt install pandoc
$ pip install -r docs/requirements.txt

To build the HTML documentation, go to the top-level directory and run the command

$ make doc

The documentation can then be found in the docs/_build/html/ directory.

Contributing to The Walrus

We welcome contributions - simply fork The Walrus repository, and then make a pull request containing your contribution. All contributors to The Walrus will be listed as authors on the releases.

We also encourage bug reports, suggestions for new features and enhancements, and even links to projects, applications or scientific publications that use The Walrus.

Authors

The Walrus is the work of many contributors.

If you are doing research using The Walrus, please cite our paper:

Brajesh Gupt, Josh Izaac and Nicolas Quesada. The Walrus: a library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling. Journal of Open Source Software, 4(44), 1705 (2019)

Support

If you are having issues, please let us know by posting the issue on our Github issue tracker.

License

The Walrus is free and open source, released under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thewalrus-0.22.0.tar.gz (111.8 kB view details)

Uploaded Source

Built Distribution

thewalrus-0.22.0-py3-none-any.whl (95.4 kB view details)

Uploaded Python 3

File details

Details for the file thewalrus-0.22.0.tar.gz.

File metadata

  • Download URL: thewalrus-0.22.0.tar.gz
  • Upload date:
  • Size: 111.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for thewalrus-0.22.0.tar.gz
Algorithm Hash digest
SHA256 5b7c53a9b158c1e15f8896de3e5f06f3e295b6480681a1ca2b173361eb58a4e7
MD5 5d077dd1ea4e6bb36add304a3aa3dd8d
BLAKE2b-256 a684aecfe5668b5f3686b5c889166ad6c624862e0f05319fd69d1e16e52422c2

See more details on using hashes here.

File details

Details for the file thewalrus-0.22.0-py3-none-any.whl.

File metadata

  • Download URL: thewalrus-0.22.0-py3-none-any.whl
  • Upload date:
  • Size: 95.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for thewalrus-0.22.0-py3-none-any.whl
Algorithm Hash digest
SHA256 782cf1703c8f99a573bd218808075ac9ec1aa8ba5d39f803027e19339e1899ba
MD5 3b977352467414dc284bf26d6cfde5b0
BLAKE2b-256 71957fb3b5241892b4cc6627c0e32838bcc1581f00e12c31bc38ed8a66560c0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page