[Scipy-svn] r3210 - trunk/Lib/sparse/sparsetools

scipy-svn@scip... scipy-svn@scip...
Tue Jul 31 00:44:16 CDT 2007


Author: wnbell
Date: 2007-07-31 00:44:04 -0500 (Tue, 31 Jul 2007)
New Revision: 3210

Modified:
   trunk/Lib/sparse/sparsetools/sparsetools.h
Log:
eliminate zeros in sum_duplicates



Modified: trunk/Lib/sparse/sparsetools/sparsetools.h
===================================================================
--- trunk/Lib/sparse/sparsetools/sparsetools.h	2007-07-30 19:17:36 UTC (rev 3209)
+++ trunk/Lib/sparse/sparsetools/sparsetools.h	2007-07-31 05:44:04 UTC (rev 3210)
@@ -443,14 +443,15 @@
     while(head != -2){
         I curr = head; //current column
         head   = next[curr];
-
-        Aj[NNZ] = curr;
-        Ax[NNZ] = sums[curr];
-
+        
+        if(sums[curr] != 0){
+            Aj[NNZ] = curr;
+            Ax[NNZ] = sums[curr];
+            NNZ++;
+        }
+        
         next[curr] = -1;
         sums[curr] =  0;
-
-        NNZ++;
     }
     Ap[i+1] = NNZ;
   }



More information about the Scipy-svn mailing list