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

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.3
File Size Uploaded Provenance
qmc_sampler-1.0.3.tar.gz 8.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 17.2 kB

Release files / qmc_sampler-1.0.3.tar.gz

Download URL qmc_sampler-1.0.3.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
27f34814753ab11a547bb5f51173c3efbd8608a7cf2fb98b757f19f7ce264d9f
BLAKE2b-256 checksum
How to use checksums
c392529eeda38fc0947e02236813be549bf65a987eb4c8f473657f514220160c
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.3-py3-none-any.whl

Download URL qmc_sampler-1.0.3-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9730c35acf07acb2f35fd06072f5ae171bd730f1e8ba383628335593151a3e89
BLAKE2b-256 checksum
How to use checksums
be43a925f450befc63dedcee45a2a4e790c945967c6847be6d43bf1359ef2559
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.3

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