Added store_negative argument to StaticPersistence.pair_simpices() dev
authorDmitriy Morozov <dmitriy@mrzv.org>
Fri, 11 May 2012 10:25:57 -0700
branchdev
changeset 250 021030a8f97c
parent 249 0c5c45ebbf97
child 251 870865d25958
child 252 4de0bd5b4ae1
Added store_negative argument to StaticPersistence.pair_simpices()
bindings/python/static-persistence.cpp
doc/python/static-persistence.rst
examples/triangle/triangle.py
include/topology/static-persistence.h
tools/CMakeLists.txt
--- a/bindings/python/static-persistence.cpp	Thu May 10 15:52:53 2012 -0700
+++ b/bindings/python/static-persistence.cpp	Fri May 11 10:25:57 2012 -0700
@@ -11,7 +11,11 @@
 namespace dp = dionysus::python;
 
 
-void                                    pair_simplices(dp::SPersistence& sp)                { sp.pair_simplices(false); }
+void            pair_simplices(dp::SPersistence& sp, bool store_negative)
+{
+    dp::SPersistence::PairVisitorNoProgress visitor;
+    sp.pair_simplices(sp.begin(), sp.end(), store_negative, visitor);
+}
 
 
 void export_static_persistence()
@@ -26,7 +30,7 @@
     bp::class_<dp::SPersistence>("StaticPersistence", bp::no_init)
         .def("__init__",        bp::make_constructor(&dp::init_from_filtration<dp::SPersistence>))
 
-        .def("pair_simplices",  &pair_simplices)
+        .def("pair_simplices",  &pair_simplices, (bp::args("store_negative")=false))
         .def("__call__",        &dp::distance<dp::SPersistence, dp::SPersistenceIndex>)
         .def("make_simplex_map",&dp::SPersistence::make_simplex_map<dp::PythonFiltration>)
 
--- a/doc/python/static-persistence.rst	Thu May 10 15:52:53 2012 -0700
+++ b/doc/python/static-persistence.rst	Fri May 11 10:25:57 2012 -0700
@@ -10,9 +10,10 @@
         matrix of the complex captured by the filtration with rows and columns
         sorted with respect to the filtration ordering.
 
-    .. method:: pair_simplices()
+    .. method:: pair_simplices(store_negative = False)
 
-        Pairs simplices using the [ELZ02]_ algorithm.
+        Pairs simplices using the [ELZ02]_ algorithm. `store_negative` indicates
+        whether to store the negative simplices in the cycles.
 
     .. method:: __call__(i)
 
--- a/examples/triangle/triangle.py	Thu May 10 15:52:53 2012 -0700
+++ b/examples/triangle/triangle.py	Fri May 11 10:25:57 2012 -0700
@@ -19,7 +19,7 @@
 
 p = StaticPersistence(f)
 print "Persistence initialized"
-p.pair_simplices()
+p.pair_simplices(True)
 print "Simplices paired"
 
 smap = p.make_simplex_map(f)
--- a/include/topology/static-persistence.h	Thu May 10 15:52:53 2012 -0700
+++ b/include/topology/static-persistence.h	Fri May 11 10:25:57 2012 -0700
@@ -128,7 +128,6 @@
         };
         OrderModifier                   modifier()                                              { return OrderModifier(order()); }
 
-    protected:
         // Function: pair_simplices(bg, end)
         // Compute persistence of the simplices in filtration between bg and end
         template<class Visitor>
@@ -165,6 +164,7 @@
             void                        finished(iterator j) const                              {}
         };
 
+    protected:
         const Order&                    order() const                                           { return order_; }
         Order&                          order()                                                 { return order_; }
 
--- a/tools/CMakeLists.txt	Thu May 10 15:52:53 2012 -0700
+++ b/tools/CMakeLists.txt	Fri May 11 10:25:57 2012 -0700
@@ -1,16 +1,16 @@
 find_package                (Qt4)
 
-if                          (QT4_FOUND)
-    set                     (QT_USE_QTOPENGL TRUE)
-    set                     (QT_USE_QTXML TRUE)
-    include                 (${QT_USE_FILE})
+#if                          (QT4_FOUND)
+#    set                     (QT_USE_QTOPENGL TRUE)
+#    set                     (QT_USE_QTXML TRUE)
+#    include                 (${QT_USE_FILE})
 
-    add_subdirectory        (diagram-viewer)
-#find_library                (gle_LIBRARY                NAMES gle)
-#find_library                (QGLViewer_LIBRARY          NAMES QGLViewer)
-#find_path                   (QGLViewer_INCLUDE_DIR      QGLViewer/qglviewer.h)
-#include_directories         (${QGLViewer_INCLUDE_DIR})
-endif                       (QT4_FOUND)
+#    add_subdirectory        (diagram-viewer)
+##find_library                (gle_LIBRARY                NAMES gle)
+##find_library                (QGLViewer_LIBRARY          NAMES QGLViewer)
+##find_path                   (QGLViewer_INCLUDE_DIR      QGLViewer/qglviewer.h)
+##include_directories         (${QGLViewer_INCLUDE_DIR})
+#endif                       (QT4_FOUND)
 
 
 add_executable              (extract-diagram                extract-diagram.cpp)