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

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

Built distribution (wheel)

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

Total release size: 17.5 kB

Release files / qmc_sampler-1.0.4.tar.gz

Download URL qmc_sampler-1.0.4.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
48b37eeb29cb418ac691530a35537b0e72345d3b155212a21688d1cd21eec7b3
BLAKE2b-256 checksum
How to use checksums
8a1d9594285e2f6cbe127ea8d687e203cbfde7b8ca8adc303f0fa5b59d3fb468
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.4-py3-none-any.whl

Download URL qmc_sampler-1.0.4-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be5d48818c27948dfafaa84e2ad8bdf83856dc728fc5901b01aff760f71e21ec
BLAKE2b-256 checksum
How to use checksums
4f37cdd38d6174943ccc969bb219cf2c070969502c3e57390ff060426b178394
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.4

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