|
SSJ V. 2.6.2. |
||||||||
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 = bk points in
s dimensions, where the ith point
ui,
for
i = 0,..., bk - 1, is defined as follows:
i | = | ∑r=0k-1ai, rbr, | |
(ui, j, 1 ui, j, 2 …)T | = | Cj (ai, 0 ai, 1 … ai, k-1)T, | |
ui, j | = | ∑r=1∞ui, j, rb-r, | |
ui | = | (ui, 0, …, ui, s-1). |
The points ui are enumerated using the Gray code technique. With this technique, the b-ary representation of i, ai = (ai, 0,..., ai, k-1), is replaced by a Gray code representation of i, gi = (gi, 0,..., gi, k-1). The Gray code gi used here is defined by gi, k-1 = ai, k-1 and gi, ν = (ai, ν - ai, ν+1)mod b for ν = 0,..., k - 2. It has the property that gi = (gi, 0,..., gi, k-1) and gi+1 = (gi+1, 0,..., gi+1, k-1) differ only in the position of the smallest index ν such that ai, ν < b - 1, and we have gi+1, ν = (gi, ν +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 ui are enumerated, but the first bm 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 b-ary representation ai' is given by the Gray code gi. 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 b-ary representation ai. The digits of each coordinate j of the current point can be updated by adding column ν of the generator matrix Cj 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 ui, j, ν in the third equation above by (ui, j, ν + dj, ν)mod b, where the dj, ν'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
Cj
by a random invertible matrix
Mj, modulo b.
There are several variants, depending on how
Mj is generated, and on
whether
Cj is multiplied on the left or on the right.
In our implementation, the linear matrix scrambles are incorporated directly
into the matrices
Cj, 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
Cj's.
A copy of the original
Cj'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 Cj 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 ui, j, the coordinate j of the point i. |
double |
getCoordinateNoGray(int i,
int j)
Returns ui, j, the coordinate j of point i, the points being enumerated in the standard order (no Gray code). |
void |
iBinomialMatrixScramble(RandomStream stream)
Applies the i-binomial matrix scramble proposed by Tezuka . |
void |
iBinomialMatrixScrambleFaurePermut(RandomStream stream,
int sb)
Similar to iBinomialMatrixScramble except that the diagonal
elements of each matrix
Mj 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
off-diagonal 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 Cj on the left by a w×w nonsingular lower-triangular matrix Mj, as suggested by Matoušek and implemented by Hong and Hickernell. |
void |
leftMatrixScrambleDiag(RandomStream stream)
Similar to leftMatrixScramble except that all the
off-diagonal elements of the
Mj are 0. |
void |
leftMatrixScrambleFaurePermut(RandomStream stream,
int sb)
Similar to leftMatrixScramble except that the diagonal elements
of each matrix
Mj 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
off-diagonal 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 Cj on the right by a single k×k nonsingular upper-triangular 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
Mj 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
off-diagonal elements of the
Mj 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
Mj 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
off-diagonal 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
Mj 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
Mj 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
off-diagonal 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
Mj 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
Mj 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. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |