Renamed header files in bindings/python to get rid of the "python-" prefix dev
authorDmitriy Morozov <dmitriy@mrzv.org>
Mon, 13 Apr 2009 20:44:31 -0700
branchdev
changeset 128 a5fd0c2a1c88
parent 127 406c6cc00b9c
child 129 95454ea3f9c0
Renamed header files in bindings/python to get rid of the "python-" prefix
bindings/python/chain.cpp
bindings/python/filtration.cpp
bindings/python/filtration.h
bindings/python/optional.h
bindings/python/python-filtration.h
bindings/python/python-optional.h
bindings/python/python-rips.h
bindings/python/python-simplex.h
bindings/python/python-static-persistence.h
bindings/python/python-zigzag-persistence.h
bindings/python/rips.cpp
bindings/python/rips.h
bindings/python/simplex.cpp
bindings/python/simplex.h
bindings/python/static-persistence.cpp
bindings/python/static-persistence.h
bindings/python/zigzag-persistence.cpp
bindings/python/zigzag-persistence.h
--- a/bindings/python/chain.cpp	Mon Apr 13 20:38:46 2009 -0700
+++ b/bindings/python/chain.cpp	Mon Apr 13 20:44:31 2009 -0700
@@ -1,5 +1,5 @@
 #include <topology/chain.h>
-#include "python-static-persistence.h"
+#include "static-persistence.h"
 #include <boost/python.hpp>
 
 using namespace boost::python;
--- a/bindings/python/filtration.cpp	Mon Apr 13 20:38:46 2009 -0700
+++ b/bindings/python/filtration.cpp	Mon Apr 13 20:44:31 2009 -0700
@@ -1,13 +1,13 @@
 #include <topology/filtration.h>
 #include <boost/iterator.hpp>
-#include "python-simplex.h"
+#include "simplex.h"
 #include <iostream>
 
 #include <boost/python.hpp>
 using namespace boost::python;
 
 
-#include "python-filtration.h"      // defines ListFiltration, ListTraits, ListRandomAccessIterator
+#include "filtration.h"      // defines ListFiltration, ListTraits, ListRandomAccessIterator
 
 // Filtration python iterator interface    
 class FiltrationPythonIterator:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/filtration.h	Mon Apr 13 20:44:31 2009 -0700
