37 static final double TRENTEUN24 = 31.0 / 24.0;
38 static final double SEPT24 = 7.0 / 24.0;
40 static final BigDecimal BIGp5625 =
new BigDecimal(0.5625);
41 static final BigDecimal BIGp046875 =
new BigDecimal(0.046875);
42 static final BigDecimal BIGp0625 =
new BigDecimal(0.0625);
43 static final BigDecimal BIGp5 =
new BigDecimal(0.5);
44 static final BigDecimal BIG1p5 =
new BigDecimal(1.5);
45 static final BigDecimal BIG2 =
new BigDecimal(2.0);
46 static final BigDecimal BIG3 =
new BigDecimal(3.0);
47 static final BigDecimal BIG4 =
new BigDecimal(4.0);
48 static final BigDecimal BIG4p5 =
new BigDecimal(4.5);
49 static final BigDecimal BIG5 =
new BigDecimal(5.0);
50 static final BigDecimal BIG6 =
new BigDecimal(6.0);
51 static final BigDecimal BIG8 =
new BigDecimal(8.0);
52 static final BigDecimal BIG14 =
new BigDecimal(14.0);
53 static final BigDecimal BIG31s24 =
new BigDecimal(
"1.2916666666666666666666666666666667");
54 static final BigDecimal BIG7s24 =
new BigDecimal(
"0.2916666666666666666666666666666667");
64 setCBig(this.gamma, s);
65 reserveFactorBig(n, s);
77 protected void setFactorBig(
int n,
int s) {
79 for (
int i = 0; i < n; i++) {
80 for (
int j = 0; j < s; j++) {
81 FactorBig[i][j] = computeFactor(UBig[i], C1Big[j], C2Big[j], C3Big[j]);
86 private static BigDecimal computeFactor(BigDecimal x, BigDecimal C1, BigDecimal C2, BigDecimal C3) {
91 BigDecimal pol1 =
new BigDecimal(0);
92 BigDecimal pol2 =
new BigDecimal(0);
93 BigDecimal pol3 =
new BigDecimal(0);
94 BigDecimal temp =
new BigDecimal(0);
100 if (x.compareTo(BIGp5) >= 0) {
102 pol1 = pol1.multiply(BIG2);
103 pol1 = pol1.subtract(BIG4p5);
104 pol1 = pol1.multiply(x);
105 pol1 = pol1.add(BIG3);
106 pol1 = pol1.multiply(x);
107 pol1 = pol1.subtract(BIGp5625);
110 pol2 = pol2.multiply(BIG5);
111 pol2 = pol2.negate();
112 pol2 = pol2.add(BIG6);
113 pol2 = pol2.multiply(x);
114 pol2 = pol2.add(BIG4);
115 pol2 = pol2.multiply(x);
116 pol2 = pol2.negate();
117 pol2 = pol2.add(BIG6);
118 pol2 = pol2.multiply(x);
119 pol2 = pol2.subtract(BIG31s24);
122 temp = temp.multiply(BIG4);
123 temp = temp.subtract(BIG6);
124 temp = temp.multiply(x);
125 temp = temp.add(BigDecimal.ONE);
128 pol3 = pol3.multiply(BIG4);
129 pol3 = pol3.subtract(BIG3);
130 pol3 = pol3.multiply(temp);
131 pol3 = pol3.multiply(temp);
132 pol3 = pol3.multiply(BIGp046875);
136 pol1 = pol1.multiply(BIG2);
137 pol1 = pol1.negate();
138 pol1 = pol1.add(BIG1p5);
139 pol1 = pol1.multiply(x);
140 pol1 = pol1.multiply(x);
141 pol1 = pol1.subtract(BIGp0625);
144 pol2 = pol2.multiply(BIG5);
145 pol2 = pol2.subtract(BIG14);
146 pol2 = pol2.multiply(x);
147 pol2 = pol2.add(BIG8);
148 pol2 = pol2.multiply(x);
149 pol2 = pol2.multiply(x);
150 pol2 = pol2.subtract(BIG7s24);
153 temp = temp.multiply(BIG4);
154 temp = temp.negate();
155 temp = temp.add(BIG2);
156 temp = temp.multiply(x);
157 temp = temp.add(BigDecimal.ONE);
160 pol3 = pol3.multiply(BIG4);
161 pol3 = pol3.subtract(BigDecimal.ONE);
162 pol3 = pol3.multiply(temp);
163 pol3 = pol3.multiply(temp);
164 pol3 = pol3.multiply(BIGp046875);
165 pol3 = pol3.negate();
169 BigDecimal sum =
new BigDecimal(0);
170 pol1 = pol1.multiply(C1);
172 pol2 = pol2.multiply(C2);
174 pol3 = pol3.multiply(C3);
186 BigDecimal prod =
new BigDecimal(1);
187 BigDecimal tem =
new BigDecimal(0);
188 BigDecimal sum =
new BigDecimal(0);
192 for (
long i = 0; i < nl; ++i) {
193 prod = BigDecimal.ONE;
194 for (j = 0; j < s; ++j) {
195 r = (int) ((i * a[j]) % nl);
196 tem = FactorBig[r][j];
198 tem = tem.add(BigDecimal.ONE);
199 prod = prod.multiply(tem);
204 sum = sum.divide(
new BigDecimal(nl), MathContext.DECIMAL128);
205 sum = sum.subtract(BigDecimal.ONE);
206 double disc = sum.doubleValue();
209 return Math.sqrt(disc);
215 public double compute(
double[][] points,
int n,
int s) {
217 return compute(points, n, s, ONES);
223 public double compute(
double[][] points,
int n,
int s,
double[] gamma) {
224 throw new UnsupportedOperationException(
"method NOT IMPLEMENTED");