Overview

Python API

  • The thewalrus Python API provides access to various highly optimized hafnian, permanent, and torontonian algorithms

  • The thewalrus.quantum submodule provides access to various utility functions that act on Gaussian quantum states

  • The thewalrus.samples submodule provides access to algorithms to sample from the hafnian or the torontonian of Gaussian quantum states

  • The thewalrus.symplectic submodule provides access to a convenient set of symplectic matrices and utility functions to manipulate them

  • The thewalrus.decompositions submodule provides access to common shared matrix decompositions used to perform gate decompositions

  • The thewalrus.charpoly submodule provides access to La Budde’s algorithm to calculate the characteristic polynomials of matrices

  • The thewalrus.random submodule provides access to random unitary, symplectic and covariance matrices

  • The thewalrus.fock_gradients submodule provides access to the Fock representation of certain continuous-variable gates and their gradients

  • The thewalrus.reference submodule provides access to pure-Python reference implementations of the hafnian, loop hafnian, and torontonian

Octave

In addition, two Octave functions are provided: octave/hafnian.m and octave/loophafnian.m.