@@ -0,0 +1,61 @@
+#ifndef __PYTHON_FILTRATION_H__
+#define __PYTHON_FILTRATION_H__
+
+#include <topology/filtration.h>
+#include <boost/python.hpp>
+#include "simplex.h"
+
+namespace bp = boost::python;
+
+// Random access iterator into python's list (using integer indices)
+class ListRandomAccessIterator:
+    public boost::iterator_adaptor<ListRandomAccessIterator,                // Derived
+                                   boost::counting_iterator<unsigned>,      // Base
+                                   SimplexObject,                           // Value
+                                   boost::use_default,
+                                   SimplexObject>
+{
+    public:
+        typedef                 ListRandomAccessIterator                                        Self;
+        typedef                 boost::iterator_adaptor<ListRandomAccessIterator,           
+                                                        boost::counting_iterator<unsigned>,     
+                                                        SimplexObject,
+                                                        boost::use_default,
+                                                        SimplexObject>                          Parent;
+                    
+                                ListRandomAccessIterator()                                      {}
+
+                                ListRandomAccessIterator(bp::list l, unsigned i):
+                                    Parent(i), l_(l)                                            {}
+
+    private:
+        friend class boost::iterator_core_access;
+        friend class FiltrationPythonIterator;
+
+        Parent::reference       dereference() const                                             { return bp::object(l_[*(this->base())]); }
+
+        bp::list                l_;
+};
+
+// ComplexTraits describing complexes of type list
+struct ListTraits
+{
+    typedef     bp::list                                        Complex;
+    typedef     SimplexObject                                   Simplex;
+    typedef     ListRandomAccessIterator                        Index;
+    typedef     std::less<Index>                                IndexComparison;
+
+    typedef     BinarySearchMap<SimplexVD, Index,
+                                SimplexVD::VertexComparison>    SimplexIndexMap;
+
+    static SimplexIndexMap      simplex_index_map(const Complex& l)             { return SimplexIndexMap(begin(l), end(l)); }
+    static SimplexIndexMap      simplex_index_map(Index bg, Index end)          { return SimplexIndexMap(bg, end); }
+
+    static unsigned             size(const Complex& l)                          { return bp::len(l); }
+    static Index                begin(const Complex& l)                         { return Index(l, 0); }
+    static Index                end(const Complex& l)                           { return Index(l, size(l)); }
+};
+
+typedef         Filtration<bp::list, unsigned, ListTraits>          ListFiltration;
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/optional.h	Mon Apr 13 20:44:31 2009 -0700
@@ -0,0 +1,83 @@
+#ifndef __PYTHON_OPTIONAL_H__
+#define __PYTHON_OPTIONAL_H__
+
+#include <boost/python.hpp>
+
+// Taken from an email by John Wiegley; 
+// http://mail.python.org/pipermail/cplusplus-sig/2007-May/012003.html
+
+template <typename T, typename TfromPy>
+struct object_from_python
+{
+    object_from_python() 
+    {
+        boost::python::converter::registry::push_back(&TfromPy::convertible, 
+                                                      &TfromPy::construct, 
+                                                      boost::python::type_id<T>());
+    }
+};
+
+template <typename T, typename TtoPy, typename TfromPy>
+struct register_python_conversion
+{
+    register_python_conversion() 
+    {
+        boost::python::to_python_converter<T, TtoPy>();
+        object_from_python<T, TfromPy>();
+    }
+};
+
+template <typename T>
+struct python_optional : public boost::noncopyable
+{
+    struct optional_to_python
+    {
+        static PyObject * convert(const boost::optional<T>& value)
+        {
+            return (value ? boost::python::to_python_value<T>()(*value) :
+                            boost::python::detail::none());
+        }
+    };
+
+    struct optional_from_python
+    {
+        static void * convertible(PyObject * source)
+        {
+            using namespace boost::python::converter;
+
+            if (source == Py_None)
+                return source;
+
+            const registration& converters(registered<T>::converters);
+
+            if (implicit_rvalue_convertible_from_python(source, converters)) 
+            {
+                rvalue_from_python_stage1_data data = rvalue_from_python_stage1(source, converters);
+                return rvalue_from_python_stage2(source, data, converters);
+            }
+            return NULL;
+        }
+
+        static void construct(PyObject * source,
+                              boost::python::converter::rvalue_from_python_stage1_data * data)
+        {
+            using namespace boost::python::converter;
+
+            void * const storage = ((rvalue_from_python_storage<T> *) data)->storage.bytes;
+
+            if (data->convertible == source)     // == None
+                new (storage) boost::optional<T>(); // A Boost uninitialized value
+            else
+                new (storage) boost::optional<T>(*static_cast<T *>(data->convertible));
+
+            data->convertible = storage;
+        }
+    };
+
+    explicit python_optional() 
+    {
+        register_python_conversion<boost::optional<T>, optional_to_python, optional_from_python>();
+    }
+};
+
+#endif
--- a/bindings/python/python-filtration.h	Mon Apr 13 20:38:46 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#ifndef __PYTHON_FILTRATION_H__
-#define __PYTHON_FILTRATION_H__
-
-#include <topology/filtration.h>
-#include <boost/python.hpp>
-#include "python-simplex.h"
-
-namespace bp = boost::python;
-
-// Random access iterator into python's list (using integer indices)
-class ListRandomAccessIterator:
-    public boost::iterator_adaptor<ListRandomAccessIterator,                // Derived
-                                   boost::counting_iterator<unsigned>,      // Base
-                                   SimplexObject,                           // Value
-                                   boost::use_default,
-                                   SimplexObject>
-{
-    public:
-        typedef                 ListRandomAccessIterator                                        Self;
-        typedef                 boost::iterator_adaptor<ListRandomAccessIterator,           
-                                                        boost::counting_iterator<unsigned>,     
-                                                        SimplexObject,
-                                                        boost::use_default,
-                                                        SimplexObject>                          Parent;
-                    
-                                ListRandomAccessIterator()                                      {}
-
-                                ListRandomAccessIterator(bp::list l, unsigned i):
-                                    Parent(i), l_(l)                                            {}
-
-    private:
-        friend class boost::iterator_core_access;
-        friend class FiltrationPythonIterator;
-
-        Parent::reference       dereference() const                                             { return bp::object(l_[*(this->base())]); }
-
-        bp::list                l_;
-};
-
-// ComplexTraits describing complexes of type list
-struct ListTraits
-{
-    typedef     bp::list                                        Complex;
-    typedef     SimplexObject                                   Simplex;
-    typedef     ListRandomAccessIterator                        Index;
-    typedef     std::less<Index>                                IndexComparison;
-
-    typedef     BinarySearchMap<SimplexVD, Index,
-                                SimplexVD::VertexComparison>    SimplexIndexMap;
-
-    static SimplexIndexMap      simplex_index_map(const Complex& l)             { return SimplexIndexMap(begin(l), end(l)); }
-    static SimplexIndexMap      simplex_index_map(Index bg, Index end)          { return SimplexIndexMap(bg, end); }
-
-    static unsigned             size(const Complex& l)                          { return bp::len(l); }
-    static Index                begin(const Complex& l)                         { return Index(l, 0); }
-    static Index                end(const Complex& l)                           { return Index(l, size(l)); }
-};
-
-typedef         Filtration<bp::list, unsigned, ListTraits>          ListFiltration;
-
-#endif
--- a/bindings/python/python-optional.h	Mon Apr 13 20:38:46 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#ifndef __PYTHON_OPTIONAL_H__
-#define __PYTHON_OPTIONAL_H__
-
-#include <boost/python.hpp>
-
-// Taken from an email by John Wiegley; 
-// http://mail.python.org/pipermail/cplusplus-sig/2007-May/012003.html
-
-template <typename T, typename TfromPy>
-struct object_from_python
-{
-    object_from_python() 
-    {
-        boost::python::converter::registry::push_back(&TfromPy::convertible, 
-                                                      &TfromPy::construct, 
-                                                      boost::python::type_id<T>());
-    }
-};
-
-template <typename T, typename TtoPy, typename TfromPy>
-struct register_python_conversion
-{
-    register_python_conversion() 
-    {
-        boost::python::to_python_converter<T, TtoPy>();
-        object_from_python<T, TfromPy>();
-    }
-};
-
-template <typename T>
-struct python_optional : public boost::noncopyable
-{
-    struct optional_to_python
-    {
-        static PyObject * convert(const boost::optional<T>& value)
-        {
-            return (value ? boost::python::to_python_value<T>()(*value) :
-                            boost::python::detail::none());
-        }
-    };
-
-    struct optional_from_python
-    {
-        static void * convertible(PyObject * source)
-        {
-            using namespace boost::python::converter;
-
-            if (source == Py_None)
-                return source;
-
-            const registration& converters(registered<T>::converters);
-
-            if (implicit_rvalue_convertible_from_python(source, converters)) 
-            {
-                rvalue_from_python_stage1_data data = rvalue_from_python_stage1(source, converters);
-                return rvalue_from_python_stage2(source, data, converters);
-            }
-            return NULL;
-        }
-
-        static void construct(PyObject * source,
-                              boost::python::converter::rvalue_from_python_stage1_data * data)
-        {
-            using namespace boost::python::converter;
-
-            void * const storage = ((rvalue_from_python_storage<T> *) data)->storage.bytes;
-
-            if (data->convertible == source)     // == None
-                new (storage) boost::optional<T>(); // A Boost uninitialized value
-            else
-                new (storage) boost::optional<T>(*static_cast<T *>(data->convertible));
-
-            data->convertible = storage;
-        }
-    };
-
-    explicit python_optional() 
-    {
-        register_python_conversion<boost::optional<T>, optional_to_python, optional_from_python>();
-    }
-};
-
-#endif
--- a/bindings/python/python-rips.h	Mon Apr 13 20:38:46 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-#ifndef __PYTHON_RIPS_H__
-#define __PYTHON_RIPS_H__
-
-#include <topology/rips.h>
-#include <utilities/indirect.h>
-
-#include "python-simplex.h"
-
-#include <boost/python.hpp>
-#include <boost/python/stl_iterator.hpp>
-
-
-namespace bp = boost::python;
-
-
-
-// This strange wrapper is necessary because Rips<...> stores only a const reference to the distances. 
-// Something on the C++ side of things must store the actual DistancesWrapper object, and that's the 
-// purpose of this class.
-class RipsWithDistances
-{
-    public:
-        class DistancesWrapper
-        {
-            public:
-                typedef             unsigned                                        IndexType;
-                typedef             double                                          DistanceType;
-        
-                                    DistancesWrapper(bp::object distances):
-                                        distances_(distances)                       {}
-        
-                DistanceType        operator()(IndexType a, IndexType b) const      { return bp::extract<DistanceType>(distances_(a, b)); }
-        
-                IndexType           size() const                                    { return bp::len(distances_); }
-                IndexType           begin() const                                   { return 0; }
-                IndexType           end() const                                     { return size(); }
-        
-            private:
-                bp::object          distances_;
-        };
-
-        typedef             DistancesWrapper::IndexType                             IndexType;
-        typedef             DistancesWrapper::DistanceType                          DistanceType;
-
-        typedef             Rips<DistancesWrapper, SimplexVD>                       RipsDS;
-        typedef             RipsDS::Comparison                                      Comparison;
-        typedef             RipsDS::Evaluator                                       Evaluator;
-
-        class FunctorWrapper
-        {
-            public:
-                                    FunctorWrapper(bp::object functor):
-                                        functor_(functor)                           {}
-        
-                void                operator()(const RipsDS::Simplex& s) const      { functor_(s); }
-        
-            private:
-                bp::object          functor_;
-        };
-
-
-                            RipsWithDistances(bp::object distances):
-                                distances_(distances), rips_(distances_),
-                                cmp_(Comparison(distances_)), eval_(distances_)     {}
-
-        void                generate(Dimension k, DistanceType max, bp::object functor) const
-        { rips_.generate(k, max, FunctorWrapper(functor)); }
-
-        void                vertex_cofaces(IndexType v, Dimension k, DistanceType max, bp::object functor) const
-        { rips_.vertex_cofaces(v, k, max, FunctorWrapper(functor)); }
-        
-        void                edge_cofaces(IndexType u, IndexType v, Dimension k, DistanceType max, bp::object functor) const
-        { rips_.edge_cofaces(u, v, k, max, FunctorWrapper(functor)); }
-
-        void                generate_candidates(Dimension k, DistanceType max, bp::object functor, bp::object seq) const
-        { 
-            rips_.generate(k, max, FunctorWrapper(functor), 
-                           bp::stl_input_iterator<IndexType>(seq), bp::stl_input_iterator<IndexType>());
-        }
-        
-        void                vertex_cofaces_candidate(IndexType v, Dimension k, DistanceType max, 
-                                                     bp::object functor, bp::object seq) const
-        { 
-            rips_.vertex_cofaces(v, k, max, FunctorWrapper(functor), 
-                                 bp::stl_input_iterator<IndexType>(seq), bp::stl_input_iterator<IndexType>());
-        }
-        
-        void                edge_cofaces_candidates(IndexType u, IndexType v, Dimension k, DistanceType max, 
-                                                    bp::object functor, bp::object seq) const
-        { 
-            rips_.edge_cofaces(u, v, k, max, FunctorWrapper(functor), 
-                               bp::stl_input_iterator<IndexType>(seq), bp::stl_input_iterator<IndexType>());
-        }
-
-        int                 cmp(const SimplexObject& s1, const SimplexObject& s2) const                     { return cmp_native(s1, s2); }
-        int                 cmp_native(const SimplexVD& s1, const SimplexVD& s2) const                      { return cmp_.compare(s1, s2); }
-        
-        DistanceType        eval(const SimplexObject& s) const                                              { return eval_native(s); }
-        DistanceType        eval_native(const SimplexVD& s) const                                           { return eval_(s); }
-        
-    private:
-        DistancesWrapper                            distances_;
-        RipsDS                                      rips_;
-        ThreeOutcomeCompare<Comparison>             cmp_;           // in Python, cmp is a three outcome comparison
-        Evaluator                                   eval_;
-};
-
-#endif
--- a/bindings/python/python-simplex.h	Mon Apr 13 20:38:46 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-#ifndef __PYTHON_SIMPLEX_H__
-#define __PYTHON_SIMPLEX_H__
-
-#include <topology/simplex.h>
-
-#include <boost/python.hpp>
-#include <boost/python/stl_iterator.hpp>
-namespace bp = boost::python;
-
-
-/**
- * SimplexVD is a base class for Python simplices (it's exposed to python as Simplex)
- *
- * SimplexObject is the representation of Python simplices in C++; i.e. it wraps bp::object and exposes a simplex-like interface.
- */
-typedef                             int                                         Vertex;
-// typedef                             double                                      Data;
-typedef                             Empty<>                                     Data;
-typedef                             Simplex<Vertex, Data>                       SimplexVD;
-
-
-// Wrapper around bp::object that acts like a simplex
-class SimplexObject: public bp::object
-{
-    public:
-        typedef                 SimplexObject                                   Self;
-        typedef                 bp::object                                      Parent;
-        typedef                 SimplexVD::BoundaryIterator                     BoundaryIterator;
-
-
-                                SimplexObject(Parent o = Parent()): Parent(o)   {}
-
-        BoundaryIterator        boundary_begin() const                          { return bp::extract<const SimplexVD&>(*this)().boundary_begin(); }
-        BoundaryIterator        boundary_end() const                            { return bp::extract<const SimplexVD&>(*this)().boundary_end(); }
-
-                                operator SimplexVD() const                      { return bp::extract<const SimplexVD&>(*this); }
-                                operator bp::object() const                     { return *this; }
-
-        bp::object              getattribute(const char* name) const            { return this->attr(name); }
-
-        class                   VertexComparison: public SimplexVD::VertexComparison
-        {
-            public:
-                typedef         Self                                            first_argument_type;
-                typedef         Self                                            second_argument_type;
-                typedef         bool                                            result_type;
-
-                bool            operator()(const SimplexObject& s1, const SimplexObject& s2) const  
-                { return SimplexVD::VertexComparison::operator()(bp::extract<const SimplexVD&>(s1), bp::extract<const SimplexVD&>(s2)); }
-        };
-};
-
-struct SimplexObjectToSimplexVD
-{
-    static PyObject* convert (const SimplexObject& so)
-    {
-        return (PyObject*) &so;
-    }
-};
-
-#endif
--- a/bindings/python/python-static-persistence.h	Mon Apr 13 20:38:46 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#ifndef __PYTHON_STATIC_PERSISTENCE_H__
-#define __PYTHON_STATIC_PERSISTENCE_H__
-
-#include <topology/static-persistence.h>
-
-typedef         StaticPersistence<>             SPersistence;
-typedef         SPersistence::OrderElement      SPersistenceNode;
-
-#endif
--- a/bindings/python/python-zigzag-persistence.h	Mon Apr 13 20:38:46 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-#ifndef __PYTHON_ZIGZAG_PERSISTENCE_H__
-#define __PYTHON_ZIGZAG_PERSISTENCE_H__
-
-#include <topology/zigzag-persistence.h>
-#include <topology/image-zigzag-persistence.h>
-#include <boost/python.hpp>
-
-//typedef         int                             BirthID;
-//typedef         boost::python::long_            BirthID;
-typedef         boost::python::object           BirthID;
-
-typedef         ZigzagPersistence<BirthID>      ZZPersistence;
-typedef         ImageZigzagPersistence<BirthID> IZZPersistence;
-
-#endif
--- a/bindings/python/rips.cpp	Mon Apr 13 20:38:46 2009 -0700
+++ b/bindings/python/rips.cpp	Mon Apr 13 20:44:31 2009 -0700
@@ -1,6 +1,6 @@
 #include <topology/rips.h>
 #include <boost/python.hpp>
