25package umontreal.ssj.discrepancy;
27import umontreal.ssj.hups.PointSet;
28import umontreal.ssj.util.Num;
82 static protected double[] setC(
double gam) {
83 double[] C =
new double[3];
88 C[2] = v * 16.0 / 45.0;
92 static protected void setC(
double[] C1,
double[] C2,
double[] C3,
double[] gam,
int s) {
93 for (
int i = 0; i < s; i++) {
94 double v = gam[i] * gam[i];
95 C1[i] = v * 4.0 / 3.0;
98 C3[i] = v * 16.0 / 45.0;
117 super(points, n, s, gamma);
151 public double compute(
double[][] points,
int n,
int s) {
153 return compute(points, n, s, ONES);
161 public double compute(
double[][] points,
int n,
int s,
double[] gamma) {
162 double[] C1 =
new double[s];
163 double[] C2 =
new double[s];
164 double[] C3 =
new double[s];
165 setC(C1, C2, C3, gamma, s);
167 double pol1 = -1.0 / 30.0;
168 double pol2 = 7.0 / 240.0;
169 double pol3 = 1.0 / 42.0;
170 double pol4 = -31.0 / 1344.0;
174 for (
int r = 0; r < s; ++r) {
175 temp = C1[r] * (pol1 - pol2) + C2[r] * (7.0 * pol1 - 2.0 * pol2) + C3[r] * (pol3 - pol4);
178 double disc = prod / n;
181 for (
int i = 0; i < n - 1; ++i) {
182 for (
int j = i + 1; j < n; ++j) {
184 for (
int r = 0; r < s; ++r) {
185 double u = points[i][r] - points[j][r];
188 pol1 = ((u - 2.0) * u + 1.0) * u * u - UNTRENTE;
192 pol2 = ((v - 2.0) * v + 1.0) * v * v - UNTRENTE;
195 pol3 = (((u - 3.0) * u + 2.5) * u * u - 0.5) * u * u + QUARAN;
196 pol4 = (((v - 3.0) * v + 2.5) * v * v - 0.5) * v * v + QUARAN;
198 temp = C1[r] * (pol1 - pol2) + C2[r] * (7.0 * pol1 - 2.0 * pol2) + C3[r] * (pol3 - pol4);
205 disc += 2.0 * sum / ((long) n * n) - 1.0;
208 return Math.sqrt(disc);
225 public double compute(
double[] T,
int n,
double gamma) {
226 double[] C = setC(gamma);
231 double pol1 = -1.0 / 30.0;
232 double pol2 = 7.0 / 240.0;
233 double temp = C1 * (pol1 - pol2) + C2 * (7.0 * pol1 - 2.0 * pol2) + C3 * (1.0 / 42.0 + 31.0 / 1344.0);
234 double disc = -temp / n;
237 for (
int i = 0; i < n - 1; ++i) {
238 for (
int j = i + 1; j < n; ++j) {
239 double h = T[i] - T[j];
242 pol1 = ((h - 2.0) * h + 1.0) * h * h - UNTRENTE;
246 pol2 = ((v - 2.0) * v + 1.0) * v * v - UNTRENTE;
247 temp = C1 * (pol1 - pol2) + C2 * (7.0 * pol1 - 2.0 * pol2);
249 pol1 = (((h - 3.0) * h + 2.5) * h * h - 0.5) * h * h + QUARAN;
250 pol2 = (((v - 3.0) * v + 2.5) * v * v - 0.5) * v * v + QUARAN;
251 temp += C3 * (pol1 - pol2);
256 disc += 2.0 * sum / ((long) n * n);
259 return Math.sqrt(disc);
double compute(double[] T, int n)
Computes the discrepancy ( baker1dim1 ) for the first points of in 1 dimension, with weight .
DiscShiftBaker1(int n, int s, double[] gamma)
The number of points is , the dimension , and the.
double compute(double[] T, int n, double gamma)
Computes the discrepancy ( baker1dim1 ) for the first points of in 1 dimension, with weight gamma.
double compute(double[][] points, int n, int s, double[] gamma)
Computes the discrepancy ( baker1 ) for the first points of points in dimension and with weight ga...
DiscShiftBaker1(double[][] points, int n, int s, double[] gamma)
Constructor with the points points[i] in dimensions, with weights gamma[r-1].
double compute(double[][] points, int n, int s)
Computes the discrepancy ( baker1 ) for the -dimensional points of set points, containing.
DiscShiftBaker1()
Empty constructor.
DiscShiftBaker1(PointSet set)
Constructor with the point set set.
DiscShiftBaker1(double[][] points, int n, int s)
Constructor with the points points[i] in dimensions, with all the weights .
Discrepancy(double[][] points, int n, int s)
Constructor with the points points[i] in dimensions.
double compute()
Computes the discrepancy of all the points in maximal dimension (dimension of the points).
This abstract class represents a general point set.