qmc-sampler 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: qmc-sampler
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: QMC sampling methods based on blue_sampler
|
|
5
|
+
Project-URL: Repository, https://github.com/For-a-few-DPPs-more/hyperuniform-samplers
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: NUFFT,QMC,hyperuniformity,point sampling,quasi-Monte Carlo,wrap-around discrepancy
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Requires-Dist: blue-sampler[keops]
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# qmc-sampler
|
|
13
|
+
|
|
14
|
+
**Quasi-Monte Carlo point sampling with spectral exclusion and discrepancy-based criteria.**
|
|
15
|
+
|
|
16
|
+
`qmc-sampler` is a lightweight wrapper around [`blue_sampler`](https://github.com/For-a-few-DPPs-more/hyperuniform-samplers) that provides several sampling methods for generating quasi-Monte Carlo (QMC) point sets.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Install from PyPI:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install qmc-sampler
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
For the optional KeOps backend:
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Available sampling methods
|
|
30
|
+
|
|
31
|
+
The package provides three sampling methods:
|
|
32
|
+
|
|
33
|
+
- **`sample_l2(N, D, **kwargs)`** — uses a classical isotropic L_2-ball as the spectral exclusion region.
|
|
34
|
+
- **`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.
|
|
35
|
+
- **`sample_wd(N, D, **kwargs)`** — uses the wrap-around discrepancy (WD), a criterion designed to further exploit low-effective-dimensionality structure.
|
|
36
|
+
|
|
37
|
+
Here, `N` denotes the number of points and `D` the dimension.
|
|
38
|
+
|
|
39
|
+
## Basic usage
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from qmc_sampler import sample_l1, sample_l2, sample_wd
|
|
43
|
+
|
|
44
|
+
N = 1000
|
|
45
|
+
D = 2
|
|
46
|
+
|
|
47
|
+
points_l2 = sample_l2(N, D)
|
|
48
|
+
points_l1 = sample_l1(N, D)
|
|
49
|
+
points_wd = sample_wd(N, D)
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Additional keyword arguments e.g. "chi = 0.4" can be passed to the sampling functions and forwarded to the underlying implementation.
|
|
54
|
+
|
|
55
|
+
## Accelerated L2 sampling with FINUFFT
|
|
56
|
+
|
|
57
|
+
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).
|
|
58
|
+
|
|
59
|
+
This backend requires a compatible GPU environment and additional dependencies. Install the appropriate extras supported by your version of `blue_sampler`, for example:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install "blue-sampler[gpu13]"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
To use the accelerated backend, overwright the default `sample_l2` implementation with:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
def sample_l2(N, D, **kwargs):
|
|
69
|
+
from blue_sampler.run.run_nufft import _nufft_pipeline
|
|
70
|
+
|
|
71
|
+
kwargs.setdefault("verbose", 0)
|
|
72
|
+
return _nufft_pipeline(N, D, **kwargs)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**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.
|
|
76
|
+
|
|
77
|
+
## Plotting utilities
|
|
78
|
+
|
|
79
|
+
The package also exposes plotting functions from `blue_sampler`:
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from qmc_sampler import plot, plot_structure_factor
|
|
83
|
+
|
|
84
|
+
plot(...)
|
|
85
|
+
plot_structure_factor(...)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Refer to the upstream documentation for the accepted arguments.
|
|
89
|
+
|
|
90
|
+
## Links
|
|
91
|
+
|
|
92
|
+
- **Source code:** [hyperuniform-samplers on GitHub](https://github.com/For-a-few-DPPs-more/hyperuniform-samplers)
|
|
93
|
+
- **Underlying package:** [blue_sampler on PyPI](https://pypi.org/project/blue-sampler/)
|
|
94
|
+
- **Upstream repository:** [Recursive Gaussian Blue Noise](https://github.com/For-a-few-DPPs-more/Recursive-Gaussian-Blue-Noise)
|
|
95
|
+
- **Documentation:** [blue-sampler.readthedocs.io](https://blue-sampler.readthedocs.io)
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|