# `pfapack`: Efficient numerical computation of the Pfaffian for dense and banded skew-symmetric matrices
Code and algorithms are taken from [arXiv:1102.3440](https://arxiv.org/abs/1102.3440) which is authored by [Michael Wimmer](https://michaelwimmer.org/).
[![license](https://img.shields.io/github/license/basnijholt/pfapack)](https://github.com/basnijholt/pfapack/blob/master/LICENSE)
[![tests](https://github.com/basnijholt/pfapack/workflows/tests/badge.svg)](https://github.com/basnijholt/pfapack/actions?query=workflow%3Atests)
[![codecov](https://img.shields.io/codecov/c/github/basnijholt/pfapack)](https://codecov.io/gh/basnijholt/pfapack)
[![docs](https://img.shields.io/readthedocs/pfapack)](https://pfapack.readthedocs.io)
[![version](https://img.shields.io/pypi/v/pfapack)](https://pypi.org/project/pfapack/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pfapack)](https://pypi.org/project/pfapack/)
### Install
Recommended way (because it includes faster C/FORTRAN bindings)
```bash
conda install -c conda-forge pfapack
```
Alternatively use
```bash
pip install pfapack
```
## Usage
```python
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:
```python
from pfapack.ctypes import pfaffian as cpf
pfa1 = cpf(A)
pfa2 = cpf(A, method="H")
print(pfa1, pfa2)
```
## Citing
If you have used `pfapack` in your research, please cite it using the following `bib` entry:
```
@article{wimmer2012algorithm,
title={Efficient numerical computation of the pfaffian for dense and banded skew-symmetric matrices},
author={Michael Wimmer},
journal={ACM Transactions on Mathematical Software (TOMS)},
volume={38},
number={4},
pages={1--17},
year={2012},
publisher={ACM New York, NY, USA}
}
```
## License
MIT License
## Contributions
- Bas Nijholt
- [Michael Wimmer (author of the algorithms)](https://arxiv.org/abs/1102.3440)
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/pfapack-batched",
"name": "pfapack-batched",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "your.email@example.com",
"download_url": "https://files.pythonhosted.org/packages/c7/22/526b611c962467b98f203dc29b8ef9a85c2af8898c455ecf5b6068a7a862/pfapack-batched-0.0.3.tar.gz",
"platform": null,
"description": "# `pfapack`: Efficient numerical computation of the Pfaffian for dense and banded skew-symmetric matrices\n\nCode and algorithms are taken from [arXiv:1102.3440](https://arxiv.org/abs/1102.3440) which is authored by [Michael Wimmer](https://michaelwimmer.org/).\n\n[![license](https://img.shields.io/github/license/basnijholt/pfapack)](https://github.com/basnijholt/pfapack/blob/master/LICENSE)\n[![tests](https://github.com/basnijholt/pfapack/workflows/tests/badge.svg)](https://github.com/basnijholt/pfapack/actions?query=workflow%3Atests)\n[![codecov](https://img.shields.io/codecov/c/github/basnijholt/pfapack)](https://codecov.io/gh/basnijholt/pfapack)\n[![docs](https://img.shields.io/readthedocs/pfapack)](https://pfapack.readthedocs.io)\n[![version](https://img.shields.io/pypi/v/pfapack)](https://pypi.org/project/pfapack/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pfapack)](https://pypi.org/project/pfapack/)\n\n### Install\nRecommended way (because it includes faster C/FORTRAN bindings)\n```bash\nconda install -c conda-forge pfapack\n```\n\nAlternatively use\n```bash\npip install pfapack\n```\n\n## Usage\n```python\nfrom pfapack import pfaffian as pf\nimport numpy.matlib\n\nA = numpy.matlib.rand(100, 100)\nA = A - A.T\npfa1 = pf.pfaffian(A)\npfa2 = pf.pfaffian(A, method=\"H\")\npfa3 = pf.pfaffian_schur(A)\n\nprint(pfa1, pfa2, pfa3)\n```\n\nIf installed with `conda`, C/FORTRAN code is included with Python bindings, use it like:\n```python\nfrom pfapack.ctypes import pfaffian as cpf\n\npfa1 = cpf(A)\npfa2 = cpf(A, method=\"H\")\n\nprint(pfa1, pfa2)\n```\n\n## Citing\nIf you have used `pfapack` in your research, please cite it using the following `bib` entry:\n```\n@article{wimmer2012algorithm,\n title={Efficient numerical computation of the pfaffian for dense and banded skew-symmetric matrices},\n author={Michael Wimmer},\n journal={ACM Transactions on Mathematical Software (TOMS)},\n volume={38},\n number={4},\n pages={1--17},\n year={2012},\n publisher={ACM New York, NY, USA}\n}\n```\n\n## License\nMIT License\n\n## Contributions\n- Bas Nijholt\n- [Michael Wimmer (author of the algorithms)](https://arxiv.org/abs/1102.3440)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Efficient numerical computation of the Pfaffian for dense and banded skew-symmetric matrices (batched version).",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/yourusername/pfapack-batched"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7e6ba94a632f992fb290f85581fc9b19e1e35a7f9a6b24b9feb1a106533748ee",
"md5": "b66e9c307e26f7b87f6458bf55c2c92b",
"sha256": "ac6678eb0918ebb4e58bb48e512cdca329b3fec7d1b2dea7dc982192312d3523"
},
"downloads": -1,
"filename": "pfapack_batched-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b66e9c307e26f7b87f6458bf55c2c92b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 205516,
"upload_time": "2024-10-01T18:24:55",
"upload_time_iso_8601": "2024-10-01T18:24:55.907603Z",
"url": "https://files.pythonhosted.org/packages/7e/6b/a94a632f992fb290f85581fc9b19e1e35a7f9a6b24b9feb1a106533748ee/pfapack_batched-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c722526b611c962467b98f203dc29b8ef9a85c2af8898c455ecf5b6068a7a862",
"md5": "5b5bae9675765c96d126d4587fc04689",
"sha256": "b0223d0e1449f87f122324159fa32bd954a4e3650353b1f77b446a77dfbb9fcf"
},
"downloads": -1,
"filename": "pfapack-batched-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "5b5bae9675765c96d126d4587fc04689",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 219994,
"upload_time": "2024-10-01T18:24:57",
"upload_time_iso_8601": "2024-10-01T18:24:57.642372Z",
"url": "https://files.pythonhosted.org/packages/c7/22/526b611c962467b98f203dc29b8ef9a85c2af8898c455ecf5b6068a7a862/pfapack-batched-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-01 18:24:57",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "pfapack-batched",
"github_not_found": true,
"lcname": "pfapack-batched"
}