SSJ  3.3.1
Stochastic Simulation in Java
Classes | Public Member Functions | Protected Attributes | List of all members
DigitalNetBase2 Class Reference

A special case of DigitalNet for the base \(b=2\). More...

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

Classes

class  DigitalNetBase2Iterator
 
class  DigitalNetBase2IteratorNoGray
 

Public Member Functions

void printGeneratorMatrices (int s)
 Prints the generator matrices as bit matrices in standard form for dimensions 1 to \(s\). More...
 
void printGeneratorMatricesTrans (int s)
 Prints the generator matrices transposed in the form of integers for dimensions 1 to \(s\). More...
 
double getCoordinate (int i, int j)
 
double getCoordinateNoGray (int i, int j)
 
PointSetIterator iterator ()
 Returns a DigitalNetBase2Iterator which enumerates the points using a Gray code.
 
PointSetIterator iteratorNoGray ()
 This iterator does not use the Gray code. More...
 
String toString ()
 
void clearRandomShift ()
 
void addRandomShift (int d1, int d2, RandomStream stream)
 
void addRandomShift (RandomStream stream)
 
void leftMatrixScramble (RandomStream stream)
 
void iBinomialMatrixScramble (RandomStream stream)
 
void stripedMatrixScramble (RandomStream stream)
 
void rightMatrixScramble (RandomStream stream)
 
void nestedUniformScramble (RandomStream stream, double[][] output)
 Same as nestedUniformScramble(stream, output, 0) .
 
void nestedUniformScramble (RandomStream stream, double[][] output, int numBits)
 Apply Owen's nested uniform scrambling. More...
 
void leftMatrixScrambleDiag (RandomStream stream)
 
void leftMatrixScrambleFaurePermut (RandomStream stream, int sb)
 
void leftMatrixScrambleFaurePermutDiag (RandomStream stream, int sb)
 
void leftMatrixScrambleFaurePermutAll (RandomStream stream, int sb)
 
void iBinomialMatrixScrambleFaurePermut (RandomStream stream, int sb)
 
void iBinomialMatrixScrambleFaurePermutDiag (RandomStream stream, int sb)
 
void iBinomialMatrixScrambleFaurePermutAll (RandomStream stream, int sb)
 
void stripedMatrixScrambleFaurePermutAll (RandomStream stream, int sb)
 
- Public Member Functions inherited from DigitalNet
 DigitalNet ()
 Empty constructor.
 
