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 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

The project requires Python 3.11 or later and a C++20-compatible compiler.

pip install quantlop

On macOS, install the OpenMP runtime before installing quantlop:

brew install libomp
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 classmethods to import the hamiltonian 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

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.3.tar.gz (269.9 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.3-cp314-cp314-win_amd64.whl (80.0 kB view details)

Uploaded CPython 3.14Windows x86-64

quantlop-0.0.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (200.9 kB view details)

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

quantlop-0.0.3-cp314-cp314-macosx_15_0_arm64.whl (314.7 kB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

quantlop-0.0.3-cp313-cp313-win_amd64.whl (77.8 kB view details)

Uploaded CPython 3.13Windows x86-64

quantlop-0.0.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (200.8 kB view details)

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

quantlop-0.0.3-cp313-cp313-macosx_15_0_arm64.whl (314.6 kB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

quantlop-0.0.3-cp312-cp312-win_amd64.whl (77.8 kB view details)

Uploaded CPython 3.12Windows x86-64

quantlop-0.0.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (200.9 kB view details)

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

quantlop-0.0.3-cp312-cp312-macosx_15_0_arm64.whl (314.7 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

quantlop-0.0.3-cp311-cp311-win_amd64.whl (78.7 kB view details)

Uploaded CPython 3.11Windows x86-64

quantlop-0.0.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (201.9 kB view details)

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

quantlop-0.0.3-cp311-cp311-macosx_15_0_arm64.whl (315.8 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for quantlop-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b1e380aaa51add8bbc52908c1eaf729ed935382967f9933b6ee134389cce41a9
MD5 a1bd94db53097cf34b01977265473211
BLAKE2b-256 872bee2b0a2af979c6e54af9a7f82ff95cb090d522bab3e4e9a9e7eb3eadd9ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3.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.3-cp314-cp314-win_amd64.whl.

File metadata

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

File hashes

Hashes for quantlop-0.0.3-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ed6511490bbf71aed63082fe050cbf46e357983c4679da1f3306b3c890d450b3
MD5 dbc737fc5cbaa7fb79b2b53b00ca5e88
BLAKE2b-256 170a1fc4e43469af061b68e931fa3db0549f5107697b0c19d6db0164a428b9b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f2877d40d8f7468e1202052c9ed0c7a1123996fd8ef5a8f61313397128eb2b1f
MD5 d92862d8aaa728935245bed5a5724420
BLAKE2b-256 8b81db215bc942dbe041918d5eb306ed6a1428fa9e5404bafdba116558fbd955

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 6fe800dcfcf61439150366098eb645dfabfbd5b4bc965c0b7d876b7960325612
MD5 6631aeafc43728196690257b5e4d857d
BLAKE2b-256 f0fe6d6fa13ae77d7ec244a6e0e145cda1eece83bb61ceae1a587d80da7855e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp313-cp313-win_amd64.whl.

File metadata

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

File hashes

Hashes for quantlop-0.0.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 27ba6f1cd6175f6eb967e3b714d76c3778953f915e0df66494d2c98c03d9d2d3
MD5 c2583f2b7ce14062e2eb6f6c6cdc1206
BLAKE2b-256 4dd5d01fe2ddf644997fec4c3d10b82c0b2655766ceee72c1f160a49f27e18de

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a4234ba69ef0ca7dc1397621b9373d68ba779b9fe91d2eb37b77c6ca65916505
MD5 690c4ec2bcb76f030979277c8006613d
BLAKE2b-256 03763d9628e3b8871a8eb2b3411b9239f62255cde1274c750269b948384b0502

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8cf957834b6a7652e2ff2c602737ca01a71405576e10310e69829ba03a3620a5
MD5 7341de7ad82cd6f3c182d9c7618b3112
BLAKE2b-256 a0a0c5eb38040235fa56b9fa5cdf7b4865f84eae27e39cf62c300e23f71b2b36

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp312-cp312-win_amd64.whl.

File metadata

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

File hashes

Hashes for quantlop-0.0.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 06bad5235c25c244c1b56bebaebf20624489bc524b775c7940ba96eeeb1d62bb
MD5 ab79e9d72ea89b7306c1b7baf693f93a
BLAKE2b-256 86184a066cb84e0ed880ece3de00dd138daac10a271d03b1a2b68ce3b45cb1d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1725ab1409d5479cc37a885a0ec5877b0a7cb1a54fa90819dc11bb35ae446cb8
MD5 2b745c78b6d6a5b9b289cb0825dcc089
BLAKE2b-256 873349ef2950d4fba8fcb62d7c1919d699bf473c386288ea1dbbd7b1558c2585

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 5d9a631eb339e15b57bfdc23c8a77ea6952b67625edf43003aa8ff7dd665e303
MD5 c276b52ae6ef2f374cab949b9699d942
BLAKE2b-256 e36abbccffff90bca9a74a0fbc34a280625325a536899ebceef82dbc96b52f69

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp311-cp311-win_amd64.whl.

File metadata

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

File hashes

Hashes for quantlop-0.0.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 179194773ba518047fcda77a61ef4ba385fd2029bbb86fd9800dbf25eecdfeb4
MD5 3b8f63bdee129faa15de0545e2d6f97f
BLAKE2b-256 a01cb7f1b60ff997448621033e1745c1599e969c3dcbcb2b2168d3cd0c23c0e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 050d3200acb7d7525bf0cb63aa9d7ea11286fba112c3ab9f3637cf1197f71da4
MD5 620bf830e1f75a669898f08c30f8e1de
BLAKE2b-256 b153e556dc8a083b1c37030c0af9a4aca6704c07d2de9f64012460da567049cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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.3-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for quantlop-0.0.3-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8734bcf5784a839f671a4495fe2852a986b207318cc1fbc9043413d971e58abd
MD5 3163bb55dd0117f8fae48fdae463fb42
BLAKE2b-256 8f9f1a9641bd9728e7ad5811c0de83a744cb34ec86bacd8ff6af720fd0bf4e46

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantlop-0.0.3-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