umontreal.iro.lecuyer.hups
Class DigitalNetBase2
- java.lang.Object
-
- umontreal.iro.lecuyer.hups.PointSet
-
- umontreal.iro.lecuyer.hups.DigitalNet
-
- umontreal.iro.lecuyer.hups.DigitalNetBase2
-
- Direct Known Subclasses:
- DigitalNetBase2FromFile, DigitalSequenceBase2, F2wNetLFSR, F2wNetPolyLCG
public class DigitalNetBase2 extends DigitalNet
A special case ofDigitalNetfor the base b = 2. The implementation exploit the binary nature of computers and is much more efficient than for the general case. Binary expansions are easy to obtain because the computer already uses them internally. The generator matrices Cj are stored in a large array of size sk. The c-th column of Cj, for c = 0,..., k - 1, is stored at position jk + c of that array, as a 32-bit integer. For all derived classes, the above 32-bit integer must be of the form [00 ... C0C1 ... Cr-1]. 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 31.The random digital shift in base 2 corresponds to a random XOR. It can be applied via the method
addRandomShift.
-
-
Constructor Summary
Constructors Constructor and Description DigitalNetBase2()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddRandomShift(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.voidaddRandomShift(RandomStream stream)Same asaddRandomShift(0, dim, stream), where dim is the dimension of the digital net.voidclearRandomShift()Erases the current random shift, if any.doublegetCoordinate(int i, int j)Returns ui, j, the coordinate j of the point i.doublegetCoordinateNoGray(int i, int j)Returns ui, j, the coordinate j of point i, the points being enumerated in the standard order (no Gray code).voidiBinomialMatrixScramble(RandomStream stream)Applies the i-binomial matrix scramble proposed by Tezuka .voidiBinomialMatrixScrambleFaurePermut(RandomStream stream, int sb)Similar toiBinomialMatrixScrambleexcept that the diagonal elements of each matrix Mj are chosen as inleftMatrixScrambleFaurePermut.voidiBinomialMatrixScrambleFaurePermutAll(RandomStream stream, int sb)Similar toiBinomialMatrixScrambleFaurePermutexcept that the elements under the diagonal are also chosen from the same restricted set as the diagonal elements.voidiBinomialMatrixScrambleFaurePermutDiag(RandomStream stream, int sb)Similar toiBinomialMatrixScrambleFaurePermutexcept that all the off-diagonal elements are 0.PointSetIteratoriterator()Constructs and returns a point set iterator.PointSetIteratoriteratorNoGray()This iterator does not use the Gray code.voidleftMatrixScramble(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.voidleftMatrixScrambleDiag(RandomStream stream)Similar toleftMatrixScrambleexcept that all the off-diagonal elements of the Mj are 0.voidleftMatrixScrambleFaurePermut(RandomStream stream, int sb)Similar toleftMatrixScrambleexcept that the diagonal elements of each matrix Mj are chosen from a restricted set of the best integers as calculated by Faure.voidleftMatrixScrambleFaurePermutAll(RandomStream stream, int sb)Similar toleftMatrixScrambleFaurePermutexcept that the elements under the diagonal are also chosen from the same restricted set as the diagonal elements.voidleftMatrixScrambleFaurePermutDiag(RandomStream stream, int sb)Similar toleftMatrixScrambleFaurePermutexcept that all off-diagonal elements are 0.voidprintGeneratorMatrices(int s)Prints the generator matrices as bit matrices in standard form for dimensions 1 to s.voidprintGeneratorMatricesTrans(int s)Prints the generator matrices transposed in the form of integers for dimensions 1 to s.voidrightMatrixScramble(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.voidstripedMatrixScramble(RandomStream stream)Applies the striped matrix scramble proposed by Owen.voidstripedMatrixScrambleFaurePermutAll(RandomStream stream, int sb)Similar tostripedMatrixScrambleexcept that the elements on and under the diagonal of each matrix Mj are chosen as inleftMatrixScrambleFaurePermut.java.lang.StringtoString()Formats a string that contains information about the point set.-
Methods inherited from class umontreal.iro.lecuyer.hups.DigitalNet
eraseOriginalGeneratorMatrices, resetGeneratorMatrices, unrandomize
-
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
-
-
-
-
Method Detail
-
printGeneratorMatrices
public void printGeneratorMatrices(int s)
Prints the generator matrices as bit matrices in standard form for dimensions 1 to s.- Overrides:
printGeneratorMatricesin classDigitalNet
-
printGeneratorMatricesTrans
public void printGeneratorMatricesTrans(int s)
Prints the generator matrices transposed in the form of integers for dimensions 1 to s. Each integer corresponds to a column of bits.
-
getCoordinate
public double getCoordinate(int i, int j)Description copied from class:PointSetReturns ui, j, the coordinate j of the point i.- Overrides:
getCoordinatein classDigitalNet- Parameters:
i- index of the point to look forj- index of the coordinate to look for- Returns:
- the value of ui, j
-
getCoordinateNoGray
public double getCoordinateNoGray(int i, int j)Description copied from class:DigitalNetReturns ui, j, the coordinate j of point i, the points being enumerated in the standard order (no Gray code).- Overrides:
getCoordinateNoGrayin classDigitalNet- Parameters:
i- point indexj- coordinate index- Returns:
- the value of ui, j
-
iterator
public PointSetIterator iterator()
Description copied from class:PointSetConstructs and returns a point set iterator. The default implementation returns an iterator that uses the methodgetCoordinate(i,j) to iterate over the points and coordinates, but subclasses can reimplement it for better efficiency.- Overrides:
iteratorin classDigitalNet- Returns:
- point set iterator for the point set
-
iteratorNoGray
public PointSetIterator iteratorNoGray()
This iterator does not use the Gray code. Thus the points are enumerated in the order of their first coordinate before randomization.- Overrides:
iteratorNoGrayin classDigitalNet
-
toString
public java.lang.String toString()
Description copied from class:PointSetFormats a string that contains information about the point set.- Overrides:
toStringin classDigitalNet- Returns:
- string representation of the point set information
-
clearRandomShift
public void clearRandomShift()
Description copied from class:PointSetErases the current random shift, if any.- Overrides:
clearRandomShiftin classDigitalNet
-
addRandomShift
public void addRandomShift(RandomStream stream)
Description copied from class:DigitalNetSame asaddRandomShift(0, dim, stream), where dim is the dimension of the digital net.- Overrides:
addRandomShiftin classDigitalNet- Parameters:
stream- random number stream used to generate uniforms
-
addRandomShift
public void addRandomShift(int d1, int d2, RandomStream stream)Description copied from class:DigitalNetAdds a random digital shift to all the points of the point set, using stream stream to generate the random numbers. For each coordinate j from d1 to d2-1, the shift vector (dj, 0,..., dj, k-1) is generated uniformly over {0,..., b - 1}k and added modulo b to the digits of all the points. After adding a digital shift, all iterators must be reconstructed or reset to zero.- Overrides:
addRandomShiftin classDigitalNetstream- random number stream used to generate uniforms
-
leftMatrixScramble
public void leftMatrixScramble(RandomStream stream)
Description copied from class:DigitalNetApplies 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. The diagonal entries of each matrix Mj are generated uniformly over {1,..., b - 1}, the entries below the diagonal are generated uniformly over {0,..., b - 1}, and all these entries are generated independently. This means that in base b = 2, all diagonal elements are equal to 1.- Overrides:
leftMatrixScramblein classDigitalNet- Parameters:
stream- random number stream used to generate the randomness
-
iBinomialMatrixScramble
public void iBinomialMatrixScramble(RandomStream stream)
Description copied from class:DigitalNetApplies the i-binomial matrix scramble proposed by Tezuka . This multiplies each Cj on the left by a w×w nonsingular lower-triangular matrix Mj as inleftMatrixScramble, but with the additional constraint that all entries on any given diagonal or subdiagonal of Mj are identical.- Overrides:
iBinomialMatrixScramblein classDigitalNet- Parameters:
stream- random number stream used as generator of the randomness
-
stripedMatrixScramble
public void stripedMatrixScramble(RandomStream stream)
Description copied from class:DigitalNetApplies the striped matrix scramble proposed by Owen. It multiplies each Cj on the left by a w×w nonsingular lower-triangular matrix Mj as inleftMatrixScramble, 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.- Overrides:
stripedMatrixScramblein classDigitalNet- Parameters:
stream- random number stream used as generator of the randomness
-
rightMatrixScramble
public void rightMatrixScramble(RandomStream stream)
Description copied from class:DigitalNetApplies 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. The diagonal entries of the matrix M are generated uniformly over {1,..., b - 1}, the entries above the diagonal are generated uniformly over {0,..., b - 1}, and all the entries are generated independently. The effect of this scramble is only to change the order in which the points are generated. If one computes the average value of a function over all the points of a given digital net, or over a number of points that is a power of the basis, then this scramble makes no difference.- Overrides:
rightMatrixScramblein classDigitalNet- Parameters:
stream- random number stream used as generator of the randomness
-
leftMatrixScrambleDiag
public void leftMatrixScrambleDiag(RandomStream stream)
Description copied from class:DigitalNetSimilar toleftMatrixScrambleexcept that all the off-diagonal elements of the Mj are 0.- Overrides:
leftMatrixScrambleDiagin classDigitalNet- Parameters:
stream- random number stream used to generate the randomness
-
leftMatrixScrambleFaurePermut
public void leftMatrixScrambleFaurePermut(RandomStream stream, int sb)
Description copied from class:DigitalNetSimilar toleftMatrixScrambleexcept 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.- Overrides:
leftMatrixScrambleFaurePermutin classDigitalNet- Parameters:
stream- random number stream used to generate the randomnesssb- Only the first sb elements of F are used
-
leftMatrixScrambleFaurePermutDiag
public void leftMatrixScrambleFaurePermutDiag(RandomStream stream, int sb)
Description copied from class:DigitalNetSimilar toleftMatrixScrambleFaurePermutexcept that all off-diagonal elements are 0.- Overrides:
leftMatrixScrambleFaurePermutDiagin classDigitalNet- Parameters:
stream- random number stream used to generate the randomnesssb- Only the first sb elements of F are used
-
leftMatrixScrambleFaurePermutAll
public void leftMatrixScrambleFaurePermutAll(RandomStream stream, int sb)
Description copied from class:DigitalNetSimilar toleftMatrixScrambleFaurePermutexcept that the elements under the diagonal are also chosen from the same restricted set as the diagonal elements.- Overrides:
leftMatrixScrambleFaurePermutAllin classDigitalNet- Parameters:
stream- random number stream used to generate the randomnesssb- Only the first sb elements of F are used
-
iBinomialMatrixScrambleFaurePermut
public void iBinomialMatrixScrambleFaurePermut(RandomStream stream, int sb)
Description copied from class:DigitalNetSimilar toiBinomialMatrixScrambleexcept that the diagonal elements of each matrix Mj are chosen as inleftMatrixScrambleFaurePermut.- Overrides:
iBinomialMatrixScrambleFaurePermutin classDigitalNet- Parameters:
stream- random number stream used to generate the randomnesssb- Only the first sb elements of F are used
-
iBinomialMatrixScrambleFaurePermutDiag
public void iBinomialMatrixScrambleFaurePermutDiag(RandomStream stream, int sb)
Description copied from class:DigitalNetSimilar toiBinomialMatrixScrambleFaurePermutexcept that all the off-diagonal elements are 0.- Overrides:
iBinomialMatrixScrambleFaurePermutDiagin classDigitalNet- Parameters:
stream- random number stream used to generate the randomnesssb- Only the first sb elements of F are used
-
iBinomialMatrixScrambleFaurePermutAll
public void iBinomialMatrixScrambleFaurePermutAll(RandomStream stream, int sb)
Description copied from class:DigitalNetSimilar toiBinomialMatrixScrambleFaurePermutexcept that the elements under the diagonal are also chosen from the same restricted set as the diagonal elements.- Overrides:
iBinomialMatrixScrambleFaurePermutAllin classDigitalNet- Parameters:
stream- random number stream used to generate the randomnesssb- Only the first sb elements of F are used
-
stripedMatrixScrambleFaurePermutAll
public void stripedMatrixScrambleFaurePermutAll(RandomStream stream, int sb)
Description copied from class:DigitalNetSimilar tostripedMatrixScrambleexcept that the elements on and under the diagonal of each matrix Mj are chosen as inleftMatrixScrambleFaurePermut.- Overrides:
stripedMatrixScrambleFaurePermutAllin classDigitalNet- Parameters:
stream- random number stream used as generator of the randomnesssb- Only the first sb elements of F are used
-
-
DMelt 3.0 © DataMelt by jWork.ORG