SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
F2wNetLFSR.java
1/*
2 * Class: F2wNetLFSR
3 * Description: digital net in base 2 starting from a linear feedback
4 shift register generator
5 * Environment: Java
6 * Software: SSJ
7 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
8 * Organization: DIRO, Universite de Montreal
9 * @author
10 * @since
11 *
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 *
25 */
26package umontreal.ssj.hups;
27
28import umontreal.ssj.util.PrintfFormat;
29
44public class F2wNetLFSR extends DigitalNetBase2 {
45 private F2wStructure param;
46
60
65 public F2wNetLFSR(int w, int r, int modQ, int step, int nbcoeff, int coeff[], int nocoeff[], int dim) {
66 param = new F2wStructure(w, r, modQ, step, nbcoeff, coeff, nocoeff);
67 param.initParamLFSR();
68 initNet(r, w, dim);
69 }
70
77 public F2wNetLFSR(String filename, int no, int dim) {
78 param = new F2wStructure(filename, no);
79 param.initParamLFSR();
80 initNet(param.r, param.w, dim);
81 }
82
83 public String toString() {
84 String s = "F2wNetLFSR:" + PrintfFormat.NEWLINE;
85 return s + param.toString();
86 }
87
88 private void initNet(int r, int w, int dim) {
89 numCols = r * w;
90 numRows = 31;
91 outDigits = 31;
92 numPoints = (1 << numCols);
93 this.dim = dim;
94 normFactor = 1.0 / (1L << 31);
95 genMat = new int[dim * numCols];
96
97 for (int j = 0; j < numCols; j++) {
98 param.state = 1 << (r * w - 1 - j);
99 param.initF2wLFSR();
100 genMat[j] = param.output;
101 for (int i = 1; i < dim; i++) {
102 param.F2wLFSR();
103 genMat[i * numCols + j] = param.output;
104 }
105 }
106 }
107}
A special case of DigitalNet for the base .
String toString()
Formats a string that contains information on this digital net.
F2wNetLFSR(int w, int r, int modQ, int step, int nbcoeff, int coeff[], int nocoeff[], int dim)
Constructs and stores the set of cycles for an LCG with modulus n and multiplier a.
F2wNetLFSR(String filename, int no, int dim)
Constructs a point set after reading its parameters from file filename; the parameters are located at...
This class implements methods and fields needed by the classes.
int numPoints
Number of points.
int dim
Dimension of the points.
This class acts like a StringBuffer which defines new types of append methods.
static final String NEWLINE
End-of-line symbol or line separator.