Skip to main content

High-performance quantum simulator for matrix-free Hamiltonian evolution

Project description

quantlop

High-performance quantum simulator for matrix-free Hamiltonian evolution

quantlop quantlop

Build and test Documentation PyPI version Python 3.11+ License

Introduction

quantlop is a high-performance simulator for the time evolution of quantum systems whose Hamiltonians can be written as sparse sums of Pauli words.

Rather than constructing the full Hamiltonian matrix, quantlop applies each Pauli word as a linear operator directly to the state vector. It then uses a Krylov method to numerically approximate the action of the matrix exponential. This matrix-free approach dramatically reduces memory usage and avoids costly dense-matrix operations, making larger simulations more practical.

Installation

Install the latest release of the package directly from PyPI with:

pip install quantlop

Quick example

Here is a simple code example using quantlop native data structures:

import numpy as np
import quantlop as ql

num_qubits = 3

# define Hamiltonian in Pauli basis
pwords = [
    ql.PauliWord(coeff=0.5, string="ZZI"),
    ql.PauliWord(coeff=0.2, string="YIX"),
]
ham = ql.Hamiltonian(pwords=pwords)

# set initial state vector
psi = np.zeros(2**num_qubits, dtype=complex)
psi[0] = 1.0

# evolve state vector
evolved_psi = ql.evolve(ham, psi)

The library also provides class methods to import Hamiltonians directly from other quantum computing frameworks:

  • ql.Hamiltonian.from_pennylane to build from PennyLane Hamiltonian objects
  • ql.Hamiltonian.from_qiskit to build from Qiskit SparsePauliOp objects

Multi-threading

Evolution is serial by default. Set num_threads to a positive integer to use that many OpenMP threads, or to "auto" to use the CPU count reported by the operating system:

evolved_psi = ql.evolve(ham, psi, num_threads="auto")

Development

The Python package is built with scikit-build-core, while the numerical C++ code is kept in the standalone quantlop_core CMake target.

Build project from source in dev mode and run Python tests with:

python -m pip install -e .[dev]
python -m pytest -v

Build the native C++ target from source with:

cmake -S . -B build
cmake --build build

Install pre-commit hook to format Python and C++ code automatically:

pre-commit install

Check the examples in the API docstrings and build the documentation locally with:

python -m sphinx -b doctest -W docs site
python -m sphinx -W docs site

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

quantlop-0.0.4.tar.gz (275.3 kB view details)

Uploaded Source

Built Distributions

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

quantlop-0.0.4-cp314-cp314-win_amd64.whl (84.4 kB view details)

Uploaded CPython 3.14Windows x86-64

