pfapack: Efficient numerical computation of the Pfaffian for dense and banded skew-symmetric matrices

Code and algorithms are taken from arXiv:1102.3440 which is authored by Michael Wimmer.

license tests codecov docs version PyPI - Python Version

Install

pip install pfapack

Usage

from pfapack import pfaffian as pf
import numpy.matlib

# first real matrices
A = numpy.matlib.rand(100, 100)
A = A - A.T
pfa1 = pf.pfaffian(A)
pfa2 = pf.pfaffian(A, method="H")
pfa3 = pf.pfaffian_schur(A)

print(pfa1, pfa2, pfa3)

License

MIT License