summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathieuCarriere <mathieu.carriere3@gmail.com>2020-03-17 12:14:49 -0400
committerMathieuCarriere <mathieu.carriere3@gmail.com>2020-03-17 12:14:49 -0400
commit58d923b13afb9b18a2d5b028c6575baee691d182 (patch)
tree2242fb61d711f6c7abcc20ea355a38eb3a36d9e6 /src
parenta52e84fdcdbf66f3542416499c26245d0435a8fb (diff)
update python doc
Diffstat (limited to 'src')
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h8
-rw-r--r--src/python/gudhi/simplex_tree.pyx34
2 files changed, 33 insertions, 9 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h
index 02f2c7e9..f661f687 100644
--- a/src/Simplex_tree/include/gudhi/Simplex_tree.h
+++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h
@@ -1478,8 +1478,8 @@ class Simplex_tree {
* \post The coordinates of the persistence diagram points might be a little different than the
* original filtration values due to the internal transformation (scaling to [-2,-1]) that is
* performed on these values during the computation of extended persistence.
- * @param[in] dgm Persistence diagram obtained after calling this->extend_filtration
- * and this->get_persistence.
+ * @param[in] dgm Persistence diagram obtained after calling this->extend_filtration,
+ * this->initialize_filtration, and this->compute_persistent_cohomology.
* @return A vector of four persistence diagrams. The first one is Ordinary, the
* second one is Relative, the third one is Extended+ and the fourth one is Extended-.
* See section 2.2 in https://link.springer.com/article/10.1007/s10208-017-9370-z for a description of these subtypes.
@@ -1538,14 +1538,14 @@ class Simplex_tree {
int maxvert = std::numeric_limits<int>::min();
this->minval_ = std::numeric_limits<double>::max();
this->maxval_ = std::numeric_limits<double>::min();
- for (auto sh : this->skeleton_simplex_range(0)) {
+ for (auto sh = root_.members().begin(); sh != root_.members().end(); ++sh){
double f = this->filtration(sh);
this->minval_ = std::min(this->minval_, f);
this->maxval_ = std::max(this->maxval_, f);
maxvert = std::max(*this->simplex_vertex_range(sh).begin(), maxvert);
}
- assert (maxvert < std::numeric_limits<int>::max());
+ GUDHI_CHECK(maxvert < std::numeric_limits<int>::max(), std::invalid_argument("Simplex_tree contains a vertex with the largest Vertex_handle"));
maxvert += 1;
Simplex_tree* st_copy = new Simplex_tree(*this);
diff --git a/src/python/gudhi/simplex_tree.pyx b/src/python/gudhi/simplex_tree.pyx
index 733ecb97..7af44683 100644
--- a/src/python/gudhi/simplex_tree.pyx
+++ b/src/python/gudhi/simplex_tree.pyx
@@ -397,19 +397,43 @@ cdef class SimplexTree:
return self.get_ptr().make_filtration_non_decreasing()
def extend_filtration(self):
- """ Extend filtration for computing extended persistence. This function only uses the filtration values at the 0-dimensional simplices, and computes the extended persistence diagram induced by the lower-star filtration computed with these values. Note that after calling this function, the filtration values are actually modified. The function :func:`compute_extended_persistence_subdiagrams()<gudhi.SimplexTree.compute_extended_persistence_subdiagrams>` retrieves the original values and separates the extended persistence diagram points w.r.t. their types (Ord, Rel, Ext+, Ext-) and should always be called after computing the persistent homology of the extended simplicial complex.
+ """ Extend filtration for computing extended persistence. This function only uses the
+ filtration values at the 0-dimensional simplices, and computes the extended persistence
+ diagram induced by the lower-star filtration computed with these values.
+
+ .. note::
+
+ Note that after calling this function, the filtration
+ values are actually modified within the Simplex_tree.
+ The function :func:`compute_extended_persistence_subdiagrams()<gudhi.SimplexTree.compute_extended_persistence_subdiagrams>`
+ retrieves the original values.
+
+ .. note::
+
+ Note that this code creates an extra vertex internally, so you should make sure that
+ the Simplex_tree does not contain a vertex with the largest Vertex_handle.
"""
return self.get_ptr().extend_filtration()
def compute_extended_persistence_subdiagrams(self, dgm):
- """This function retrieves good values for extended persistence, and separate the diagrams into the ordinary, relative, extended+ and extended- subdiagrams.
+ """This function retrieves good values for extended persistence, and separate the diagrams
+ into the ordinary, relative, extended+ and extended- subdiagrams.
+
+ :param dgm: Persistence diagram obtained after calling :func:`extend_filtration()<gudhi.SimplexTree.extend_filtration>`, :func:`initialize_filtration()<gudhi.SimplexTree.initialize_filtration>`, and :func:`persistence()<gudhi.SimplexTree.persistence>`.
+
+ :returns: A vector of four persistence diagrams. The first one is Ordinary, the second one is Relative, the third one is Extended+ and the fourth one is Extended-. See section 2.2 in https://link.springer.com/article/10.1007/s10208-017-9370-z for a description of these subtypes.
+
+ .. note::
- :param dgm: Persistence diagram obtained after calling :func:`extend_filtration()<gudhi.SimplexTree.extend_filtration>` and :func:`persistence()<gudhi.SimplexTree.persistence>`.
- :returns: A vector of four persistence diagrams. The first one is Ordinary, the second one is Relative, the third one is Extended+ and the fourth one is Extended-.
+ This function should be called only if :func:`extend_filtration()<gudhi.SimplexTree.extend_filtration>`,
+ :func:`initialize_filtration()<gudhi.SimplexTree.initialize_filtration>`,
+ and :func:`persistence()<gudhi.SimplexTree.persistence>` have been called first!
.. note::
- This function should be called only after calling :func:`extend_filtration()<gudhi.SimplexTree.extend_filtration>` and :func:`persistence()<gudhi.SimplexTree.persistence>`.
+ The coordinates of the persistence diagram points might be a little different than the
+ original filtration values due to the internal transformation (scaling to [-2,-1]) that is
+ performed on these values during the computation of extended persistence.
"""
return self.get_ptr().compute_extended_persistence_subdiagrams(dgm)