4 #include "local_proto.h"
9 double *xcopy, sqrt2,
mean = 0.0, sdx = 0.0, fx;
10 double dp = 0.0, dp_max = 0.0, dm = 0.0, dm_max = 0.0;
13 if ((xcopy = (
double *)
malloc(n *
sizeof(
double))) ==
NULL) {
14 fprintf(stderr,
"Memory error in Cdhc_dmax\n");
18 sqrt2 = sqrt((
double)2.0);
20 for (i = 0; i < n; ++i) {
25 sdx = sqrt((n * sdx -
mean *
mean) / (n * (n - 1.0)));
28 qsort(xcopy, n,
sizeof(
double),
Cdhc_dcmp);
30 for (i = 0; i < n; ++i) {
31 xcopy[i] = (xcopy[i] -
mean) / sdx;
39 dp = (double)(i + 1) / (double)n - fx;
40 dm = fx - i / (double)n;
41 if (i == 0 || dp > dp_max)
44 if (i == 0 || dm > dm_max)
int Cdhc_dcmp(const void *i, const void *j)
double Cdhc_normp(double)
double * Cdhc_dmax(double *x, int n)
float mean(IClass_statistics *statistics, int band)
Helper function for computing mean.