summaryrefslogtreecommitdiff
path: root/src/cython
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2019-05-10 12:37:48 +0200
committerMarc Glisse <marc.glisse@inria.fr>2019-05-10 12:37:48 +0200
commit27114ca8df752b4ddd24f0ebf161f46882e352df (patch)
treead3be60d9a438499cc0c0d3c165c99510d2b9a7c /src/cython
parenta33d17ebb1a5f7c830ee155ec2733a0f48211010 (diff)
Clarify doc of witness complex
Diffstat (limited to 'src/cython')
-rw-r--r--src/cython/cython/strong_witness_complex.pyx10
-rw-r--r--src/cython/cython/witness_complex.pyx10
-rwxr-xr-xsrc/cython/example/witness_complex_from_nearest_landmark_table.py12
3 files changed, 16 insertions, 16 deletions
diff --git a/src/cython/cython/strong_witness_complex.pyx b/src/cython/cython/strong_witness_complex.pyx
index 74c5cb05..1da2466f 100644
--- a/src/cython/cython/strong_witness_complex.pyx
+++ b/src/cython/cython/strong_witness_complex.pyx
@@ -47,8 +47,8 @@ cdef class StrongWitnessComplex:
def __init__(self, nearest_landmark_table=None):
"""StrongWitnessComplex constructor.
- :param nearest_landmark_table: A list of nearest landmark.
- :type nearest_landmark_table: list of list of pair of unsigned and double
+ :param nearest_landmark_table: A list of lists of nearest landmarks and their distances. `nearest_landmark_table[w][k]==(l,d)` means that l is the k-th nearest landmark to witness w, and d is the (squared) distance between l and w.
+ :type nearest_landmark_table: list of list of pair of int and float
"""
# The real cython constructor
@@ -65,10 +65,10 @@ cdef class StrongWitnessComplex:
"""
return self.thisptr != NULL
- def create_simplex_tree(self, max_alpha_square, limit_dimension = -1):
+ def create_simplex_tree(self, max_alpha_square = float('inf'), limit_dimension = -1):
"""
- :param max_alpha_square: The maximum alpha square threshold the
- simplices shall not exceed. Default is set to infinity.
+ :param max_alpha_square: The maximum relaxation parameter.
+ Default is set to infinity.
:type max_alpha_square: float
:returns: A simplex tree created from the Delaunay Triangulation.
:rtype: SimplexTree
diff --git a/src/cython/cython/witness_complex.pyx b/src/cython/cython/witness_complex.pyx
index 8591465a..d230fd49 100644
--- a/src/cython/cython/witness_complex.pyx
+++ b/src/cython/cython/witness_complex.pyx
@@ -47,8 +47,8 @@ cdef class WitnessComplex:
def __init__(self, nearest_landmark_table=None):
"""WitnessComplex constructor.
- :param nearest_landmark_table: A list of nearest landmark.
- :type nearest_landmark_table: list of list of pair of unsigned and double
+ :param nearest_landmark_table: A list of lists of nearest landmarks and their distances. `nearest_landmark_table[w][k]==(l,d)` means that l is the k-th nearest landmark to witness w, and d is the (squared) distance between l and w.
+ :type nearest_landmark_table: list of list of pair of int and float
"""
# The real cython constructor
@@ -65,10 +65,10 @@ cdef class WitnessComplex:
"""
return self.thisptr != NULL
- def create_simplex_tree(self, max_alpha_square, limit_dimension = -1):
+ def create_simplex_tree(self, max_alpha_square = float('inf'), limit_dimension = -1):
"""
- :param max_alpha_square: The maximum alpha square threshold the
- simplices shall not exceed. Default is set to infinity.
+ :param max_alpha_square: The maximum relaxation parameter.
+ Default is set to infinity.
:type max_alpha_square: float
:returns: A simplex tree created from the Delaunay Triangulation.
:rtype: SimplexTree
diff --git a/src/cython/example/witness_complex_from_nearest_landmark_table.py b/src/cython/example/witness_complex_from_nearest_landmark_table.py
index e6b295ee..1b79d9b2 100755
--- a/src/cython/example/witness_complex_from_nearest_landmark_table.py
+++ b/src/cython/example/witness_complex_from_nearest_landmark_table.py
@@ -30,14 +30,14 @@ __license__ = "GPL v3"
print("#####################################################################")
print("WitnessComplex creation from nearest landmark table")
-nearest_landmark_table = [[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]],
- [[1, 0], [2, 1], [3, 2], [4, 3], [0, 4]],
- [[2, 0], [3, 1], [4, 2], [0, 3], [1, 4]],
- [[3, 0], [4, 1], [0, 2], [1, 3], [2, 4]],
- [[4, 0], [0, 1], [1, 2], [2, 3], [3, 4]]]
+nearest_landmark_table = [[[0, 0.0], [1, 0.1], [2, 0.2], [3, 0.3], [4, 0.4]],
+ [[1, 0.0], [2, 0.1], [3, 0.2], [4, 0.3], [0, 0.4]],
+ [[2, 0.0], [3, 0.1], [4, 0.2], [0, 0.3], [1, 0.4]],
+ [[3, 0.0], [4, 0.1], [0, 0.2], [1, 0.3], [2, 0.4]],
+ [[4, 0.0], [0, 0.1], [1, 0.2], [2, 0.3], [3, 0.4]]]
witness_complex = StrongWitnessComplex(nearest_landmark_table=nearest_landmark_table)
-simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=4.1)
+simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=0.41)
message = "Number of simplices: " + repr(simplex_tree.num_simplices())
print(message)