double getCoordinate (int i, int j)
 Returns \(u_{i',j}\), the coordinate \(j\) of point \(i'\), where \(i'\) is the Gray code for \(i\). More...
 
PointSetIterator iterator ()
 
double getCoordinateNoGray (int i, int j)
 Returns \(u_{i,j}\), the coordinate \(j\) of point \(i\), the points being enumerated in the standard order (no Gray code). More...
 
PointSetIterator iteratorNoGray ()
 Returns an iterator that does not use the Gray code. More...
 
void addRandomShift (int d1, int d2, RandomStream stream)
 Generates a random digital shift for coordinates \(j\) from d1 to d2-1, using stream to generate the random numbers. More...
 
void addRandomShift (RandomStream stream)
 Same as addRandomShift(0, dim, stream), where dim is the dimension of the digital net. More...
 
void clearRandomShift ()
 Erases the current digital random shift, if any.
 
String toString ()
 Formats a string that contains information on this digital net. More...
 
void leftMatrixScramble (RandomStream stream)
 Applies a linear scramble by multiplying each \(\mathbf{C}_j\) on the left by a \(w\times w\) nonsingular lower-triangular matrix. More...
 
void leftMatrixScrambleDiag (RandomStream stream)
 Similar to leftMatrixScramble except that all the off-diagonal elements of the \(\mathbf{M}_j\) are 0. More...
 
void leftMatrixScrambleFaurePermut (RandomStream stream, int sb)
 Similar to leftMatrixScramble except that the diagonal elements of each matrix \(\mathbf{M}_j\) are chosen from a restricted set of the best integers as calculated by Faure [59] . More...
 
void leftMatrixScrambleFaurePermutDiag (RandomStream stream, int sb)
 Similar to leftMatrixScrambleFaurePermut except that all off-diagonal elements are 0. More...
 
void leftMatrixScrambleFaurePermutAll (RandomStream stream, int sb)
 Similar to leftMatrixScrambleFaurePermut except that the elements under the diagonal are also chosen from the same restricted set as the diagonal elements. More...
 
void iBinomialMatrixScramble (RandomStream stream)
 Applies the \(i\)-binomial matrix scramble proposed by Tezuka. More...
 
void iBinomialMatrixScrambleFaurePermut (RandomStream stream, int sb)
 Similar to iBinomialMatrixScramble except that the diagonal elements of each matrix \(\mathbf{M}_j\) are chosen as in leftMatrixScrambleFaurePermut. More...
 
void iBinomialMatrixScrambleFaurePermutDiag (RandomStream stream, int sb)
 Similar to iBinomialMatrixScrambleFaurePermut except that all the off-diagonal elements are 0. More...
 
void iBinomialMatrixScrambleFaurePermutAll (RandomStream stream, int sb)
 Similar to iBinomialMatrixScrambleFaurePermut except that the elements under the diagonal are also chosen from the same restricted set as the diagonal elements. More...
 
void stripedMatrixScramble (RandomStream stream)
 Applies the striped matrix scramble proposed by Owen. More...
 
void stripedMatrixScrambleFaurePermutAll (RandomStream stream, int sb)
 Similar to stripedMatrixScramble except that the elements on and under the diagonal of each matrix \(\mathbf{M}_j\) are chosen as in leftMatrixScrambleFaurePermut. More...
 
void rightMatrixScramble (RandomStream stream)
 Applies a linear scramble by multiplying each \(\mathbf{C}_j\) on the right by a single \(k\times k\) nonsingular upper-triangular matrix \(\mathbf{M}\), as suggested by Faure and Tezuka. More...
 
void unrandomize ()
 Restores the original generator matrices and removes the random shift.
 
void resetGeneratorMatrices ()
 Restores the original generator matrices. More...
 
void eraseOriginalGeneratorMatrices ()
 Erases the original generator matrices and replaces them by the current ones. More...
 
void printGeneratorMatrices (int s)
 Prints the generator matrices in standard form for dimensions 1 to \(s\).
 
- Public Member Functions inherited from PointSet
int getDimension ()
 Returns the dimension (number of available coordinates) of the points. More...
 
int getNumPoints ()
 Returns the number of points. More...
 
abstract double getCoordinate (int i, int j)
 Returns \(u_{i,j}\), the coordinate \(j\) of the point \(i\). More...
 
PointSetIterator iterator ()
 Constructs and returns a point set iterator. More...
 
void randomize (PointSetRandomization rand)
 Randomizes this point set using the given rand. More...
 
void addRandomShift (int d1, int d2, RandomStream stream)
 By default, this method generates a random shift in the protected double[] array shift, to be used eventually for a random shift modulo 1. More...
 
void addRandomShift (RandomStream stream)
 Same as addRandomShift(0, dim, stream), where dim is the dimension of the point set. More...
 
void addRandomShift (int d1, int d2)
 Refreshes the random shift (generates new uniform values for the random shift coordinates) for coordinates d1 to d2-1, using the saved shiftStream.
 
void addRandomShift ()
 Same as addRandomShift(0, dim), where dim is the dimension of the point set.
 
void clearRandomShift ()
 Erases the current random shift, if any.
 
String toString ()
 Formats a string that contains information about the point set. More...
 
String formatPoints ()
 Same as invoking formatPoints(n, d) with \(n\) and \(d\) equal to the number of points and the dimension of this object, respectively. More...
 
String formatPoints (int n, int d)
 Formats a string that displays the same information as returned by toString, together with the first \(d\) coordinates of the first \(n\) points. More...
 
String formatPoints (PointSetIterator iter)
 Same as invoking formatPoints(iter, n, d) with \(n\) and \(d\) equal to the number of points and the dimension, respectively. More...
 
String formatPoints (PointSetIterator iter, int n, int d)
 Same as invoking formatPoints(n, d), but prints the points by calling iter repeatedly. More...
 
String formatPointsBase (int b)
 Similar to formatPoints(), but the points coordinates are printed in base \(b\). More...
 
String formatPointsBase (int n, int d, int b)
 Similar to formatPoints(n, d), but the points coordinates are printed in base \(b\). More...
 
String formatPointsBase (PointSetIterator iter, int b)
 Similar to formatPoints(iter), but the points coordinates are printed in base \(b\). More...
 
String formatPointsBase (PointSetIterator iter, int n, int d, int b)
 Similar to formatPoints(iter, n, d), but the points coordinates are printed in base \(b\). More...
 
String formatPointsNumbered ()
 Same as invoking formatPointsNumbered(n, d) with \(n\) and \(d\) equal to the number of points and the dimension, respectively. More...
 
String formatPointsNumbered (int n, int d)
 Same as invoking formatPoints(n,d), except that the points are numbered. More...
 

Protected Attributes

int [] genMat
 
int [] digitalShift
 
- Protected Attributes inherited from DigitalNet
int b = 0
 
int numCols = 0
 
int numRows = 0
 
int outDigits = 0
 
int [][] genMat
 
int [][] digitalShift
 
double normFactor
 
double [] factor
 
- Protected Attributes inherited from PointSet
double EpsilonHalf = 1.0 / Num.TWOEXP[55]
 To avoid 0 for nextCoordinate when random shifting, we add this to each coordinate.
 
int dim = 0
 Dimension of the points.
 
int numPoints = 0
 Number of points.
 
int dimShift = 0
 Current dimension of the shift. More...
 
int capacityShift = 0
 Number of array elements in the shift vector, always >= dimShift.
 
double [] shift
 This is the shift vector as a double[] array, which contains the current random shift in case we apply a random shift modulo 1. More...
 
RandomStream shiftStream
 Stream used to generate the random shifts. More...
 

Additional Inherited Members

- Protected Member Functions inherited from DigitalNet
void printMat (int N, int[][][] A, String name)
 
void printMat0 (int[][] A, String name)
 
int intToDigitsGray (int b, int i, int numDigits, int[] bary, int[] gray)
 
- Static Protected Attributes inherited from PointSet
static final int MAXBITS = 31
 Since Java has no unsigned type, the 32nd bit cannot be used efficiently, so we have only 31 bits. More...
 

Detailed Description

A special case of DigitalNet for the base \(b=2\).

The implementation exploit the binary nature of computers and is much more efficient than for the case of a general \(b=2\). Binary expansions are easy to obtain because the computer already uses them internally. The generator matrices \(\mathbf{C}_j\) are stored in a single large array of size \(sk\). The \(c\)-th column of \(\mathbf{C}_j\), for \(c=0,\dots,k-1\), is stored at position \(jk + c\) of this array, as a 32-bit integer. For all derived classes, this 32-bit integer must have a binary representation of the form \( [0\, 0\, \cdots\, c_0\, c_1 \cdots \, c_{r-1}]\), i.e., should be less than \(2^r\). The value of \(k\) cannot exceed 31 (32 is not allowed because Java does not have 32-bit unsigned integers). The value of \(w\) is always

  1. In this class, the random digital shift in base 2 generated by addRandomShift corresponds to a random XOR.

Member Function Documentation

◆ iteratorNoGray()

PointSetIterator iteratorNoGray ( )

This iterator does not use the Gray code.

Thus the points are enumerated in the order of their first coordinate before randomization.

◆ nestedUniformScramble()

void nestedUniformScramble ( RandomStream  stream,
double  output[][],
int  numBits 
)

Apply Owen's nested uniform scrambling.

This type of scrambling does not modify the DigitalNetBase2 object. In particular, it does not randomize the generator matrices stored in the object. Rather, it computes the randomized points all at once and stores them in the two-dimensional array output. All points are randomized at once to avoid storing all the permutations.

The implementation is an adaptation of that found in SAMPLE PACKage by Thomas Kollig and Alexander Keller.

Parameters
streamRandom stream used to randomize the bits.
outputOutput array that will store the randomized points. The size of its first dimension must be getNumPoints() and the size of its second dimension must be getDimension().
numBitsNumber of ouput bits to scramble. If it is zero, the number of ouput bits of the DigitalNetBase2 instance is used. It can be smaller than, equal to or larger than DigitalNet.outDigits.

◆ printGeneratorMatrices()

void printGeneratorMatrices ( int  s)

Prints the generator matrices as bit matrices in standard form for dimensions 1 to \(s\).

Each matrix has \(r\) rows and \(k\) columns.

◆ printGeneratorMatricesTrans()

void printGeneratorMatricesTrans ( int  s)

Prints the generator matrices transposed in the form of integers for dimensions 1 to \(s\).

Each integer corresponds to one column of bits.


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