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

This class permits one to read the parameters that define a digital net in base 2 either from a file, or from a URL address. More...

Inheritance diagram for umontreal.ssj.hups.DigitalNetBase2FromFile:
umontreal.ssj.hups.DigitalNetBase2 umontreal.ssj.hups.DigitalNet umontreal.ssj.hups.PointSet

Public Member Functions

 DigitalNetBase2FromFile (String filename, int r1, int w, int s1) throws IOException, MalformedURLException
 Constructs a digital net in base 2 after reading its parameters from file filename.
 DigitalNetBase2FromFile (String filename, int s1) throws IOException, MalformedURLException
 Same as DigitalNetBase2FromFile(filename, r, 31, s1) where s1 is the dimension and r is given in data file filename.
String toString ()
 Formats a string that contains information on this digital net.
String toStringDetailed ()
 Writes the parameters and the generating matrices of this digital net to a string.
Public Member Functions inherited from umontreal.ssj.hups.DigitalNetBase2
double getCoordinate (int i, int j)
 Returns \(u_{i',j}\), the coordinate \(j\) of point \(i'\), where \(i'\) is the Gray code for \(i\).
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).
PointSetIterator iterator ()
 Returns a DigitalNetBase2Iterator which enumerates the points using a Gray code.
PointSetIterator iteratorNoGray ()
 This iterator does not use the Gray code.
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.
void addRandomShift (RandomStream stream)
 Same as addRandomShift(0, dim, stream), where dim is the dimension of the digital net.
void clearRandomShift ()
 Erases the current digital random shift, if any.
void leftMatrixScramble (int r, RandomStream stream)
 This is a version of LMS in which each column of the lower-triangular scrambling matrix is represented as an integer less than 2^w, just like for Cj.
void leftMatrixScramble (RandomStream stream)
 By default, the matrices L_j have r = w rows.
void iBinomialMatrixScramble (RandomStream stream)
 Similar to leftMatrixScramble, except that all entries on any given diagonal or subdiagonal of any given \(\mathbf{M}_j\) are identical.
void stripedMatrixScramble (RandomStream stream)
 Applies the striped matrix scramble proposed by Owen.
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.
void nestedUniformScramble (RandomStream stream, double[][] output)
 Same as nestedUniformScramble(stream, output, 0) .
void nestedUniformScramble (RandomStream stream, double[][] output, int numBits)
 Applies Owen's nested uniform scrambling to the digital net and returns the scrambled points in the two-dimensional array output.
void nestedUniformScramble (RandomStream stream, int[][] output, int numBits)
 Same as nestedUniformScramble(RandomStream,double[][],int), but it returns the points as integers from 0 to 2^outDigits - 1, instead of doubles.
void leftMatrixScrambleDiag (RandomStream stream)
 Similar to leftMatrixScramble except that all the off-diagonal elements of the \(\mathbf{M}_j\) are 0.
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 [58] .
void leftMatrixScrambleFaurePermutDiag (RandomStream stream, int sb)
 Similar to leftMatrixScrambleFaurePermut except that all off-diagonal elements are 0.
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.
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.
void iBinomialMatrixScrambleFaurePermutDiag (RandomStream stream, int sb)
 Similar to iBinomialMatrixScrambleFaurePermut except that all the off-diagonal elements are 0.
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.
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.
void unrandomize ()
 Restores the original generator matrices and removes the random shift.
void resetGenMatrices ()
 Restores genMat to the original generator matrices.
void eraseOriginalGenMatrices ()
 Erases the original generator matrices and replaces them by the current ones.
int[][][] genMatricesToBitByBitFormat ()
 Returns the generator matrices as a 3-dimensional array of shape dim x numRows x numCols integers, one integer for each bit.
void genMatricesFromBitByBitFormat (int[][][] matrices)
 Reverse of the previous function.
void printGeneratorMatrices (int s)
 Prints the generating matrices bit by bit for dimensions 1 to \(s\).
void printGenMatrices (int s)
 Prints the generating matrices in the standard format, one integer per column, for dimensions 1 to \(s\).
void printOriginalMatrices (int s)
 Prints the generating matrices in the standard format, one integer per column, for dimensions 1 to \(s\).
int[] getGenMatrices ()
 Returns a copy of the generator matrices for dimensions 1 to \(s\).
void outputInterlace (int[][] points, double[][] interlacedPoints)
 Interlaces the points from a digital net.
DigitalNetBase2 matrixInterlace ()
 Interlaces the matrices from a digital net.
Public Member Functions inherited from umontreal.ssj.hups.DigitalNet
 DigitalNet ()
 Empty constructor.
int getInterlacing ()
 Returns the interlacing factor.
void setInterlacing (int interlacing)
 Sets the interlacing factor.
void resetGeneratorMatrices ()
 Restores the original generator matrices.
void eraseOriginalGeneratorMatrices ()
 Erases the original generator matrices and replaces them by the current ones.
Public Member Functions inherited from umontreal.ssj.hups.PointSet
int getDimension ()
 Returns the dimension (number of available coordinates) of the points.
int getNumPoints ()
 Returns the number of points.
void randomize (PointSetRandomization rand)
 Randomizes this point set using the given rand.
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.
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.
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.
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.
String formatPoints (PointSetIterator iter, int n, int d)
 Same as invoking formatPoints(n, d), but prints the points by calling iter repeatedly.
String formatPointsBase (int b)
 Similar to formatPoints(), but the points coordinates are printed in base \(b\).
String formatPointsBase (int n, int d, int b)
 Similar to formatPoints(n, d), but the points coordinates are printed in base \(b\).
String formatPointsBase (PointSetIterator iter, int b)
 Similar to formatPoints(iter), but the points coordinates are printed in base.
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\).
String formatPointsNumbered ()
 Same as invoking formatPointsNumbered(n, d) with \(n\) and \(d\) equal to the number of points and the dimension, respectively.
