Skip to main content

C++ accelerated FPM quantum simulation primitives with Python bindings

Project description

fpm-qsim

C++ accelerated FPM quantum-simulation primitives exposed as a Python extension module.

Install from PyPI:

pip install fpm-qsim

Use it from Python:

import fpm_cpp as fpm

Layout

.
├── src/
│   ├── fpm_core.hpp          # Header-only C++17 FPM core
│   └── fpm_cpp_bindings.cpp  # pybind11 extension bindings
├── scripts/
│   └── build.sh              # Manual Linux/macOS/WSL build helper
├── tests/
│   ├── smoke_test.py         # Fast installed-wheel smoke test
│   └── equivalence_test.py   # Reference equivalence checks
├── pyproject.toml            # PyPI build metadata
├── setup.py                  # Extension build configuration
├── MANIFEST.in               # Source distribution contents
└── README.md

Example

import numpy as np
import fpm_cpp as fpm

rho0 = np.array([[0.5, 0.5], [0.5, 0.5]], dtype=np.complex128)

rho1 = fpm.lindblad_step(
    rho0,
    gamma=0.1,
    dt=1.0,
    method="exact",
    use_omp=False,
)

traj = fpm.simulate(
    rho0,
    gamma=0.05,
    dt=1.0,
    n_steps=1000,
    method="exact",
    use_omp=True,
)

fpm.bounded_gamma(29.3)

Build From Source

PyPI installs prebuilt wheels when available. If no wheel matches your platform, pip builds from source and requires:

  • Python 3.9+
  • NumPy
  • pybind11
  • A C++17 compiler

Manual local build:

python -m pip install pybind11 numpy
./scripts/build.sh
python tests/smoke_test.py

On Windows, normal pip install fpm-qsim builds with MSVC when a matching wheel is unavailable.

API Surface

The extension module is fpm_cpp.

Core functions:

  • lindblad_step(rho, gamma, dt=1.0, method="exact", use_omp=True)
  • simulate(rho0, gamma, dt=1.0, n_steps=1, method="exact", use_omp=True)
  • kappa_from_gamma(gamma, dt=1.0)
  • kappa_exact(gamma, dt=1.0)
  • gamma_from_kappa(kappa, dt=1.0)
  • bounded_gamma(gamma_raw, gamma_max=GAMMA_MAX)
  • gamma_from_energy(daemon, gate_power, load=None, dt=1.0, C_N=1.0, bounded=True)

State and accounting:

  • DaemonState
  • ConservationLedger
  • exp_route_cost(taylor_order=8)
  • bill_exp_route_cost(ledger, daemon, taylor_order=8, cost_per_op=1e-5)

Constants:

  • GAMMA_MAX
  • FALSIFICATION_THRESHOLD
  • ENERGY_FLOOR_FRACTION
  • ISOTROPIC_WEIGHT_LIMIT

Verification

After installing or building locally:

python tests/smoke_test.py

tests/equivalence_test.py is retained for reference comparison workflows that also have the old Python implementation available.

License

MIT

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

fpm_qsim-0.2.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

fpm_qsim-0.2.0-cp314-cp314-win_amd64.whl (140.2 kB view details)

Uploaded CPython 3.14Windows x86-64

File details

Details for the file fpm_qsim-0.2.0.tar.gz.

File metadata

  • Download URL: fpm_qsim-0.2.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for fpm_qsim-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2bd8b8337baf75099d575b82e320d89267349a53b63f002fb18d73a6b8c45a2c
MD5 e66cd75ba06da08a4ac7c2bea2f5328f
BLAKE2b-256 245ce30b7f2b0b49befa3abf064d8371923bc9938923776aa875126eef9bf337

See more details on using hashes here.

File details

Details for the file fpm_qsim-0.2.0-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: fpm_qsim-0.2.0-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 140.2 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for fpm_qsim-0.2.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 bd98620f9ed0679f695737733eaf1e93ed223b483084561f4aa90b99a7a25eb6
MD5 9f538c3d5b976c17350e7b764ed68d40
BLAKE2b-256 0dfc021338c080649974bdb174bf459fcfd01fabc3fef20ec411aa1a45e4933d

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