SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
BakerTransformedStream Class Reference

This container class permits one to apply the baker’s transformation to the output of any RandomStream. More...

Inheritance diagram for BakerTransformedStream:
[legend]
Collaboration diagram for BakerTransformedStream:
[legend]

Public Member Functions

 BakerTransformedStream (RandomStream stream)
 Constructs a new baker transformed stream, using the random numbers from the base stream stream.
 
void resetStartStream ()
 Reinitializes the stream to its initial state \(I_g\): \(C_g\) and \(B_g\) are set to \(I_g\).
 
void resetStartSubstream ()
 Reinitializes the stream to the beginning of its current substream: \(C_g\) is set to \(B_g\).
 
void resetNextSubstream ()
 Reinitializes the stream to the beginning of its next substream: \(N_g\) is computed, and \(C_g\) and \(B_g\) are set to \(N_g\).
 
String toString ()
 Returns a string starting with "Baker transformation of " and finishing with the result of the call to the toString method of the generator.
 
double nextDouble ()
 Returns the baker transformation of s.nextDouble() where s is the base stream.
 
int nextInt (int i, int j)
 Generates a random integer in \(\{i,...,j\}\) via nextDouble (in which the baker transformation is applied).
 
void nextArrayOfDouble (double[] u, int start, int n)
 Calls nextArrayOfDouble (u, start, n) for the base stream, then applies the baker transformation. More...
 
void nextArrayOfInt (int i, int j, int[] u, int start, int n)
 Fills up the array by calling nextInt (i, j). More...
 

Detailed Description

This container class permits one to apply the baker’s transformation to the output of any RandomStream.

It transforms each \(u \in[0,1]\) into \(2u\) if \(u \le1/2\) and \(2(1-u)\) if \(u > 1/2\). The nextDouble method will return the result of this transformation and the other next... methods are affected accordingly. Any instance of this class contains a RandomStream called its base stream, used to generate its numbers and to which the transformation is applied. Any call to one of the next... methods of this class will modify the state of the base stream.

The baker transformation is often applied when the RandomStream is actually an iterator over a point set used for quasi-Monte Carlo integration (see the hups package).

Member Function Documentation

◆ nextArrayOfDouble()

void nextArrayOfDouble ( double []  u,
int  start,
int  n 
)

Calls nextArrayOfDouble (u, start, n) for the base stream, then applies the baker transformation.

Parameters
uthe array in which the numbers will be stored
startthe first index of u to be used
nthe number of random numbers to put in u

Implements RandomStream.

◆ nextArrayOfInt()

void nextArrayOfInt ( int  i,
int  j,
int []  u,
int  start,
int  n 
)

Fills up the array by calling nextInt (i, j).

Parameters
ithe smallest possible integer to put in u
jthe largest possible integer to put in u
uthe array in which the numbers will be stored
startthe first index of u to be used
nthe number of random numbers to put in u

Implements RandomStream.


The documentation for this class was generated from the following file: