sobol_sequence
sobol_sequence(n, dimension=1, skip=0)Sobol quasi-random low-discrepancy sequence.
Mirrors the C# SobolSequence class. dimension > 1 needs the new-joe-kuo-6 direction numbers shipped with the package (dimension == 1 needs no file, matching the C# ctor); the packaged file is located automatically.
n and dimension are validated rather than passed through to the C++ layer, which would otherwise silently return an empty result for a non-positive value instead of raising an error.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| n | int | Number of points to generate, at least 1. | required |
| dimension | int | Spatial dimension, between 1 and 21201. Default 1. | 1 |
| skip | int | Number of points to skip before the first returned point: skip=k returns the same first point as the C# SkipTo(k) call, i.e. the sequence’s (k + 1)-th point. Default 0 (no skip). |
0 |
Returns
| Name | Type | Description |
|---|---|---|
| numpy.ndarray | An (n, dimension) array, every value in [0, 1). |
Examples
>>> from corehydropy import sobol_sequence
>>> sobol_sequence(1, dimension=2)
array([[0.5, 0.5]])