[GRASS-SVN] r63909 - in grass/trunk: display/d.thematic.area include/defs lib/arraystats vector/v.class

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jan 1 11:24:55 PST 2015


Author: martinl
Date: 2015-01-01 11:24:55 -0800 (Thu, 01 Jan 2015)
New Revision: 63909

Modified:
   grass/trunk/display/d.thematic.area/main.c
   grass/trunk/include/defs/arraystats.h
   grass/trunk/lib/arraystats/arraystatslib.dox
   grass/trunk/lib/arraystats/basic.c
   grass/trunk/lib/arraystats/class.c
   grass/trunk/vector/v.class/main.c
Log:
arraystatslib: rename fns to use prefix (AS)

Modified: grass/trunk/display/d.thematic.area/main.c
===================================================================
--- grass/trunk/display/d.thematic.area/main.c	2015-01-01 19:02:54 UTC (rev 63908)
+++ grass/trunk/display/d.thematic.area/main.c	2015-01-01 19:24:55 UTC (rev 63909)
@@ -326,8 +326,8 @@
 	    /* Get classbreaks for given algorithm and number of classbreaks.
 	     * class_info takes any info coming from the classification algorithms */
 	    class_info =
-		class_apply_algorithm(algo_opt->answer, data, nrec, &nbreaks,
-				      breakpoints);
+		AS_class_apply_algorithm(algo_opt->answer, data, nrec, &nbreaks,
+                                         breakpoints);
 
 	}
 	else {
@@ -414,10 +414,10 @@
     frequencies = (int *)G_malloc((nbreaks + 1) * sizeof(int));
     for (i = 0; i < nbreaks + 1; i++)
 	frequencies[i] = 0.0;
-    class_frequencies(data, nrec, nbreaks, breakpoints, frequencies);
+    AS_class_frequencies(data, nrec, nbreaks, breakpoints, frequencies);
 
     /*Get basic statistics about the data */
-    basic_stats(data, nrec, &stats);
+    AS_basic_stats(data, nrec, &stats);
 
     if (legend_flag->answer) {
 

Modified: grass/trunk/include/defs/arraystats.h
===================================================================
--- grass/trunk/include/defs/arraystats.h	2015-01-01 19:02:54 UTC (rev 63908)
+++ grass/trunk/include/defs/arraystats.h	2015-01-01 19:24:55 UTC (rev 63909)
@@ -1,16 +1,17 @@
 #ifndef GRASS_ARRAYSTATSDEFS_H
 #define GRASS_ARRAYSTATSDEFS_H
 
-double class_apply_algorithm(char *, double *, int, int *, double *);
-int class_interval(double *, int, int, double *);
-int class_quant(double *, int, int, double *);
-double class_discont(double *, int, int, double *);
-double class_stdev(double *, int, int, double *);
-int class_equiprob(double *, int, int *, double *);
+/* basic.c */
+void AS_eqdrt(double[], double[], int, int, double *);
+void AS_basic_stats(double *, int, struct GASTATS *);
 
-int class_frequencies(double *, int, int, double *, int *);
+/* class.c */
+double AS_class_apply_algorithm(char *, double *, int, int *, double *);
+int AS_class_interval(double *, int, int, double *);
+int AS_class_quant(double *, int, int, double *);
+double AS_class_discont(double *, int, int, double *);
+double AS_class_stdev(double *, int, int, double *);
+int AS_class_equiprob(double *, int, int *, double *);
+int AS_class_frequencies(double *, int, int, double *, int *);
 
-void eqdrt(double[], double[], int, int, double *);
-void basic_stats(double *, int, struct GASTATS *);
-
 #endif

Modified: grass/trunk/lib/arraystats/arraystatslib.dox
===================================================================
--- grass/trunk/lib/arraystats/arraystatslib.dox	2015-01-01 19:02:54 UTC (rev 63908)
+++ grass/trunk/lib/arraystats/arraystatslib.dox	2015-01-01 19:24:55 UTC (rev 63909)
@@ -6,15 +6,15 @@
 
 \section listOfFunctios List of functions
 
-- class_apply_algorithm()
-- class_interval()
-- class_quant()
-- class_discont()
-- class_stdev()
-- class_equiprob()
-- class_frequencies()
-- eqdrt()
-- basic_stats()
+- AS_class_apply_algorithm()
+- AS_class_interval()
+- AS_class_quant()
+- AS_class_discont()
+- AS_class_stdev()
+- AS_class_equiprob()
+- AS_class_frequencies()
+- AS_eqdrt()
+- AS_basic_stats()
 
 */
 

Modified: grass/trunk/lib/arraystats/basic.c
===================================================================
--- grass/trunk/lib/arraystats/basic.c	2015-01-01 19:02:54 UTC (rev 63908)
+++ grass/trunk/lib/arraystats/basic.c	2015-01-01 19:24:55 UTC (rev 63909)
@@ -3,7 +3,7 @@
 
 
 /*provides basic univar stats */
-void basic_stats(double *data, int count, struct GASTATS *stats)
+void AS_basic_stats(double *data, int count, struct GASTATS *stats)
 {
     int i = 1;
     double sum = 0, sumsq = 0, sumabs = 0;
@@ -37,7 +37,7 @@
 }
 
 
-void eqdrt(double vectx[], double vecty[], int i1, int i2, double *vabc)
+void AS_eqdrt(double vectx[], double vecty[], int i1, int i2, double *vabc)
 {
     double bn = 0, bd = 0, x1 = 0, y1 = 0;
 

Modified: grass/trunk/lib/arraystats/class.c
===================================================================
--- grass/trunk/lib/arraystats/class.c	2015-01-01 19:02:54 UTC (rev 63908)
+++ grass/trunk/lib/arraystats/class.c	2015-01-01 19:24:55 UTC (rev 63909)
@@ -3,19 +3,19 @@
 #include <grass/glocale.h>
 #include <grass/arraystats.h>
 
-double class_apply_algorithm(char *algo, double *data, int nrec, int *nbreaks,
-			     double *classbreaks)
+double AS_class_apply_algorithm(char *algo, double *data, int nrec, int *nbreaks,
+                                double *classbreaks)
 {
     double finfo = 0.0;
 
     if (G_strcasecmp(algo, "int") == 0)
-	finfo = class_interval(data, nrec, *nbreaks, classbreaks);
+	finfo = AS_class_interval(data, nrec, *nbreaks, classbreaks);
     else if (G_strcasecmp(algo, "std") == 0)
-	finfo = class_stdev(data, nrec, *nbreaks, classbreaks);
+	finfo = AS_class_stdev(data, nrec, *nbreaks, classbreaks);
     else if (G_strcasecmp(algo, "qua") == 0)
-	finfo = class_quant(data, nrec, *nbreaks, classbreaks);
+        finfo = AS_class_quant(data, nrec, *nbreaks, classbreaks);
     else if (G_strcasecmp(algo, "equ") == 0)
-	finfo = class_equiprob(data, nrec, nbreaks, classbreaks);
+	finfo = AS_class_equiprob(data, nrec, nbreaks, classbreaks);
     else if (G_strcasecmp(algo, "dis") == 0)
 	    /*	finfo = class_discont(data, nrec, *nbreaks, classbreaks); disabled because of bugs */
         G_fatal_error(_("Discont algorithm currently not available because of bugs"));
@@ -28,7 +28,7 @@
     return finfo;
 }
 
-int class_interval(double *data, int count, int nbreaks, double *classbreaks)
+int AS_class_interval(double *data, int count, int nbreaks, double *classbreaks)
 {
     double min, max;
     double step;
@@ -45,14 +45,14 @@
     return (1);
 }
 
-double class_stdev(double *data, int count, int nbreaks, double *classbreaks)
+double AS_class_stdev(double *data, int count, int nbreaks, double *classbreaks)
 {
     struct GASTATS stats;
     int i;
     int nbclass;
     double scale = 1.0;
 
-    basic_stats(data, count, &stats);
+    AS_basic_stats(data, count, &stats);
 
     nbclass = nbreaks + 1;
 
@@ -109,7 +109,7 @@
     return (scale);
 }
 
-int class_quant(double *data, int count, int nbreaks, double *classbreaks)
+int AS_class_quant(double *data, int count, int nbreaks, double *classbreaks)
 {
     int i, step;
 
@@ -122,7 +122,7 @@
 }
 
 
-int class_equiprob(double *data, int count, int *nbreaks, double *classbreaks)
+int AS_class_equiprob(double *data, int count, int *nbreaks, double *classbreaks)
 {
     int i, j;
     double *lequi;		/*Vector of scale factors for probabilities of the normal distribution */
@@ -201,11 +201,10 @@
 	lequi[8] = 1.28155;
     }
     else {
-	G_fatal_error
-	    ("Equiprobable classbreaks currently limited to 10 classes");
+	G_fatal_error(_("Equiprobable classbreaks currently limited to 10 classes"));
     }
 
-    basic_stats(data, count, &stats);
+    AS_basic_stats(data, count, &stats);
 
     /* Check if any of the classbreaks would fall outside of the range min-max */
     j = 0;
@@ -242,7 +241,7 @@
 
 /* FIXME: there seems to a problem with array overflow, probably due to
    the fact that the code was ported from fortran which has 1-based arrays*/
-double class_discont(double *data, int count, int nbreaks,
+double AS_class_discont(double *data, int count, int nbreaks,
 		     double *classbreaks)
 {
     int *num, nbclass;
@@ -319,7 +318,7 @@
 	    nd = nf;		/*Start number */
 	    nf = num[j];
 	    co[j] = 10e37;
-	    eqdrt(x, xn, nd, nf, abc);
+	    AS_eqdrt(x, xn, nd, nf, abc);
 	    den = sqrt(pow(abc[1], 2) + 1.0);
 	    nd++;
 	    /*              Loop through observations */
@@ -422,7 +421,7 @@
     return (chi2);
 }
 
-int class_frequencies(double *data, int count, int nbreaks,
+int AS_class_frequencies(double *data, int count, int nbreaks,
 		      double *classbreaks, int *frequencies)
 {
     int i, j;

Modified: grass/trunk/vector/v.class/main.c
===================================================================
--- grass/trunk/vector/v.class/main.c	2015-01-01 19:02:54 UTC (rev 63908)
+++ grass/trunk/vector/v.class/main.c	2015-01-01 19:24:55 UTC (rev 63909)
@@ -164,8 +164,8 @@
      * finfo takes any info coming from the classification algorithms
      * equ algorithm can alter number of class breaks */
     finfo =
-	class_apply_algorithm(algo_opt->answer, data, nrec, &nbreaks,
-			      classbreaks);
+	AS_class_apply_algorithm(algo_opt->answer, data, nrec, &nbreaks,
+                                 classbreaks);
 
 
     if (G_strcasecmp(algo_opt->answer, "dis") == 0 && finfo < 3.84148)
@@ -188,9 +188,8 @@
 	for (i = 0; i < nbreaks + 1; i++)
 	    frequencies[i] = 0;
 
-	ret =
-	    class_frequencies(data, nrec, nbreaks, classbreaks, frequencies);
-	basic_stats(data, nrec, &stats);
+	ret = AS_class_frequencies(data, nrec, nbreaks, classbreaks, frequencies);
+	AS_basic_stats(data, nrec, &stats);
 
 	min = data[0];
 	max = data[nrec - 1];



More information about the grass-commit mailing list