quantlop-0.0.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (205.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

quantlop-0.0.4-cp314-cp314-macosx_15_0_arm64.whl (319.1 kB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

quantlop-0.0.4-cp313-cp313-win_amd64.whl (82.2 kB view details)

Uploaded CPython 3.13Windows x86-64

quantlop-0.0.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (205.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

quantlop-0.0.4-cp313-cp313-macosx_15_0_arm64.whl (319.0 kB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

quantlop-0.0.4-cp312-cp312-win_amd64.whl (82.3 kB view details)

Uploaded CPython 3.12Windows x86-64

quantlop-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (205.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

quantlop-0.0.4-cp312-cp312-macosx_15_0_arm64.whl (319.1 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

quantlop-0.0.4-cp311-cp311-win_amd64.whl (83.1 kB view details)

Uploaded CPython 3.11Windows x86-64

quantlop-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (206.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

quantlop-0.0.4-cp311-cp311-macosx_15_0_arm64.whl (320.2 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

Details for the file quantlop-0.0.4.tar.gz.

File metadata

  • Download URL: quantlop-0.0.4.tar.gz
  • Upload date:
  • Size: 275.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for quantlop-0.0.4.tar.gz
Algorithm Hash digest
SHA256 d87a0ad879fdc6cfd1dc7ceb02a3df57be2dd1579bd772b6a09ee91f081186af
MD5 9ca0736d8ec4797ab204c023f483ad08
BLAKE2b-256 bbafc25056258fd6ff0d948a5584ff84bcb779c8c76491c4627131e97b47f20c

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4.tar.gz:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: quantlop-0.0.4-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 84.4 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for quantlop-0.0.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 c9a0825a22c3418f17780e0b47cd27eb94b54c8cc2a338921b983f642348bfd4
MD5 05d5be7635d296e3514875048b0f86ff
BLAKE2b-256 7c68688a7bf900097d3f5ee83c5d8fe5a584dc22f95ec2af105aed99e8e8ff66

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp314-cp314-win_amd64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cff24f69da0b313bf364d290e6dc1cd11754d872fb109a86a0bbf24ae98416cb
MD5 2d3c5880866060619774ee690b7ef225
BLAKE2b-256 942e41961e84c08ec4ea9e35d21db6694b3133658dc5ee7f57832fc654f63000

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 3aa8e0770f6b52b4767a2d73c18b2a3586b5778206624bfc0782874d27d7e629
MD5 672509091bea0a918429df82f669cf61
BLAKE2b-256 d606937d80c3d62700e550a57087bc14395ba063037aac8dc17572a18cb7c5a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp314-cp314-macosx_15_0_arm64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: quantlop-0.0.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 82.2 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for quantlop-0.0.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 60063364f339940f60c11f847206d5b2cdc0674c5063bc6d77a4834eb953b996
MD5 4dd5f8e89c19abede8f0c7e11b690da3
BLAKE2b-256 1e0291521d6973529e56baccd3a373aacbffd66f97422ac2f627f2b2cb59fb34

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp313-cp313-win_amd64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 15f3fe508e35c887b1d486bfb9c8ee225e199e546ff66929bb4f1aa8eb6f8b0d
MD5 d0793c1cf6284f97899068b56c130ddd
BLAKE2b-256 5795dff0b937b3207ece02e64e3cb0c55ef0f28b6ce67211d330cef50772343e

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 6b57bae3ef16d37a094c13fc05af0776fd359c3316011f1d63946b8c8b5345ec
MD5 7c1e35e9a27651d58efd81c59ba57fa7
BLAKE2b-256 6472d98f8f9e682eda4157a848ba148fec813b16ee9f9f159facec15367a8e53

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: quantlop-0.0.4-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 82.3 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for quantlop-0.0.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4d1fad91e7c2cce5addfa14227a2ca1fbe964f0c6662dd3c0452038a753fec37
MD5 51cc15aaa0c80fd1f5164ac07c07f788
BLAKE2b-256 8c0d3381654975be084d40036007a57f1bc623ef4ac79175936e5faa89d4eee9

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp312-cp312-win_amd64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9fabc1b2c5e48536a4288784837d888f282397c5bcecc908faa7655fe8f5f647
MD5 06cacbdd988eaea9dd70f4302584f83b
BLAKE2b-256 9f16b0713cd10807d250a13c68405af512113532869c1badaa34d05b3c366948

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 75e2e15cca3304a1b811fa57daeab0ae348ab14362538af39e12b7ad446f65e0
MD5 5050c5348d8c3908b74a986bac4a9df9
BLAKE2b-256 fcb277895a74d0eca2c2e749746b835e97b2503e54e2f20300a8313754218eee

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp312-cp312-macosx_15_0_arm64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: quantlop-0.0.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 83.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for quantlop-0.0.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 349c013c8c56bdaea219c98ba302f5ed43c561911db076b6f39847708a7345c0
MD5 f9f31ff03715f8ab06a126b81893a0ab
BLAKE2b-256 85022b3c319269463f2be2e0a4741767b642c0895970402b43357ff5e4131fdc

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp311-cp311-win_amd64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a7bb55ac91ec426539d1f998e4539f106001c9050533e780631dbc90062d7bbd
MD5 767ba6fe59c132582a49dc1cd793f25f
BLAKE2b-256 62b2849a78447eba9cb5c6c7b95f750b76d3958c364daa13f8594e09441e9909

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quantlop-0.0.4-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.4-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 ebe99db57f8a970d2b4d769d822fa6d6c95e5eefe14be52ec07ffd5544568442
MD5 f47d40abe9fc6ca429b0995470c54afb
BLAKE2b-256 0e77514ea67f6b73546082d318b12cf4665b3a5e01a11cd847d9f14ebbeefd11

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.4-cp311-cp311-macosx_15_0_arm64.whl:

Publisher: pypi.yml on SimoneGasperini/quantlop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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