Template Function libwalrus::hafnian_rpt¶
Defined in File repeated_hafnian.hpp
Function Documentation¶
-
template<typename
T
>
Tlibwalrus
::
hafnian_rpt
(std::vector<T> &mat, std::vector<int> &rpt)¶ Returns the hafnian of a matrix using the algorithm described in From moments of sum to moments of product, doi:10.1016/j.jmva.2007.01.013.
Note that this algorithm, while generally slower than others, can be significantly more efficient in the cases where the matrix has repeated rows and columns.
- Return
hafnian of the input matrix
- Parameters
mat
: a flattened vector of size \(n^2\), representing an \(n\times n\) row-ordered symmetric matrix.rpt
: a vector of integers, representing the number of times each row/column inmat
is repeated. For example,mat = [1]
andrpt = [6]
represents a \(6\times 6\) matrix of all ones.
libwalrus_cpp_api/function_namespacelibwalrus_1ad5c1b0b221e3d31190ba97381addb36a
Download Python script
Download Notebook
View on GitHub
Contents
Downloads