Added ZigzagPersistence::is_alive() + consistency zigzag outputs betti 1 at each stage dev
authorDmitriy Morozov <dmitriy@mrzv.org>
Wed, 25 Mar 2009 09:56:52 -0700
branchdev
changeset 119 505b3795d239
parent 118 c4e25fb4082c
child 120 3c830b15d694
Added ZigzagPersistence::is_alive() + consistency zigzag outputs betti 1 at each stage
examples/consistency/rips-consistency-zigzag.cpp
include/topology/zigzag-persistence.h
--- a/examples/consistency/rips-consistency-zigzag.cpp	Tue Mar 24 15:17:39 2009 -0700
+++ b/examples/consistency/rips-consistency-zigzag.cpp	Wed Mar 25 09:56:52 2009 -0700
@@ -222,7 +222,11 @@
                            complex, zz, out, remove);
         rInfo("  Subcomplex simplices removed");
         
-        rInfo("Complex size: %d", complex.size());
+        Dimension betti_1 = 0;
+        for (Zigzag::ZIndex cur = zz.begin(); cur != zz.end(); ++cur)
+            if (cur->birth.dimension == 1 && zz.is_alive(cur)) ++betti_1;
+        
+        rInfo("Complex size: %d, Betti_1 = %d", complex.size(), betti_1);
         
         ++show_progress;
     }
--- a/include/topology/zigzag-persistence.h	Tue Mar 24 15:17:39 2009 -0700
+++ b/include/topology/zigzag-persistence.h	Wed Mar 25 09:56:52 2009 -0700
@@ -97,6 +97,8 @@
 
         ZIndex                          begin()                                                     { return z_list.begin(); }
         ZIndex                          end()                                                       { return z_list.end(); }
+
+        bool                            is_alive(ZIndex i) const                                    { return i->low == b_list.end(); }
  
     protected:                                        
         // Function: add(s)