[GRASS-SVN] r62130 - in grass/trunk: include/defs lib/cdhc vector/v.normal
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Sep 28 14:52:15 PDT 2014
Author: neteler
Date: 2014-09-28 14:52:15 -0700 (Sun, 28 Sep 2014)
New Revision: 62130
Modified:
grass/trunk/include/defs/cdhc.h
grass/trunk/lib/cdhc/README
grass/trunk/lib/cdhc/andrsnde.c
grass/trunk/lib/cdhc/andrsndn.c
grass/trunk/lib/cdhc/as177.c
grass/trunk/lib/cdhc/as181.c
grass/trunk/lib/cdhc/as241.c
grass/trunk/lib/cdhc/as66.c
grass/trunk/lib/cdhc/cdhclib.dox
grass/trunk/lib/cdhc/chisqe.c
grass/trunk/lib/cdhc/chisqn.c
grass/trunk/lib/cdhc/cvmw2e.c
grass/trunk/lib/cdhc/cvmw2n.c
grass/trunk/lib/cdhc/dagstndn.c
grass/trunk/lib/cdhc/dcmp.c
grass/trunk/lib/cdhc/dmax.c
grass/trunk/lib/cdhc/dmaxe.c
grass/trunk/lib/cdhc/durbins.c
grass/trunk/lib/cdhc/enormp.c
grass/trunk/lib/cdhc/extreme.c
grass/trunk/lib/cdhc/geary.c
grass/trunk/lib/cdhc/kotz.c
grass/trunk/lib/cdhc/kse.c
grass/trunk/lib/cdhc/ksn.c
grass/trunk/lib/cdhc/kuiprsve.c
grass/trunk/lib/cdhc/kuiprsvn.c
grass/trunk/lib/cdhc/local_proto.h
grass/trunk/lib/cdhc/normp.c
grass/trunk/lib/cdhc/omnibus.c
grass/trunk/lib/cdhc/royston.c
grass/trunk/lib/cdhc/shapiro1.c
grass/trunk/lib/cdhc/shapiro2.c
grass/trunk/lib/cdhc/shapiroe.c
grass/trunk/lib/cdhc/test.c
grass/trunk/lib/cdhc/watsonue.c
grass/trunk/lib/cdhc/watsonun.c
grass/trunk/lib/cdhc/weisberg.c
grass/trunk/lib/cdhc/xinormal.c
grass/trunk/vector/v.normal/main.c
Log:
cdhc lib: prefix added (trac #2421)
Modified: grass/trunk/include/defs/cdhc.h
===================================================================
--- grass/trunk/include/defs/cdhc.h 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/include/defs/cdhc.h 2014-09-28 21:52:15 UTC (rev 62130)
@@ -1,35 +1,35 @@
#ifndef CDHCDEFS_H
#define CDHCDEFS_H
-double enormp(double);
-double normp(double);
-double xinormal(double);
-double *dmax(double *, int);
-double *dmax_exp(double *, int);
-double *omnibus_moments(double *, int);
-double *geary_test(double *, int);
-double *dagostino_d(double *, int);
-double *extreme(double *, int);
-double *kuipers_v(double *, int);
-double *watson_u2(double *, int);
-double *durbins_exact(double *, int);
-double *anderson_darling(double *, int);
-double *cramer_von_mises(double *, int);
-double *kolmogorov_smirnov(double *, int);
-double *chi_square(double *, int);
-double *shapiro_wilk(double *, int);
-double *shapiro_francia(double *, int);
-double *weisberg_bingham(double *, int);
-double *royston(double *, int);
-double *shapiro_wilk_exp(double *, int);
-double *kolmogorov_smirnov_exp(double *, int);
-double *cramer_von_mises_exp(double *, int);
-double *kuipers_v_exp(double *, int);
-double *watson_u2_exp(double *, int);
-double *anderson_darling_exp(double *, int);
-double *chi_square_exp(double *, int);
-double *mod_maxlik_ratio(double *, int);
-double *coeff_variation(double *, int);
-double *kotz_families(double *, int);
+double Cdhc_enormp(double);
+double Cdhc_normp(double);
+double Cdhc_xinormal(double);
+double *Cdhc_dmax(double *, int);
+double *Cdhc_dmax_exp(double *, int);
+double *Cdhc_omnibus_moments(double *, int);
+double *Cdhc_geary_test(double *, int);
+double *Cdhc_dagostino_d(double *, int);
+double *Cdhc_extreme(double *, int);
+double *Cdhc_kuipers_v(double *, int);
+double *Cdhc_watson_u2(double *, int);
+double *Cdhc_durbins_exact(double *, int);
+double *Cdhc_anderson_darling(double *, int);
+double *Cdhc_cramer_von_mises(double *, int);
+double *Cdhc_kolmogorov_smirnov(double *, int);
+double *Cdhc_chi_square(double *, int);
+double *Cdhc_shapiro_wilk(double *, int);
+double *Cdhc_shapiro_francia(double *, int);
+double *Cdhc_weisberg_bingham(double *, int);
+double *Cdhc_royston(double *, int);
+double *Cdhc_shapiro_wilk_exp(double *, int);
+double *Cdhc_kolmogorov_smirnov_exp(double *, int);
+double *Cdhc_cramer_von_mises_exp(double *, int);
+double *Cdhc_kuipers_v_exp(double *, int);
+double *Cdhc_watson_u2_exp(double *, int);
+double *Cdhc_anderson_darling_exp(double *, int);
+double *Cdhc_chi_square_exp(double *, int);
+double *Cdhc_mod_maxlik_ratio(double *, int);
+double *Cdhc_coeff_variation(double *, int);
+double *Cdhc_kotz_families(double *, int);
#endif /* CDHCDEFS_H */
Modified: grass/trunk/lib/cdhc/README
===================================================================
--- grass/trunk/lib/cdhc/README 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/README 2014-09-28 21:52:15 UTC (rev 62130)
@@ -8,7 +8,7 @@
* Radim Blazek <radim.blazek gmail.com>
* Glynn Clements <glynn gclements.plus.com>,
* PURPOSE: library for testing normality & exponentiality
- * COPYRIGHT: (C) 2002-2007 by the GRASS Development Team
+ * COPYRIGHT: (C) 2002-2014 by the GRASS Development Team
*
* This program is free software under the GNU General Public
* License (>=v2). Read the file COPYING that comes with GRASS
@@ -28,4 +28,4 @@
Includes D'Agostino's D, Anderson-Darling, Cramer-Von Mises W^2,
Kolmogorov-Smirnov, Chi-Square, Shapiro-Wilk, many others.
Expands and fixes bugs in general/cdh in statlib.
-
+ Other document: http://svn.osgeo.org/grass/grass/branches/releasebranch_5_0/src/sites/cdhc/doc/goodness.ps
Modified: grass/trunk/lib/cdhc/andrsnde.c
===================================================================
--- grass/trunk/lib/cdhc/andrsnde.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/andrsnde.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,14 +4,14 @@
#include "local_proto.h"
-double *anderson_darling_exp(double *x, int n)
+double *Cdhc_anderson_darling_exp(double *x, int n)
{
static double y[2];
double sqrt2, mean = 0.0, *xcopy, fx, sum3 = 0.0;
int i;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in anderson_darling\n");
+ fprintf(stderr, "Memory error in Cdhc_anderson_darling\n");
exit(EXIT_FAILURE);
}
@@ -22,7 +22,7 @@
mean += x[i];
}
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
fx = 1 - exp(-xcopy[i] / mean);
Modified: grass/trunk/lib/cdhc/andrsndn.c
===================================================================
--- grass/trunk/lib/cdhc/andrsndn.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/andrsndn.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,14 +4,14 @@
#include "local_proto.h"
-double *anderson_darling(double *x, int n)
+double *Cdhc_anderson_darling(double *x, int n)
{
int i;
static double y[2];
double sqrt2, mean = 0.0, sdx = 0.0, *xcopy, fx;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in anderson_darling\n");
+ fprintf(stderr, "Memory error in Cdhc_anderson_darling\n");
exit(EXIT_FAILURE);
}
@@ -26,13 +26,13 @@
sdx = sqrt((n * sdx - mean * mean) / (n * (n - 1.0)));
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i)
xcopy[i] = (xcopy[i] - mean) / sdx;
for (i = 0; i < n; ++i) {
- fx = 0.5 + normp(xcopy[i] / sqrt2) / 2.0;
+ fx = 0.5 + Cdhc_normp(xcopy[i] / sqrt2) / 2.0;
if (fx <= 1e-5)
fx = 1e-5;
Modified: grass/trunk/lib/cdhc/as177.c
===================================================================
--- grass/trunk/lib/cdhc/as177.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/as177.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -6,7 +6,7 @@
*
* Translation to C by James Darrell McCauley, mccauley at ecn.purdue.edu.
*
- * The functions nscor1() and nscor2() calculate the expected values of
+ * The functions Cdhc_nscor1() and Cdhc_nscor2() calculate the expected values of
* normal order statistics in exact or approximate form, respectively.
*
*/
@@ -20,12 +20,12 @@
/* Local function prototypes */
-static double alnfac(int j);
-static double correc(int i, int n);
+static double Cdhc_alnfac(int j);
+static double Cdhc_correc(int i, int n);
/* exact calculation of normal scores */
-void nscor1(double s[], int n, int n2, double work[], int *ifault)
+void Cdhc_nscor1(double s[], int n, int n2, double work[], int *ifault)
{
double ani, c, c1, d, scor;
int i, j;
@@ -43,7 +43,7 @@
*ifault = 2;
/* calculate the natural log of factorial(n) */
- c1 = alnfac(n);
+ c1 = Cdhc_alnfac(n);
d = c1 - log((double)n);
/* accumulate ordinates for calculation of integral for rankits */
@@ -73,8 +73,8 @@
for (i = 0; i < NSTEP; ++i) {
work[0 * NSTEP + i] = xx;
work[1 * NSTEP + i] = pi2 - xx * xx * 0.5;
- work[2 * NSTEP + i] = log(alnorm(xx, 1));
- work[3 * NSTEP + i] = log(alnorm(xx, 0));
+ work[2 * NSTEP + i] = log(Cdhc_alnorm(xx, 1));
+ work[3 * NSTEP + i] = log(Cdhc_alnorm(xx, 0));
xx = xstart + H * (i + 1.0);
}
@@ -85,7 +85,7 @@
/*-Algorithm AS 177.2 Appl. Statist. (1982) Vol.31, No.2
* Natural logarithm of factorial for non-negative argument
*/
-static double alnfac(int j)
+static double Cdhc_alnfac(int j)
{
static double r[7] = { 0.0, 0.0, 0.69314718056, 1.79175946923,
3.17805383035, 4.78749174278, 6.57925121101
@@ -108,7 +108,7 @@
/*-Algorithm AS 177.3 Appl. Statist. (1982) Vol.31, No.2
* Approximation for Rankits
*/
-void nscor2(double s[], int n, int n2, int *ifault)
+void Cdhc_nscor2(double s[], int n, int n2, int *ifault)
{
static double eps[4] = { 0.419885, 0.450536, 0.456936, 0.468488 };
static double dl1[4] = { 0.112063, 0.121770, 0.239299, 0.215159 };
@@ -140,7 +140,7 @@
for (i = 0; i < k; ++i) {
e1 = (1.0 + i - eps[i]) / (n + gam[i]);
e2 = pow(e1, lam[i]);
- s[i] = e1 + e2 * (dl1[i] + e2 * dl2[i]) / n - correc(1 + i, n);
+ s[i] = e1 + e2 * (dl1[i] + e2 * dl2[i]) / n - Cdhc_correc(1 + i, n);
}
if (n2 != k) {
@@ -149,7 +149,7 @@
l1 = lam[3] + bb / (1.0 + i + d);
e1 = (1.0 + i - eps[3]) / (n + gam[3]);
e2 = pow(e1, l1);
- s[i] = e1 + e2 * (dl1[3] + e2 * dl2[3]) / n - correc(1 + i, n);
+ s[i] = e1 + e2 * (dl1[3] + e2 * dl2[3]) / n - Cdhc_correc(1 + i, n);
}
}
@@ -162,10 +162,10 @@
/*-Algorithm AS 177.4 Appl. Statist. (1982) Vol.31, No.2
- * Calculates correction for tail area of noraml distribution
+ * Calculates Cdhc_correction for tail area of noraml distribution
* corresponding to ith largest rankit in sample size n.
*/
-static double correc(int i, int n)
+static double Cdhc_correc(int i, int n)
{
static double c1[7] = { 9.5, 28.7, 1.9, 0.0, -7.0, -6.2, -1.6 };
static double c2[7] = { -6.195e3, -9.569e3, -6.728e3, -17.614e3,
Modified: grass/trunk/lib/cdhc/as181.c
===================================================================
--- grass/trunk/lib/cdhc/as181.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/as181.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -17,7 +17,7 @@
* Calculates Shapiro and Wilk's W statistic and its sig. level
*
* Originally used:
- * Auxiliary routines required: ALNORM = algorithm AS 66 and NSCOR2
+ * Auxiliary routines required: Cdhc_alnorm = algorithm AS 66 and Cdhc_nscor2
* from AS 177.
* Note: ppnd() from as66 was replaced with ppnd16() from as241.
@@ -112,7 +112,7 @@
y = pow(one - *w, lamda);
z = (y - ybar) / sdy;
- *pw = alnorm(z, upper);
+ *pw = Cdhc_alnorm(z, upper);
return;
}
@@ -195,8 +195,8 @@
*ifault = 0;
if (n > 6) {
- /* Calculate rankits using approximate function nscor2(). (AS177) */
- nscor2(a, n, n2, ifault);
+ /* Calculate rankits using approximate function Cdhc_nscor2(). (AS177) */
+ Cdhc_nscor2(a, n, n2, ifault);
for (sastar = 0.0, j = 1; j < n2; ++j)
sastar += a[j] * a[j];
@@ -285,12 +285,12 @@
*
* A remark on AS 181
*
- * Calculates Sheppard corrected version of W test.
+ * Calculates Sheppard Cdhc_corrected version of W test.
*
- * Auxiliary functions required: ALNORM = algorithm AS 66, and PPND =
- * algorithm AS 111 (or PPND7 from AS 241).
+ * Auxiliary functions required: Cdhc_alnorm = algorithm AS 66, and PPND =
+ * algorithm AS 111 (or Cdhc_ppnd7 from AS 241).
*/
-void wgp(double x[], int n, double ssq, double gp, double h, double a[],
+void Cdhc_wgp(double x[], int n, double ssq, double gp, double h, double a[],
int n2, double eps, double w, double u, double p, int *ifault)
{
double zbar, zsd, an1, hh;
@@ -302,9 +302,9 @@
if (n < 7)
return;
- if (gp > 0.0) { /* No correction applied if gp=0. */
+ if (gp > 0.0) { /* No Cdhc_correction applied if gp=0. */
an1 = (double)(n - 1);
- /* correct ssq and find standardized grouping interval (h) */
+ /* Cdhc_correct ssq and find standardized grouping interval (h) */
ssq = ssq - an1 * gp * gp / 12.0;
h = gp / sqrt(ssq / an1);
*ifault = 4;
@@ -324,7 +324,7 @@
}
if (gp > 0.0) {
- /* correct u for grouping interval (n<=100 and n>100 separately) */
+ /* Cdhc_correct u for grouping interval (n<=100 and n>100 separately) */
hh = sqrt(h);
if (n <= 100) {
zbar = -h * (1.07457 + hh * (-2.8185 + hh * 1.8898));
@@ -339,8 +339,8 @@
/* ppnd is AS 111 (Beasley and Springer, 1977) */
u = (-ppnd16(p) - zbar) / zsd;
- /* alnorm is AS 66 (Hill, 1973) */
- p = alnorm(u, 1);
+ /* Cdhc_alnorm is AS 66 (Hill, 1973) */
+ p = Cdhc_alnorm(u, 1);
return;
}
Modified: grass/trunk/lib/cdhc/as241.c
===================================================================
--- grass/trunk/lib/cdhc/as241.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/as241.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -9,7 +9,7 @@
* the hash sums below are the sums of the mantissas of the coefficients.
* they are included for use in checking transcription.
*/
-double ppnd7(double p)
+double Cdhc_ppnd7(double p)
{
static double zero = 0.0, one = 1.0, half = 0.5;
static double split1 = 0.425, split2 = 5.0;
Modified: grass/trunk/lib/cdhc/as66.c
===================================================================
--- grass/trunk/lib/cdhc/as66.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/as66.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -32,7 +32,7 @@
#define UTZERO 18.66
-double alnorm(double x, int upper)
+double Cdhc_alnorm(double x, int upper)
{
double ret, z, y;
int up;
Modified: grass/trunk/lib/cdhc/cdhclib.dox
===================================================================
--- grass/trunk/lib/cdhc/cdhclib.dox 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/cdhclib.dox 2014-09-28 21:52:15 UTC (rev 62130)
@@ -8,7 +8,7 @@
- Moments \sqrt{b_1} and b_2
- Geary's a-statistic & an approx. normal
-- Extreme normal deviates
+- Cdhc_extreme normal deviates
- D'Agostino's D & an approx. normal
- Kuiper's V (regular & modified for normality)
- Watson's U^2 (regular & modified for normality)
@@ -32,38 +32,36 @@
in the <tt>Makefile</tt>.
-\section listOfFunctios List of functions
+\section listOfFunctios List of functions (incomplete)
-- anderson_darling()
-- anderson_darling_exp()
-- chi_square()
-- chi_square_exp()
-- coeff_variation()
-- cramer_von_mises()
-- cramer_von_mises_exp()
-- dagostino_d()
-- dmax()
-- dmax_exp()
-- durbins_exact()
-- enormp()
-- extreme()
-- geary_test()
-- kolmogorov_smirnov()
-- kolmogorov_smirnov_exp()
-- kotz_families()
-- kuipers_v()
-- kuipers_v_exp()
-- mod_maxlik_ratio()
-- normp()
-- omnibus_moments()
-- royston()
-- shapiro_francia()
-- shapiro_wilk()
-- shapiro_wilk_exp()
-- watson_u2()
-- watson_u2_exp()
-- weisberg_bingham()
-- xinormal()
+- Cdhc_anderson_darling()
+- Cdhc_anderson_darling_exp()
+- Cdhc_chi_square()
+- Cdhc_chi_square_exp()
+- Cdhc_cramer_von_mises()
+- Cdhc_cramer_von_mises_exp()
+- Cdhc_dagostino_d()
+- Cdhc_dmax()
+- Cdhc_dmax_exp()
+- Cdhc_durbins_exact()
+- Cdhc_enormp()
+- Cdhc_extreme()
+- Cdhc_geary_test()
+- Cdhc_kolmogorov_smirnov()
+- Cdhc_kolmogorov_smirnov_exp()
+- Cdhc_kotz_families()
+- Cdhc_kuipers_v()
+- Cdhc_kuipers_v_exp()
+- Cdhc_normp()
+- Cdhc_omnibus_moments()
+- Cdhc_royston()
+- Cdhc_shapiro_francia()
+- Cdhc_shapiro_wilk()
+- Cdhc_shapiro_wilk_exp()
+- Cdhc_watson_u2()
+- Cdhc_watson_u2_exp()
+- Cdhc_weisberg_bingham()
+- Cdhc_xinormal()
*/
Modified: grass/trunk/lib/cdhc/chisqe.c
===================================================================
--- grass/trunk/lib/cdhc/chisqe.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/chisqe.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -3,7 +3,7 @@
#include <math.h>
-double *chi_square_exp(double *x, int n)
+double *Cdhc_chi_square_exp(double *x, int n)
{
static double y[2];
double mean = 0.0, sum3 = 0.0, *v;
@@ -15,11 +15,11 @@
--k;
if ((f = (int *)calloc(k, sizeof(int))) == NULL) {
- fprintf(stderr, "Memory error in chi_square\n");
+ fprintf(stderr, "Memory error in Cdhc_chi_square\n");
exit(EXIT_FAILURE);
}
if ((v = (double *)malloc((k + 1) * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in chi_square\n");
+ fprintf(stderr, "Memory error in Cdhc_chi_square\n");
exit(EXIT_FAILURE);
}
Modified: grass/trunk/lib/cdhc/chisqn.c
===================================================================
--- grass/trunk/lib/cdhc/chisqn.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/chisqn.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,7 +4,7 @@
#include "local_proto.h"
-double *chi_square(double *x, int n)
+double *Cdhc_chi_square(double *x, int n)
{
static double y[2];
double mean = 0.0, sdx = 0.0, sum3 = 0.0, *v;
@@ -16,11 +16,11 @@
--k;
if ((f = (int *)calloc(k, sizeof(int))) == NULL) {
- fprintf(stderr, "Memory error in chi_square\n");
+ fprintf(stderr, "Memory error in Cdhc_chi_square\n");
exit(EXIT_FAILURE);
}
if ((v = (double *)malloc((k + 1) * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in chi_square\n");
+ fprintf(stderr, "Memory error in Cdhc_chi_square\n");
exit(EXIT_FAILURE);
}
@@ -33,7 +33,7 @@
v[0] = -1e9;
for (i = 1; i < k; ++i)
- v[i] = mean + xinormal((double)i / k) * sdx;
+ v[i] = mean + Cdhc_xinormal((double)i / k) * sdx;
v[k] = 1e9;
Modified: grass/trunk/lib/cdhc/cvmw2e.c
===================================================================
--- grass/trunk/lib/cdhc/cvmw2e.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/cvmw2e.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,14 +4,14 @@
#include "local_proto.h"
-double *cramer_von_mises_exp(double *x, int n)
+double *Cdhc_cramer_von_mises_exp(double *x, int n)
{
static double y[2];
double *xcopy, mean = 0.0, fx, fn2, sum4 = 0.0;
int i;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in cramer_von_mises_exp\n");
+ fprintf(stderr, "Memory error in Cdhc_cramer_von_mises_exp\n");
exit(EXIT_FAILURE);
}
@@ -21,7 +21,7 @@
}
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
Modified: grass/trunk/lib/cdhc/cvmw2n.c
===================================================================
--- grass/trunk/lib/cdhc/cvmw2n.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/cvmw2n.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,7 +4,7 @@
#include "local_proto.h"
-double *cramer_von_mises(double *x, int n)
+double *Cdhc_cramer_von_mises(double *x, int n)
{
int i;
static double y[2];
@@ -14,7 +14,7 @@
y[1] = 0.0;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in cramer_von_mises\n");
+ fprintf(stderr, "Memory error in Cdhc_cramer_von_mises\n");
exit(EXIT_FAILURE);
}
@@ -26,10 +26,10 @@
sdx = sqrt((n * sdx - mean * mean) / (n * (n - 1.0)));
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
- fx = 0.5 + normp((xcopy[i] - mean) / sdx / sqrt2) / 2.0;
+ fx = 0.5 + Cdhc_normp((xcopy[i] - mean) / sdx / sqrt2) / 2.0;
if (fx <= 1e-5)
fx = 1e-5;
Modified: grass/trunk/lib/cdhc/dagstndn.c
===================================================================
--- grass/trunk/lib/cdhc/dagstndn.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/dagstndn.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,7 +4,7 @@
#include "local_proto.h"
-double *dagostino_d(double *x, int n)
+double *Cdhc_dagostino_d(double *x, int n)
{
int i;
static double y[2];
@@ -18,7 +18,7 @@
for (i = 0; i < n; ++i)
xcopy[i] = x[i];
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
t += xcopy[i] * ((i + 1) - 0.5 * (n + 1));
Modified: grass/trunk/lib/cdhc/dcmp.c
===================================================================
--- grass/trunk/lib/cdhc/dcmp.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/dcmp.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -1,4 +1,4 @@
-int dcmp(const void *i, const void *j)
+int Cdhc_dcmp(const void *i, const void *j)
{
double x = *(double *)i;
double y = *(double *)j;
Modified: grass/trunk/lib/cdhc/dmax.c
===================================================================
--- grass/trunk/lib/cdhc/dmax.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/dmax.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,7 +4,7 @@
#include "local_proto.h"
-double *dmax(double *x, int n)
+double *Cdhc_dmax(double *x, int n)
{
static double y[2];
double *xcopy, sqrt2, sqrtn, mean = 0.0, sdx = 0.0, fx;
@@ -12,7 +12,7 @@
int i;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in dmax\n");
+ fprintf(stderr, "Memory error in Cdhc_dmax\n");
exit(EXIT_FAILURE);
}
@@ -27,11 +27,11 @@
sdx = sqrt((n * sdx - mean * mean) / (n * (n - 1.0)));
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
xcopy[i] = (xcopy[i] - mean) / sdx;
- fx = 0.5 + normp(xcopy[i] / sqrt2) / 2.0;
+ fx = 0.5 + Cdhc_normp(xcopy[i] / sqrt2) / 2.0;
if (fx <= 1e-5)
fx = 1e-5;
Modified: grass/trunk/lib/cdhc/dmaxe.c
===================================================================
--- grass/trunk/lib/cdhc/dmaxe.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/dmaxe.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,14 +4,14 @@
#include "local_proto.h"
-double *dmax_exp(double *x, int n)
+double *Cdhc_dmax_exp(double *x, int n)
{
static double y[2];
double mean = 0.0, zmax, tmax, *xcopy, t, z, fx;
int i;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in dmax_exp\n");
+ fprintf(stderr, "Memory error in Cdhc_dmax_exp\n");
exit(EXIT_FAILURE);
}
@@ -21,7 +21,7 @@
}
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
fx = 1 - exp(-xcopy[i] / mean);
Modified: grass/trunk/lib/cdhc/durbins.c
===================================================================
--- grass/trunk/lib/cdhc/durbins.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/durbins.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -5,30 +5,30 @@
/* could probably use some cleanup/optimization */
-double *durbins_exact(double *x, int n)
+double *Cdhc_durbins_exact(double *x, int n)
{
static double y[2];
double *xcopy, sumx = 0.0, sumx2 = 0.0, s2, *b, *c, *g, *z, sqrt2;
int i, j;
if ((b = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in durbins_exact\n");
+ fprintf(stderr, "Memory error in Cdhc_durbins_exact\n");
exit(EXIT_FAILURE);
}
if ((c = (double *)malloc((n + 1) * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in durbins_exact\n");
+ fprintf(stderr, "Memory error in Cdhc_durbins_exact\n");
exit(EXIT_FAILURE);
}
if ((g = (double *)malloc((n + 1) * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in durbins_exact\n");
+ fprintf(stderr, "Memory error in Cdhc_durbins_exact\n");
exit(EXIT_FAILURE);
}
if ((z = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in durbins_exact\n");
+ fprintf(stderr, "Memory error in Cdhc_durbins_exact\n");
exit(EXIT_FAILURE);
}
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in durbins_exact\n");
+ fprintf(stderr, "Memory error in Cdhc_durbins_exact\n");
exit(EXIT_FAILURE);
}
@@ -42,10 +42,10 @@
s2 = sqrt((sumx2 - sumx * sumx / n) / (n - 1));
for (i = 0; i < n; ++i) {
xcopy[i] = (xcopy[i] - sumx / n) / s2;
- b[i] = 0.5 + normp(xcopy[i] / sqrt2) / 2.0;
+ b[i] = 0.5 + Cdhc_normp(xcopy[i] / sqrt2) / 2.0;
}
- qsort(b, n, sizeof(double), dcmp);
+ qsort(b, n, sizeof(double), Cdhc_dcmp);
for (i = 1; i < n; ++i)
c[i] = b[i] - b[i - 1];
@@ -53,7 +53,7 @@
c[0] = b[0];
c[n] = 1 - b[n - 1];
- qsort(c, n + 1, sizeof(double), dcmp);
+ qsort(c, n + 1, sizeof(double), Cdhc_dcmp);
for (j = 1; j <= n; ++j)
g[j] = (n + 1 - j) * (c[j] - c[j - 1]);
@@ -69,7 +69,7 @@
z[i] = (i + 1.0) / n - z[i];
}
- qsort(z, n, sizeof(double), dcmp);
+ qsort(z, n, sizeof(double), Cdhc_dcmp);
y[0] = z[n - 1];
y[1] = sqrt((double)n) * z[n - 1];
Modified: grass/trunk/lib/cdhc/enormp.c
===================================================================
--- grass/trunk/lib/cdhc/enormp.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/enormp.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -1,7 +1,7 @@
#include <math.h>
-double enormp(double x)
+double Cdhc_enormp(double x)
{
double x1, x2, x3, x4, ret_val;
static double xp[5] = { 7.7105849500132e-5, -0.00133733772997339,
Modified: grass/trunk/lib/cdhc/extreme.c
===================================================================
--- grass/trunk/lib/cdhc/extreme.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/extreme.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,7 +2,7 @@
#include <math.h>
-double *extreme(double *x, int n)
+double *Cdhc_extreme(double *x, int n)
{
int i;
static double y[2];
Modified: grass/trunk/lib/cdhc/geary.c
===================================================================
--- grass/trunk/lib/cdhc/geary.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/geary.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,7 +2,7 @@
#include <math.h>
-double *geary_test(double *x, int n)
+double *Cdhc_geary_test(double *x, int n)
{
int i;
static double y[2];
Modified: grass/trunk/lib/cdhc/kotz.c
===================================================================
--- grass/trunk/lib/cdhc/kotz.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/kotz.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,7 +2,7 @@
#include <math.h>
-double *kotz_families(double *x, int n)
+double *Cdhc_kotz_families(double *x, int n)
{
static double y[2];
int i;
Modified: grass/trunk/lib/cdhc/kse.c
===================================================================
--- grass/trunk/lib/cdhc/kse.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/kse.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,12 +4,12 @@
#include "local_proto.h"
-double *kolmogorov_smirnov_exp(double *x, int n)
+double *Cdhc_kolmogorov_smirnov_exp(double *x, int n)
{
static double y[2];
double *d, sqrtn;
- d = dmax_exp(x, n);
+ d = Cdhc_dmax_exp(x, n);
sqrtn = sqrt((double)n);
y[1] = (d[0] > d[1]) ? d[0] : d[1];
Modified: grass/trunk/lib/cdhc/ksn.c
===================================================================
--- grass/trunk/lib/cdhc/ksn.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/ksn.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,13 +4,13 @@
#include "local_proto.h"
-double *kolmogorov_smirnov(double *x, int n)
+double *Cdhc_kolmogorov_smirnov(double *x, int n)
{
static double y[2];
double *d, sqrtn;
sqrtn = sqrt((double)n);
- d = dmax(x, n);
+ d = Cdhc_dmax(x, n);
y[1] = (d[0] > d[1]) ? d[0] : d[1];
y[0] = y[1] * (sqrtn + 0.85 / sqrtn - 0.01);
Modified: grass/trunk/lib/cdhc/kuiprsve.c
===================================================================
--- grass/trunk/lib/cdhc/kuiprsve.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/kuiprsve.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,12 +4,12 @@
#include "local_proto.h"
-double *kuipers_v_exp(double *x, int n)
+double *Cdhc_kuipers_v_exp(double *x, int n)
{
static double y[2];
double *d, r;
- d = dmax_exp(x, n);
+ d = Cdhc_dmax_exp(x, n);
r = sqrt((double)n);
y[1] = d[0] + d[1];
Modified: grass/trunk/lib/cdhc/kuiprsvn.c
===================================================================
--- grass/trunk/lib/cdhc/kuiprsvn.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/kuiprsvn.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,13 +4,13 @@
#include "local_proto.h"
-double *kuipers_v(double *x, int n)
+double *Cdhc_kuipers_v(double *x, int n)
{
static double y[2];
double *d, sqrtn;
sqrtn = sqrt((double)n);
- d = dmax(x, n);
+ d = Cdhc_dmax(x, n);
y[1] = d[0] + d[1];
y[0] = y[1] * (sqrtn + 0.05 + 0.82 / sqrtn);
Modified: grass/trunk/lib/cdhc/local_proto.h
===================================================================
--- grass/trunk/lib/cdhc/local_proto.h 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/local_proto.h 2014-09-28 21:52:15 UTC (rev 62130)
@@ -3,23 +3,43 @@
/* qsort() comparison function */
-int dcmp(const void *, const void *);
+int Cdhc_dcmp(const void *, const void *);
+double *Cdhc_dmax(double *, int);
+double *Cdhc_dmax_exp(double *, int);
+
/* misc internal support functions */
void wcoef(double[], int, int, double *, int *);
-void wgp(double[], int, double, double, double, double[],
+void Cdhc_wgp(double[], int, double, double, double, double[],
int, double, double, double, double, int *);
-void nscor2(double[], int, int, int *);
+void Cdhc_nscor2(double[], int, int, int *);
void wext(double[], int, double, double[], int, double,
double *, double *, int *);
-double alnorm(double, int);
-double enormp(double);
-double normp(double);
-double xinormal(double);
+double Cdhc_alnorm(double, int);
+double Cdhc_enormp(double);
+double Cdhc_normp(double);
+double Cdhc_xinormal(double);
double ppn7(double);
double ppnd16(double);
+double *Cdhc_anderson_darling(double *, int);
+double *Cdhc_chi_square(double *, int);
+double *Cdhc_cramer_von_mises(double *, int);
+double *Cdhc_dagostino_d(double *, int);
+double *Cdhc_durbins_exact(double *, int);
+double *Cdhc_extreme(double *, int);
+double *Cdhc_geary_test(double *, int);
+double *Cdhc_kolmogorov_smirnov(double *, int);
+double *Cdhc_kotz_families(double *, int);
+double *Cdhc_kuipers_v(double *, int);
+double *Cdhc_omnibus_moments(double *, int);
+double *Cdhc_royston(double *, int);
+double *Cdhc_shapiro_wilk(double *, int);
+double *Cdhc_watson_u2(double *, int);
+double *Cdhc_weisberg_bingham(double *, int);
+
+
#endif /* __LOCAL_PROTO_H__ */
Modified: grass/trunk/lib/cdhc/normp.c
===================================================================
--- grass/trunk/lib/cdhc/normp.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/normp.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,7 +2,7 @@
/*-
- * SUBROUTINE NORMP(Z, P, Q, PDF)
+ * SUBROUTINE Cdhc_normp(Z, P, Q, PDF)
*
* Normal distribution probabilities accurate to 1.e-15.
* Z = no. of standard deviations from the mean.
@@ -20,7 +20,7 @@
/* Conversion to C by James Darrell McCauley, 24 September 1994 */
-double normp(double z)
+double Cdhc_normp(double z)
{
static double p[7] = { 220.2068679123761, 221.2135961699311,
112.079291497870, 33.91286607838300, 6.37396220353165,
Modified: grass/trunk/lib/cdhc/omnibus.c
===================================================================
--- grass/trunk/lib/cdhc/omnibus.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/omnibus.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,7 +2,7 @@
#include <math.h>
-double *omnibus_moments(double *x, int n)
+double *Cdhc_omnibus_moments(double *x, int n)
{
double diff, mean = 0., fssm, tssm, sum_cube = 0., sum_four = 0.,
sum_sq = 0.;
Modified: grass/trunk/lib/cdhc/royston.c
===================================================================
--- grass/trunk/lib/cdhc/royston.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/royston.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -7,10 +7,10 @@
/*-
* driver program for AS 181: Royston's extension of the Shapiro-Wilk
* W statistic to n=2000
- * needs as181.c as177.c as241.c dcmp.c as66.c
+ * needs as181.c as177.c as241.c Cdhc_dcmp.c as66.c
*/
-double *royston(double *x, int n)
+double *Cdhc_royston(double *x, int n)
{
static double y[2];
double *a, eps, w, pw, mean = 0, ssq = 0, *xcopy;
@@ -35,7 +35,7 @@
}
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i)
ssq += (mean - x[i]) * (mean - x[i]);
Modified: grass/trunk/lib/cdhc/shapiro1.c
===================================================================
--- grass/trunk/lib/cdhc/shapiro1.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/shapiro1.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,7 +4,7 @@
#include "local_proto.h"
-double *shapiro_wilk(double *x, int n)
+double *Cdhc_shapiro_wilk(double *x, int n)
{
static double y[2];
double a[25], s2, *xcopy;
@@ -12,7 +12,7 @@
int i, k;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in shapiro_wilk\n");
+ fprintf(stderr, "Memory error in Cdhc_shapiro_wilk\n");
exit(EXIT_FAILURE);
}
@@ -24,7 +24,7 @@
}
s2 = sumx2 - sumx * sumx / n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
if (n == 3) {
a[0] = (double).7071;
Modified: grass/trunk/lib/cdhc/shapiro2.c
===================================================================
--- grass/trunk/lib/cdhc/shapiro2.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/shapiro2.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -5,26 +5,26 @@
/* this is actually the Weisberg-Bingham stat. I need to
- OCR the constants and implment this correctly */
+ OCR the constants and implment this Cdhc_correctly */
-double *shapiro_francia(double *x, int n)
+double *Cdhc_shapiro_francia(double *x, int n)
{
static double y[2];
double suma = 0.0, sumb = 0.0, sumc = 0.0, sumd = 0.0, z, *xcopy;
int i;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in shapiro_francia\n");
+ fprintf(stderr, "Memory error in Cdhc_shapiro_francia\n");
exit(EXIT_FAILURE);
}
for (i = 0; i < n; ++i)
xcopy[i] = x[i];
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
- z = xinormal((i + 1 - 0.375) / (n + 0.25));
+ z = Cdhc_xinormal((i + 1 - 0.375) / (n + 0.25));
suma += z * xcopy[i];
sumb += z * z;
sumc += xcopy[i];
Modified: grass/trunk/lib/cdhc/shapiroe.c
===================================================================
--- grass/trunk/lib/cdhc/shapiroe.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/shapiroe.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,7 +2,7 @@
#include <math.h>
-double *shapiro_wilk_exp(double *x, int n)
+double *Cdhc_shapiro_wilk_exp(double *x, int n)
{
static double y[2];
double mean, b, s1, xs, sum1 = 0.0, sum2 = 0.0;
Modified: grass/trunk/lib/cdhc/test.c
===================================================================
--- grass/trunk/lib/cdhc/test.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/test.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,8 +2,8 @@
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/cdhc.h>
+#include "local_proto.h"
-
int main(int argc, char **argv)
{
double z[1000];
@@ -17,50 +17,50 @@
fprintf(stdout, "N: %d\n", n);
fprintf(stdout, "Moments \\sqrt{b_1} and b_2: ");
- w = omnibus_moments(z, n);
+ w = Cdhc_omnibus_moments(z, n);
fprintf(stdout, "%g %g\n", w[0], w[1]);
fprintf(stdout, "Geary's a-statistic & an approx. normal: ");
- w = geary_test(z, n);
+ w = Cdhc_geary_test(z, n);
fprintf(stdout, "%g %g\n", w[0], w[1]);
- fprintf(stdout, "Extreme normal deviates: ");
- w = extreme(z, n);
+ fprintf(stdout, "Cdhc_extreme normal deviates: ");
+ w = Cdhc_extreme(z, n);
fprintf(stdout, "%g %g\n", w[0], w[1]);
fprintf(stdout, "D'Agostino's D & an approx. normal: ");
- w = dagostino_d(z, n);
+ w = Cdhc_dagostino_d(z, n);
fprintf(stdout, "%g %g\n", w[0], w[1]);
fprintf(stdout, "Kuiper's V (regular & modified for normality): ");
- w = kuipers_v(z, n);
+ w = Cdhc_kuipers_v(z, n);
fprintf(stdout, "%g %g\n", w[1], w[0]);
fprintf(stdout, "Watson's U^2 (regular & modified for normality): ");
- w = watson_u2(z, n);
+ w = Cdhc_watson_u2(z, n);
fprintf(stdout, "%g %g\n", w[1], w[0]);
fprintf(stdout, "Durbin's Exact Test (modified Kolmogorov): ");
- w = durbins_exact(z, n);
+ w = Cdhc_durbins_exact(z, n);
fprintf(stdout, "%g\n", w[0]);
fprintf(stdout,
"Anderson-Darling's A^2 (regular & modified for normality): ");
- w = anderson_darling(z, n);
+ w = Cdhc_anderson_darling(z, n);
fprintf(stdout, "%g %g\n", w[1], w[0]);
fprintf(stdout,
"Cramer-Von Mises W^2(regular & modified for normality): ");
- w = cramer_von_mises(z, n);
+ w = Cdhc_cramer_von_mises(z, n);
fprintf(stdout, "%g %g\n", w[1], w[0]);
fprintf(stdout,
"Kolmogorov-Smirnov's D (regular & modified for normality): ");
- w = kolmogorov_smirnov(z, n);
+ w = Cdhc_kolmogorov_smirnov(z, n);
fprintf(stdout, "%g %g\n", w[1], w[0]);
fprintf(stdout, "Chi-Square stat (equal probability classes) and d.f.: ");
- w = chi_square(z, n);
+ w = Cdhc_chi_square(z, n);
fprintf(stdout, "%g %d\n", w[0], (int)w[1]);
if (n > 50) {
G_warning("Shapiro-Wilk's W cannot be used for n > 50");
@@ -69,7 +69,7 @@
}
else {
fprintf(stdout, "Shapiro-Wilk W: ");
- w = shapiro_wilk(z, n);
+ w = Cdhc_shapiro_wilk(z, n);
fprintf(stdout, "%g\n", w[0]);
}
@@ -78,7 +78,7 @@
("Weisberg-Bingham's W'' cannot be used for n < 50 or n > 99");
else {
fprintf(stdout, "Weisberg-Bingham's W'': ");
- w = weisberg_bingham(z, n);
+ w = Cdhc_weisberg_bingham(z, n);
fprintf(stdout, "%g\n", w[0]);
}
@@ -86,12 +86,12 @@
G_warning("Royston only extended Shapiro-Wilk's W up to n = 2000");
else {
fprintf(stdout, "Shapiro-Wilk W'': ");
- w = royston(z, n);
+ w = Cdhc_royston(z, n);
fprintf(stdout, "%g\n", w[0]);
}
fprintf(stdout, "Kotz' T'_f (Lognormality vs. Normality): ");
- w = kotz_families(z, n);
+ w = Cdhc_kotz_families(z, n);
fprintf(stdout, "%g\n", w[0]);
return EXIT_SUCCESS;
Modified: grass/trunk/lib/cdhc/watsonue.c
===================================================================
--- grass/trunk/lib/cdhc/watsonue.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/watsonue.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,14 +4,14 @@
#include "local_proto.h"
-double *watson_u2_exp(double *x, int n)
+double *Cdhc_watson_u2_exp(double *x, int n)
{
double *xcopy, mean = 0.0, zbar = 0.0, fn2, fx, sum4 = 0.0;
static double y[2];
int i;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in watson_u2_exp\n");
+ fprintf(stderr, "Memory error in Cdhc_watson_u2_exp\n");
exit(EXIT_FAILURE);
}
@@ -21,7 +21,7 @@
}
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
fx = 1 - exp(-xcopy[i] / mean);
Modified: grass/trunk/lib/cdhc/watsonun.c
===================================================================
--- grass/trunk/lib/cdhc/watsonun.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/watsonun.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,7 +4,7 @@
#include "local_proto.h"
-double *watson_u2(double *x, int n)
+double *Cdhc_watson_u2(double *x, int n)
{
double *xcopy, mean = 0.0, sdx = 0.0, sqrt2, zbar = 0.0;
double fn2, fx, sum4 = 0.0;
@@ -14,7 +14,7 @@
sqrt2 = sqrt((double)2.0);
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in anderson_darling\n");
+ fprintf(stderr, "Memory error in Cdhc_anderson_darling\n");
exit(EXIT_FAILURE);
}
@@ -26,12 +26,12 @@
sdx = sqrt((n * sdx - mean * mean) / (n * (n - 1)));
mean /= n;
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
xcopy[i] = (xcopy[i] - mean) / sdx;
fn2 = (2.0 * (i + 1) - 1.0) / (2.0 * n);
- fx = 0.5 + normp(xcopy[i] / sqrt2) / 2.0;
+ fx = 0.5 + Cdhc_normp(xcopy[i] / sqrt2) / 2.0;
if (fx <= 0.0)
fx = 1e-5;
Modified: grass/trunk/lib/cdhc/weisberg.c
===================================================================
--- grass/trunk/lib/cdhc/weisberg.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/weisberg.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -4,24 +4,24 @@
#include "local_proto.h"
-double *weisberg_bingham(double *x, int n)
+double *Cdhc_weisberg_bingham(double *x, int n)
{
static double y[2];
double suma = 0.0, sumb = 0.0, sumc = 0.0, sumd = 0.0, z, *xcopy;
int i;
if ((xcopy = (double *)malloc(n * sizeof(double))) == NULL) {
- fprintf(stderr, "Memory error in shapiro_francia\n");
+ fprintf(stderr, "Memory error in Cdhc_shapiro_francia\n");
exit(EXIT_FAILURE);
}
for (i = 0; i < n; ++i)
xcopy[i] = x[i];
- qsort(xcopy, n, sizeof(double), dcmp);
+ qsort(xcopy, n, sizeof(double), Cdhc_dcmp);
for (i = 0; i < n; ++i) {
- z = xinormal((i + 1 - 0.375) / (n + 0.25));
+ z = Cdhc_xinormal((i + 1 - 0.375) / (n + 0.25));
suma += z * xcopy[i];
sumb += z * z;
sumc += xcopy[i];
Modified: grass/trunk/lib/cdhc/xinormal.c
===================================================================
--- grass/trunk/lib/cdhc/xinormal.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/lib/cdhc/xinormal.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -2,7 +2,7 @@
#include <math.h>
-double xinormal(double pee)
+double Cdhc_xinormal(double pee)
{
double f0, pind, pw, px;
static double p[5] = { -0.322232431088, -1., -0.342242088547,
Modified: grass/trunk/vector/v.normal/main.c
===================================================================
--- grass/trunk/vector/v.normal/main.c 2014-09-28 21:44:54 UTC (rev 62129)
+++ grass/trunk/vector/v.normal/main.c 2014-09-28 21:52:15 UTC (rev 62130)
@@ -1,5 +1,3 @@
-
-
/***************************************************************
*
* MODULE: v.normal
@@ -9,7 +7,7 @@
*
* PURPOSE: GRASS program for distributional testing (based on s.normal)
*
- * COPYRIGHT: (C) 2001-2009 by the GRASS Development Team
+ * COPYRIGHT: (C) 2001-2014 by the GRASS Development Team
*
* This program is free software under the GNU General
* Public License (>=v2). Read the file COPYING that
@@ -222,64 +220,64 @@
switch (x++) {
case 1: /* moments */
fprintf(stdout, _("Moments \\sqrt{b_1} and b_2: "));
- w = omnibus_moments(z, nsites);
+ w = Cdhc_omnibus_moments(z, nsites);
fprintf(stdout, "%g %g\n", w[0], w[1]);
break;
case 2: /* geary */
fprintf(stdout, _("Geary's a-statistic & an approx. normal: "));
- w = geary_test(z, nsites);
+ w = Cdhc_geary_test(z, nsites);
fprintf(stdout, "%g %g\n", w[0], w[1]);
break;
case 3: /* extreme deviates */
fprintf(stdout, _("Extreme normal deviates: "));
- w = extreme(z, nsites);
+ w = Cdhc_extreme(z, nsites);
fprintf(stdout, "%g %g\n", w[0], w[1]);
break;
case 4: /* D'Agostino */
fprintf(stdout, _("D'Agostino's D & an approx. normal: "));
- w = dagostino_d(z, nsites);
+ w = Cdhc_dagostino_d(z, nsites);
fprintf(stdout, "%g %g\n", w[0], w[1]);
break;
case 5: /* Kuiper */
fprintf(stdout,
_("Kuiper's V (regular & modified for normality): "));
- w = kuipers_v(z, nsites);
+ w = Cdhc_kuipers_v(z, nsites);
fprintf(stdout, "%g %g\n", w[1], w[0]);
break;
case 6: /* Watson */
fprintf(stdout,
_("Watson's U^2 (regular & modified for normality): "));
- w = watson_u2(z, nsites);
+ w = Cdhc_watson_u2(z, nsites);
fprintf(stdout, "%g %g\n", w[1], w[0]);
break;
case 7: /* Durbin */
fprintf(stdout,
_("Durbin's Exact Test (modified Kolmogorov): "));
- w = durbins_exact(z, nsites);
+ w = Cdhc_durbins_exact(z, nsites);
fprintf(stdout, "%g\n", w[0]);
break;
case 8: /* Anderson-Darling */
fprintf(stdout,
_("Anderson-Darling's A^2 (regular & modified for normality): "));
- w = anderson_darling(z, nsites);
+ w = Cdhc_anderson_darling(z, nsites);
fprintf(stdout, "%g %g\n", w[1], w[0]);
break;
case 9: /* Cramer-Von Mises */
fprintf(stdout,
_("Cramer-Von Mises W^2(regular & modified for normality): "));
- w = cramer_von_mises(z, nsites);
+ w = Cdhc_cramer_von_mises(z, nsites);
fprintf(stdout, "%g %g\n", w[1], w[0]);
break;
case 10: /* Kolmogorov-Smirnov */
fprintf(stdout,
_("Kolmogorov-Smirnov's D (regular & modified for normality): "));
- w = kolmogorov_smirnov(z, nsites);
+ w = Cdhc_kolmogorov_smirnov(z, nsites);
fprintf(stdout, "%g %g\n", w[1], w[0]);
break;
case 11: /* chi-square */
fprintf(stdout,
_("Chi-Square stat (equal probability classes) and d.f.: "));
- w = chi_square(z, nsites);
+ w = Cdhc_chi_square(z, nsites);
fprintf(stdout, "%g %d\n", w[0], (int)w[1]);
break;
case 12: /* Shapiro-Wilk */
@@ -290,7 +288,7 @@
}
else {
fprintf(stdout, _("Shapiro-Wilk W: "));
- w = shapiro_wilk(z, nsites);
+ w = Cdhc_shapiro_wilk(z, nsites);
fprintf(stdout, "%g\n", w[0]);
}
break;
@@ -299,7 +297,7 @@
G_warning(_("Weisberg-Bingham's W'' cannot be used for n < 50 or n > 99"));
else {
fprintf(stdout, _("Weisberg-Bingham's W'': "));
- w = weisberg_bingham(z, nsites);
+ w = Cdhc_weisberg_bingham(z, nsites);
fprintf(stdout, "%g\n", w[0]);
}
break;
@@ -308,13 +306,13 @@
G_warning(_("Royston only extended Shapiro-Wilk's W up to n = 2000"));
else {
fprintf(stdout, _("Shapiro-Wilk W'': "));
- w = royston(z, nsites);
+ w = Cdhc_royston(z, nsites);
fprintf(stdout, "%g\n", w[0]);
}
break;
case 15: /* Kotz */
fprintf(stdout, _("Kotz' T'_f (Lognormality vs. Normality): "));
- w = kotz_families(z, nsites);
+ w = Cdhc_kotz_families(z, nsites);
fprintf(stdout, "%g\n", w[0]);
break;
default:
More information about the grass-commit
mailing list