4 #include "local_proto.h" 10 double *xcopy, sqrt2, sqrtn,
mean = 0.0, sdx = 0.0, fx;
11 double dp, dp_max, dm, dm_max;
14 if ((xcopy = (
double *)
malloc(n *
sizeof(
double))) ==
NULL) {
15 fprintf(stderr,
"Memory error in Cdhc_dmax\n");
19 sqrt2 = sqrt((
double)2.0);
20 sqrtn = sqrt((
double)n);
22 for (i = 0; i < n; ++i) {
27 sdx = sqrt((n * sdx - mean * mean) / (n * (n - 1.0)));
30 qsort(xcopy, n,
sizeof(
double),
Cdhc_dcmp);
32 for (i = 0; i < n; ++i) {
33 xcopy[i] = (xcopy[i] -
mean) / sdx;
41 dp = (double)(i + 1) / (double)n - fx;
42 dm = fx - i / (double)n;
43 if (i == 0 || dp > dp_max)
46 if (i == 0 || dm > dm_max)
double * Cdhc_dmax(double *x, int n)
double Cdhc_normp(double)
int Cdhc_dcmp(const void *i, const void *j)
float mean(IClass_statistics *statistics, int band)
Helper function for computing mean.