Software Open Access

The Walrus: a library for the calculation of hafnians, Hermite polynomials and Gaussian boson sampling

Brajesh Gupt; Josh Izaac; Nicolas Quesada

In The Walrus, we provide a highly optimized implementation of the best known algorithms for hafnians, loop hafnians, multidimensional Hermite polynomials, and torontonians of generic real and complex matrices. We also provide access to recently proposed methods to generate samples of a Gaussian boson sampler. These methods have exponential time complexity in the number of bosons measured. For ease of use, a Python interface to the library's low-level C++ implementations is also provided, as well as pre-compiled static libraries installable via the Python package manager pip. This short paper provides a high-level description of the library and its rationale; in-depth information on the algorithms, implementations and interface can be found in its documentation.

Files (6.7 MB)
Name Size
6.7 MB Download
All versions This version
Views 1818
Downloads 11
Data volume 6.7 MB6.7 MB
Unique views 1414
Unique downloads 11


Cite as