[GRASS-SVN] r37600 - in grass/branches/releasebranch_6_4: imagery/i.gensigset imagery/i.smap/bouman include lib/gmath lib/rst/interp_float raster/r.param.scale raster/r.resamp.rst vector/lidar/lidarlib vector/v.surf.rst

svn_grass at osgeo.org svn_grass at osgeo.org
Sat May 30 01:38:31 EDT 2009


Author: neteler
Date: 2009-05-30 01:38:31 -0400 (Sat, 30 May 2009)
New Revision: 37600

Removed:
   grass/branches/releasebranch_6_4/imagery/i.smap/bouman/eigen.c
Modified:
   grass/branches/releasebranch_6_4/imagery/i.gensigset/invert.c
   grass/branches/releasebranch_6_4/imagery/i.gensigset/subcluster.c
   grass/branches/releasebranch_6_4/imagery/i.smap/bouman/bouman.h
   grass/branches/releasebranch_6_4/imagery/i.smap/bouman/invert.c
   grass/branches/releasebranch_6_4/imagery/i.smap/bouman/model.c
   grass/branches/releasebranch_6_4/include/gisdefs.h
   grass/branches/releasebranch_6_4/include/gmath.h
   grass/branches/releasebranch_6_4/lib/gmath/eigen.c
   grass/branches/releasebranch_6_4/lib/gmath/lu.c
   grass/branches/releasebranch_6_4/lib/gmath/svd.c
   grass/branches/releasebranch_6_4/lib/rst/interp_float/matrix.c
   grass/branches/releasebranch_6_4/lib/rst/interp_float/ressegm2d.c
   grass/branches/releasebranch_6_4/lib/rst/interp_float/segmen2d.c
   grass/branches/releasebranch_6_4/raster/r.param.scale/process.c
   grass/branches/releasebranch_6_4/raster/r.resamp.rst/main.c
   grass/branches/releasebranch_6_4/vector/lidar/lidarlib/PolimiFunct.h
   grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c
Log:
Various files have moved from lib/gis to lib/gmath:
    Update gisdefs.h and gmath.h accordingly
    Update clients accordingly
    Generalise eigen(), remove local version from i.smap (merge + backport from trunk, r35274)


Modified: grass/branches/releasebranch_6_4/imagery/i.gensigset/invert.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.gensigset/invert.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/imagery/i.gensigset/invert.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -1,4 +1,5 @@
 #include <grass/gis.h>
