naginterfaces.library.rand.quasi_init_scrambled¶
- naginterfaces.library.rand.quasi_init_scrambled(genid, stype, idim, iskip, nsdigi, statecomm)[source]¶
quasi_init_scrambled
initializes a scrambled quasi-random generator prior to callingquasi_uniform()
,quasi_normal()
orquasi_lognormal()
. It must be preceded by a call to one of the pseudorandom initialization functionsinit_repeat()
orinit_nonrepeat()
.For full information please refer to the NAG Library document for g05yn
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g05/g05ynf.html
- Parameters
- genidint
Must identify the quasi-random generator to use.
Sobol generator.
Sobol (A659) generator.
Niederreiter generator.
- stypeint
Must identify the scrambling method to use.
No scrambling. This is equivalent to calling
quasi_init()
.Owen like scrambling.
Faure–Tezuka scrambling.
Owen and Faure–Tezuka scrambling.
- idimint
The number of dimensions required.
- iskipint
The number of terms of the sequence to skip on initialization for the Sobol and Niederreiter generators.
- nsdigiint
Controls the number of digits (bits) to scramble when or , otherwise is ignored. If or then all the digits are scrambled.
- statecommdict, RNG communication object, modified in place
RNG communication structure.
This argument must have been initialized by a prior call to
init_repeat()
orinit_nonrepeat()
.
- Returns
- commdict, communication object
Communication structure.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, [‘state’] vector has been corrupted or not initialized.
- Notes
quasi_init_scrambled
selects a quasi-random number generator through the input value of , a method of scrambling through the input value of and initializes the [‘iref’] communication array for use in the functionsquasi_uniform()
,quasi_normal()
orquasi_lognormal()
.Scrambled quasi-random sequences are an extension of standard quasi-random sequences that attempt to eliminate the bias inherent in a quasi-random sequence whilst retaining the low-discrepancy properties. The use of a scrambled sequence allows error estimation of Monte Carlo results by performing a number of iterates and computing the variance of the results.
This implementation of scrambled quasi-random sequences is based on TOMS Algorithm 823 and details can be found in the accompanying paper, Hong and Hickernell (2003). Three methods of scrambling are supplied; the first a restricted form of Owen’s scrambling (Owen (1995)), the second based on the method of Faure and Tezuka (2000) and the last method combines the first two.
Scrambled versions of the Niederreiter sequence and two sets of Sobol sequences are provided. The first Sobol sequence is obtained using . The first direction numbers for this sequence are based on the work of Joe and Kuo (2008). For dimensions greater than , the direction numbers are randomly generated using the pseudorandom generator specified in [‘state’] (see Jäckel (2002) for details). The second Sobol sequence is obtained using and referred to in the documentation as ‘Sobol (A659)’. The first direction numbers for this sequence are based on Algorithm 659 of Bratley and Fox (1988) with the extension proposed by Joe and Kuo (2003). For dimensions greater than the direction numbers are once again randomly generated. The Niederreiter sequence is obtained by setting .
- References
Bratley, P and Fox, B L, 1988, Algorithm 659: implementing Sobol’s quasirandom sequence generator, ACM Trans. Math. Software (14(1)), 88–100
Faure, H and Tezuka, S, 2000, Another random scrambling of digital (t,s)-sequences, Monte Carlo and Quasi-Monte Carlo Methods, Springer-Verlag, Berlin, Germany, (eds K T Fang, F J Hickernell and H Niederreiter)
Hong, H S and Hickernell, F J, 2003, Algorithm 823: implementing scrambled digital sequences, ACM Trans. Math. Software (29:2), 95–109
Jäckel, P, 2002, Monte Carlo Methods in Finance, Wiley Finance Series, John Wiley and Sons, England
Joe, S and Kuo, F Y, 2003, Remark on Algorithm 659: implementing Sobol’s quasirandom sequence generator, ACM Trans. Math. Software (TOMS) (29), 49–57
Joe, S and Kuo, F Y, 2008, Constructing Sobol sequences with better two-dimensional projections, SIAM J. Sci. Comput. (30), 2635–2654
Niederreiter, H, 1988, Low-discrepancy and low dispersion sequences, Journal of Number Theory (30), 51–70
Owen, A B, 1995, Randomly permuted (t,m,s)-nets and (t,s)-sequences, Monte Carlo and Quasi-Monte Carlo Methods in Scientific Computing, Lecture Notes in Statistics (106), Springer-Verlag, New York, NY, 299–317, (eds H Niederreiter and P J-S Shiue)