# HG changeset patch
# User Dmitriy Morozov <dmitriy@mrzv.org>
# Date 1259791434 28800
# Node ID b5f2e93fa75c333f9cca3f906ab33a350c4347b3
# Parent  64177e8ef379beae892f22fe2ac616e4c29d0881
StaticPersistence operates on chains consisting of only positive simplices

diff -r 64177e8ef379 -r b5f2e93fa75c include/topology/static-persistence.hpp
--- a/include/topology/static-persistence.hpp	Tue Dec 01 20:34:31 2009 -0800
+++ b/include/topology/static-persistence.hpp	Wed Dec 02 14:03:54 2009 -0800
@@ -4,6 +4,8 @@
 #include <boost/utility.hpp>
 #include <utilities/property-maps.h>
 
+#include <boost/foreach.hpp>
+
 #ifdef LOGGING
 static rlog::RLogChannel* rlPersistence =                   DEF_CHANNEL("topology/persistence", rlog::Log_Debug);
 #endif // LOGGING
@@ -54,6 +56,14 @@
         OrderElement& oe = *j;
         typename OrderElement::Cycle& z = oe.cycle;
         rLog(rlPersistence, "  has boundary: %s", z.tostring(outmap).c_str());
+
+        // Sparsify the cycle by removing the negative elements (TODO: make parameter based)
+        typename OrderElement::Cycle zz;
+        BOOST_FOREACH(OrderIndex i, z)
+            if (i->sign())           // positive
+                zz.push_back(i);
+        z.swap(zz);
+        // --------------------------
         
         CountNum(cPersistencePairBoundaries, oe.cycle.size());
         Count(cPersistencePair);