summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Rips_complex/doc/Intro_rips_complex.h2
-rw-r--r--src/cython/cython/rips_complex.pyx16
-rw-r--r--src/cython/doc/rips_complex_user.rst10
-rw-r--r--src/cython/include/Rips_complex_interface.h6
-rwxr-xr-xsrc/cython/test/test_rips_complex.py9
5 files changed, 30 insertions, 13 deletions
diff --git a/src/Rips_complex/doc/Intro_rips_complex.h b/src/Rips_complex/doc/Intro_rips_complex.h
index e54ae57c..a2537036 100644
--- a/src/Rips_complex/doc/Intro_rips_complex.h
+++ b/src/Rips_complex/doc/Intro_rips_complex.h
@@ -55,7 +55,7 @@ namespace rips_complex {
* simplices with filtration value larger than some threshold, and keeping only
* the dim_max-skeleton. It may also be a good idea to start by making the
* point set sparser, for instance with
- * `Gudhi::subsampling::sparsify_point_set`, since small clusters of points
+ * `Gudhi::subsampling::sparsify_point_set()`, since small clusters of points
* have a disproportionate cost without affecting the persistence diagram much.
*
* In order to build this complex, the algorithm first builds the graph.
diff --git a/src/cython/cython/rips_complex.pyx b/src/cython/cython/rips_complex.pyx
index cb9aad2e..7c83241c 100644
--- a/src/cython/cython/rips_complex.pyx
+++ b/src/cython/cython/rips_complex.pyx
@@ -51,7 +51,8 @@ cdef class RipsComplex:
cdef Rips_complex_interface thisref
# Fake constructor that does nothing but documenting the constructor
- def __init__(self, points=None, distance_matrix=None, max_edge_length=float('inf'), sparse=None):
+ def __init__(self, points=None, distance_matrix=None,
+ max_edge_length=float('inf'), sparse=None):
"""RipsComplex constructor.
:param max_edge_length: Rips value.
@@ -62,20 +63,25 @@ cdef class RipsComplex:
Or
- :param distance_matrix: A distance matrix (full square or lower triangular).
+ :param distance_matrix: A distance matrix (full square or lower
+ triangular).
:type points: list of list of double
And in both cases
- :param sparse: If this is not None, it switches to building a sparse Rips and represents the approximation parameter epsilon.
+ :param sparse: If this is not None, it switches to building a sparse
+ Rips and represents the approximation parameter epsilon.
:type sparse: float
"""
# The real cython constructor
- def __cinit__(self, points=None, distance_matrix=None, max_edge_length=float('inf'), sparse=None):
+ def __cinit__(self, points=None, distance_matrix=None,
+ max_edge_length=float('inf'), sparse=None):
if sparse is not None:
if distance_matrix is not None:
- self.thisref.init_matrix_sparse(distance_matrix, max_edge_length, sparse)
+ self.thisref.init_matrix_sparse(distance_matrix,
+ max_edge_length,
+ sparse)
else:
if points is None:
# Empty Rips construction
diff --git a/src/cython/doc/rips_complex_user.rst b/src/cython/doc/rips_complex_user.rst
index 0aeffe55..e814b4c3 100644
--- a/src/cython/doc/rips_complex_user.rst
+++ b/src/cython/doc/rips_complex_user.rst
@@ -15,11 +15,17 @@ Definition
| :doc:`rips_complex_user` | :doc:`rips_complex_ref` |
+-------------------------------------------+----------------------------------------------------------------------+
-The `Rips complex <https://en.wikipedia.org/wiki/Vietoris%E2%80%93Rips_complex>`_ is a simplicial complex that generalizes proximity (:math:`\varepsilon`-ball) graphs to higher dimensions. The vertices correspond to the input points, and a simplex is present if and only if its diameter is smaller than some parameter α. Considering all parameters α defines a filtered simplicial complex, where the filtration value of a simplex is its diameter. The filtration can be restricted to values α smaller than some threshold, to reduce its size.
+The `Rips complex <https://en.wikipedia.org/wiki/Vietoris%E2%80%93Rips_complex>`_ is a simplicial complex that
+generalizes proximity (:math:`\varepsilon`-ball) graphs to higher dimensions. The vertices correspond to the input
+points, and a simplex is present if and only if its diameter is smaller than some parameter α. Considering all
+parameters α defines a filtered simplicial complex, where the filtration value of a simplex is its diameter.
+The filtration can be restricted to values α smaller than some threshold, to reduce its size.
The input discrete metric space can be provided as a point cloud plus a distance function, or as a distance matrix.
-When creating a simplicial complex from the graph, :doc:`RipsComplex <rips_complex_ref>` first builds the graph and inserts it into the data structure. It then expands the simplicial complex (adds the simplices corresponding to cliques) when required. The expansion can be stopped at dimension `max_dimension`, by default 1.
+When creating a simplicial complex from the graph, :doc:`RipsComplex <rips_complex_ref>` first builds the graph and
+inserts it into the data structure. It then expands the simplicial complex (adds the simplices corresponding to cliques)
+when required. The expansion can be stopped at dimension `max_dimension`, by default 1.
A vertex name corresponds to the index of the point in the given range (aka. the point cloud).
diff --git a/src/cython/include/Rips_complex_interface.h b/src/cython/include/Rips_complex_interface.h
index f6fc79a1..1a6e2477 100644
--- a/src/cython/include/Rips_complex_interface.h
+++ b/src/cython/include/Rips_complex_interface.h
@@ -67,14 +67,16 @@ class Rips_complex_interface {
rips_complex_->create_complex(*simplex_tree, dim_max);
else {
sparse_rips_complex_->create_complex(*simplex_tree, dim_max);
- // This pruning should be done much earlier! It isn't that useful for sparse Rips, but it would be inconsistent not to do it.
+ // This pruning should be done much earlier! It isn't that useful for sparse Rips,
+ // but it would be inconsistent not to do it.
simplex_tree->prune_above_filtration(threshold_);
}
simplex_tree->initialize_filtration();
}
private:
- // std::variant would work, but we don't require C++17 yet, and boost::variant is not super convenient. Anyway, storing a graph would make more sense. Or changing the interface completely so there is no such storage.
+ // std::variant would work, but we don't require C++17 yet, and boost::variant is not super convenient.
+ // Anyway, storing a graph would make more sense. Or changing the interface completely so there is no such storage.
boost::optional<Rips_complex<Simplex_tree_interface<>::Filtration_value>> rips_complex_;
boost::optional<Sparse_rips_complex<Simplex_tree_interface<>::Filtration_value>> sparse_rips_complex_;
double threshold_;
diff --git a/src/cython/test/test_rips_complex.py b/src/cython/test/test_rips_complex.py
index 73cdac17..05dfcaf7 100755
--- a/src/cython/test/test_rips_complex.py
+++ b/src/cython/test/test_rips_complex.py
@@ -69,7 +69,8 @@ def test_filtered_rips_from_points():
def test_sparse_filtered_rips_from_points():
point_list = [[0, 0], [1, 0], [0, 1], [1, 1]]
- filtered_rips = RipsComplex(points=point_list, max_edge_length=1.0, sparse=.001)
+ filtered_rips = RipsComplex(points=point_list, max_edge_length=1.0,
+ sparse=.001)
simplex_tree = filtered_rips.create_simplex_tree(max_dimension=1)
@@ -84,7 +85,8 @@ def test_rips_from_distance_matrix():
[1, 0],
[1, sqrt(2), 0],
[sqrt(2), 1, 1, 0]]
- rips_complex = RipsComplex(distance_matrix=distance_matrix, max_edge_length=42)
+ rips_complex = RipsComplex(distance_matrix=distance_matrix,
+ max_edge_length=42)
simplex_tree = rips_complex.create_simplex_tree(max_dimension=1)
@@ -111,7 +113,8 @@ def test_filtered_rips_from_distance_matrix():
[1, 0],
[1, sqrt(2), 0],
[sqrt(2), 1, 1, 0]]
- filtered_rips = RipsComplex(distance_matrix=distance_matrix, max_edge_length=1.0)
+ filtered_rips = RipsComplex(distance_matrix=distance_matrix,
+ max_edge_length=1.0)
simplex_tree = filtered_rips.create_simplex_tree(max_dimension=1)