25package umontreal.ssj.discrepancy;
27import umontreal.ssj.hups.Rank1Lattice;
28import umontreal.ssj.util.Num;
47 protected double[] bestVals;
49 private double exhaust(
int s,
boolean relPrime) {
50 int n = disc.getNumPoints();
51 gamma = disc.getGamma();
59 for (j = 1; j < s; j++) {
60 best = Double.MAX_VALUE;
62 for (i = 1; i < n; i++) {
76 err = disc.compute(lat, gamma);
90 private double random(
int s,
int k,
boolean relPrime) {
91 int n = disc.getNumPoints();
93 return exhaust(s, relPrime);
95 gamma = disc.getGamma();
96 final int nm1 = n - 1;
104 for (j = 1; j < s; j++) {
105 best = Double.MAX_VALUE;
109 bestAs[j] = gen.nextInt(1, nm1);
114 bestAs[j] = gen.nextInt(1, nm1);
115 }
while (relPrime && (
Num.
gcd(n, bestAs[j]) != 1));
120 err = disc.compute(lat, gamma);
143 int s = disc.getDimension();
144 bestVals =
new double[s];
159 return exhaust(s,
false);
168 return exhaust(s,
false);
170 return exhaust(s,
true);
183 return random(s, k,
false);
192 return random(s, k,
false);
194 return random(s, k,
true);
This abstract class is the base class of all discrepancy classes.
SearcherCBC(Discrepancy disc, boolean primeN)
The number of points , the dimension , and possibly the weight factors must be given in disc.
double exhaustPrime(int s)
Similar to exhaust(s), except that only values of relatively prime to are considered.
double[] getBestVals()
Returns the best value of the discrepancy found in the last search, in each dimension up to .
double exhaust(int s)
Exhaustive CBC search to find the lattice with the best (the smallest) discrepancy in dimension .
double random(int s, int k)
Random CBC search to find the lattice with the best (the smallest) discrepancy in dimension .
double randomPrime(int s, int k)
Similar to random(s, k), except that only values of relatively prime to are considered.
Searcher(Discrepancy disc, boolean primeN)
The number of points , the dimension , and possibly the weight factors must be given in disc.
This class implements point sets specified by integration lattices of rank 1.
This class provides various constants and methods to compute numerical quantities such as factorials,...
static int gcd(int x, int y)
Returns the greatest common divisor (gcd) of and .