
SSJ V. labo. 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object umontreal.iro.lecuyer.hups.PointSet umontreal.iro.lecuyer.hups.DigitalNet
public class DigitalNet
This class provides the basic structures for storing and
manipulating linear digital nets in base b, for an arbitrary
base b >= 2. We recall that a net contains n = b^{k} points in
s dimensions, where the ith point
u_{i},
for
i = 0,..., b^{k}  1, is defined as follows:
i  =  ∑_{r=0}^{k1}a_{i, r}b^{r},  
(u_{i, j, 1} u_{i, j, 2} …)^{T}  =  C_{j} (a_{i, 0} a_{i, 1} … a_{i, k1})^{T},  
u_{i, j}  =  ∑_{r=1}^{∞}u_{i, j, r}b^{r},  
u_{i}  =  (u_{i, 0}, …, u_{i, s1}). 
The points u_{i} are enumerated using the Gray code technique. With this technique, the bary representation of i, a_{i} = (a_{i, 0},..., a_{i, k1}), is replaced by a Gray code representation of i, g_{i} = (g_{i, 0},..., g_{i, k1}). The Gray code g_{i} used here is defined by g_{i, k1} = a_{i, k1} and g_{i, ν} = (a_{i, ν}  a_{i, ν+1})mod b for ν = 0,..., k  2. It has the property that g_{i} = (g_{i, 0},..., g_{i, k1}) and g_{i+1} = (g_{i+1, 0},..., g_{i+1, k1}) differ only in the position of the smallest index ν such that a_{i, ν} < b  1, and we have g_{i+1, ν} = (g_{i, ν} +1)mod b in that position.
This Gray code representation permits a more efficient enumeration of the points by the iterators. It changes the order in which the points u_{i} are enumerated, but the first b^{m} points remain the same for every integer m. The ith point of the sequence with the Gray enumeration is the i'th point of the original enumeration, where i' is the integer whose bary representation a_{i'} is given by the Gray code g_{i}. To enumerate all the points successively, we never need to compute the Gray codes explicitly. It suffices to know the position ν of the Gray code digit that changes at each step, and this can be found quickly from the bary representation a_{i}. The digits of each coordinate j of the current point can be updated by adding column ν of the generator matrix C_{j} to the old digits, modulo b.
One should avoid using the method getCoordinate
(i, j)
for arbitrary values of i and j, because this is much
slower than using an iterator to access successive coordinates.
Digital nets can be randomized in various ways. Several types of randomizations specialized for nets are implemented directly in this class.
A simple but important randomization is the random digital shift in base b, defined as follows: replace each digit u_{i, j, ν} in the third equation above by (u_{i, j, ν} + d_{j, ν})mod b, where the d_{j, ν}'s are i.i.d. uniform over {0,..., b  1}. This is equivalent to applying a single random shift to all the points in a formal series representation of their coordinates. In practice, the digital shift is truncated to w digits, for some integer w >= r. Applying a digital shift does not change the equidistribution and (t, m, s)net properties of a point set. Moreover, with the random shift, each point is uniformly distributed over the unit hypercube (but the points are not independent, of course).
A second class of randomizations specialized for digital nets
are the linear matrix scrambles, which multiply the matrices
C_{j}
by a random invertible matrix
M_{j}, modulo b.
There are several variants, depending on how
M_{j} is generated, and on
whether
C_{j} is multiplied on the left or on the right.
In our implementation, the linear matrix scrambles are incorporated directly
into the matrices
C_{j}, so they
do not slow down the enumeration of points.
Methods are available for applying
linear matrix scrambles and for removing these randomizations.
These methods generate the appropriate random numbers and make
the corresponding changes to the
C_{j}'s.
A copy of the original
C_{j}'s is maintained, so the point
set can be returned to its original unscrambled state at any time.
When a new linear matrix scramble is applied, it is always applied to
the original generator matrices.
The method resetGeneratorMatrices
removes the current matrix
scramble by resetting the generator matrices to their original state.
On the other hand, the method eraseOriginalGeneratorMatrices
replaces the original generator matrices by the current
ones, making the changes permanent.
This is useful if one wishes to apply two or more linear matrix
scrambles on top of each other.
Linear matrix scrambles are usually combined with a random digital shift; this combination is called an affine matrix scramble. These two randomizations are applied via separate methods. The linear matrix scrambles are incorporated into the matrices C_{j} whereas the digital random shift is stored and applied separately, independently of the other scramblings.
Applying a digital shift or a linear matrix scramble to a digital net
invalidates all iterators for that randomized point,
because each iterator uses a
cached copy of the current point, which is updated only when
the current point index of that iterator changes, and the update also
depends on the cached copy of the previous point.
After applying any kind of scrambling, the iterators must be
reinitialized to the initial point by invoking
resetCurPointIndex
or reinstantiated by the iterator
method
(this is not done automatically).
Constructor Summary  

DigitalNet()
Empty constructor. 
Method Summary  

void 
addRandomShift(int d1,
int d2,
RandomStream stream)
Adds a random digital shift to all the points of the point set, using stream 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 random shift, if any. 
void 
eraseOriginalGeneratorMatrices()
Erases the original generator matrices and replaces them by the current ones. 
double 
getCoordinate(int i,
int j)
Returns u_{i, j}, the coordinate j of the point 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). 
void 
iBinomialMatrixScramble(RandomStream stream)
Applies the ibinomial matrix scramble proposed by Tezuka . 
void 
iBinomialMatrixScrambleFaurePermut(RandomStream stream,
int sb)
Similar to iBinomialMatrixScramble except that the diagonal
elements of each matrix
M_{j} are chosen as in
leftMatrixScrambleFaurePermut . 
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 
iBinomialMatrixScrambleFaurePermutDiag(RandomStream stream,
int sb)
Similar to iBinomialMatrixScrambleFaurePermut except that all the
offdiagonal elements are 0. 
PointSetIterator 
iterator()
Constructs and returns a point set iterator. 
PointSetIterator 
iteratorNoGray()
This iterator does not use the Gray code. 
void 
leftMatrixScramble(RandomStream stream)
Applies a linear scramble by multiplying each C_{j} on the left by a w×w nonsingular lowertriangular matrix M_{j}, as suggested by Matoušek and implemented by Hong and Hickernell. 
void 
leftMatrixScrambleDiag(RandomStream stream)
Similar to leftMatrixScramble except that all the
offdiagonal elements of the
M_{j} are 0. 
void 
leftMatrixScrambleFaurePermut(RandomStream stream,
int sb)
Similar to leftMatrixScramble except that the diagonal elements
of each matrix
M_{j} are chosen from a restricted set of the best
integers as calculated by Faure. 
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 
leftMatrixScrambleFaurePermutDiag(RandomStream stream,
int sb)
Similar to leftMatrixScrambleFaurePermut except that all
offdiagonal elements are 0. 
void 
printGeneratorMatrices(int s)
Prints the generator matrices in standard form for dimensions 1 to s. 
void 
resetGeneratorMatrices()
Restores the original generator matrices. 
void 
rightMatrixScramble(RandomStream stream)
Applies a linear scramble by multiplying each C_{j} on the right by a single k×k nonsingular uppertriangular matrix M, as suggested by Faure and Tezuka. 
void 
stripedMatrixScramble(RandomStream stream)
Applies the striped matrix scramble proposed by Owen. 
void 
stripedMatrixScrambleFaurePermutAll(RandomStream stream,
int sb)
Similar to stripedMatrixScramble except that the
elements on and under the diagonal of each matrix
M_{j} are
chosen as in leftMatrixScrambleFaurePermut . 
String 
toString()
Formats a string that contains information about the point set. 
void 
unrandomize()
By default, this method simply calls clearRandomShift(). 
Methods inherited from class umontreal.iro.lecuyer.hups.PointSet 

