--- a/bindings/python/cohomology-persistence.cpp Wed Aug 19 12:01:47 2009 -0700
+++ b/bindings/python/cohomology-persistence.cpp Fri Aug 21 14:26:56 2009 -0700
@@ -29,6 +29,17 @@
return bp::make_tuple(i,d);
}
+
+bp::tuple chp_add_store(dp::CohomPersistence& chp, bp::object bdry, dp::BirthID birth, bool store)
+{
+ dp::CohomPersistence::SimplexIndex i;
+ dp::CohomPersistence::Death d;
+ boost::tie(i,d) = chp.add(bp::stl_input_iterator<dp::CohomPersistence::SimplexIndex>(bdry),
+ bp::stl_input_iterator<dp::CohomPersistence::SimplexIndex>(),
+ birth, store);
+ return bp::make_tuple(i,d);
+}
+
dp::CohomPersistence::ZColumn::const_iterator
cocycle_zcolumn_begin(dp::CohomPersistence::Cocycle& ccl)
{ return ccl.zcolumn.begin(); }
@@ -60,6 +71,7 @@
bp::class_<dp::CohomPersistence>("CohomologyPersistence")
.def("__init__", bp::make_constructor(&init_from_prime))
.def("add", &chp_add)
+ .def("add", &chp_add_store)
.def("__iter__", bp::range(&dp::CohomPersistence::begin, &dp::CohomPersistence::end))
;
--- a/doc/python/cohomology-persistence.rst Wed Aug 19 12:01:47 2009 -0700
+++ b/doc/python/cohomology-persistence.rst Fri Aug 21 14:26:56 2009 -0700
@@ -11,12 +11,17 @@
this point on all the computation will be performed with coefficients
coming from :math:`\mathbb{Z}/prime \mathbb{Z}`.
- .. method:: add(boundary, birth)
+ .. method:: add(boundary, birth, [store = True])
Adds a simplex with the given `boundary` to the complex, i.e.
:math:`K_{i+1} = K_i \cup \sigma` and `boundary` = :math:`\partial \sigma`.
If a new class is born as a result of the addition, `birth` is stored with
- it for future reference.
+ it for future reference.
+
+ If `store` is ``False`` and a class is born, it will not be stored in
+ :class:`CohomologyPersistence`. This is useful to not waste space on the
+ classes of the dimension equal to the maximum-dimensional simplices of
+ the complex since such classes will never die.
:returns: a pair (`i`, `d`). The first element is the index `i`.
It is the internal representation of the newly added simplex,