24package umontreal.ssj.discrepancy;
26import umontreal.ssj.hups.Rank1Lattice;
27import umontreal.ssj.util.Num;
28import umontreal.ssj.util.PrintfFormat;
76 private void initFactor(
int s,
double[] Beta,
int alpha) {
78 for (
int j = 1; j <= s; j++)
79 C[j - 1] = Math.pow(2.0 * Math.PI * Beta[j], (
double) alpha) /
Num.
factorial(alpha);
82 private void initA(
int s,
double[] bet,
int alp) {
101 public Palpha(
double[][] points,
int n,
int s,
double[] beta,
int alpha) {
102 super(points, n, s, beta);
103 initA(s, beta, alpha);
110 public Palpha(
double[][] points,
int n,
int s,
int alpha) {
112 initA(s,
null, alpha);
122 public Palpha(
int n,
int s,
double[] beta,
int alpha) {
124 initA(s, beta, alpha);
152 public double compute(
double[][] points,
int n,
int s) {
153 return compute(points, n, s,
null, alpha);
161 public double compute(
double[][] points,
int n,
int s,
double[] beta) {
162 return compute(points, n, s, beta, alpha);
172 public double compute(
double[][] points,
int n,
int s,
int alpha) {
173 return compute(points, n, s,
null, alpha);
182 public double compute(
double[][] points,
int n,
int s,
double[] beta,
int alpha) {
183 initA(s, beta, alpha);
184 initFactor(s, gamma, alpha);
188 return calcPalpha2(points, n, s, gamma);
190 return calcPalpha4(points, n, s, gamma);
192 return calcPalpha6(points, n, s, gamma);
194 return calcPalpha8(points, n, s, gamma);
196 throw new IllegalArgumentException(
"alpha must be one of {2, 4, 6, 8}");
204 private double calcPalpha2(
double[][] points,
int N,
int s,
double[] beta) {
206 for (
int i = 0; i < N; ++i) {
208 for (
int j = 0; j < s; ++j) {
209 double u = Points[i][j];
210 prod *= 1.0 + C[j] * (u * (u - 1.0) + UNSIX);
215 return beta[0] * (sum - 1.0);
222 private double calcPalpha4(
double[][] points,
int N,
int s,
double[] beta) {
224 for (
int i = 0; i < N; ++i) {
226 for (
int j = 0; j < s; ++j) {
227 double u = Points[i][j];
228 prod *= 1.0 - C[j] * (((u - 2.0) * u + 1.0) * u * u - UNTRENTE);
233 return beta[0] * (sum - 1.0);
240 private double calcPalpha6(
double[][] points,
int N,
int s,
double[] beta) {
242 for (
int i = 0; i < N; ++i) {
244 for (
int j = 0; j < s; ++j) {
245 double u = Points[i][j];
246 prod *= 1.0 + C[j] * ((((u - 3.0) * u + 2.5) * u * u - 0.5) * u * u + QUARAN);
251 return beta[0] * (sum - 1.0);
258 private double calcPalpha8(
double[][] points,
int N,
int s,
double[] beta) {
260 for (
int i = 0; i < N; ++i) {
262 for (
int j = 0; j < s; ++j) {
263 double u = Points[i][j];
264 prod *= 1.0 - C[j] * (((((u - 4.0) * u + QTIERS) * u * u - STIERS) * u * u + DTIERS) * u * u - UNTRENTE);
269 return beta[0] * (sum - 1.0);
275 sb.append(
"gamma = [");
276 appendGamma(sb, gamma, dim + 1);
279 return sb.toString();
int getDimension()
Returns the dimension of the points .
String getName()
Returns the name of the Discrepancy.
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).
double compute(double[][] points, int n, int s, double[] beta)
Computes the discrepancy ( shift1lat ) for the -dimensional points of lattice points,...
double compute(double[][] points, int n, int s, int alpha)
Computes the discrepancy ( shift1lat ) for the -dimensional points of lattice points,...
Palpha(int n, int s, double[] beta, int alpha)
Constructor with points in dimensions and with alpha .
String toString()
Returns the parameters of this class.
void setBeta(double[] beta)
Sets the values of , where is the dimension of the points.
double compute(double[][] points, int n, int s)
Computes the discrepancy ( shift1lat ) for the -dimensional points of lattice points,...
Palpha(double[][] points, int n, int s, double[] beta, int alpha)
Constructor with points in dimensions and with alpha .
Palpha(Rank1Lattice set, double[] beta, int alpha)
Constructor with the lattice set with weights beta[j] and parameter alpha .
Palpha(int alpha)
Constructor with parameter alpha .
double compute(double[][] points, int n, int s, double[] beta, int alpha)
Computes the discrepancy ( shift1lat ) for the -dimensional points of lattice points,...
Palpha(double[][] points, int n, int s, int alpha)
Constructor with all (see eq.
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 double factorial(int n)
Returns the value of .