26package umontreal.ssj.hups;
46 private int[] copyDigitalShift(
int[] S) {
50 int[] T =
new int[S.length];
51 for (
int i = 0; i < S.length; ++i)
64 net.numCols = numCols;
65 net.numRows = numRows;
66 net.outDigits = outDigits;
67 net.normFactor = normFactor;
68 net.factor =
new double[outDigits];
69 net.genMat =
new int[net.dim * numCols];
73 net.digitalShift = copyDigitalShift(digitalShift);
88 for (
int i = 0; i <
dim * numCols; i++)
89 net.genMat[i] = genMat[i];
111 for (c = (
dim + 1) * numCols - 1; c >= numCols; --c)
112 net.genMat[c] = genMat[c - numCols];
115 for (c = 0; c < numCols; c++)
116 net.genMat[c] = (1 << (outDigits - numCols + c));
152 protected class DigitalNetBase2IteratorShiftGenerators
extends DigitalNetBase2Iterator {
157 public DigitalNetBase2IteratorShiftGenerators() {
160 if (digitalShift !=
null &&
dimShift < dimS)
165 public void init2() {
168 protected void addShiftToCache() {
169 if (digitalShift ==
null)
170 for (
int j = 0; j < dimS; j++)
171 cachedCurPoint[j] = 0;
173 for (
int j = 0; j < dimS; j++)
174 cachedCurPoint[j] = digitalShift[j];
189 int grayCode = i ^ (i >> 1);
191 while ((grayCode >> pos) != 0) {
192 if (((grayCode >> pos) & 1) != 0) {
193 cachedCurPoint[0] ^= 1 << (outDigits - numCols + pos);
194 for (j = 1; j <=
dim; j++)
195 cachedCurPoint[j] ^= genMat[(j - 1) * numCols + pos];
209 cachedCurPoint[0] ^= 1 << (outDigits - numCols + pos);
210 for (
int j = 1; j <=
dim; j++)
211 cachedCurPoint[j] ^= genMat[(j - 1) * numCols + pos];
221 protected class DigitalNetBase2IteratorShiftNoGray
extends DigitalNetBase2Iterator {
224 private boolean shiftDimFlag =
false;
227 public DigitalNetBase2IteratorShiftNoGray() {
230 if (digitalShift !=
null &&
dimShift < dimS)
235 public void init2() {
238 protected void addShiftToCache() {
239 if (digitalShift ==
null)
240 for (
int j = 0; j <=
dim; j++)
241 cachedCurPoint[j] = 0;
243 for (
int j = 0; j <=
dim; j++)
244 cachedCurPoint[j] = digitalShift[j];
259 while ((i >> pos) != 0) {
260 if (((i >> pos) & 1) != 0) {
261 cachedCurPoint[0] ^= 1 << (outDigits - numCols + pos);
262 for (
int j = 1; j <=
dim; j++)
263 cachedCurPoint[j] ^= genMat[(j - 1) * numCols + pos];
275 while ((diff >> pos) != 0) {
276 if (((diff >> pos) & 1) != 0) {
277 cachedCurPoint[0] ^= 1 << (outDigits - numCols + pos);
278 for (
int j = 1; j <=
dim; j++)
279 cachedCurPoint[j] ^= genMat[(j - 1) * numCols + pos];
void resetCurPointIndex()
Resets both the current point index and the current coordinate to 0.
A special case of DigitalNet for the base .
void setCurPointIndex(int i)
Resets the current point index to i and current coordinate to 0.
int resetToNextPoint()
Resets the current point index to the next one and current coordinate to 0, and returns the new curre...
int resetToNextPoint()
Resets the current point index to the next one and current coordinate to 0, and returns the new curre...
void setCurPointIndex(int i)
Resets the current point index to i and current coordinate to 0.
This abstract class describes methods specific to digital sequences in base.
PointSetIterator iteratorShiftNoGray()
This iterator shifts all coordinates of each point one position to the right and sets the first coord...
DigitalNetBase2 toNet()
Transforms this digital sequence into a digital net without changing the coordinates of the points.
PointSetIterator iteratorShift()
Similar to iterator, except that the first coordinate of the points is , the second coordinate is obt...
DigitalNetBase2 toNetShiftCj()
Transforms this digital sequence into a digital net by adding one dimension and shifting all coordina...
abstract void extendSequence(int k)
Increases the number of points to from now on.
int curPointIndex
Index of the current point.
int curCoordIndex
Index of the current coordinate.
int dimShift
Current dimension of the shift.
void addRandomShift()
Same as addRandomShift(0, dim), where dim is the dimension of the point set.
int numPoints
Number of points.
int capacityShift
Number of array elements in the shift vector, always >= dimShift.
int dim
Dimension of the points.
RandomStream shiftStream
Stream used to generate the random shifts.
This is the interface for iterators that permit one to go through the points of a PointSet and the su...