[GRASS-SVN] r36526 - grass/branches/develbranch_6/imagery/i.pca

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 30 06:14:17 EDT 2009


Author: neteler
Date: 2009-03-30 06:14:16 -0400 (Mon, 30 Mar 2009)
New Revision: 36526

Modified:
   grass/branches/develbranch_6/imagery/i.pca/support.c
Log:
write out appropriately eigenvectors, eigenvalues and percent importance (fixes trac #430)

Modified: grass/branches/develbranch_6/imagery/i.pca/support.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.pca/support.c	2009-03-30 10:14:11 UTC (rev 36525)
+++ grass/branches/develbranch_6/imagery/i.pca/support.c	2009-03-30 10:14:16 UTC (rev 36526)
@@ -49,14 +49,18 @@
     for (i = 0; i < bands; i++) {
 	char tmpeigen[256], tmpa[80];
 
-	sprintf(tmpeigen, "PC%d %9.2f ( ", i+1, eigval[i]);
+	sprintf(tmpeigen, "PC%d %9.2f (", i+1, eigval[i]);
 	for (j = 0; j < bands; j++) {
-	    sprintf(tmpa, "%5.2f ", eigmat[i][j]);
+	    sprintf(tmpa, "%7.4f", eigmat[i][j]);
 	    G_strcat(tmpeigen, tmpa);
+	    if (j < (bands - 1) ){
+		sprintf(tmpa, ",");
+		G_strcat(tmpeigen, tmpa);
+	    }
 	}
-	G_strcat(tmpeigen, ") ");
+	G_strcat(tmpeigen, ")");
 	
-	sprintf(tmpa, "[ %5.2f%% ]", eigval[i] * 100/eigval_total);
+	sprintf(tmpa, "[%.2f%%]", eigval[i] * 100/eigval_total);
 	G_strcat(tmpeigen, tmpa);
 
 	sprintf(hist.edhist[i + 1], tmpeigen);



More information about the grass-commit mailing list