4 #include "local_proto.h"
8 double *xcopy,
mean = 0.0, zbar = 0.0, fn2, fx, sum4 = 0.0;
12 if ((xcopy = (
double *)
malloc(n *
sizeof(
double))) ==
NULL) {
13 fprintf(stderr,
"Memory error in Cdhc_watson_u2_exp\n");
17 for (i = 0; i < n; ++i) {
23 qsort(xcopy, n,
sizeof(
double),
Cdhc_dcmp);
25 for (i = 0; i < n; ++i) {
26 fx = 1 - exp(-xcopy[i] /
mean);
34 fn2 = (2.0 * i + 1.0) / (2.0 * n);
35 sum4 += (fx - fn2) * (fx - fn2);
36 fn2 = (2.0 * (i + 1) - 1.0) / (2.0 * n);
41 y[0] = (1.0 / (n * 12) + sum4) - n * (zbar - .5) * (zbar - .5);
42 y[0] *= 1.0 + 0.16 / n;
45 fprintf(stdout,
" TEST19 WU2(E) =%10.4f\n", y[0]);
int Cdhc_dcmp(const void *i, const void *j)
float mean(IClass_statistics *statistics, int band)
Helper function for computing mean.
double * Cdhc_watson_u2_exp(double *x, int n)