4 #include "local_proto.h"
10 double mean = 0.0, sdx = 0.0, fx, sqrt2, *xcopy;
12 sqrt2 = sqrt((
double)2.0);
15 if ((xcopy = (
double *)
malloc(n *
sizeof(
double))) ==
NULL) {
16 fprintf(stderr,
"Memory error in Cdhc_cramer_von_mises\n");
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) {
38 fx -= (2.0 * i + 1.0) / (2.0 * n);
41 y[1] += 1.0 / (double)(n * 12);
42 y[0] = y[1] * (0.5 / n + 1.0);
45 fprintf(stdout,
" TEST9 CVM(N) =%10.4f\n", y[0]);
double * Cdhc_cramer_von_mises(double *x, int n)
int Cdhc_dcmp(const void *i, const void *j)
double Cdhc_normp(double)
float mean(IClass_statistics *statistics, int band)
Helper function for computing mean.