addRandomShift, addRandomShift, formatPoints, formatPoints, formatPoints, formatPoints, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsBase, formatPointsNumbered, formatPointsNumbered, getDimension, getNumPoints, getStream, randomize, randomize, randomize, randomize, randomize, setStream 
Methods inherited from class java.lang.Object 

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait 
Constructor Detail 

public DigitalNet()
Method Detail 

public double getCoordinate(int i, int j)
PointSet
getCoordinate
in class PointSet
i
 index of the point to look forj
 index of the coordinate to look for
public PointSetIterator iterator()
PointSet
getCoordinate
(i,j) to iterate over the
points and coordinates, but subclasses can reimplement it
for better efficiency.
iterator
in class PointSet
public double getCoordinateNoGray(int i, int j)
i
 point indexj
 coordinate index
public PointSetIterator iteratorNoGray()
public void addRandomShift(int d1, int d2, RandomStream stream)
addRandomShift
in class PointSet
stream
 random number stream used to generate uniformspublic void addRandomShift(RandomStream stream)
addRandomShift
(0, dim, stream),
where dim is the dimension of the digital net.
addRandomShift
in class PointSet
stream
 random number stream used to generate uniformspublic void clearRandomShift()
PointSet
clearRandomShift
in class PointSet
public String toString()
PointSet
toString
in class PointSet
public void leftMatrixScramble(RandomStream stream)
stream
 random number stream used to generate the randomnesspublic void leftMatrixScrambleDiag(RandomStream stream)