-#include "python-rips.h"            // defines RipsWithDistances
+#include "rips.h"                   // defines RipsWithDistances
 
 #include <iostream>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/rips.h	Mon Apr 13 20:44:31 2009 -0700
@@ -0,0 +1,108 @@
+#ifndef __PYTHON_RIPS_H__
+#define __PYTHON_RIPS_H__
+
+#include <topology/rips.h>
+#include <utilities/indirect.h>
+
+#include "simplex.h"
+
+#include <boost/python.hpp>
+#include <boost/python/stl_iterator.hpp>
+
+
+namespace bp = boost::python;
+
+
+
+// This strange wrapper is necessary because Rips<...> stores only a const reference to the distances. 
+// Something on the C++ side of things must store the actual DistancesWrapper object, and that's the 
+// purpose of this class.
+class RipsWithDistances
+{
+    public:
+        class DistancesWrapper
+        {
+            public:
+                typedef             unsigned                                        IndexType;
+                typedef             double                                          DistanceType;
+        
+                                    DistancesWrapper(bp::object distances):
+                                        distances_(distances)                       {}
+        
+                DistanceType        operator()(IndexType a, IndexType b) const      { return bp::extract<DistanceType>(distances_(a, b)); }
+        
+                IndexType           size() const                                    { return bp::len(distances_); }
+                IndexType           begin() const                                   { return 0; }
+                IndexType           end() const                                     { return size(); }
+        
+            private:
+                bp::object          distances_;
+        };
+
+        typedef             DistancesWrapper::IndexType                             IndexType;
+        typedef             DistancesWrapper::DistanceType                          DistanceType;
+
+        typedef             Rips<DistancesWrapper, SimplexVD>                       RipsDS;
+        typedef             RipsDS::Comparison                                      Comparison;
+        typedef             RipsDS::Evaluator                                       Evaluator;
+
+        class FunctorWrapper
+        {
+            public:
+                                    FunctorWrapper(bp::object functor):
+                                        functor_(functor)                           {}
+        
+                void                operator()(const RipsDS::Simplex& s) const      { functor_(s); }
+        
+            private:
+                bp::object          functor_;
+        };
+
+
+                            RipsWithDistances(bp::object distances):
+                                distances_(distances), rips_(distances_),
+                                cmp_(Comparison(distances_)), eval_(distances_)     {}
+
+        void                generate(Dimension k, DistanceType max, bp::object functor) const
+        { rips_.generate(k, max, FunctorWrapper(functor)); }
+
+        void                vertex_cofaces(IndexType v, Dimension k, DistanceType max, bp::object functor) const
+        { rips_.vertex_cofaces(v, k, max, FunctorWrapper(functor)); }
+        
+        void                edge_cofaces(IndexType u, IndexType v, Dimension k, DistanceType max, bp::object functor) const
+        { rips_.edge_cofaces(u, v, k, max, FunctorWrapper(functor)); }
+
+        void                generate_candidates(Dimension k, DistanceType max, bp::object functor, bp::object seq) const
+        { 
+            rips_.generate(k, max, FunctorWrapper(functor), 
+                           bp::stl_input_iterator<IndexType>(seq), bp::stl_input_iterator<IndexType>());
+        }
+        
+        void                vertex_cofaces_candidate(IndexType v, Dimension k, DistanceType max, 
+                                                     bp::object functor, bp::object seq) const
+        { 
+            rips_.vertex_cofaces(v, k, max, FunctorWrapper(functor), 
+                                 bp::stl_input_iterator<IndexType>(seq), bp::stl_input_iterator<IndexType>());
+        }
+        
+        void                edge_cofaces_candidates(IndexType u, IndexType v, Dimension k, DistanceType max, 
+                                                    bp::object functor, bp::object seq) const
+        { 
+            rips_.edge_cofaces(u, v, k, max, FunctorWrapper(functor), 
+                               bp::stl_input_iterator<IndexType>(seq), bp::stl_input_iterator<IndexType>());
+        }
+
+        int                 cmp(const SimplexObject& s1, const SimplexObject& s2) const                     { return cmp_native(s1, s2); }
+        int                 cmp_native(const SimplexVD& s1, const SimplexVD& s2) const                      { return cmp_.compare(s1, s2); }
+        
+        DistanceType        eval(const SimplexObject& s) const                                              { return eval_native(s); }
+        DistanceType        eval_native(const SimplexVD& s) const                                           { return eval_(s); }
+        
+    private:
+        DistancesWrapper                            distances_;
+        RipsDS                                      rips_;
+        ThreeOutcomeCompare<Comparison>             cmp_;           // in Python, cmp is a three outcome comparison
+        Evaluator                                   eval_;
+};
+
+#endif
--- a/bindings/python/simplex.cpp	Mon Apr 13 20:38:46 2009 -0700
+++ b/bindings/python/simplex.cpp	Mon Apr 13 20:44:31 2009 -0700
@@ -8,6 +8,9 @@
 #include <boost/functional/hash.hpp>
 using namespace boost::python;
 
