summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-06-05 18:44:17 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-06-05 18:44:17 +0200
commit4f02ba9c5a3233ff9d4554578fbe3ae456b9711f (patch)
treee330fa1a9781d73fa497ef56d791162d1bf65a87 /src
parente7ccfabc395352823c0330ef876b9ac0ef72e840 (diff)
code review: rename complexity with precision
Diffstat (limited to 'src')
-rw-r--r--src/python/doc/alpha_complex_user.rst8
-rw-r--r--src/python/gudhi/alpha_complex.pyx14
-rwxr-xr-xsrc/python/test/test_alpha_complex.py22
3 files changed, 22 insertions, 22 deletions
diff --git a/src/python/doc/alpha_complex_user.rst b/src/python/doc/alpha_complex_user.rst
index bc9fe513..e8b4f25e 100644
--- a/src/python/doc/alpha_complex_user.rst
+++ b/src/python/doc/alpha_complex_user.rst
@@ -23,14 +23,14 @@ Remarks
equivalent to the `Čech complex <https://gudhi.inria.fr/doc/latest/group__cech__complex.html>`_ and much smaller if
you do not bound the radii. `Čech complex <https://gudhi.inria.fr/doc/latest/group__cech__complex.html>`_ can still
make sense in higher dimension precisely because you can bound the radii.
-* Using the default :code:`complexity = 'safe'` makes the construction safe.
- If you pass :code:`complexity = 'exact'` to :func:`~gudhi.AlphaComplex.__init__`, the filtration values are the exact
+* Using the default :code:`precision = 'safe'` makes the construction safe.
+ If you pass :code:`precision = 'exact'` to :func:`~gudhi.AlphaComplex.__init__`, the filtration values are the exact
ones converted to float. This can be very slow.
- If you pass :code:`complexity = 'safe'` (the default), the filtration values are only
+ If you pass :code:`precision = 'safe'` (the default), the filtration values are only
guaranteed to have a small multiplicative error compared to the exact value.
A drawback, when computing persistence, is that an empty exact interval [10^12,10^12] may become a
non-empty approximate interval [10^12,10^12+10^6].
- Using :code:`complexity = 'fast'` makes the computations slightly faster, and the combinatorics are still exact, but
+ Using :code:`precision = 'fast'` makes the computations slightly faster, and the combinatorics are still exact, but
the computation of filtration values can exceptionally be arbitrarily bad. In all cases, we still guarantee that the
output is a valid filtration (faces have a filtration value no larger than their cofaces).
* For performances reasons, it is advised to use Alpha_complex with `CGAL <installation.html#cgal>`_ :math:`\geq` 5.0.0.
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx
index 3855f1ac..d9c2be81 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -57,7 +57,7 @@ cdef class AlphaComplex:
cdef bool exact
# Fake constructor that does nothing but documenting the constructor
- def __init__(self, points=None, off_file='', complexity='safe'):
+ def __init__(self, points=None, off_file='', precision='safe'):
"""AlphaComplex constructor.
:param points: A list of points in d-Dimension.
@@ -68,15 +68,15 @@ cdef class AlphaComplex:
:param off_file: An OFF file style name.
:type off_file: string
- :param complexity: Alpha complex complexity can be 'fast', 'safe' or 'exact'. Default is 'safe'.
- :type complexity: string
+ :param precision: Alpha complex precision can be 'fast', 'safe' or 'exact'. Default is 'safe'.
+ :type precision: string
"""
# The real cython constructor
- def __cinit__(self, points = None, off_file = '', complexity = 'safe'):
- assert complexity in ['fast', 'safe', 'exact'], "Alpha complex complexity can only be 'fast', 'safe' or 'exact'"
- cdef bool fast = complexity == 'fast'
- self.exact = complexity == 'safe'
+ def __cinit__(self, points = None, off_file = '', precision = 'safe'):
+ assert precision in ['fast', 'safe', 'exact'], "Alpha complex precision can only be 'fast', 'safe' or 'exact'"
+ cdef bool fast = precision == 'fast'
+ self.exact = precision == 'safe'
cdef vector[vector[double]] pts
if off_file:
diff --git a/src/python/test/test_alpha_complex.py b/src/python/test/test_alpha_complex.py
index 913397dd..943ad2c4 100755
--- a/src/python/test/test_alpha_complex.py
+++ b/src/python/test/test_alpha_complex.py
@@ -24,8 +24,8 @@ __copyright__ = "Copyright (C) 2016 Inria"
__license__ = "MIT"
-def _empty_alpha(complexity):
- alpha_complex = AlphaComplex(points=[[0, 0]], complexity = complexity)
+def _empty_alpha(precision):
+ alpha_complex = AlphaComplex(points=[[0, 0]], precision = precision)
assert alpha_complex.__is_defined() == True
def test_empty_alpha():
@@ -33,9 +33,9 @@ def test_empty_alpha():
_empty_alpha('safe')
_empty_alpha('exact')
-def _infinite_alpha(complexity):
+def _infinite_alpha(precision):
point_list = [[0, 0], [1, 0], [0, 1], [1, 1]]
- alpha_complex = AlphaComplex(points=point_list, complexity = complexity)
+ alpha_complex = AlphaComplex(points=point_list, precision = precision)
assert alpha_complex.__is_defined() == True
simplex_tree = alpha_complex.create_simplex_tree()
@@ -88,9 +88,9 @@ def test_infinite_alpha():
_infinite_alpha('safe')
_infinite_alpha('exact')
-def _filtered_alpha(complexity):
+def _filtered_alpha(precision):
point_list = [[0, 0], [1, 0], [0, 1], [1, 1]]
- filtered_alpha = AlphaComplex(points=point_list, complexity = complexity)
+ filtered_alpha = AlphaComplex(points=point_list, precision = precision)
simplex_tree = filtered_alpha.create_simplex_tree(max_alpha_square=0.25)
@@ -132,7 +132,7 @@ def test_filtered_alpha():
_filtered_alpha('safe')
_filtered_alpha('exact')
-def _safe_alpha_persistence_comparison(complexity):
+def _safe_alpha_persistence_comparison(precision):
#generate periodic signal
time = np.arange(0, 10, 1)
signal = [math.sin(x) for x in time]
@@ -144,10 +144,10 @@ def _safe_alpha_persistence_comparison(complexity):
embedding2 = [[signal[i], delayed[i]] for i in range(len(time))]
#build alpha complex and simplex tree
- alpha_complex1 = AlphaComplex(points=embedding1, complexity = complexity)
+ alpha_complex1 = AlphaComplex(points=embedding1, precision = precision)
simplex_tree1 = alpha_complex1.create_simplex_tree()
- alpha_complex2 = AlphaComplex(points=embedding2, complexity = complexity)
+ alpha_complex2 = AlphaComplex(points=embedding2, precision = precision)
simplex_tree2 = alpha_complex2.create_simplex_tree()
diag1 = simplex_tree1.persistence()
@@ -163,9 +163,9 @@ def test_safe_alpha_persistence_comparison():
_safe_alpha_persistence_comparison('safe')
_safe_alpha_persistence_comparison('exact')
-def _delaunay_complex(complexity):
+def _delaunay_complex(precision):
point_list = [[0, 0], [1, 0], [0, 1], [1, 1]]
- filtered_alpha = AlphaComplex(points=point_list, complexity = complexity)
+ filtered_alpha = AlphaComplex(points=point_list, precision = precision)
simplex_tree = filtered_alpha.create_simplex_tree(default_filtration_value = True)