+#include <grass/gmath.h>
 
 int invert(
 	      /* inverts a matrix of arbitrary size input as a 2D array. */

Modified: grass/branches/releasebranch_6_4/imagery/i.gensigset/subcluster.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.gensigset/subcluster.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/imagery/i.gensigset/subcluster.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -3,6 +3,7 @@
 #include <grass/gis.h>
 #include <grass/imagery.h>
 #include <grass/glocale.h>
+#include <grass/gmath.h>
 #include "local_proto.h"
 
 #define ZERO 1e-10

Modified: grass/branches/releasebranch_6_4/imagery/i.smap/bouman/bouman.h
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.smap/bouman/bouman.h	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/imagery/i.smap/bouman/bouman.h	2009-05-30 05:38:31 UTC (rev 37600)
@@ -54,9 +54,6 @@
 /* Subroutine in solve.c */
 double solve(double (*)(double), double, double, double, int *);
 
-/* Subroutine in eigen.c */
-int eigen(double **, double *, int);
-
 /* Subroutine in invert.c */
 int invert(double **, int);
 

Deleted: grass/branches/releasebranch_6_4/imagery/i.smap/bouman/eigen.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.smap/bouman/eigen.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/imagery/i.smap/bouman/eigen.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -1,33 +0,0 @@
-#include <grass/gis.h>
-
-int eigen(
-	     /* Computes eigenvalues (and eigen vectors if desired) for      *
-	      *  symmetric matices.                                          */
-	     double **M,	/* Input matrix */
-	     double *lambda,	/* Output eigenvalues */
-	     int n		/* Input matrix dimension */
-    )
-{
-    int i, j;
-    double **a, *e;
-
-    a = G_alloc_matrix(n, n);
-    e = G_alloc_vector(n);
-
-    for (i = 0; i < n; i++)
-	for (j = 0; j < n; j++)
-	    a[i][j] = M[i][j];
-
-    G_tred2(a, n, lambda, e);
-    G_tqli(lambda, e, n, a);
-
-    /* Returns eigenvectors */
-    /*      for(i=0; i<n; i++) 
-       for(j=0; j<n; j++) 
-       M[i][j] = a[i][j]; */
-
-    G_free_matrix(a);
-    G_free_vector(e);
-
-    return 0;
-}

Modified: grass/branches/releasebranch_6_4/imagery/i.smap/bouman/invert.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.smap/bouman/invert.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/imagery/i.smap/bouman/invert.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -1,5 +1,6 @@
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/gmath.h>
 
 int invert(
 	      /* inverts a matrix of arbitrary size input as a 2D array. */

Modified: grass/branches/releasebranch_6_4/imagery/i.smap/bouman/model.c
===================================================================
--- grass/branches/releasebranch_6_4/imagery/i.smap/bouman/model.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/imagery/i.smap/bouman/model.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -1,6 +1,7 @@
 #include <grass/gis.h>
 #include <grass/glocale.h>
 #include <grass/imagery.h>
+#include <grass/gmath.h>
 #include "bouman.h"
 #include "region.h"
 
@@ -42,7 +43,7 @@
 		}
 
 	    /* Test for positive definite matrix */
-	    eigen(SubS->Rinv, lambda, nbands);
+	    eigen(SubS->Rinv, NULL, lambda, nbands);
 	    for (b1 = 0; b1 < nbands; b1++) {
 		if (lambda[b1] <= 0.0)
 		    G_warning(_("Nonpositive eigenvalues for class %d subclass %d"),

Modified: grass/branches/releasebranch_6_4/include/gisdefs.h
===================================================================
--- grass/branches/releasebranch_6_4/include/gisdefs.h	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/include/gisdefs.h	2009-05-30 05:38:31 UTC (rev 37600)
@@ -403,16 +403,6 @@
 int G_copy_file(const char *, const char *);
 int G_recursive_copy(const char *, const char *);
 
-/* dalloc.c */
-double *G_alloc_vector(size_t);
-double **G_alloc_matrix(int, int);
-float *G_alloc_fvector(size_t);
-float **G_alloc_fmatrix(int, int);
-void G_free_vector(double *);
-void G_free_matrix(double **);
-void G_free_fvector(float *);
-void G_free_fmatrix(float **);
-
 /* date.c */
 char *G_date(void);
 
@@ -438,10 +428,6 @@
 /* done_msg.c */
 int G_done_msg(const char *, ...) __attribute__ ((format(printf, 1, 2)));
 
-/* eigen_tools.c */
-int G_tqli(double[], double[], int, double **);
-void G_tred2(double **, int, double[], double[]);
-
 /* endian.c */
 int G_is_little_endian(void);
 
@@ -672,12 +658,6 @@
 char *G_home(void);
 char *G__home(void);
 
-/* ialloc.c */
-int *G_alloc_ivector(size_t);
-int **G_alloc_imatrix(int, int);
-void G_free_ivector(int *);
-void G_free_imatrix(int **);
-
 /* index.c */
 char *G_index(const char *, int);
 char *G_rindex(const char *, int);
@@ -769,10 +749,6 @@
 void G_ls(const char *, FILE *);
 void G_ls_format(char **, int, int, FILE *);
 
-/* lu.c */
-int G_ludcmp(double **, int, int *, double *);
-void G_lubksb(double **, int, int *, double[]);
-
 /* mach_name.c */
 char *G__machine_name(void);
 
@@ -1155,11 +1131,6 @@
 int G_str_to_sql(char *);
 int G_strip(char *);
 
-/* svd.c */
-int G_svdcmp(double **, int, int, double *, double **);
-int G_svbksb(double **, double[], double **, int, int, double[], double[]);
-int G_svelim(double *, int);
-
 /* system.c */
 int G_system(const char *);
 

Modified: grass/branches/releasebranch_6_4/include/gmath.h
===================================================================
--- grass/branches/releasebranch_6_4/include/gmath.h	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/include/gmath.h	2009-05-30 05:38:31 UTC (rev 37600)
@@ -68,4 +68,33 @@
 int mult(double *v1[2], int size1, double *v2[2], int size2, double *v3[2],
 	 int size3);
 
+/* dalloc.c */
+double *G_alloc_vector(size_t);
+double **G_alloc_matrix(int, int);
+float *G_alloc_fvector(size_t);
+float **G_alloc_fmatrix(int, int);
+void G_free_vector(double *);
+void G_free_matrix(double **);
+void G_free_fvector(float *);
+void G_free_fmatrix(float **);
+
+/* eigen_tools.c */
+int G_tqli(double[], double[], int, double **);
+void G_tred2(double **, int, double[], double[]);
+
+/* ialloc.c */
+int *G_alloc_ivector(size_t);
+int **G_alloc_imatrix(int, int);
+void G_free_ivector(int *);
+void G_free_imatrix(int **);
+
+/* lu.c */
+int G_ludcmp(double **, int, int *, double *);
+void G_lubksb(double **, int, int *, double[]);
+
+/* svd.c */
+int G_svdcmp(double **, int, int, double *, double **);
+int G_svbksb(double **, double[], double **, int, int, double[], double[]);
+int G_svelim(double *, int);
+
 #endif /* GMATH_H_ */

Modified: grass/branches/releasebranch_6_4/lib/gmath/eigen.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gmath/eigen.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/lib/gmath/eigen.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -43,9 +43,10 @@
     G_tqli(lambda, e, n, a);
 
     /* Returns eigenvectors */
-    for (i = 0; i < n; i++)
-	for (j = 0; j < n; j++)
-	    Vectors[i][j] = a[i][j];
+    if (Vectors)
+	for (i = 0; i < n; i++)
+	    for (j = 0; j < n; j++)
+		Vectors[i][j] = a[i][j];
 
     G_free_matrix(a);
     G_free_vector(e);

Modified: grass/branches/releasebranch_6_4/lib/gmath/lu.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gmath/lu.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/lib/gmath/lu.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -1,5 +1,6 @@
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/gmath.h>
 
 
 #define TINY 1.0e-20;

Modified: grass/branches/releasebranch_6_4/lib/gmath/svd.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/gmath/svd.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/lib/gmath/svd.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -1,5 +1,6 @@
+#include <math.h>
 #include <grass/gis.h>
-#include <math.h>
+#include <grass/gmath.h>
 
 static double at, bt, ct;
 

Modified: grass/branches/releasebranch_6_4/lib/rst/interp_float/matrix.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/rst/interp_float/matrix.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/lib/rst/interp_float/matrix.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -25,6 +25,7 @@
 #include <unistd.h>
 #include <grass/gis.h>
 #include <grass/interpf.h>
+#include <grass/gmath.h>
 
 int IL_matrix_create(struct interp_params *params, struct triple *points,	/* points for interpolation */
 		     int n_points,	/* number of points */

Modified: grass/branches/releasebranch_6_4/lib/rst/interp_float/ressegm2d.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/rst/interp_float/ressegm2d.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/lib/rst/interp_float/ressegm2d.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -23,6 +23,7 @@
 #include <math.h>
 #include <grass/gis.h>
 #include <grass/interpf.h>
+#include <grass/gmath.h>
 
 static int input_data(struct interp_params *,
 		      int, int, struct fcell_triple *, int, int, int, int,

Modified: grass/branches/releasebranch_6_4/lib/rst/interp_float/segmen2d.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/rst/interp_float/segmen2d.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/lib/rst/interp_float/segmen2d.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -8,8 +8,8 @@
 #include <math.h>
 #include <grass/gis.h>
 #include <grass/glocale.h>
-
 #include <grass/interpf.h>
+#include <grass/gmath.h>
 
 static double smallest_segment(struct multtree *, int);
 

Modified: grass/branches/releasebranch_6_4/raster/r.param.scale/process.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.param.scale/process.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/raster/r.param.scale/process.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -16,6 +16,7 @@
 #include <stdlib.h>
 #include <grass/gis.h>
 #include <grass/glocale.h>
+#include <grass/gmath.h>
 #include "param.h"
 #include "nrutil.h"
 

Modified: grass/branches/releasebranch_6_4/raster/r.resamp.rst/main.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.resamp.rst/main.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/raster/r.resamp.rst/main.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -44,6 +44,7 @@
 #include "surf.h"
 #include <grass/interpf.h>
 #include <grass/glocale.h>
+#include <grass/gmath.h>
 
 #include "local_proto.h"
 

Modified: grass/branches/releasebranch_6_4/vector/lidar/lidarlib/PolimiFunct.h
===================================================================
--- grass/branches/releasebranch_6_4/vector/lidar/lidarlib/PolimiFunct.h	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/vector/lidar/lidarlib/PolimiFunct.h	2009-05-30 05:38:31 UTC (rev 37600)
@@ -20,13 +20,13 @@
 #ifndef _POLIMIFUNCT_H_
 #define _POLIMIFUNCT_H_
 
+#include <grass/config.h>
 #include <grass/gis.h>
 #include <grass/Vect.h>
 #include <grass/dbmi.h>
 #include <grass/glocale.h>
-#include <grass/config.h>
+#include <grass/gmath.h>
 
-
 /*----------------------------------------------------------------------------------------------------------*/
 /*CONSTANS DECLARATION */
 

Modified: grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c	2009-05-30 05:35:37 UTC (rev 37599)
+++ grass/branches/releasebranch_6_4/vector/v.surf.rst/main.c	2009-05-30 05:38:31 UTC (rev 37600)
@@ -44,6 +44,7 @@
 #include <grass/qtree.h>
 #include "surf.h"
 #include <grass/dataquad.h>
+#include <grass/gmath.h>
 
 
 #define SCIK1 1			/*100000 */



More information about the grass-commit mailing list