SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.rng.BakerTransformedStream Class Reference

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

Inheritance diagram for umontreal.ssj.rng.BakerTransformedStream:
umontreal.ssj.rng.RandomStream

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:
void resetNextSubstream ()
 Reinitializes the stream to the beginning of its next substream:
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.
void nextArrayOfInt (int i, int j, int[] u, int start, int n)
 Fills up the array by calling nextInt (i, j).

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

Definition at line 44 of file BakerTransformedStream.java.

Constructor & Destructor Documentation

◆ BakerTransformedStream()

umontreal.ssj.rng.BakerTransformedStream.BakerTransformedStream ( RandomStream stream)

Constructs a new baker transformed stream, using the random numbers from the base stream stream.

Definition at line 53 of file BakerTransformedStream.java.

Member Function Documentation

◆ nextArrayOfDouble()

void umontreal.ssj.rng.BakerTransformedStream.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 umontreal.ssj.rng.RandomStream.

Definition at line 105 of file BakerTransformedStream.java.

◆ nextArrayOfInt()

void umontreal.ssj.rng.BakerTransformedStream.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 umontreal.ssj.rng.RandomStream.

Definition at line 123 of file BakerTransformedStream.java.

◆ nextDouble()

double umontreal.ssj.rng.BakerTransformedStream.nextDouble ( )

Returns the baker transformation of s.nextDouble() where s is the base stream.

Implements umontreal.ssj.rng.RandomStream.

Definition at line 81 of file BakerTransformedStream.java.

◆ nextInt()

int umontreal.ssj.rng.BakerTransformedStream.nextInt ( int i,
int j )

Generates a random integer in \(\{i,...,j\}\) via nextDouble (in which the baker transformation is applied).

Implements umontreal.ssj.rng.RandomStream.

Definition at line 93 of file BakerTransformedStream.java.

◆ resetNextSubstream()

void umontreal.ssj.rng.BakerTransformedStream.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\).

Implements umontreal.ssj.rng.RandomStream.

Definition at line 65 of file BakerTransformedStream.java.

◆ resetStartStream()

void umontreal.ssj.rng.BakerTransformedStream.resetStartStream ( )

Reinitializes the stream to its initial state \(I_g\): \(C_g\) and \(B_g\) are set to \(I_g\).

Implements umontreal.ssj.rng.RandomStream.

Definition at line 57 of file BakerTransformedStream.java.

◆ resetStartSubstream()

void umontreal.ssj.rng.BakerTransformedStream.resetStartSubstream ( )

Reinitializes the stream to the beginning of its current substream:

\(C_g\) is set to \(B_g\).

Implements umontreal.ssj.rng.RandomStream.

Definition at line 61 of file BakerTransformedStream.java.

◆ toString()

String umontreal.ssj.rng.BakerTransformedStream.toString ( )

Returns a string starting with "Baker transformation of " and finishing with the result of the call to the toString method of the generator.

Implements umontreal.ssj.rng.RandomStream.

Definition at line 73 of file BakerTransformedStream.java.


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