+#include "simplex.h"                // defines SimplexVD, Vertex, and Data
+
+
 /* Various wrappers for exposing Simplex to Python */
 // `vertices` property
 template<class V, class T>
@@ -48,8 +51,6 @@
 }
 
 
-#include "python-simplex.h"         // defines SimplexVD, Vertex, and Data
-
 void export_simplex()
 {
     class_<SimplexVD>("Simplex")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/simplex.h	Mon Apr 13 20:44:31 2009 -0700
@@ -0,0 +1,61 @@
+#ifndef __PYTHON_SIMPLEX_H__
+#define __PYTHON_SIMPLEX_H__
+
+#include <topology/simplex.h>
+
+#include <boost/python.hpp>
+#include <boost/python/stl_iterator.hpp>
+namespace bp = boost::python;
+
+
+/**
+ * SimplexVD is a base class for Python simplices (it's exposed to python as Simplex)
+ *
+ * SimplexObject is the representation of Python simplices in C++; i.e. it wraps bp::object and exposes a simplex-like interface.
+ */
+typedef                             int                                         Vertex;
+// typedef                             double                                      Data;
+typedef                             Empty<>                                     Data;
+typedef                             Simplex<Vertex, Data>                       SimplexVD;
+
+
+// Wrapper around bp::object that acts like a simplex
+class SimplexObject: public bp::object
+{
+    public:
+        typedef                 SimplexObject                                   Self;
+        typedef                 bp::object                                      Parent;
+        typedef                 SimplexVD::BoundaryIterator                     BoundaryIterator;
+
+
+                                SimplexObject(Parent o = Parent()): Parent(o)   {}
+
+        BoundaryIterator        boundary_begin() const                          { return bp::extract<const SimplexVD&>(*this)().boundary_begin(); }
+        BoundaryIterator        boundary_end() const                            { return bp::extract<const SimplexVD&>(*this)().boundary_end(); }
+
+                                operator SimplexVD() const                      { return bp::extract<const SimplexVD&>(*this); }
+                                operator bp::object() const                     { return *this; }
+
+        bp::object              getattribute(const char* name) const            { return this->attr(name); }
+
+        class                   VertexComparison: public SimplexVD::VertexComparison
+        {
+            public:
+                typedef         Self                                            first_argument_type;
+                typedef         Self                                            second_argument_type;
+                typedef         bool                                            result_type;
+
+                bool            operator()(const SimplexObject& s1, const SimplexObject& s2) const  
+                { return SimplexVD::VertexComparison::operator()(bp::extract<const SimplexVD&>(s1), bp::extract<const SimplexVD&>(s2)); }
+        };
+};
+
+struct SimplexObjectToSimplexVD
+{
+    static PyObject* convert (const SimplexObject& so)
+    {
+        return (PyObject*) &so;
+    }
+};
+
+#endif
--- a/bindings/python/static-persistence.cpp	Mon Apr 13 20:38:46 2009 -0700
+++ b/bindings/python/static-persistence.cpp	Mon Apr 13 20:44:31 2009 -0700
@@ -1,10 +1,11 @@
 #include <topology/static-persistence.h>
-#include "python-filtration.h"
 
 #include <boost/python.hpp>
 using namespace boost::python;
 
-#include "python-static-persistence.h"
+#include "filtration.h"
+#include "static-persistence.h"
+
 
 boost::shared_ptr<SPersistence>     init_from_filtration(object f)
 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/static-persistence.h	Mon Apr 13 20:44:31 2009 -0700
@@ -0,0 +1,9 @@
+#ifndef __PYTHON_STATIC_PERSISTENCE_H__
+#define __PYTHON_STATIC_PERSISTENCE_H__
+
+#include <topology/static-persistence.h>
+
+typedef         StaticPersistence<>             SPersistence;
+typedef         SPersistence::OrderElement      SPersistenceNode;
+
+#endif
--- a/bindings/python/zigzag-persistence.cpp	Mon Apr 13 20:38:46 2009 -0700
+++ b/bindings/python/zigzag-persistence.cpp	Mon Apr 13 20:44:31 2009 -0700
@@ -6,8 +6,8 @@
 #include <boost/shared_ptr.hpp>
 namespace bp = boost::python;
 
-#include "python-zigzag-persistence.h"      // defines ZZPersistence, IZZPersistence
-#include "python-optional.h"
+#include "zigzag-persistence.h"             // defines ZZPersistence, IZZPersistence
+#include "optional.h"
 
 
 // ZigzagPersistence
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bindings/python/zigzag-persistence.h	Mon Apr 13 20:44:31 2009 -0700
@@ -0,0 +1,15 @@
+#ifndef __PYTHON_ZIGZAG_PERSISTENCE_H__
+#define __PYTHON_ZIGZAG_PERSISTENCE_H__
+
+#include <topology/zigzag-persistence.h>
+#include <topology/image-zigzag-persistence.h>
+#include <boost/python.hpp>
+
+//typedef         int                             BirthID;
+//typedef         boost::python::long_            BirthID;
+typedef         boost::python::object           BirthID;
+
+typedef         ZigzagPersistence<BirthID>      ZZPersistence;
+typedef         ImageZigzagPersistence<BirthID> IZZPersistence;
+
+#endif