SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
BigDiscrepancy.java
1/*
2 * Class: BigDiscrepancy
3 * Description: Base class of all discrepancy classes programmed with
4 multi-precision floating-point numbers
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.PointSet;
28import java.math.*;
29
40public abstract class BigDiscrepancy extends Discrepancy {
41
42 protected BigDecimal[] C1Big; // functions of gamma[i]
43 protected BigDecimal[] C2Big; // functions of gamma[i]
44 protected BigDecimal[] C3Big; // functions of gamma[i]
45 protected BigDecimal[] UBig; // i/n
46 protected BigDecimal[][] FactorBig;
47
48 protected void reserveCBig(int s) {
49 // Reserve memory for gamma factors
50 C1Big = new BigDecimal[s];
51 C2Big = new BigDecimal[s];
52 C3Big = new BigDecimal[s];
53
54 for (int i = 0; i < s; i++) {
55 C1Big[i] = new BigDecimal(0);
56 C2Big[i] = new BigDecimal(0);
57 C3Big[i] = new BigDecimal(0);
58 }
59 }
60
61 protected void reserveFactorBig(int n, int s) {
62 // Reserve memory for factors
63 FactorBig = new BigDecimal[n][s];
64 for (int i = 0; i < n; i++) {
65 FactorBig[i] = new BigDecimal[s];
66 for (int j = 0; j < s; j++)
67 FactorBig[i][j] = new BigDecimal(0);
68 }
69 }
70
71 protected void setUBig(int n) {
72 // Precompute all U[i] = i/n, with i = 0, 1, 2, ..., n-1
73 UBig = new BigDecimal[n];
74 BigDecimal Ninv = new BigDecimal(1); // = 1/n
75 Ninv = Ninv.divide(new BigDecimal(n), MathContext.DECIMAL128);
76
77 for (int i = 0; i < n; i++) {
78 UBig[i] = new BigDecimal(i);
79 UBig[i] = UBig[i].multiply(Ninv);
80 }
81 }
82
89 public BigDiscrepancy(double[][] points, int n, int s) {
90 super(points, n, s);
91 }
92
99 public BigDiscrepancy(double[][] points, int n, int s, double[] gamma) {
100 super(points, n, s, gamma);
101 }
102
109 public BigDiscrepancy(int n, int s, double[] gamma) {
110 super(n, s, gamma);
111 }
112
118 super(set);
119 }
120
125 public BigDiscrepancy() {
126 }
127
128}
BigDiscrepancy(double[][] points, int n, int s, double[] gamma)
Constructor with the points points[i] in dimensions with weight factors gamma.
BigDiscrepancy(int n, int s, double[] gamma)
The number of points is , the dimension , and the.
BigDiscrepancy(PointSet set)
Constructor with the point set set.
BigDiscrepancy(double[][] points, int n, int s)
Constructor with the points points[i] in dimensions.
Discrepancy(double[][] points, int n, int s)
Constructor with the points points[i] in dimensions.
This abstract class represents a general point set.
Definition PointSet.java:99