Added DequeChains (for ZigzagPersistence) dev
authorDmitriy Morozov <dmitriy@mrzv.org>
Wed, 31 Dec 2008 11:54:34 -0800
branchdev
changeset 107 a5debdc35559
parent 106 dfa74f2f2a76
child 108 e096f8892a04
Added DequeChains (for ZigzagPersistence)
include/topology/cycles.h
include/topology/zigzag-persistence.h
--- a/include/topology/cycles.h	Wed Dec 31 11:51:14 2008 -0800
+++ b/include/topology/cycles.h	Wed Dec 31 11:54:34 2008 -0800
@@ -3,6 +3,7 @@
 
 #include "chain.h"
 #include <vector>
+#include <deque>
 #include "utilities/circular_list.h"
 
 template<class OrderIndex_ = int>
@@ -24,6 +25,24 @@
 };
 
 template<class OrderIndex_ = int>
+struct DequeChains
+{
+    typedef             OrderIndex_                                             OrderIndex;
+    typedef             ChainWrapper<std::deque<OrderIndex> >                   Chain;
+    typedef             Chain                                                   Cycle;
+
+    Cycle               cycle;
+
+                        DequeChains()                                           {}
+                        DequeChains(Cycle z): cycle(z)                          {}
+
+    bool                sign() const                                            { return cycle.empty(); }
+
+    template<class U> struct rebind
+    { typedef           DequeChains<U>         other; };
+};
+
+template<class OrderIndex_ = int>
 struct ListChains
 {
     typedef             OrderIndex_                                             OrderIndex;
--- a/include/topology/zigzag-persistence.h	Wed Dec 31 11:51:14 2008 -0800
+++ b/include/topology/zigzag-persistence.h	Wed Dec 31 11:54:34 2008 -0800
@@ -27,9 +27,9 @@
         typedef                         std::list<SimplexNode>                          SimplexList;
         typedef                         typename SimplexList::iterator                  SimplexIndex;
 
-        // TODO: deques might make a lot of sense, at least for BColumns and ZRows
-        typedef                         typename VectorChains<ZIndex>::Chain            ZRow;
-        typedef                         typename VectorChains<ZIndex>::Chain            BColumn;
+        // TODO: should all chains be DequeChains? probably not
+        typedef                         typename DequeChains<ZIndex>::Chain             ZRow;
+        typedef                         typename DequeChains<ZIndex>::Chain             BColumn;
         typedef                         typename VectorChains<BIndex>::Chain            BRow;
         typedef                         typename VectorChains<BIndex>::Chain            CRow;
         typedef                         typename VectorChains<SimplexIndex>::Chain      ZColumn;