String formatPointsNumbered (int n, int d)
 Same as invoking formatPoints(n,d), except that the points are numbered.

Static Public Member Functions

static String listDir (String dirname) throws IOException
 Lists all files (or directories) in directory dirname.
Static Public Member Functions inherited from umontreal.ssj.hups.PointSet
static int getMaxBits ()
 Returns the maximum number of usable bits.

Additional Inherited Members

Protected Attributes inherited from umontreal.ssj.hups.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.
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.
RandomStream shiftStream
 Stream used to generate the random shifts.
Static Protected Attributes inherited from umontreal.ssj.hups.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.

Detailed Description

This class permits one to read the parameters that define a digital net in base 2 either from a file, or from a URL address.

See the documentation of umontreal.ssj.hups.DigitalNetFromFile. The parameters used in building the net are those defined in the class

umontreal.ssj.hups.DigitalNetBase2. The format of the data files must be as follows, where \(B\) represents any generating matrix \(C_j\) (see the format in umontreal.ssj.hups):

// Any number of comment lines starting with //
\(2\)// Base
\(k\)// Number of columns
\(r\)// Number of rows
\(n\)// Number of points = \(2^k\)
\(s\)// Dimension of points
// dim = 1
\(a_1\)// \(= 2^{30}B_{11} + 2^{29}B_{21} + \cdots+ 2^{31 - r}B_{r1}\)
\(a_2\)// \(= 2^{30}B_{12} + 2^{29}B_{22} + \cdots+ 2^{31 - r}B_{r2}\)
\(\vdots\)
\(a_k\)
// dim = 2
\(\vdots\)
// dim = \(s\)
\(a_1\)
\(a_2\)
\(\vdots\)
\(a_k\)
For each dimension @f$j@f$, there must be a @f$k@f$-dimensional vector
of 32-bit integers (the @f$a_i@f$) corresponding to the columns of

\(\mathbf{C}_j\). The correspondence is such that the integer \(a_i = 2^{30}(\mathbf{C}_j)_{1i} + 2^{29}(\mathbf{C}_j)_{2i} + \cdots+ 2^{31 - r}(\mathbf{C}_j)_{ri}\).

Definition at line 110 of file DigitalNetBase2FromFile.java.

Constructor & Destructor Documentation

◆ DigitalNetBase2FromFile() [1/2]

umontreal.ssj.hups.DigitalNetBase2FromFile.DigitalNetBase2FromFile ( String filename,
int r1,
int w,
int s1 ) throws IOException, MalformedURLException

Constructs a digital net in base 2 after reading its parameters from file filename.

See the documentation in

umontreal.ssj.hups.DigitalNetFromFile. Parameter w gives the number of bits of resolution, r1 is the number of rows, and s1 is the dimension. Restrictions: s1 must be less than the maximal dimension, and r1 less than the maximal number of rows in the data file. Also w \(\ge\) r1.

Parameters
filenameName of the file to be read
r1Number of rows for the generating matrices
wNumber of bits of resolution
s1Number of dimensions

Definition at line 190 of file DigitalNetBase2FromFile.java.

◆ DigitalNetBase2FromFile() [2/2]

umontreal.ssj.hups.DigitalNetBase2FromFile.DigitalNetBase2FromFile ( String filename,
int s1 ) throws IOException, MalformedURLException

Same as DigitalNetBase2FromFile(filename, r, 31, s1) where s1 is the dimension and r is given in data file filename.

Parameters
filenameName of the file to be read
s1Number of dimensions

Definition at line 236 of file DigitalNetBase2FromFile.java.

Member Function Documentation

◆ listDir()

String umontreal.ssj.hups.DigitalNetBase2FromFile.listDir ( String dirname) throws IOException
static

Lists all files (or directories) in directory dirname.

Only relative pathnames should be used. The files are parameter files used in defining digital nets. For example, calling listDir("") will give the list of the main data directory in SSJ, while calling listDir("Edel/OOA2") will give the list of all files in directory Edel/OOA2.

Definition at line 270 of file DigitalNetBase2FromFile.java.

◆ toString()

String umontreal.ssj.hups.DigitalNetBase2FromFile.toString ( )

Formats a string that contains information on this digital net.

Returns
string representation of basic information on this digital net

Reimplemented from umontreal.ssj.hups.DigitalNetBase2.

Definition at line 240 of file DigitalNetBase2FromFile.java.

◆ toStringDetailed()

String umontreal.ssj.hups.DigitalNetBase2FromFile.toStringDetailed ( )

Writes the parameters and the generating matrices of this digital net to a string.

This is useful to check that the file parameters have been read correctly.

Definition at line 251 of file DigitalNetBase2FromFile.java.


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