[GRASS-SVN] r37599 - in grass/branches/develbranch_6: 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:35:37 EDT 2009


Author: neteler
Date: 2009-05-30 01:35:37 -0400 (Sat, 30 May 2009)
New Revision: 37599

Removed:
   grass/branches/develbranch_6/imagery/i.smap/bouman/eigen.c
Modified:
   grass/branches/develbranch_6/imagery/i.gensigset/invert.c
   grass/branches/develbranch_6/imagery/i.gensigset/subcluster.c
   grass/branches/develbranch_6/imagery/i.smap/bouman/bouman.h
   grass/branches/develbranch_6/imagery/i.smap/bouman/invert.c
   grass/branches/develbranch_6/imagery/i.smap/bouman/model.c
   grass/branches/develbranch_6/include/gisdefs.h
   grass/branches/develbranch_6/include/gmath.h
   grass/branches/develbranch_6/lib/gmath/eigen.c
   grass/branches/develbranch_6/lib/gmath/lu.c
   grass/branches/develbranch_6/lib/gmath/svd.c
   grass/branches/develbranch_6/lib/rst/interp_float/matrix.c
   grass/branches/develbranch_6/lib/rst/interp_float/ressegm2d.c
   grass/branches/develbranch_6/lib/rst/interp_float/segmen2d.c
   grass/branches/develbranch_6/raster/r.param.scale/process.c
   grass/branches/develbranch_6/raster/r.resamp.rst/main.c
   grass/branches/develbranch_6/vector/lidar/lidarlib/PolimiFunct.h
   grass/branches/develbranch_6/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/develbranch_6/imagery/i.gensigset/invert.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.gensigset/invert.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/imagery/i.gensigset/invert.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/imagery/i.gensigset/subcluster.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.gensigset/subcluster.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/imagery/i.gensigset/subcluster.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/imagery/i.smap/bouman/bouman.h
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/bouman.h	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/bouman.h	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/imagery/i.smap/bouman/eigen.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/eigen.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/eigen.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/imagery/i.smap/bouman/invert.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/invert.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/invert.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/imagery/i.smap/bouman/model.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.smap/bouman/model.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/imagery/i.smap/bouman/model.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/include/gisdefs.h
===================================================================
--- grass/branches/develbranch_6/include/gisdefs.h	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/include/gisdefs.h	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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);
 
@@ -1154,11 +1130,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/develbranch_6/include/gmath.h
===================================================================
--- grass/branches/develbranch_6/include/gmath.h	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/include/gmath.h	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/lib/gmath/eigen.c
===================================================================
--- grass/branches/develbranch_6/lib/gmath/eigen.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/lib/gmath/eigen.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/lib/gmath/lu.c
===================================================================
--- grass/branches/develbranch_6/lib/gmath/lu.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/lib/gmath/lu.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -1,5 +1,6 @@
 #include <math.h>
 #include <grass/gis.h>
+#include <grass/gmath.h>
 
 
 #define TINY 1.0e-20;

Modified: grass/branches/develbranch_6/lib/gmath/svd.c
===================================================================
--- grass/branches/develbranch_6/lib/gmath/svd.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/lib/gmath/svd.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/lib/rst/interp_float/matrix.c
===================================================================
--- grass/branches/develbranch_6/lib/rst/interp_float/matrix.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/lib/rst/interp_float/matrix.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/lib/rst/interp_float/ressegm2d.c
===================================================================
--- grass/branches/develbranch_6/lib/rst/interp_float/ressegm2d.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/lib/rst/interp_float/ressegm2d.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/lib/rst/interp_float/segmen2d.c
===================================================================
--- grass/branches/develbranch_6/lib/rst/interp_float/segmen2d.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/lib/rst/interp_float/segmen2d.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/raster/r.param.scale/process.c
===================================================================
--- grass/branches/develbranch_6/raster/r.param.scale/process.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/raster/r.param.scale/process.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/raster/r.resamp.rst/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.resamp.rst/main.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/raster/r.resamp.rst/main.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/vector/lidar/lidarlib/PolimiFunct.h
===================================================================
--- grass/branches/develbranch_6/vector/lidar/lidarlib/PolimiFunct.h	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/vector/lidar/lidarlib/PolimiFunct.h	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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/develbranch_6/vector/v.surf.rst/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.surf.rst/main.c	2009-05-30 04:50:36 UTC (rev 37598)
+++ grass/branches/develbranch_6/vector/v.surf.rst/main.c	2009-05-30 05:35:37 UTC (rev 37599)
@@ -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