From 27114ca8df752b4ddd24f0ebf161f46882e352df Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Fri, 10 May 2019 12:37:48 +0200 Subject: Clarify doc of witness complex --- src/cython/cython/strong_witness_complex.pyx | 10 +++++----- src/cython/cython/witness_complex.pyx | 10 +++++----- .../example/witness_complex_from_nearest_landmark_table.py | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src/cython') 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) -- cgit v1.2.3 From a858e7001808a20c7335593e1b056dfc546ed206 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Mon, 27 May 2019 12:00:45 +0200 Subject: long lines --- src/cython/cython/strong_witness_complex.pyx | 4 +++- src/cython/cython/witness_complex.pyx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/strong_witness_complex.pyx b/src/cython/cython/strong_witness_complex.pyx index 1da2466f..4b7bff34 100644 --- a/src/cython/cython/strong_witness_complex.pyx +++ b/src/cython/cython/strong_witness_complex.pyx @@ -47,7 +47,9 @@ cdef class StrongWitnessComplex: def __init__(self, nearest_landmark_table=None): """StrongWitnessComplex constructor. - :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. + :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 """ diff --git a/src/cython/cython/witness_complex.pyx b/src/cython/cython/witness_complex.pyx index d230fd49..b1cce83f 100644 --- a/src/cython/cython/witness_complex.pyx +++ b/src/cython/cython/witness_complex.pyx @@ -47,7 +47,9 @@ cdef class WitnessComplex: def __init__(self, nearest_landmark_table=None): """WitnessComplex constructor. - :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. + :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 """ -- cgit v1.2.3