Skip to content

Commit

Permalink
Merge pull request #19 from michaelosthege/sobol_seq
Browse files Browse the repository at this point in the history
  • Loading branch information
naught101 committed Feb 24, 2020
2 parents 6ac1799 + 6e8500d commit 8f819b6
Show file tree
Hide file tree
Showing 4 changed files with 355 additions and 369 deletions.
28 changes: 15 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from setuptools import setup

setup(name='sobol_seq',
version='0.1.2',
description='Sobol sequence generator',
url='https://github.com/naught101/sobol_seq',
author='naught101',
author_email='[email protected]',
license='MIT',
packages=['sobol_seq'],
install_requires=[
'scipy',
'numpy'
],
zip_safe=False)
setup(
name='sobol_seq',
version='0.2.0',
description='Sobol sequence generator',
url='https://github.com/naught101/sobol_seq',
author='naught101',
author_email='[email protected]',
license='MIT',
packages=['sobol_seq'],
install_requires=[
'scipy',
'numpy'
],
zip_safe=False
)
9 changes: 3 additions & 6 deletions sobol_seq/sobol_seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def i4_bit_lo0(n):
return bit


def i4_sobol_generate(dim_num, n, skip=1):
def i4_sobol_generate(dim_num, n, skip=0):
"""
i4_sobol_generate generates a Sobol dataset.
Expand All @@ -124,13 +124,12 @@ def i4_sobol_generate(dim_num, n, skip=1):
"""
r = np.full((n, dim_num), np.nan)
for j in range(n):
seed = j + skip
r[j, 0:dim_num], next_seed = i4_sobol(dim_num, seed)
r[j, :], _ = i4_sobol(dim_num, seed=1+skip+j)

return r


def i4_sobol_generate_std_normal(dim_num, n, skip=1):
def i4_sobol_generate_std_normal(dim_num, n, skip=0):
"""
Generates multivariate standard normal quasi-random variables.
Expand All @@ -141,9 +140,7 @@ def i4_sobol_generate_std_normal(dim_num, n, skip=1):
Output, real np array of shape (n, dim_num).
"""

sobols = i4_sobol_generate(dim_num, n, skip)

normals = norm.ppf(sobols)

return normals
Expand Down
Empty file added tests/__init__.py
Empty file.
Loading

0 comments on commit 8f819b6

Please sign in to comment.