Template Function libwalrus::do_chunk_loops¶
Defined in File eigenvalue_hafnian.hpp
Function Documentation¶
-
template<typename
T
>
Tlibwalrus
::
do_chunk_loops
(std::vector<T> &mat, std::vector<T> &C, std::vector<T> &D, int n, unsigned long long int X, unsigned long long int chunksize)¶ Calculates the partial sum \(X,X+1,\dots,X+\text{chunksize}\) using the Cygan and Pilipczuk formula for the loop hafnian of matrix
mat
.Note that if
X=0
andchunksize=pow(2.0, n/2)
, then the full loop hafnian is calculated.This function uses OpenMP (if available) to parallelize the reduction.
- Return
the partial sum for the loop hafnian
- Parameters
mat
: vector representing the flattened matrixC
: contains the diagonal elements of matrixz
D
: the diagonal elements of matrixz
, with every consecutive pair swapped (i.e.,C[0]==D[1]
,C[1]==D[0]
,C[2]==D[3]
,C[3]==D[2]
, etc.).n
: size of the matrixX
: initial index of the partial sumchunksize
: length of the partial sum
libwalrus_cpp_api/function_namespacelibwalrus_1a4bece28df810a3df3b1ca24c21395387
Download Python script
Download Notebook
View on GitHub
Contents
Downloads