ksn.c 493 B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <grass/cdhc.h>
  4. #include "local_proto.h"
  5. double *Cdhc_kolmogorov_smirnov(double *x, int n)
  6. {
  7. static double y[2];
  8. double *d, sqrtn;
  9. sqrtn = sqrt((double)n);
  10. d = Cdhc_dmax(x, n);
  11. y[1] = (d[0] > d[1]) ? d[0] : d[1];
  12. y[0] = y[1] * (sqrtn + 0.85 / sqrtn - 0.01);
  13. #ifdef NOISY
  14. fprintf(stdout, " TEST10 KSD(N) =%10.4f\n", y[0]);
  15. fprintf(stdout, " TEST11 KSD =%10.4f\n", y[1]);
  16. #endif /* NOISY */
  17. return y;
  18. }