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

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.5
File Size Uploaded Provenance
qmc_sampler-1.0.5.tar.gz 8.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 17.5 kB

Release files / qmc_sampler-1.0.5.tar.gz

Download URL qmc_sampler-1.0.5.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
63746709db96041783d7192fd04c204294c51847ce9d714cafdcdbca554a99e2
BLAKE2b-256 checksum
How to use checksums
4d1b2087f6cc7e72ec130f902c816fd107b228c6d4782dd6180cedcee1a7d405
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.5-py3-none-any.whl

Download URL qmc_sampler-1.0.5-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
166e07426f008a2ff65e9d97521a54be57db835be2f604af77fd86bf4fe505cb
BLAKE2b-256 checksum
How to use checksums
243f7e1adfd3420b95c8061e381cf7fd8e976618198da9c4e8c859f36825f06a
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.5

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