Skip to main content

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 version
  • coverage: Code coverage
  • type: Type check
  • lint: Lint check
  • format: Format check
  • docs: Build documentation

Run code checks directly

Running the code checks directly using the corresponding software tool is also useful, for example, for automatically fixing lint or format errors.

Run tests

pytest

Run type check

mypy

Fix lint errors

ruff check --fix

Fix formatting errors

ruff format

Build and view documentation

After running

tox run -e docs

open the file docs/_build/html/index.html in your web browser.

Note that building the docs can consume significant CPU because the tutorial notebooks are executed. To avoid executing the notebooks, you can change the value of nbsphinx_execute to "never" in docs/conf.py.

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


Download files

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

Source Distribution

ffsim-0.0.25.tar.gz (110.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ffsim-0.0.25-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.0 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

ffsim-0.0.25-cp38-abi3-macosx_10_12_x86_64.whl (514.1 kB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file ffsim-0.0.25.tar.gz.

File metadata

  • Download URL: ffsim-0.0.25.tar.gz
  • Upload date:
  • Size: 110.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for ffsim-0.0.25.tar.gz
Algorithm Hash digest
SHA256 70556e0c1de294f1f0d904f0bf29e8cf1ec85f4b2854b878202f09b0be559f97
MD5 14be7997b5a2532367fa82b25a9562d2
BLAKE2b-256 64573236ab2cf65c6f8fcd537635941eb0596731bffbb6175251b5b7bad57857

See more details on using hashes here.

File details

Details for the file ffsim-0.0.25-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ffsim-0.0.25-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ca15a69f3be289471c51244fdd850caeda76ca5c2735be028e2bfa770aa078bb
MD5 1a5ca7aeab36336539589c14f2722d3e
BLAKE2b-256 52e32dd7e7a3178029d1787d07d02f6337d9e508c0f7ba3a7025e6fc5c4a69ae

See more details on using hashes here.

File details

Details for the file ffsim-0.0.25-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ffsim-0.0.25-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6a799da5680d5bdbba5d8907689f50c1c2c2172505cf3a0d143948c61091077a
MD5 97b9eafb6e43e9aac370a7b2acf7b8f7
BLAKE2b-256 ccf8f14446ce18a7021395c15d169c64a45e1b04a1677e4cbcdf23c4b4036166

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page