Skip to main content

PyPI version Build Status

Sobol

Concise implementation of the Sobol sequence for generating low-discrepancy quasi-random numbers in up to 1111 dimensions.

Note: scipy>=1.7 features a qmc module with a better Sobol implementation.

Install

pip install sobolsequence

Usage

import sobol

sobol.sample(dimension=3, n_points=5)
array([[0.5  , 0.5  , 0.5  ],
       [0.75 , 0.25 , 0.75 ],
       [0.25 , 0.75 , 0.25 ],
       [0.375, 0.375, 0.625],
       [0.875, 0.875, 0.125]])

Skip the first n points:

sobol.sample(dimension=3, n_points=5, skip=10000)

Sample point by point using the underlying generator:

sob = sobol.generator(dimension=5)
for i in range(10):
    print(next(sob))

References

This implementation is based on the Python version by Corrado Chisari available here.

  • Antonov, Saleev, USSR Computational Mathematics and Mathematical Physics, Volume 19, 1980, pages 252 - 256.
  • Paul Bratley, Bennett Fox, Algorithm 659: Implementing Sobol's Quasirandom Sequence Generator, ACM Transactions on Mathematical Software, Volume 14, Number 1, pages 88-100, 1988.
  • Bennett Fox, Algorithm 647: Implementation and Relative Efficiency of Quasirandom Sequence Generators, ACM Transactions on Mathematical Software, Volume 12, Number 4, pages 362-376, 1986.
  • Ilya Sobol, USSR Computational Mathematics and Mathematical Physics, Volume 16, pages 236-242, 1977.
  • Ilya Sobol, Levitan, The Production of Points Uniformly Distributed in a Multidimensional Cube (in Russian), Preprint IPM Akad. Nauk SSSR, Number 40, Moscow 1976.

The direction numbers from Joe and Kuo are available here.

  • Stephen Joe and Frances Kuo, Remark on Algorithm 659: Implementing Sobol's quasirandom sequence generator, ACM Trans. Math. Softw. 29, 49-57 (2003), http://doi.acm.org/10.1145/641876.641879
  • Stephen Joe and Frances Kuo, Constructing Sobol sequences with better two-dimensional projections, SIAM J. Sci. Comput. 30, 2635-2654 (2008), https://doi.org/10.1137/070709359

Metadata

Release files for SobolSequence 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SobolSequence 0.2.1
File Size Uploaded
SobolSequence-0.2.1.tar.gz 23.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SobolSequence 0.2.1
File Interpreter ABI Platform
SobolSequence-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 47.0 kB

Release files / SobolSequence-0.2.1.tar.gz

Download URL SobolSequence-0.2.1.tar.gz
Size 23.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b2b4b57451b8d2e79ddb07efa23bc471dfdd436ea357d6368666bdc364df3eb1
BLAKE2b-256 checksum
How to use checksums
13c506eae8024943bb71ab9194f00cecd3564ad7553532dd1f058be7b368cbe4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release files / SobolSequence-0.2.1-py3-none-any.whl

Download URL SobolSequence-0.2.1-py3-none-any.whl
Size 23.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5bf71252d65382773686d0943e6aac6a392bf5b814e7b294676818e331feada5
BLAKE2b-256 checksum
How to use checksums
c28f4e24bcc09e5c21d13d60107d1dcd5be34cd5238541ff6123c2072e5c74a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2

2 release files

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