Skip to contents

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 installed file is located automatically with system.file().

Usage

sobol_sequence(n, dimension = 1L, skip = 0L)

Arguments

n

number of points to generate, at least 1.

dimension

spatial dimension, between 1 and 21201. Default 1.

skip

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

Value

an n by dimension numeric matrix, every value in [0, 1).

Details

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.

Examples

sobol_sequence(5, dimension = 2)
#>       [,1]  [,2]
#> [1,] 0.500 0.500
#> [2,] 0.750 0.250
#> [3,] 0.250 0.750
#> [4,] 0.375 0.375
#> [5,] 0.875 0.875