Last updated: 2023-03-16.
tf_quant_finance.math.random.sobol.sample#
Returns num_results samples from the Sobol sequence of dimension dim.
tf_quant_finance.math.random.sobol.sample(
dim, num_results, skip=0, validate_args=False, dtype=None, name=None
)
Uses the original ordering of points, not the more commonly used Gray code ordering. Derived from notes by Joe & Kuo[1].
[1] describes bitwise operations on binary floats. The implementation below achieves this by transforming the floats into ints, being careful to align the digits so the bitwise operations are correct, then transforming back to floats.
Args:#
dim: Positive Pythonintrepresenting each sample’sevent_size.num_results: Positive scalarTensorof dtype int32. The number of Sobol points to return in the output.skip: Positive scalarTensorof dtype int32. The number of initial points of the Sobol sequence to skip.validate_args: Pythonbool. WhenTrue, inputTensor'sare checked for validity despite possibly degrading runtime performance. The checks verify thatdim >= 1,num_results >= 1,skip >= 0and whethernum_results + skip < 2**31 - 1. WhenFalseinvalid inputs may silently render incorrect outputs. Default value: False.dtype: Optionaldtype. The dtype of the outputTensor(eitherfloat32orfloat64). Default value:Nonewhich maps to thefloat32.name: Pythonstrname prefixed to ops created by this function.
Returns:#
Tensor of samples from Sobol sequence with shape [n, dim].
References#
[1]: S. Joe and F. Y. Kuo. Notes on generating Sobol sequences. August 2008. https://web.maths.unsw.edu.au/~fkuo/sobol/joe-kuo-notes.pdf