summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2019-07-05 17:14:53 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2019-07-05 17:14:53 +0200
commit0a4a42e38dffaea03083e39e5eafed2e1f32ff05 (patch)
tree3446f423ba74e8cce4cf13bb865dc17b2aef1d2c /src
parentde268e32ceb8fc46a36e3f221ef0e7392a587544 (diff)
move cython in a gudhi directory - like the python package one
Diffstat (limited to 'src')
-rw-r--r--src/cython/CMakeLists.txt2
-rw-r--r--src/cython/gudhi/__init__.py.in (renamed from src/cython/__init__.py.in)0
-rw-r--r--src/cython/gudhi/alpha_complex.pyx (renamed from src/cython/cython/alpha_complex.pyx)12
-rw-r--r--src/cython/gudhi/bottleneck_distance.pyx (renamed from src/cython/cython/bottleneck_distance.pyx)0
-rw-r--r--src/cython/gudhi/cubical_complex.pyx (renamed from src/cython/cython/cubical_complex.pyx)0
-rw-r--r--src/cython/gudhi/euclidean_strong_witness_complex.pyx (renamed from src/cython/cython/euclidean_strong_witness_complex.pyx)0
-rw-r--r--src/cython/gudhi/euclidean_witness_complex.pyx (renamed from src/cython/cython/euclidean_witness_complex.pyx)0
-rw-r--r--src/cython/gudhi/nerve_gic.pyx (renamed from src/cython/cython/nerve_gic.pyx)0
-rw-r--r--src/cython/gudhi/off_reader.pyx (renamed from src/cython/cython/off_reader.pyx)0
-rw-r--r--src/cython/gudhi/periodic_cubical_complex.pyx (renamed from src/cython/cython/periodic_cubical_complex.pyx)0
-rw-r--r--src/cython/gudhi/persistence_graphical_tools.py (renamed from src/cython/cython/persistence_graphical_tools.py)0
-rw-r--r--src/cython/gudhi/reader_utils.pyx (renamed from src/cython/cython/reader_utils.pyx)0
-rw-r--r--src/cython/gudhi/rips_complex.pyx (renamed from src/cython/cython/rips_complex.pyx)12
-rw-r--r--src/cython/gudhi/simplex_tree.pxd46
-rw-r--r--src/cython/gudhi/simplex_tree.pyx (renamed from src/cython/cython/simplex_tree.pyx)90
-rw-r--r--src/cython/gudhi/strong_witness_complex.pyx (renamed from src/cython/cython/strong_witness_complex.pyx)15
-rw-r--r--src/cython/gudhi/subsampling.pyx (renamed from src/cython/cython/subsampling.pyx)0
-rw-r--r--src/cython/gudhi/tangential_complex.pyx (renamed from src/cython/cython/tangential_complex.pyx)9
-rw-r--r--src/cython/gudhi/witness_complex.pyx (renamed from src/cython/cython/witness_complex.pyx)15
19 files changed, 128 insertions, 73 deletions
diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt
index b69b2c7d..cd99f70b 100644
--- a/src/cython/CMakeLists.txt
+++ b/src/cython/CMakeLists.txt
@@ -195,7 +195,7 @@ if(PYTHONINTERP_FOUND)
# Generate gudhi/__init__.py
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/gudhi")
- configure_file(__init__.py.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi/__init__.py" @ONLY)
+ configure_file("gudhi/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/gudhi/__init__.py" @ONLY)
add_custom_command(
OUTPUT gudhi.so
diff --git a/src/cython/__init__.py.in b/src/cython/gudhi/__init__.py.in
index 60ad7865..60ad7865 100644
--- a/src/cython/__init__.py.in
+++ b/src/cython/gudhi/__init__.py.in
diff --git a/src/cython/cython/alpha_complex.pyx b/src/cython/gudhi/alpha_complex.pyx
index 249d51d0..85131780 100644
--- a/src/cython/cython/alpha_complex.pyx
+++ b/src/cython/gudhi/alpha_complex.pyx
@@ -3,8 +3,12 @@ from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.string cimport string
from libcpp cimport bool
+from libc.stdint cimport intptr_t
import os
+from gudhi.simplex_tree cimport *
+from gudhi.simplex_tree import SimplexTree
+
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
Author(s): Vincent Rouvreau
@@ -104,6 +108,8 @@ cdef class AlphaComplex:
:returns: A simplex tree created from the Delaunay Triangulation.
:rtype: SimplexTree
"""
- simplex_tree = SimplexTree()
- self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square)
- return simplex_tree
+ stree = SimplexTree()
+ cdef intptr_t stree_int_ptr=stree.thisptr
+ cdef Simplex_tree_interface_full_featured* stree_ptr = <Simplex_tree_interface_full_featured*>stree_int_ptr
+ self.thisptr.create_simplex_tree(stree_ptr, max_alpha_square)
+ return stree
diff --git a/src/cython/cython/bottleneck_distance.pyx b/src/cython/gudhi/bottleneck_distance.pyx
index 4b378cbc..4b378cbc 100644
--- a/src/cython/cython/bottleneck_distance.pyx
+++ b/src/cython/gudhi/bottleneck_distance.pyx
diff --git a/src/cython/cython/cubical_complex.pyx b/src/cython/gudhi/cubical_complex.pyx
index 0dc133d1..0dc133d1 100644
--- a/src/cython/cython/cubical_complex.pyx
+++ b/src/cython/gudhi/cubical_complex.pyx
diff --git a/src/cython/cython/euclidean_strong_witness_complex.pyx b/src/cython/gudhi/euclidean_strong_witness_complex.pyx
index 26bd8375..26bd8375 100644
--- a/src/cython/cython/euclidean_strong_witness_complex.pyx
+++ b/src/cython/gudhi/euclidean_strong_witness_complex.pyx
diff --git a/src/cython/cython/euclidean_witness_complex.pyx b/src/cython/gudhi/euclidean_witness_complex.pyx
index e687c6f3..e687c6f3 100644
--- a/src/cython/cython/euclidean_witness_complex.pyx
+++ b/src/cython/gudhi/euclidean_witness_complex.pyx
diff --git a/src/cython/cython/nerve_gic.pyx b/src/cython/gudhi/nerve_gic.pyx
index 3c8f1200..3c8f1200 100644
--- a/src/cython/cython/nerve_gic.pyx
+++ b/src/cython/gudhi/nerve_gic.pyx
diff --git a/src/cython/cython/off_reader.pyx b/src/cython/gudhi/off_reader.pyx
index 9efd97ff..9efd97ff 100644
--- a/src/cython/cython/off_reader.pyx
+++ b/src/cython/gudhi/off_reader.pyx
diff --git a/src/cython/cython/periodic_cubical_complex.pyx b/src/cython/gudhi/periodic_cubical_complex.pyx
index 724fadd4..724fadd4 100644
--- a/src/cython/cython/periodic_cubical_complex.pyx
+++ b/src/cython/gudhi/periodic_cubical_complex.pyx
diff --git a/src/cython/cython/persistence_graphical_tools.py b/src/cython/gudhi/persistence_graphical_tools.py
index 34803222..34803222 100644
--- a/src/cython/cython/persistence_graphical_tools.py
+++ b/src/cython/gudhi/persistence_graphical_tools.py
diff --git a/src/cython/cython/reader_utils.pyx b/src/cython/gudhi/reader_utils.pyx
index 147fae71..147fae71 100644
--- a/src/cython/cython/reader_utils.pyx
+++ b/src/cython/gudhi/reader_utils.pyx
diff --git a/src/cython/cython/rips_complex.pyx b/src/cython/gudhi/rips_complex.pyx
index b9a2331f..1a6c8571 100644
--- a/src/cython/cython/rips_complex.pyx
+++ b/src/cython/gudhi/rips_complex.pyx
@@ -3,7 +3,10 @@ from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.string cimport string
from libcpp cimport bool
-import os
+from libc.stdint cimport intptr_t
+
+from gudhi.simplex_tree cimport *
+from gudhi.simplex_tree import SimplexTree
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
@@ -93,6 +96,7 @@ cdef class RipsComplex:
:returns: A simplex tree created from the Delaunay Triangulation.
:rtype: SimplexTree
"""
- simplex_tree = SimplexTree()
- self.thisref.create_simplex_tree(simplex_tree.thisptr, max_dimension)
- return simplex_tree
+ stree = SimplexTree()
+ cdef intptr_t stree_ptr=stree.thisptr
+ self.thisref.create_simplex_tree(<Simplex_tree_interface_full_featured*>stree_ptr, max_dimension)
+ return stree
diff --git a/src/cython/gudhi/simplex_tree.pxd b/src/cython/gudhi/simplex_tree.pxd
new file mode 100644
index 00000000..25051295
--- /dev/null
+++ b/src/cython/gudhi/simplex_tree.pxd
@@ -0,0 +1,46 @@
+from cython cimport numeric
+from libcpp.vector cimport vector
+from libcpp.utility cimport pair
+from libcpp cimport bool
+from libcpp.string cimport string
+
+""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
+ See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2016 Inria
+
+ Modification(s):
+ - YYYY/MM Author: Description of the modification
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2016 Inria"
+__license__ = "MIT"
+
+cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
+ cdef cppclass Simplex_tree_options_full_featured:
+ pass
+
+ cdef cppclass Simplex_tree_interface_full_featured "Gudhi::Simplex_tree_interface<Gudhi::Simplex_tree_options_full_featured>":
+ Simplex_tree()
+ double simplex_filtration(vector[int] simplex)
+ void assign_simplex_filtration(vector[int] simplex, double filtration)
+ void initialize_filtration()
+ int num_vertices()
+ int num_simplices()
+ void set_dimension(int dimension)
+ int dimension()
+ int upper_bound_dimension()
+ bool find_simplex(vector[int] simplex)
+ bool insert_simplex_and_subfaces(vector[int] simplex,
+ double filtration)
+ vector[pair[vector[int], double]] get_filtration()
+ vector[pair[vector[int], double]] get_skeleton(int dimension)
+ 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 remove_maximal_simplex(vector[int] simplex)
+ bool prune_above_filtration(double filtration)
+ bool make_filtration_non_decreasing()
diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/gudhi/simplex_tree.pyx
index 8e791c17..e5f9e9d1 100644
--- a/src/cython/cython/simplex_tree.pyx
+++ b/src/cython/gudhi/simplex_tree.pyx
@@ -1,9 +1,4 @@
-from cython cimport numeric
-from libcpp.vector cimport vector
-from libcpp.utility cimport pair
-from libcpp cimport bool
-from libcpp.string cimport string
-
+from libc.stdint cimport intptr_t
from numpy import array as np_array
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
@@ -20,33 +15,6 @@ __author__ = "Vincent Rouvreau"
__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "MIT"
-cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
- cdef cppclass Simplex_tree_options_full_featured:
- pass
-
- cdef cppclass Simplex_tree_interface_full_featured "Gudhi::Simplex_tree_interface<Gudhi::Simplex_tree_options_full_featured>":
- Simplex_tree()
- double simplex_filtration(vector[int] simplex)
- void assign_simplex_filtration(vector[int] simplex, double filtration)
- void initialize_filtration()
- int num_vertices()
- int num_simplices()
- void set_dimension(int dimension)
- int dimension()
- int upper_bound_dimension()
- bool find_simplex(vector[int] simplex)
- bool insert_simplex_and_subfaces(vector[int] simplex,
- double filtration)
- vector[pair[vector[int], double]] get_filtration()
- vector[pair[vector[int], double]] get_skeleton(int dimension)
- 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 remove_maximal_simplex(vector[int] simplex)
- bool prune_above_filtration(double filtration)
- bool make_filtration_non_decreasing()
-
cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi":
cdef cppclass Simplex_tree_persistence_interface "Gudhi::Persistent_cohomology_interface<Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_full_featured>>":
Simplex_tree_persistence_interface(Simplex_tree_interface_full_featured * st, bool persistence_dim_max)
@@ -68,7 +36,13 @@ cdef class SimplexTree:
This class is a filtered, with keys, and non contiguous vertices version
of the simplex tree.
"""
- cdef Simplex_tree_interface_full_featured * thisptr
+ # unfortunately 'cdef public Simplex_tree_interface_full_featured* thisptr' is not possible
+ # Use intptr_t instead to cast the pointer
+ cdef public intptr_t thisptr
+
+ # Get the pointer casted as it should be
+ cdef Simplex_tree_interface_full_featured* get_ptr(self):
+ return <Simplex_tree_interface_full_featured*>(self.thisptr)
cdef Simplex_tree_persistence_interface * pcohptr
@@ -79,18 +53,20 @@ cdef class SimplexTree:
# The real cython constructor
def __cinit__(self):
- self.thisptr = new Simplex_tree_interface_full_featured()
+ cdef Simplex_tree_interface_full_featured* ptr = new Simplex_tree_interface_full_featured()
+ self.thisptr = <intptr_t>ptr
def __dealloc__(self):
- if self.thisptr != NULL:
- del self.thisptr
+ cdef Simplex_tree_interface_full_featured* ptr = self.get_ptr()
+ if ptr != NULL:
+ del ptr
if self.pcohptr != NULL:
del self.pcohptr
def __is_defined(self):
"""Returns true if SimplexTree pointer is not NULL.
"""
- return self.thisptr != NULL
+ return self.get_ptr() != NULL
def __is_persistence_defined(self):
"""Returns true if Persistence pointer is not NULL.
@@ -106,7 +82,7 @@ cdef class SimplexTree:
:returns: The simplicial complex filtration value.
:rtype: float
"""
- return self.thisptr.simplex_filtration(simplex)
+ return self.get_ptr().simplex_filtration(simplex)
def assign_filtration(self, simplex, filtration):
"""This function assigns the simplicial complex filtration value for a
@@ -117,7 +93,7 @@ cdef class SimplexTree:
:param filtration: The simplicial complex filtration value.
:type filtration: float
"""
- self.thisptr.assign_simplex_filtration(simplex, filtration)
+ self.get_ptr().assign_simplex_filtration(simplex, filtration)
def initialize_filtration(self):
"""This function initializes and sorts the simplicial complex
@@ -134,7 +110,7 @@ cdef class SimplexTree:
:func:`removing<gudhi.SimplexTree.remove_maximal_simplex>`
simplices.
"""
- self.thisptr.initialize_filtration()
+ self.get_ptr().initialize_filtration()
def num_vertices(self):
"""This function returns the number of vertices of the simplicial
@@ -143,7 +119,7 @@ cdef class SimplexTree:
:returns: The simplicial complex number of vertices.
:rtype: int
"""
- return self.thisptr.num_vertices()
+ return self.get_ptr().num_vertices()
def num_simplices(self):
"""This function returns the number of simplices of the simplicial
@@ -152,7 +128,7 @@ cdef class SimplexTree:
:returns: the simplicial complex number of simplices.
:rtype: int
"""
- return self.thisptr.num_simplices()
+ return self.get_ptr().num_simplices()
def dimension(self):
"""This function returns the dimension of the simplicial complex.
@@ -169,7 +145,7 @@ cdef class SimplexTree:
:func:`prune_above_filtration()<gudhi.SimplexTree.prune_above_filtration>`
methods).
"""
- return self.thisptr.dimension()
+ return self.get_ptr().dimension()
def upper_bound_dimension(self):
"""This function returns a valid dimension upper bound of the
@@ -178,7 +154,7 @@ cdef class SimplexTree:
:returns: an upper bound on the dimension of the simplicial complex.
:rtype: int
"""
- return self.thisptr.upper_bound_dimension()
+ return self.get_ptr().upper_bound_dimension()
def set_dimension(self, dimension):
"""This function sets the dimension of the simplicial complex.
@@ -196,7 +172,7 @@ cdef class SimplexTree:
:func:`prune_above_filtration()<gudhi.SimplexTree.prune_above_filtration>`
).
"""
- self.thisptr.set_dimension(<int>dimension)
+ self.get_ptr().set_dimension(<int>dimension)
def find(self, simplex):
"""This function returns if the N-simplex was found in the simplicial
@@ -210,7 +186,7 @@ cdef class SimplexTree:
cdef vector[int] csimplex
for i in simplex:
csimplex.push_back(i)
- return self.thisptr.find_simplex(csimplex)
+ return self.get_ptr().find_simplex(csimplex)
def insert(self, simplex, filtration=0.0):
"""This function inserts the given N-simplex and its subfaces with the
@@ -230,7 +206,7 @@ cdef class SimplexTree:
cdef vector[int] csimplex
for i in simplex:
csimplex.push_back(i)
- return self.thisptr.insert_simplex_and_subfaces(csimplex,
+ return self.get_ptr().insert_simplex_and_subfaces(csimplex,
<double>filtration)
def get_filtration(self):
@@ -241,7 +217,7 @@ cdef class SimplexTree:
:rtype: list of tuples(simplex, filtration)
"""
cdef vector[pair[vector[int], double]] filtration \
- = self.thisptr.get_filtration()
+ = self.get_ptr().get_filtration()
ct = []
for filtered_complex in filtration:
v = []
@@ -260,7 +236,7 @@ cdef class SimplexTree:
:rtype: list of tuples(simplex, filtration)
"""
cdef vector[pair[vector[int], double]] skeleton \
- = self.thisptr.get_skeleton(<int>dimension)
+ = self.get_ptr().get_skeleton(<int>dimension)
ct = []
for filtered_simplex in skeleton:
v = []
@@ -281,7 +257,7 @@ cdef class SimplexTree:
for i in simplex:
csimplex.push_back(i)
cdef vector[pair[vector[int], double]] star \
- = self.thisptr.get_star(csimplex)
+ = self.get_ptr().get_star(csimplex)
ct = []
for filtered_simplex in star:
v = []
@@ -306,7 +282,7 @@ cdef class SimplexTree:
for i in simplex:
csimplex.push_back(i)
cdef vector[pair[vector[int], double]] cofaces \
- = self.thisptr.get_cofaces(csimplex, <int>codimension)
+ = self.get_ptr().get_cofaces(csimplex, <int>codimension)
ct = []
for filtered_simplex in cofaces:
v = []
@@ -337,7 +313,7 @@ cdef class SimplexTree:
:func:`dimension()<gudhi.SimplexTree.dimension>`
to recompute the exact dimension.
"""
- self.thisptr.remove_maximal_simplex(simplex)
+ self.get_ptr().remove_maximal_simplex(simplex)
def prune_above_filtration(self, filtration):
"""Prune above filtration value given as parameter.
@@ -370,7 +346,7 @@ cdef class SimplexTree:
:func:`dimension()<gudhi.SimplexTree.dimension>`
method to recompute the exact dimension.
"""
- return self.thisptr.prune_above_filtration(filtration)
+ return self.get_ptr().prune_above_filtration(filtration)
def expansion(self, max_dim):
"""Expands the Simplex_tree containing only its one skeleton
@@ -389,7 +365,7 @@ cdef class SimplexTree:
:param max_dim: The maximal dimension.
:type max_dim: int.
"""
- self.thisptr.expansion(max_dim)
+ self.get_ptr().expansion(max_dim)
def make_filtration_non_decreasing(self):
"""This function ensures that each simplex has a higher filtration
@@ -410,7 +386,7 @@ cdef class SimplexTree:
:func:`initialize_filtration()<gudhi.SimplexTree.initialize_filtration>`
to recompute it.
"""
- return self.thisptr.make_filtration_non_decreasing()
+ return self.get_ptr().make_filtration_non_decreasing()
def persistence(self, homology_coeff_field=11, min_persistence=0, persistence_dim_max = False):
"""This function returns the persistence of the simplicial complex.
@@ -432,7 +408,7 @@ cdef class SimplexTree:
"""
if self.pcohptr != NULL:
del self.pcohptr
- self.pcohptr = new Simplex_tree_persistence_interface(self.thisptr, persistence_dim_max)
+ self.pcohptr = new Simplex_tree_persistence_interface(self.get_ptr(), persistence_dim_max)
cdef vector[pair[int, pair[double, double]]] persistence_result
if self.pcohptr != NULL:
persistence_result = self.pcohptr.get_persistence(homology_coeff_field, min_persistence)
diff --git a/src/cython/cython/strong_witness_complex.pyx b/src/cython/gudhi/strong_witness_complex.pyx
index 8c155815..4e3d1b67 100644
--- a/src/cython/cython/strong_witness_complex.pyx
+++ b/src/cython/gudhi/strong_witness_complex.pyx
@@ -1,6 +1,10 @@
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.utility cimport pair
+from libc.stdint cimport intptr_t
+
+from gudhi.simplex_tree cimport *
+from gudhi.simplex_tree import SimplexTree
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
@@ -63,9 +67,12 @@ cdef class StrongWitnessComplex:
:returns: A simplex tree created from the Delaunay Triangulation.
:rtype: SimplexTree
"""
- simplex_tree = SimplexTree()
+ stree = SimplexTree()
+ cdef intptr_t stree_int_ptr=stree.thisptr
+ cdef Simplex_tree_interface_full_featured* stree_ptr = <Simplex_tree_interface_full_featured*>stree_int_ptr
if limit_dimension is not -1:
- self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square, limit_dimension)
+ self.thisptr.create_simplex_tree(stree_ptr,
+ max_alpha_square, limit_dimension)
else:
- self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square)
- return simplex_tree
+ self.thisptr.create_simplex_tree(stree_ptr, max_alpha_square)
+ return stree
diff --git a/src/cython/cython/subsampling.pyx b/src/cython/gudhi/subsampling.pyx
index 1135c1fb..1135c1fb 100644
--- a/src/cython/cython/subsampling.pyx
+++ b/src/cython/gudhi/subsampling.pyx
diff --git a/src/cython/cython/tangential_complex.pyx b/src/cython/gudhi/tangential_complex.pyx
index 00a84810..b2d55520 100644
--- a/src/cython/cython/tangential_complex.pyx
+++ b/src/cython/gudhi/tangential_complex.pyx
@@ -3,8 +3,12 @@ from libcpp.vector cimport vector
from libcpp.utility cimport pair
from libcpp.string cimport string
from libcpp cimport bool
+from libc.stdint cimport intptr_t
import os
+from gudhi.simplex_tree cimport *
+from gudhi.simplex_tree import SimplexTree
+
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
Author(s): Vincent Rouvreau
@@ -138,6 +142,11 @@ cdef class TangentialComplex:
:returns: A simplex tree created from the complex.
:rtype: SimplexTree
"""
+ stree = SimplexTree()
+ cdef intptr_t stree_int_ptr=stree.thisptr
+ cdef Simplex_tree_interface_full_featured* stree_ptr = <Simplex_tree_interface_full_featured*>stree_int_ptr
+ self.thisptr.create_simplex_tree(stree_ptr)
+ return stree
simplex_tree = SimplexTree()
self.thisptr.create_simplex_tree(simplex_tree.thisptr)
return simplex_tree
diff --git a/src/cython/cython/witness_complex.pyx b/src/cython/gudhi/witness_complex.pyx
index 91046f57..c859877d 100644
--- a/src/cython/cython/witness_complex.pyx
+++ b/src/cython/gudhi/witness_complex.pyx
@@ -1,6 +1,10 @@
from cython cimport numeric
from libcpp.vector cimport vector
from libcpp.utility cimport pair
+from libc.stdint cimport intptr_t
+
+from gudhi.simplex_tree cimport *
+from gudhi.simplex_tree import SimplexTree
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
@@ -63,9 +67,12 @@ cdef class WitnessComplex:
:returns: A simplex tree created from the Delaunay Triangulation.
:rtype: SimplexTree
"""
- simplex_tree = SimplexTree()
+ stree = SimplexTree()
+ cdef intptr_t stree_int_ptr=stree.thisptr
+ cdef Simplex_tree_interface_full_featured* stree_ptr = <Simplex_tree_interface_full_featured*>stree_int_ptr
if limit_dimension is not -1:
- self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square, limit_dimension)
+ self.thisptr.create_simplex_tree(stree_ptr,
+ max_alpha_square, limit_dimension)
else:
- self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square)
- return simplex_tree
+ self.thisptr.create_simplex_tree(stree_ptr, max_alpha_square)
+ return stree