25package umontreal.ssj.hups;
45 private int[][] copyDigitalShift(
int[][] S) {
49 int[][] T =
new int[S.length][S[0].length];
50 for (
int i = 0; i < S.length; ++i)
51 for (
int j = 0; j < S[0].length; ++j)
56 private DigitalNet initNetVar(
boolean shiftFlag) {
64 net.numCols = numCols;
65 net.numRows = numRows;
66 net.outDigits = outDigits;
67 net.normFactor = normFactor;
69 net.factor =
new double[outDigits];
70 for (
int i = 0; i < outDigits; i++)
71 net.factor[i] = factor[i];
72 net.genMat =
new int[net.dim * numCols][numRows];
76 net.digitalShift = copyDigitalShift(digitalShift);
89 final int N =
dim * numCols;
90 for (
int i = 0; i < N; i++)
91 for (
int j = 0; j < numRows; j++)
92 net.genMat[i][j] = genMat[i][j];
116 for (j =
dim; j >= 1; j--) {
118 for (c = 0; c < numCols; c++)
119 for (l = 0; l < numRows; l++)
120 net.genMat[start + c][l] = genMat[start - numCols + c][l];
124 for (c = 0; c < numCols; c++) {
125 for (l = 0; l < numRows; l++)
126 net.genMat[c][l] = 0;
127 net.genMat[c][numCols - c - 1] = 1;
164 protected class DigitalNetIteratorShiftGenerators
extends DigitalNetIterator {
169 public DigitalNetIteratorShiftGenerators() {
172 if (digitalShift !=
null &&
dimShift < dimS)
180 public void init2() {
193 idigits = intToDigitsGray(b, i, numCols, bdigit, gdigit);
195 for (j = 1; j <=
dim; j++) {
196 for (l = 0; l < outDigits; l++) {
197 if (digitalShift ==
null)
200 sum = digitalShift[j][l];
202 for (c = 0; c < idigits; c++)
203 sum += genMat[(j - 1) * numCols + c][l] * gdigit[c];
204 cachedCurPoint[j * outDigits + l] = sum % b;
208 for (l = 0; l < outDigits; l++) {
209 if (digitalShift ==
null)
212 sum = digitalShift[0][l];
214 for (c = 0; c < idigits; c++)
215 if (l == numCols - c - 1)
217 cachedCurPoint[l] = sum % b;
232 for (pos = 0; gdigit[pos] == b - 1; pos++)
241 if (outDigits < numRows)
243 for (j = 1; j <=
dim; j++) {
244 for (l = 0; l < lsup; l++) {
245 cachedCurPoint[j * outDigits + l] += genMat[(j - 1) * numCols + pos][l];
246 cachedCurPoint[j * outDigits + l] %= b;
250 l = numCols - pos - 1;
252 cachedCurPoint[l] += 1;
253 cachedCurPoint[l] %= b;
262 protected class DigitalNetIteratorShiftNoGray
extends DigitalNetIterator {
267 public DigitalNetIteratorShiftNoGray() {
270 if (digitalShift !=
null &&
dimShift < dimS)
278 public void init2() {
291 idigits = intToDigitsGray(b, i, numCols, bdigit, gdigit);
293 for (j = 1; j <=
dim; j++) {
294 for (l = 0; l < outDigits; l++) {
295 if (digitalShift ==
null)
298 sum = digitalShift[j][l];
300 for (c = 0; c < idigits; c++) {
301 sum += genMat[(j - 1) * numCols + c][l] * bdigit[c];
304 cachedCurPoint[j * outDigits + l] = sum;
308 for (l = 0; l < outDigits; l++) {
309 if (digitalShift ==
null)
312 sum = digitalShift[0][l];
314 for (c = 0; c < idigits; c++)
315 if (l == numCols - c - 1)
317 cachedCurPoint[l] = sum % b;
330 for (pos = 0; bdigit[pos] == b - 1; pos++)
341 if (outDigits < numRows)
343 for (j = 1; j <=
dim; j++) {
344 for (l = 0; l < lsup; l++) {
345 for (c = 0; c <= pos; c++)
346 cachedCurPoint[j * outDigits + l] += genMat[(j - 1) * numCols + c][l];
347 cachedCurPoint[j * outDigits + l] %= b;
351 for (l = 0; l < lsup; l++) {
352 for (c = 0; c <= pos; c++)
353 if (l == numCols - c - 1) {
354 cachedCurPoint[l] += 1;
355 cachedCurPoint[l] %= b;
void resetCurPointIndex()
Resets both the current point index and the current coordinate to 0.
This class provides the basic structures for storing and manipulating linear digital nets in base ,...
DigitalNet()
Empty constructor.
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.
DigitalNet 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.
PointSetIterator iteratorShift()
Similar to iterator, except that the first coordinate of the points is , the second coordinate is obt...
DigitalNet toNet()
Transforms this digital sequence into a digital net without changing the coordinates of the points.
PointSetIterator iteratorShiftNoGray()
This iterator shifts all coordinates of each point one position to the right and sets the first coord...
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...