SSJ
3.2.1
Stochastic Simulation in Java
|
Public Member Functions | |
void | setCurCoordIndex (int j) |
Sets the current coordinate index to \(j\), so that the next calls to nextCoordinate or #nextCoordinates will return the values \(u_{i,j}, u_{i,j+1}, …\), where \(i\) is the index of the current point. More... | |
void | resetCurCoordIndex () |
Equivalent to setCurCoordIndex(0). | |
int | getCurCoordIndex () |
Returns the index \(j\) of the current coordinate. More... | |
boolean | hasNextCoordinate () |
Returns true if the current point has another coordinate. More... | |
double | nextCoordinate () |
Returns the current coordinate \(u_{i,j}\) and advances to the next one. More... | |
void | nextCoordinates (double p[], int d) |
void | setCurPointIndex (int i) |
Resets the current point index to \(i\) and the current coordinate index to zero. More... | |
void | resetCurPointIndex () |
Equivalent to setCurPointIndex(0). | |
int | resetToNextPoint () |
Increases the current point index by 1 and returns its new value. More... | |
int | getCurPointIndex () |
Returns the index \(i\) of the current point. More... | |
boolean | hasNextPoint () |
Returns true if there is a next point. More... | |
int | nextPoint (double p[], int fromDim, int d) |
int | nextPoint (double p[], int d) |
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\). | |
void | setAntithetic (boolean b) |
double | nextDouble () |
Returns a (pseudo)random number from the uniform distribution over the interval \((0,1)\), using this stream, after advancing its state by one step. More... | |
void | nextArrayOfDouble (double[] u, int start, int n) |
Generates n (pseudo)random numbers from the uniform distribution and stores them into the array u starting at index start . More... | |
int | nextInt (int i, int j) |
Returns a (pseudo)random number from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream. More... | |
void | nextArrayOfInt (int i, int j, int[] u, int start, int n) |
Generates n (pseudo)random numbers from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream and stores the result in the array u starting at index start . More... | |
String | formatState () |
![]() | |
void | nextCoordinates (double[] p, int d) |
Returns the next d coordinates of the current point in p and advances the current coordinate index by d . More... | |
int | nextPoint (double[] p, int fromDim, int d) |
Returns in p the next d coordinates of the current point, starting at coordinate fromDim (i.e., after skipping fromDim coordinates), then advances to the next point and returns the index of the new current point. More... | |
int | nextPoint (double[] p, int d) |
Same as nextPoint(p, 0, d). | |
![]() | |
String | toString () |
Returns a string containing the current state of this stream. More... | |
Protected Member Functions | |
void | outOfBounds () |
Protected Attributes | |
int | curPointIndex = 0 |
int | curCoordIndex = 0 |
double | EpsilonHalf = 1.0 / Num.TWOEXP[55] |
int getCurCoordIndex | ( | ) |
Returns the index \(j\) of the current coordinate.
This may be useful, e.g., for testing if enough coordinates are still available.
Implements PointSetIterator.
int getCurPointIndex | ( | ) |
Returns the index \(i\) of the current point.
This can be useful, e.g., for caching point sets.
Implements PointSetIterator.
boolean hasNextCoordinate | ( | ) |
Returns true
if the current point has another coordinate.
This can be useful for testing if coordinates are still available.
true
if the current point has another coordinate Implements PointSetIterator.
boolean hasNextPoint | ( | ) |
Returns true
if there is a next point.
This can be useful for testing if points are still available.
true
if a next point is available from the iterated point set Implements PointSetIterator.
void nextArrayOfDouble | ( | double [] | u, |
int | start, | ||
int | n | ||
) |
Generates n
(pseudo)random numbers from the uniform distribution and stores them into the array u
starting at index start
.
u | array that will contain the generated uniforms |
start | starting index, in the array u , to write uniforms from |
n | number of uniforms to generate |
Implements RandomStream.
void nextArrayOfInt | ( | int | i, |
int | j, | ||
int [] | u, | ||
int | start, | ||
int | n | ||
) |
Generates n
(pseudo)random numbers from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream and stores the result in the array u
starting at index start
.
(Calls nextInt
n
times.)
i | smallest integer that can be generated |
j | greatest integer that can be generated |
u | array that will contain the generated values |
start | starting index, in the array u , to write integers from |
n | number of values being generated |
Implements RandomStream.
double nextCoordinate | ( | ) |
Returns the current coordinate \(u_{i,j}\) and advances to the next one.
If no current coordinate is available (either because the current point index has reached the number of points or because the current coordinate index has reached the number of dimensions), it throws a NoSuchElementException.
NoSuchElementException | if no such coordinate is available |
Implements PointSetIterator.
double nextDouble | ( | ) |
Returns a (pseudo)random number from the uniform distribution over the interval \((0,1)\), using this stream, after advancing its state by one step.
The generators programmed in SSJ never return the values 0 or 1.
Implements RandomStream.
int nextInt | ( | int | i, |
int | j | ||
) |
Returns a (pseudo)random number from the discrete uniform distribution over the integers \(\{i,i+1,…,j\}\), using this stream.
(Calls nextDouble
once.)
i | smallest integer that can be generated |
j | greatest integer that can be generated |
Implements RandomStream.
int resetToNextPoint | ( | ) |
Increases the current point index by 1 and returns its new value.
If there is no more point, an exception will be raised only if we ask for a new coordinate or point later on.
Implements PointSetIterator.
void setCurCoordIndex | ( | int | j | ) |
Sets the current coordinate index to \(j\), so that the next calls to nextCoordinate or #nextCoordinates will return the values \(u_{i,j}, u_{i,j+1}, …\), where \(i\) is the index of the current point.
This can be useful to skip certain coordinates for each point, for example.
j | index of the new current coordinate |
Implements PointSetIterator.
void setCurPointIndex | ( | int | i | ) |
Resets the current point index to \(i\) and the current coordinate index to zero.
If i
is larger or equal to the number of points, an exception will not be raised here, but only later if we ask for a new coordinate or point.
i | new index of the current point |
Implements PointSetIterator.