24package umontreal.ssj.discrepancy;
26import umontreal.ssj.hups.PointSet;
27import umontreal.ssj.util.Num;
70 static protected void setC(
double[] C1,
double[] gam,
int s) {
71 for (
int i = 0; i < s; i++)
72 C1[i] = gam[i] * gam[i];
91 public DiscShift1(
double[][] points,
int n,
int s,
double[] gamma) {
92 super(points, n, s, gamma);
125 public double compute(
double[][] points,
int n,
int s) {
127 return compute(points, n, s, ONES);
134 public double compute(
double[][] points,
int n,
int s,
double[] gamma) {
135 double[] C1 =
new double[s];
140 for (
int r = 0; r < s; ++r)
141 prod *= (1.0 + C1[r] * pol1);
142 double disc = prod / n;
145 for (
int i = 0; i < n - 1; ++i) {
146 for (
int j = i + 1; j < n; ++j) {
148 for (
int r = 0; r < s; ++r) {
149 double u = points[i][r] - points[j][r];
152 pol1 = u * (u - 1.0) + UNSIX;
153 prod *= 1.0 + C1[r] * pol1;
159 disc += 2.0 * sum / ((long) n * n) - 1.0;
162 return Math.sqrt(disc);
171 double disc = pol1 / n;
174 for (
int i = 0; i < n - 1; ++i) {
175 for (
int j = i + 1; j < n; ++j) {
176 double h = T[i] - T[j];
179 pol1 = h * (h - 1.0) + UNSIX;
184 disc += 2.0 * sum / ((long) n * n);
187 return Math.sqrt(disc);
double compute(double[][] points, int n, int s, double[] gamma)
Computes the discrepancy ( shift1 ) in dimension with gamma[r-1].
DiscShift1(double[][] points, int n, int s)
Constructor with the points points[i] in dimensions and with all weights .
DiscShift1(int n, int s, double[] gamma)
The number of points is , the dimension , and the.
double compute(double[] T, int n)
Computes the discrepancy ( shift1dim1 ) for the 1-dimensional set of points .
double compute(double[][] points, int n, int s)
Computes the discrepancy ( shift1 ) for the first points of set points in dimension .
DiscShift1(double[][] points, int n, int s, double[] gamma)
Constructor with the points points[i] in dimensions, and with the weights gamma[r-1],...
DiscShift1(PointSet set)
Constructor with the point set set.
DiscShift1()
Empty constructor.
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.