[GRASS-SVN] r63598 - grass-addons/grass7/imagery/i.spec.unmix

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 18 12:29:05 PST 2014


Author: neteler
Date: 2014-12-18 12:29:05 -0800 (Thu, 18 Dec 2014)
New Revision: 63598

Modified:
   grass-addons/grass7/imagery/i.spec.unmix/main.c
Log:
i.spec.unmix: fix indentation

Modified: grass-addons/grass7/imagery/i.spec.unmix/main.c
===================================================================
--- grass-addons/grass7/imagery/i.spec.unmix/main.c	2014-12-18 18:47:41 UTC (rev 63597)
+++ grass-addons/grass7/imagery/i.spec.unmix/main.c	2014-12-18 20:29:05 UTC (rev 63598)
@@ -68,12 +68,8 @@
     vec_struct *b_gamma;
     struct Cell_head region;
 
-    //    VEC *startvector, *A_times_startvector, *errorvector, *temp;
-
     vec_struct *startvector, *A_times_startvector, *errorvector, *temp;
-
     mat_struct *A, *A_tilde, *A_tilde_trans_mu, *A_tilde_trans;
-
     mat_struct B, B_tilde, B_tilde_trans_mu;
 
     struct GModule *module;
@@ -94,7 +90,7 @@
     G_add_keyword(_("imagery"));
     G_add_keyword(_("spectral unmixing"));
     module->description =
-	_("Perfroms Spectral mixture analysis of satellite/aerial images");
+	_("Performs Spectral mixture analysis of satellite/aerial images");
 
     parm.group = G_define_standard_option(G_OPT_I_GROUP);
 
@@ -106,9 +102,6 @@
     parm.matrixfile->description =
 	_("Matrix file containing spectral signatures");
 
-
-
-
     parm.result = G_define_option();
     parm.result->key = "result";
     parm.result->description =
@@ -124,7 +117,6 @@
     parm.iter->description = _("Raster map to hold number of iterations");
 
     if (G_parser(argc, argv))
-
 	exit(EXIT_FAILURE);
 
 
@@ -159,16 +151,12 @@
 
     /* go columnwise through matrix */
 
-
-
-
     for (i = 0; i < A->cols; i++) {
 	vec_struct *Avector1, *Avector2;
 	double max1, max2;
 
 	Avector1 = G_matvect_get_column(A, i);
 
-
 	/* get the max. element of this vector */
 	max1 = G_vector_norm_maxval(Avector1, 1);
 
@@ -200,8 +188,7 @@
     }
 
     G_message("%s",
-	      _
-	      ("Checking linear dependencies (orthogonality check) of Matrix A..."));
+	      _("Checking linear dependencies (orthogonality check) of Matrix A..."));
 
     for (i = 0; i < A->cols; i++)
 	for (j = 0; j < A->cols; j++)
@@ -310,8 +297,7 @@
     nrows = region.rows;
     ncols = region.cols;
 
-    G_message(_
-	      ("Calculating for %i x %i pixels (%i bands) = %i pixelvectors."),
+    G_message(_("Calculating for %i x %i pixels (%i bands) = %i pixelvectors."),
 	      nrows, ncols, Ref.nfiles, (ncols * ncols));
 
     for (row = 0; row < nrows; row++) {
@@ -344,8 +330,6 @@
 	    /* add GAMMA for 1. constraint as last element */
 	    G_matrix_set_element(b_gamma, 0, Ref.nfiles, GAMMA);
 
-
-
 	    for (k = 0; k < A_tilde->cols; k++)
 		G_matrix_set_element(startvector, 0, k,
 				     (1.0 / A_tilde->cols));
@@ -360,14 +344,11 @@
 	     */
 
 	    /* solve with iterative solution: */
-	    
-	    
 	    while (fabs(change) > 0.0001) {
 
 		G_mat_vector_product(A_tilde, startvector,
 				     A_times_startvector);
 
-
 		G_vector_sub(A_times_startvector, b_gamma, errorvector);
 
 		A_tilde_trans_mu =
@@ -382,11 +363,9 @@
 		    if ((G_matrix_get_element(startvector, 0, k) < 0))
 			G_matrix_set_element(startvector, 0, k, 0);
 
-
 		/* Check the deviation */
 		double norm = G_vector_norm_euclid(errorvector);
 
-
 		change = deviation - norm;
 		deviation = norm;
 
@@ -398,12 +377,10 @@
 	    vec_struct *fraction;
 
 	    /* G_message("fcol %d  and A->cols %d", startvector->dim, A->cols); */
-	    fraction = G_vector_init(A->cols,1, RVEC);	/* length: no. of spectra */
+	    fraction = G_vector_init(A->cols, 1, RVEC);	/* length: no. of spectra */
 	    error = deviation / G_vector_norm_euclid(b_gamma);
 	    fraction = G_vector_copy(startvector, NO_COMPACT);
 
-
-
 	    /* write result in full percent */
 	    for (i = 0; i < A->cols; i++)	/* no. of spectra */
 		result_cell[i][col] =
@@ -413,14 +390,10 @@
 	    error_cell[col] = (CELL) (100 * error);
 	    iter_cell[col] = iterations;
 
-
 	    G_vector_free(fraction);
-
-
 	}			/* end cols loop */
 
 
-
 	/* write the resulting rows into output files:  */
 	for (i = 0; i < A->cols; i++)	/* no. of spectra  */
 	    Rast_put_c_row(resultfd[i], result_cell[i]);
@@ -431,8 +404,8 @@
 	if (iter_fd > 0)
 	    Rast_put_c_row(iter_fd, iter_cell);
 
+    }	/* rows loop  */
 
-    }				/* rows loop  */
     G_percent(row, nrows, 2);
 
     /* close files  */
@@ -444,8 +417,6 @@
 
 	Rast_close(resultfd[i]);
 
-
-
 	/* make grey scale color table */
 	sprintf(result_name, "%s.%d", parm.result->answer, (i + 1));
 	sprintf(command, "r.colors map=%s color=rules <<EOF\n"
@@ -470,15 +441,10 @@
 	Rast_close(iter_fd);
 
     G_matrix_free(A);
-
     G_vector_free(errorvector);
-
     G_vector_free(temp);
-
     G_vector_free(b_gamma);
-
     G_vector_free(startvector);
-
     G_vector_free(A_times_startvector);
 
     make_history(result_name, parm.group->answer, parm.matrixfile->answer);



More information about the grass-commit mailing list