SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
DiscShift1Lattice.java
1/*
2 * Class: DiscShift1Lattice
3 * Description: computes a discrepancy for the randomly shifted points of a
4 lattice
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 Richard Simard
10 * @since January 2009
11
12 * SSJ is free software: you can redistribute it and/or modify it under
13 * the terms of the GNU General Public License (GPL) as published by the
14 * Free Software Foundation, either version 3 of the License, or
15 * any later version.
16
17 * SSJ is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21
22 * A copy of the GNU General Public License is available at
23 <a href="http://www.gnu.org/licenses">GPL licence site</a>.
24 */
25package umontreal.ssj.discrepancy;
26
27import umontreal.ssj.hups.Rank1Lattice;
28
53public class DiscShift1Lattice extends DiscShift1 {
54
60 public DiscShift1Lattice(double[][] points, int n, int s) {
61 super(points, n, s);
62 }
63
70 public DiscShift1Lattice(double[][] points, int n, int s, double[] gamma) {
71 super(points, n, s, gamma);
72 }
73
80 public DiscShift1Lattice(int n, int s, double[] gamma) {
81 super(n, s, gamma);
82 }
83
89 super(set);
90 }
91
97 }
98
104 public double compute(double[][] points, int n, int s) {
105 setONES(s);
106 return compute(points, n, s, ONES);
107 }
108
114 public double compute(double[][] points, int n, int s, double[] gamma) {
115 double[] C1 = new double[s]; // gamma_r^2
116 setC(C1, gamma, s);
117
118 double sum = 0.0;
119 for (int i = 0; i < n; ++i) {
120 double prod = 1.0;
121 for (int r = 0; r < s; ++r) {
122 double u = points[i][r];
123 double pol1 = u * (u - 1.0) + UNSIX; // Bernoulli(2, u)
124 prod *= 1.0 + C1[r] * pol1;
125 }
126 sum += prod;
127 }
128
129 double disc = sum / n - 1.0;
130 if (disc < 0.0)
131 return -1.0;
132 return Math.sqrt(disc);
133 }
134
140 public double compute(double[] T, int n) {
141 double sum = 0.0;
142 for (int i = 0; i < n; ++i) {
143 double h = T[i];
144 double pol1 = h * (h - 1.0) + UNSIX; // Bernoulli(2, h)
145 sum += pol1;
146 }
147
148 double disc = sum / n;
149 if (disc < 0.0)
150 return -1.0;
151 return Math.sqrt(disc);
152 }
153
154}
DiscShift1Lattice(int n, int s, double[] gamma)
The number of points is , the dimension , and the.
DiscShift1Lattice(double[][] points, int n, int s, double[] gamma)
Constructor with the points points[i] in dimensions with the weights gamma[r-1],...
double compute(double[][] points, int n, int s)
Computes the discrepancy ( shift1lat ) for the -dimensional points of lattice points,...
DiscShift1Lattice(double[][] points, int n, int s)
Constructor with the points points[i] in dimensions with all weights .
double compute(double[] T, int n)
Computes the discrepancy ( shift1dim1lat ) for the 1-dimensional lattice of points .
DiscShift1Lattice(Rank1Lattice set)
Constructor with the lattice set.
double compute(double[][] points, int n, int s, double[] gamma)
Computes the discrepancy ( shift1lat ) for the -dimensional points of lattice points,...
DiscShift1(double[][] points, int n, int s)
Constructor with the points points[i] in dimensions and with all weights .
double compute()
Computes the discrepancy of all the points in maximal dimension (dimension of the points).
This class implements point sets specified by integration lattices of rank 1.