Returns the next term of the sequence
[this,next] = lowdisc_next ( this ) [this,next] = lowdisc_next ( this , imax )
the current object
the number of terms to retrieve (default = 1)
a matrix of size imax x s, the next vector in the sequence. The experiment #i is stored at next(i,:) for 1<=i<=imax. The component #j of experiment #i is stored in next(i,j) with 1<=j<=dimension.
The current object is updated after the call to next : both this and next are mandatory output arguments. This function is sensitive to the "-leap" option.
Because of the limitation of floating point integers, the lowdisc_next function is able to generate at most 2^52 = 4 503 599 627 370 496 experiments. Fast sequences are based on the intermediate storage of the iteration index on a 32 bits C int. This implies that these sequences are able to generate at most 2^32-1 = 4 294 967 295 experiments.
The number of simulations might be computed so that it improves the discrepancy of the sequence. This is especially true for the Sobol, Faure and Niederreiter sequences. This can lead to some trouble for non-experts. For that purpose, we designed the following functions.
lds = lowdisc_new("halton"); lds = lowdisc_startup (lds); // Term #1 [lds,computed] = lowdisc_next (lds); disp(computed) // Term #2 [lds,computed] = lowdisc_next (lds); disp(computed) // Term #3, etc... [lds,computed] = lowdisc_next (lds); disp(computed) lds lds = lowdisc_destroy(lds); // See the imax parameter in action lds = lowdisc_new("halton"); lds = lowdisc_startup (lds); // Term #1 to 100 [lds,computed] = lowdisc_next (lds,100); // Term #101 to 201 [lds,computed] = lowdisc_next (lds,100); lds lds = lowdisc_destroy(lds); // See the -leap option in action lds = lowdisc_new("halton"); lds = lowdisc_configure(lds,"-leap",10); lds = lowdisc_startup (lds); // Term #1 [lds,computed] = lowdisc_next (lds); // Term #11 [lds,computed] = lowdisc_next (lds); // Term #21 [lds,computed] = lowdisc_next (lds); lds lds = lowdisc_destroy(lds); // See the -skip option in action. lds = lowdisc_new("fauref"); lds = lowdisc_configure(lds,"-dimension",4); // Skip qs^4 - 1 terms, as in TOMS implementation qs = lowdisc_get ( lds , "-faurefprime" ); lds = lowdisc_configure(lds,"-skip", qs^4 - 2); lds lds = lowdisc_startup (lds); [lds,computed]=lowdisc_next(lds); // Terms #1 to #100 [lds,computed]=lowdisc_next(lds,100); for i = 1:100 mprintf ("%8d %14.6f %14.6f %14.6f %14.6f\n", i , computed(i,1) , computed(i,2) , computed(i,3) , computed(i,4) ) end lds = lowdisc_destroy(lds);