Skip to main content

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

Project description

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


Recommended way (because it includes faster C/FORTRAN bindings)

conda install pfapack

Alternatively use

pip install pfapack


from pfapack import pfaffian as pf
import numpy.matlib

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)

If installed with conda, C/FORTRAN code is included with Python bindings, use it like:

from pfapack.ctypes import pfaffian as cpf

pfa1 = cpf(A)
pfa2 = cpf(A, method="H")

print(pfa1, pfa2)


If you have used pfapack in your research, please cite it using the following bib entry:

  title={Efficient numerical computation of the pfaffian for dense and banded skew-symmetric matrices},
  author={Michael Wimmer},
  journal={ACM Transactions on Mathematical Software (TOMS)},
  publisher={ACM New York, NY, USA}


MIT License


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pfapack-0.3.1.tar.gz (13.0 kB view hashes)

Uploaded source

Built Distribution

pfapack-0.3.1-py3-none-any.whl (12.8 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page