Skip to main content

qmc-sampler

Quasi-Monte Carlo point sampling with spectral exclusion and discrepancy-based criteria.

qmc-sampler is a lightweight wrapper around blue_sampler that provides several sampling methods for generating quasi-Monte Carlo (QMC) point sets.

Installation

Install from PyPI:

pip install qmc-sampler

For the optional KeOps backend:

Available sampling methods

The package provides three sampling methods:

  • sample_l2(N, D, **kwargs) — uses a classical isotropic L_2-ball as the spectral exclusion region.
  • sample_l1(N, D, **kwargs) — uses an L_1-ball, producing an anisotropic spectral exclusion region that can be useful when exploiting low effective dimensionality.
  • sample_wd(N, D, **kwargs) — uses the wrap-around discrepancy (WD), a criterion designed to further exploit low-effective-dimensionality structure.

Here, N denotes the number of points and D the dimension.

Basic usage

from qmc_sampler import sample_l1, sample_l2, sample_wd

N = 1000
D = 2

points_l2 = sample_l2(N, D)
points_l1 = sample_l1(N, D)
points_wd = sample_wd(N, D)

Additional keyword arguments e.g. "chi = 0.4" can be passed to the sampling functions and forwarded to the underlying implementation.

Accelerated L2 sampling with FINUFFT

For supported 2D and 3D problems, blue_sampler provides an accelerated NUFFT-based implementation that can reduce the computational complexity from approximately O(N^2) to O(N\log N).

This backend requires a compatible GPU environment and additional dependencies. Install the appropriate extras supported by your version of blue_sampler, for example:

pip install "blue-sampler[gpu13]"

To use the accelerated backend, overwright the default sample_l2 implementation with:

def sample_l2(N, D, **kwargs):
    from blue_sampler.run.run_nufft import _nufft_pipeline

    kwargs.setdefault("verbose", 0)
    return _nufft_pipeline(N, D, **kwargs)

Note: This uses a private function from blue_sampler (indicated by the leading underscore), so its API may change between versions. The accelerated backend also requires compatible GPU dependencies and is intended for supported 2D and 3D problems.

Plotting utilities

The package also exposes plotting functions from blue_sampler:

from qmc_sampler import plot, plot_structure_factor

plot(...)
plot_structure_factor(...)

Refer to the upstream documentation for the accepted arguments.

License

MIT

Metadata

Release files for qmc-sampler 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qmc-sampler 1.0.0
File Size Uploaded Provenance
qmc_sampler-1.0.0.tar.gz 9.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for qmc-sampler 1.0.0
File Interpreter ABI Platform
qmc_sampler-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / qmc_sampler-1.0.0.tar.gz

Download URL qmc_sampler-1.0.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
35303d218a9160d0ef38bff117f0377c2d1860a330bfe21ee47b8b5b616e165e
BLAKE2b-256 checksum
How to use checksums
048b9d2c86835fab755c92c1af735506e8885ac064b919cd39846a7324717f34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / qmc_sampler-1.0.0-py3-none-any.whl

Download URL qmc_sampler-1.0.0-py3-none-any.whl
Size 2.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cbc4b645a294082f164aaba3667b32996b136b3e673277da84e7521d3446399
BLAKE2b-256 checksum
How to use checksums
f1885752c5b65ce15d6c5af7f8bddd4a9a30e65a06b389bb11f42c61dbeaf025
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for qmc-sampler 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page