summaryrefslogtreecommitdiff
path: root/src/python/gudhi
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/gudhi')
-rw-r--r--src/python/gudhi/alpha_complex.pyx11
-rw-r--r--src/python/gudhi/euclidean_strong_witness_complex.pyx4
-rw-r--r--src/python/gudhi/euclidean_witness_complex.pyx4
-rw-r--r--src/python/gudhi/off_reader.pyx2
-rw-r--r--src/python/gudhi/reader_utils.pyx8
-rw-r--r--src/python/gudhi/rips_complex.pyx2
-rw-r--r--src/python/gudhi/simplex_tree.pxd2
-rw-r--r--src/python/gudhi/strong_witness_complex.pyx4
-rw-r--r--src/python/gudhi/subsampling.pyx18
-rw-r--r--src/python/gudhi/witness_complex.pyx4
10 files changed, 32 insertions, 27 deletions
diff --git a/src/python/gudhi/alpha_complex.pyx b/src/python/gudhi/alpha_complex.pyx
index f3ca3dd5..fff3e920 100644
--- a/src/python/gudhi/alpha_complex.pyx
+++ b/src/python/gudhi/alpha_complex.pyx
@@ -24,11 +24,11 @@ __license__ = "GPL v3"
cdef extern from "Alpha_complex_interface.h" namespace "Gudhi":
cdef cppclass Alpha_complex_interface "Gudhi::alpha_complex::Alpha_complex_interface":
- Alpha_complex_interface(vector[vector[double]] points)
+ Alpha_complex_interface(vector[vector[double]] points) except +
# bool from_file is a workaround for cython to find the correct signature
- Alpha_complex_interface(string off_file, bool from_file)
- vector[double] get_point(int vertex)
- void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square)
+ Alpha_complex_interface(string off_file, bool from_file) except +
+ vector[double] get_point(int vertex) except +
+ void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except +
# AlphaComplex python interface
cdef class AlphaComplex:
@@ -96,8 +96,7 @@ cdef class AlphaComplex:
:rtype: list of float
:returns: the point.
"""
- cdef vector[double] point = self.thisptr.get_point(vertex)
- return point
+ return self.thisptr.get_point(vertex)
def create_simplex_tree(self, max_alpha_square = float('inf')):
"""
diff --git a/src/python/gudhi/euclidean_strong_witness_complex.pyx b/src/python/gudhi/euclidean_strong_witness_complex.pyx
index 9889f92c..aca6084e 100644
--- a/src/python/gudhi/euclidean_strong_witness_complex.pyx
+++ b/src/python/gudhi/euclidean_strong_witness_complex.pyx
@@ -22,9 +22,9 @@ __license__ = "GPL v3"
cdef extern from "Euclidean_strong_witness_complex_interface.h" namespace "Gudhi":
cdef cppclass Euclidean_strong_witness_complex_interface "Gudhi::witness_complex::Euclidean_strong_witness_complex_interface":
Euclidean_strong_witness_complex_interface(vector[vector[double]] landmarks, vector[vector[double]] witnesses)
- void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square)
+ void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except +
void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square,
- unsigned limit_dimension)
+ unsigned limit_dimension) except +
vector[double] get_point(unsigned vertex)
# EuclideanStrongWitnessComplex python interface
diff --git a/src/python/gudhi/euclidean_witness_complex.pyx b/src/python/gudhi/euclidean_witness_complex.pyx
index e3ce0e82..fb0c2201 100644
--- a/src/python/gudhi/euclidean_witness_complex.pyx
+++ b/src/python/gudhi/euclidean_witness_complex.pyx
@@ -22,9 +22,9 @@ __license__ = "GPL v3"
cdef extern from "Euclidean_witness_complex_interface.h" namespace "Gudhi":
cdef cppclass Euclidean_witness_complex_interface "Gudhi::witness_complex::Euclidean_witness_complex_interface":
Euclidean_witness_complex_interface(vector[vector[double]] landmarks, vector[vector[double]] witnesses)
- void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square)
+ void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except +
void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square,
- unsigned limit_dimension)
+ unsigned limit_dimension) except +
vector[double] get_point(unsigned vertex)
# EuclideanWitnessComplex python interface
diff --git a/src/python/gudhi/off_reader.pyx b/src/python/gudhi/off_reader.pyx
index a0d5bf25..7e6d9d80 100644
--- a/src/python/gudhi/off_reader.pyx
+++ b/src/python/gudhi/off_reader.pyx
@@ -26,7 +26,7 @@ def read_points_from_off_file(off_file=''):
:type off_file: string
:returns: The point set.
- :rtype: vector[vector[double]]
+ :rtype: List[List[float]]
"""
if off_file:
if os.path.isfile(off_file):
diff --git a/src/python/gudhi/reader_utils.pyx b/src/python/gudhi/reader_utils.pyx
index d6033b86..fe1c3a2e 100644
--- a/src/python/gudhi/reader_utils.pyx
+++ b/src/python/gudhi/reader_utils.pyx
@@ -34,7 +34,7 @@ def read_lower_triangular_matrix_from_csv_file(csv_file='', separator=';'):
:type separator: char
:returns: The lower triangular matrix.
- :rtype: vector[vector[double]]
+ :rtype: List[List[float]]
"""
if csv_file:
if path.isfile(csv_file):
@@ -45,15 +45,15 @@ def read_lower_triangular_matrix_from_csv_file(csv_file='', separator=';'):
def read_persistence_intervals_grouped_by_dimension(persistence_file=''):
"""Reads a file containing persistence intervals.
Each line might contain 2, 3 or 4 values: [[field] dimension] birth death
- The return value is an `map[dim, vector[pair[birth, death]]]`
- where `dim` is an `int`, `birth` a `double`, and `death` a `double`.
+ The return value is a `dict(dim, list(tuple(birth, death)))`
+ where `dim` is an `int`, `birth` a `float`, and `death` a `float`.
Note: the function does not check that birth <= death.
:param persistence_file: A persistence file style name.
:type persistence_file: string
:returns: The persistence pairs grouped by dimension.
- :rtype: map[int, vector[pair[double, double]]]
+ :rtype: Dict[int, List[Tuple[float, float]]]
"""
if persistence_file:
if path.isfile(persistence_file):
diff --git a/src/python/gudhi/rips_complex.pyx b/src/python/gudhi/rips_complex.pyx
index 722cdcdc..deb8057a 100644
--- a/src/python/gudhi/rips_complex.pyx
+++ b/src/python/gudhi/rips_complex.pyx
@@ -28,7 +28,7 @@ cdef extern from "Rips_complex_interface.h" namespace "Gudhi":
void init_matrix(vector[vector[double]] values, double threshold)
void init_points_sparse(vector[vector[double]] values, double threshold, double sparse)
void init_matrix_sparse(vector[vector[double]] values, double threshold, double sparse)
- void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, int dim_max)
+ void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, int dim_max) except +
# RipsComplex python interface
cdef class RipsComplex:
diff --git a/src/python/gudhi/simplex_tree.pxd b/src/python/gudhi/simplex_tree.pxd
index 1066d44b..96d14079 100644
--- a/src/python/gudhi/simplex_tree.pxd
+++ b/src/python/gudhi/simplex_tree.pxd
@@ -39,7 +39,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
vector[pair[vector[int], double]] get_star(vector[int] simplex)
vector[pair[vector[int], double]] get_cofaces(vector[int] simplex,
int dimension)
- void expansion(int max_dim)
+ void expansion(int max_dim) except +
void remove_maximal_simplex(vector[int] simplex)
bool prune_above_filtration(double filtration)
bool make_filtration_non_decreasing()
diff --git a/src/python/gudhi/strong_witness_complex.pyx b/src/python/gudhi/strong_witness_complex.pyx
index 2c33c3f2..9f89d3ae 100644
--- a/src/python/gudhi/strong_witness_complex.pyx
+++ b/src/python/gudhi/strong_witness_complex.pyx
@@ -22,9 +22,9 @@ __license__ = "MIT"
cdef extern from "Strong_witness_complex_interface.h" namespace "Gudhi":
cdef cppclass Strong_witness_complex_interface "Gudhi::witness_complex::Strong_witness_complex_interface":
Strong_witness_complex_interface(vector[vector[pair[size_t, double]]] nearest_landmark_table)
- void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square)
+ void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except +
void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square,
- unsigned limit_dimension)
+ unsigned limit_dimension) except +
# StrongWitnessComplex python interface
cdef class StrongWitnessComplex:
diff --git a/src/python/gudhi/subsampling.pyx b/src/python/gudhi/subsampling.pyx
index c501d16b..f77c6f75 100644
--- a/src/python/gudhi/subsampling.pyx
+++ b/src/python/gudhi/subsampling.pyx
@@ -33,13 +33,15 @@ def choose_n_farthest_points(points=None, off_file='', nb_points=0, starting_poi
The iteration starts with the landmark `starting point`.
:param points: The input point set.
- :type points: vector[vector[double]].
+ :type points: Iterable[Iterable[float]].
Or
:param off_file: An OFF file style name.
:type off_file: string
+ And in both cases
+
:param nb_points: Number of points of the subsample.
:type nb_points: unsigned.
:param starting_point: The iteration starts with the landmark `starting \
@@ -47,7 +49,7 @@ def choose_n_farthest_points(points=None, off_file='', nb_points=0, starting_poi
index is chosen randomly.
:type starting_point: unsigned.
:returns: The subsample point set.
- :rtype: vector[vector[double]]
+ :rtype: List[List[float]].
"""
if off_file:
if os.path.isfile(off_file):
@@ -74,17 +76,19 @@ def pick_n_random_points(points=None, off_file='', nb_points=0):
"""Subsample a point set by picking random vertices.
:param points: The input point set.
- :type points: vector[vector[double]].
+ :type points: Iterable[Iterable[float]].
Or
:param off_file: An OFF file style name.
:type off_file: string
+ And in both cases
+
:param nb_points: Number of points of the subsample.
:type nb_points: unsigned.
:returns: The subsample point set.
- :rtype: vector[vector[double]]
+ :rtype: List[List[float]]
"""
if off_file:
if os.path.isfile(off_file):
@@ -103,18 +107,20 @@ def sparsify_point_set(points=None, off_file='', min_squared_dist=0.0):
between any two points is greater than or equal to min_squared_dist.
:param points: The input point set.
- :type points: vector[vector[double]].
+ :type points: Iterable[Iterable[float]].
Or
:param off_file: An OFF file style name.
:type off_file: string
+ And in both cases
+
:param min_squared_dist: Minimum squared distance separating the output \
points.
:type min_squared_dist: float.
:returns: The subsample point set.
- :rtype: vector[vector[double]]
+ :rtype: List[List[float]]
"""
if off_file:
if os.path.isfile(off_file):
diff --git a/src/python/gudhi/witness_complex.pyx b/src/python/gudhi/witness_complex.pyx
index b032a5a1..e589d006 100644
--- a/src/python/gudhi/witness_complex.pyx
+++ b/src/python/gudhi/witness_complex.pyx
@@ -22,9 +22,9 @@ __license__ = "MIT"
cdef extern from "Witness_complex_interface.h" namespace "Gudhi":
cdef cppclass Witness_complex_interface "Gudhi::witness_complex::Witness_complex_interface":
Witness_complex_interface(vector[vector[pair[size_t, double]]] nearest_landmark_table)
- void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square)
+ void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) except +
void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square,
- unsigned limit_dimension)
+ unsigned limit_dimension) except +
# WitnessComplex python interface
cdef class WitnessComplex: