From 003e9b3e127a3f34c03872b0cc314d0dcbc04bcf Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Fri, 2 Aug 2019 11:25:52 +0200 Subject: First version that compiles the simplex_tree module --- src/cython/gudhi/simplex_tree.pxd | 10 ++++++++++ src/cython/gudhi/simplex_tree.pyx | 11 +---------- src/cython/setup.py.in | 6 ++++-- 3 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/cython/gudhi/simplex_tree.pxd b/src/cython/gudhi/simplex_tree.pxd index 25051295..5f86cfe2 100644 --- a/src/cython/gudhi/simplex_tree.pxd +++ b/src/cython/gudhi/simplex_tree.pxd @@ -44,3 +44,13 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": 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>": + Simplex_tree_persistence_interface(Simplex_tree_interface_full_featured * st, bool persistence_dim_max) + vector[pair[int, pair[double, double]]] get_persistence(int homology_coeff_field, double min_persistence) + vector[int] betti_numbers() + vector[int] persistent_betti_numbers(double from_value, double to_value) + vector[pair[double,double]] intervals_in_dimension(int dimension) + void write_output_diagram(string diagram_file_name) + vector[pair[vector[int], vector[int]]] persistence_pairs() diff --git a/src/cython/gudhi/simplex_tree.pyx b/src/cython/gudhi/simplex_tree.pyx index e5f9e9d1..604328e9 100644 --- a/src/cython/gudhi/simplex_tree.pyx +++ b/src/cython/gudhi/simplex_tree.pyx @@ -1,5 +1,6 @@ from libc.stdint cimport intptr_t from numpy import array as np_array +from simplex_tree cimport * """ 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. @@ -15,16 +16,6 @@ __author__ = "Vincent Rouvreau" __copyright__ = "Copyright (C) 2016 Inria" __license__ = "MIT" -cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi": - cdef cppclass Simplex_tree_persistence_interface "Gudhi::Persistent_cohomology_interface>": - Simplex_tree_persistence_interface(Simplex_tree_interface_full_featured * st, bool persistence_dim_max) - vector[pair[int, pair[double, double]]] get_persistence(int homology_coeff_field, double min_persistence) - vector[int] betti_numbers() - vector[int] persistent_betti_numbers(double from_value, double to_value) - vector[pair[double,double]] intervals_in_dimension(int dimension) - void write_output_diagram(string diagram_file_name) - vector[pair[vector[int], vector[int]]] persistence_pairs() - # SimplexTree python interface cdef class SimplexTree: """The simplex tree is an efficient and flexible data structure for diff --git a/src/cython/setup.py.in b/src/cython/setup.py.in index 454be9af..f158f6cb 100644 --- a/src/cython/setup.py.in +++ b/src/cython/setup.py.in @@ -18,23 +18,25 @@ __license__ = "MIT" simplextree = Extension( "gudhi.simplextree", - sources = ['@CMAKE_CURRENT_SOURCE_DIR@/cython/simplex_tree.pyx',], + sources = ['@CMAKE_CURRENT_SOURCE_DIR@/gudhi/simplex_tree.pyx',], language = 'c++', extra_compile_args=[@GUDHI_CYTHON_EXTRA_COMPILE_ARGS@], extra_link_args=[@GUDHI_CYTHON_EXTRA_LINK_ARGS@], libraries=[@GUDHI_CYTHON_LIBRARIES@], library_dirs=[@GUDHI_CYTHON_LIBRARY_DIRS@], - include_dirs = [numpy_get_include(), @GUDHI_CYTHON_INCLUDE_DIRS@], + include_dirs = [numpy_get_include(), '@CMAKE_CURRENT_SOURCE_DIR@/gudhi/', @GUDHI_CYTHON_INCLUDE_DIRS@], runtime_library_dirs=[@GUDHI_CYTHON_RUNTIME_LIBRARY_DIRS@], ) setup( name = 'gudhi', + packages=["gudhi",], author='GUDHI Editorial Board', author_email='gudhi-contact@lists.gforge.inria.fr', version='@GUDHI_VERSION@', url='http://gudhi.gforge.inria.fr/', ext_modules = cythonize(simplextree), +# cmdclass = {'build_ext': build_ext}, install_requires = ['cython','numpy >= 1.9',], setup_requires = ['numpy >= 1.9',], ) -- cgit v1.2.3