Faster simulations of fermionic quantum circuits.
Project description
ffsim
Faster simulations of fermionic quantum circuits.
What is ffsim?
ffsim is a software library for simulating fermionic quantum circuits that conserve particle number and the Z component of spin. This category includes many quantum circuits used for quantum chemistry simulations. By exploiting the symmetries and using specialized algorithms, ffsim can simulate these circuits much faster than a generic quantum circuit simulator.
Experimental disclaimer: ffsim is currently an experimental release. Breaking changes may be introduced without warning.
Documentation
Documentation is located at the project website.
Supported platforms
ffsim is supported on Linux, macOS, and the Windows Subsystem for Linux (WSL). It is not supported on Windows.
Installation
From PyPI
ffsim is available on PyPI. It can be installed by running the command
pip install ffsim
From source
Installing ffsim from source requires the following system dependencies:
- A Rust compiler. See these instructions.
- A BLAS implementation.
- On macOS, ffsim uses the Accelerate framework that is included with the operating system, so no action is required.
- On Linux, ffsim uses OpenBLAS. You may be able to install it using your system package manager:
-
Arch Linux:
sudo pacman -S blas-openblas
-
Fedora:
sudo dnf install openblas-devel
-
Ubuntu:
sudo apt install libopenblas-dev
-
Once these dependencies are satisfied, ffsim can be installed by running the command
pip install .
from the root directory of the code repository.
Development
Setup
To set up ffsim for development, install it from source in editable mode along with the development requirements:
pip install -e ".[dev]"
To install the git pre-commit hooks, run
pre-commit install
Rust
If you add or modify any Rust modules, rebuild them by running the command
maturin develop
If you are benchmarking the code, then pass the --release
flag:
maturin develop --release
Run code checks using tox
You can run tests and other code checks using tox. To run all checks, simply run
tox
To run a specific check, run
tox run -e <environment name>
substituting <environment name>
with the name of the tox environment for the check. The following environments are available:
py38
,py39
,py310
,py311
,py312
: Run tests for a specific Python versioncoverage
: Code coveragetype
: Type checklint
: Lint checkformat
: Format checkdocs
: Build documentation
Run code checks directly
Running the code checks directly using the corresponding software tool can be useful and allows you to:
- Automatically fix lint and formatting errors.
- Build the documentation without deleting cached files.
Run tests
pytest
Run type check
mypy
Fix lint errors
ruff check --fix
Fix formatting errors
ruff format
Build documentation
sphinx-build -b html -W docs/ docs/_build/html
View locally built documentation
After building the docs using either the tox command or the sphinx command, open the file docs/_build/html/index.html
in your web browser. For rapid iterations, the sphinx command is preferred because it retains cached files.
Building the documentation can consume significant CPU because the tutorial notebooks are executed.
The tox command deletes cached files so it will execute all the notebooks every time, while the sphinx command only executes notebooks if they were modified from the previous run.
Cite ffsim
You can cite ffsim using the following BibTeX:
@software{ffsim,
author = {{The ffsim developers}},
title = {ffsim},
url = {https://github.com/qiskit-community/ffsim}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file ffsim-0.0.27.tar.gz
.
File metadata
- Download URL: ffsim-0.0.27.tar.gz
- Upload date:
- Size: 119.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f19e4642da768a72a4b3cf72258ea4eafd906ecdcce5a63289d050ca3ae720c |
|
MD5 | 6a0609bb582bdd5a8aaf8fcbd5d10941 |
|
BLAKE2b-256 | 2b070c10eb6fcdd094f4ebf0e0a97d52b50a437c092d5d05fd5ecf25c96bfc36 |
Provenance
File details
Details for the file ffsim-0.0.27-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: ffsim-0.0.27-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 13.0 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84e40392db7f7d4cd347d6d55b52b1c476115b688f45192f02dd3ac0aa007bfb |
|
MD5 | e5e970c7de3ee7245888901b6bfd1adc |
|
BLAKE2b-256 | f583d0c27aeec7a37490861fe5a194c79cf8add20a1d0b55e215b34bfe3cde71 |
Provenance
File details
Details for the file ffsim-0.0.27-cp38-abi3-macosx_10_12_x86_64.whl
.
File metadata
- Download URL: ffsim-0.0.27-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 524.3 kB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8c911c0a0e4f7a421b86fceadf402580afc7f0bb00fec91bda49e2bf30ff2b7 |
|
MD5 | 9dad52feaadc35783ddc963fc9946167 |
|
BLAKE2b-256 | bfc3a711cd4311b8ea30247d8949771a9f5a2fcd912b47d6da2394f4dc9c54cf |