leftMatrixScramble
except that all the
offdiagonal elements of the
M_{j} are 0.
stream
 random number stream used to generate the randomnesspublic void leftMatrixScrambleFaurePermut(RandomStream stream, int sb)
leftMatrixScramble
except that the diagonal elements
of each matrix
M_{j} are chosen from a restricted set of the best
integers as calculated by Faure. They are generated
uniformly over the first sb elements of array F, where F is
made up of a permutation of the integers
[1..(b  1)]. These integers are
sorted by increasing order of the upper bounds of the extreme discrepancy
for the given integer.
stream
 random number stream used to generate the randomnesssb
 Only the first sb elements of F are usedpublic void leftMatrixScrambleFaurePermutDiag(RandomStream stream, int sb)
leftMatrixScrambleFaurePermut
except that all
offdiagonal elements are 0.
stream
 random number stream used to generate the randomnesssb
 Only the first sb elements of F are usedpublic void leftMatrixScrambleFaurePermutAll(RandomStream stream, int sb)
leftMatrixScrambleFaurePermut
except that the
elements under the diagonal are also
chosen from the same restricted set as the diagonal elements.
stream
 random number stream used to generate the randomnesssb
 Only the first sb elements of F are usedpublic void iBinomialMatrixScramble(RandomStream stream)
leftMatrixScramble
, but with the additional constraint that
all entries on any given diagonal or subdiagonal of
M_{j} are identical.
stream
 random number stream used as generator of the randomnesspublic void iBinomialMatrixScrambleFaurePermut(RandomStream stream, int sb)
iBinomialMatrixScramble
except that the diagonal
elements of each matrix
M_{j} are chosen as in
leftMatrixScrambleFaurePermut
.
stream
 random number stream used to generate the randomnesssb
 Only the first sb elements of F are usedpublic void iBinomialMatrixScrambleFaurePermutDiag(RandomStream stream, int sb)
iBinomialMatrixScrambleFaurePermut
except that all the
offdiagonal elements are 0.
stream
 random number stream used to generate the randomnesssb
 Only the first sb elements of F are usedpublic void iBinomialMatrixScrambleFaurePermutAll(RandomStream stream, int sb)
iBinomialMatrixScrambleFaurePermut
except that the
elements under the diagonal are also
chosen from the same restricted set as the diagonal elements.
stream
 random number stream used to generate the randomnesssb
 Only the first sb elements of F are usedpublic void stripedMatrixScramble(RandomStream stream)
leftMatrixScramble
, but with the additional constraint that
in any column, all entries below the diagonal are equal to the
diagonal entry, which is generated randomly over
{1,..., b  1}.
Note that for b = 2, the matrices
M_{j} become deterministic, with
all entries on and below the diagonal equal to 1.
stream
 random number stream used as generator of the randomnesspublic void stripedMatrixScrambleFaurePermutAll(RandomStream stream, int sb)
stripedMatrixScramble
except that the
elements on and under the diagonal of each matrix
M_{j} are
chosen as in leftMatrixScrambleFaurePermut
.
stream
 random number stream used as generator of the randomnesssb
 Only the first sb elements of F are usedpublic void rightMatrixScramble(RandomStream stream)
stream
 random number stream used as generator of the randomnesspublic void unrandomize()
PointSet
unrandomize
in class PointSet
public void resetGeneratorMatrices()
public void eraseOriginalGeneratorMatrices()
public void printGeneratorMatrices(int s)

SSJ V. labo. 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 