Template Function libwalrus::hafnian_recursive

Function Documentation

template<typename T>
T libwalrus::hafnian_recursive(std::vector<T> &mat)

Returns the hafnian of an matrix.

Returns the hafnian of a matrix using the recursive algorithm described in Counting perfect matchings as fast as Ryser [5], where it is labelled as ‘Algorithm 2’.

Modified with permission from https://github.com/eklotek/Hafnian.

Return

hafnian of the input matrix

Parameters
  • mat: a flattened vector of size \(n^2\), representing an \(n\times n\) row-ordered symmetric matrix.