From 1210ddafd2e26e842e66714d92f6dbfc0c3ba003 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 28 Mar 2017 19:15:44 +0000 Subject: Make Python interface compile, test and doc for Python2 and Python3 git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2267 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f7397ecc5aba27ad4ecc794f4fbf5ca857847113 --- src/cython/CMakeLists.txt | 429 +++++++++++++------------ src/cython/cython/alpha_complex.pyx | 2 +- src/cython/cython/cubical_complex.pyx | 2 +- src/cython/cython/off_reader.pyx | 2 +- src/cython/cython/periodic_cubical_complex.pyx | 2 +- src/cython/cython/rips_complex.pyx | 4 +- src/cython/cython/subsampling.pyx | 9 +- src/cython/cython/tangential_complex.pyx | 2 +- src/cython/doc/Makefile | 181 ----------- src/cython/doc/Makefile.in | 44 +++ src/cython/doc/make.bat | 246 -------------- src/cython/doc/make.bat.in | 67 ++++ src/cython/doc/python3-sphinx-build | 11 + src/cython/doc/simplex_tree_user.rst | 10 +- 14 files changed, 369 insertions(+), 642 deletions(-) delete mode 100644 src/cython/doc/Makefile create mode 100644 src/cython/doc/Makefile.in delete mode 100644 src/cython/doc/make.bat create mode 100644 src/cython/doc/make.bat.in create mode 100755 src/cython/doc/python3-sphinx-build (limited to 'src/cython') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index ba38fe3d..c51d9a1e 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -14,205 +14,234 @@ macro( find_the_lib placeholder THE_LIBS ) endforeach(THE_LIB ${THE_LIBS}) endmacro( find_the_lib ) -FIND_PROGRAM( PYTHON_PATH python ) -FIND_PROGRAM( CYTHON_PATH cython ) - -if(PYTHON_PATH AND CYTHON_PATH) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") - if(WIN32) - set( returnValue "" ) - find_the_lib (${returnValue} ${Boost_SYSTEM_LIBRARY}) - set(BOOST_SYSTEM_LIB_NAME ${returnValue}) +# Find the correct Python interpreter. Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 for instance. +if(PYTHON_EXECUTABLE) + if(NOT EXISTS "${PYTHON_EXECUTABLE}") + message(FATAL_ERROR "ERROR: ${PYTHON_EXECUTABLE} does not exist.") + endif(NOT EXISTS "${PYTHON_EXECUTABLE}") +endif(PYTHON_EXECUTABLE) +include(FindPythonInterp) + +if(PYTHONINTERP_FOUND) + if(PYTHON_VERSION_MAJOR EQUAL 2) + FIND_PROGRAM(CYTHON_PATH cython) + if(NOT CYTHON_PATH) + message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python is set to 2.X while no cython installed.") + endif(NOT CYTHON_PATH) + # Unitary tests are available through py.test + find_program( PYTEST_PATH py.test ) + # Documentation generation is available through sphinx + find_program( SPHINX_PATH sphinx-build ) + elseif(PYTHON_VERSION_MAJOR EQUAL 3) + FIND_PROGRAM(CYTHON_PATH cython3) + if(NOT CYTHON_PATH) + message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python is set to 3.X while no cython3 installed.") + endif(NOT CYTHON_PATH) + # Unitary tests are available through py.test + find_program( PYTEST_PATH py.test ) + # Documentation generation is available through sphinx + set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/doc/python3-sphinx-build") else() - set(BOOST_SYSTEM_LIB_NAME "boost_system") - endif() - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${BOOST_SYSTEM_LIB_NAME}', ") - - # Gudhi and CGAL compilation option - if(MSVC) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ") - else(MSVC) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-std=c++11', ") - endif(MSVC) - if(CMAKE_COMPILER_IS_GNUCXX) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-frounding-math', ") - endif(CMAKE_COMPILER_IS_GNUCXX) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-fp-model strict', ") - endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - if (DEBUG_TRACES) - # For programs to be more verbose - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ") - endif() - - find_package(Eigen3 3.1.0) - - if (EIGEN3_FOUND) - # No problem, even if no CGAL found - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_EIGEN3_ENABLED', ") - endif (EIGEN3_FOUND) - - # Copy recursively include, cython, example, doc and test repositories before packages finding - # Some tests and doc files are removed in case some packages are not found - file(COPY include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY cython DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY example DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY test DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - file(COPY doc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - # Developper version for doc images - file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.png") - file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.svg") - file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - # User version for doc images - file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.png") - file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.svg") - file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") - # Biblio - file(GLOB GUDHI_BIB_FILES "${CMAKE_SOURCE_DIR}/biblio/*.bib") - file(COPY ${GUDHI_BIB_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - # Cubical complex perseus doc example - file(GLOB GUDHI_CUBICAL_PERSEUS_FILES "${CMAKE_SOURCE_DIR}/data/bitmap/*cubicalcomplexdoc.txt") - file(COPY ${GUDHI_CUBICAL_PERSEUS_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - # Persistence graphical tools examples - file(COPY "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - - if (NOT CGAL_VERSION VERSION_LESS 4.8.1) - # If CGAL_VERSION >= 4.8.1, include subsampling - set(GUDHI_CYTHON_SUBSAMPLING "include 'cython/subsampling.pyx'") - set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include 'cython/tangential_complex.pyx'") - set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include 'cython/bottleneck_distance.pyx'") - else (NOT CGAL_VERSION VERSION_LESS 4.8.1) - # Remove subsampling unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_subsampling.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_user.rst") - # Remove tangential complex and bottleneck unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_tangential_complex.py) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_bottleneck_distance.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_user.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_user.rst") - endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) - if (NOT CGAL_VERSION VERSION_LESS 4.7.0) - # If CGAL_VERSION >= 4.7.0, include alpha - set(GUDHI_CYTHON_ALPHA_COMPLEX "include 'cython/alpha_complex.pyx'") - else (NOT CGAL_VERSION VERSION_LESS 4.7.0) - # Remove alpha complex unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_alpha_complex.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_user.rst") - endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) - if (NOT CGAL_VERSION VERSION_LESS 4.6.0) - # If CGAL_VERSION >= 4.6.0, include euclidean versions of witness complex - set(GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX - "include 'cython/euclidean_witness_complex.pyx'\ninclude 'cython/euclidean_strong_witness_complex.pyx'\n") - else (NOT CGAL_VERSION VERSION_LESS 4.6.0) - # Remove alpha complex unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_euclidean_witness_complex.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_witness_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_strong_witness_complex_ref.rst") - endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) - - if(CGAL_FOUND) - # Add CGAL compilation args - if(CGAL_HEADER_ONLY) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") - else(CGAL_HEADER_ONLY) - if(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL-vc140-mt-4.7', ") - else(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") - endif(WIN32) - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") - endif(CGAL_HEADER_ONLY) - # GMP and GMPXX are not required, but if present, CGAL will link with them. - if(GMP_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") - if(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") - else(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") - endif(WIN32) - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") - if(GMPXX_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmpxx', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMPXX_LIBRARIES_DIR}', ") - endif(GMPXX_FOUND) - endif(GMP_FOUND) - endif(CGAL_FOUND) - - # Specific for Mac - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.9', ") - set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.9', ") - endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - - # Loop on INCLUDE_DIRECTORIES PROPERTY - get_property(GUDHI_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) - foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${GUDHI_INCLUDE_DIRECTORY}', ") - endforeach() - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/include', ") - - if (TBB_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'tbb', 'tbbmalloc', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${TBB_LIBRARY_DIRS}', ") - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${TBB_INCLUDE_DIRS}', ") - endif() - - # Generate cythonize_gudhi.py file to cythonize Gudhi - configure_file(cythonize_gudhi.py.in "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" @ONLY) - # Generate gudhi.pyx - Gudhi cython file - configure_file(gudhi.pyx.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi.pyx" @ONLY) - - add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python version ${PYTHON_VERSION_STRING} is not valid.") + endif(PYTHON_VERSION_MAJOR EQUAL 2) +endif(PYTHONINTERP_FOUND) + +message("${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_PATH} - py.test is ${PYTEST_PATH} - Sphinx is ${SPHINX_PATH}") + +set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") +set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") +set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") +if(WIN32) + set( returnValue "" ) + find_the_lib (${returnValue} ${Boost_SYSTEM_LIBRARY}) + set(BOOST_SYSTEM_LIB_NAME ${returnValue}) +else() + set(BOOST_SYSTEM_LIB_NAME "boost_system") + endif() +set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${BOOST_SYSTEM_LIB_NAME}', ") + +# Gudhi and CGAL compilation option +if(MSVC) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ") +else(MSVC) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-std=c++11', ") +endif(MSVC) +if(CMAKE_COMPILER_IS_GNUCXX) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-frounding-math', ") +endif(CMAKE_COMPILER_IS_GNUCXX) +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-fp-model strict', ") +endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") +if (DEBUG_TRACES) + # For programs to be more verbose + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ") +endif() + +if (EIGEN3_FOUND) + # No problem, even if no CGAL found + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_EIGEN3_ENABLED', ") +endif (EIGEN3_FOUND) + +# Copy recursively include, cython, example, doc and test repositories before packages finding +# Some tests and doc files are removed in case some packages are not found +file(COPY include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY cython DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY example DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY test DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY doc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +# Developper version for doc images +file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.png") +file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") +file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.svg") +file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") +# User version for doc images +file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.png") +file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") +file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.svg") +file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") +# Biblio +file(GLOB GUDHI_BIB_FILES "${CMAKE_SOURCE_DIR}/biblio/*.bib") +file(COPY ${GUDHI_BIB_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") +# Cubical complex perseus doc example +file(GLOB GUDHI_CUBICAL_PERSEUS_FILES "${CMAKE_SOURCE_DIR}/data/bitmap/*cubicalcomplexdoc.txt") +file(COPY ${GUDHI_CUBICAL_PERSEUS_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") +file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") +file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") +# Persistence graphical tools examples +file(COPY "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") +file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + +if (NOT CGAL_VERSION VERSION_LESS 4.8.1) + # If CGAL_VERSION >= 4.8.1, include subsampling + set(GUDHI_CYTHON_SUBSAMPLING "include 'cython/subsampling.pyx'") + set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include 'cython/tangential_complex.pyx'") + set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include 'cython/bottleneck_distance.pyx'") +else (NOT CGAL_VERSION VERSION_LESS 4.8.1) + # Remove subsampling unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_subsampling.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_user.rst") + # Remove tangential complex and bottleneck unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_tangential_complex.py) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_bottleneck_distance.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_user.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_user.rst") +endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) +if (NOT CGAL_VERSION VERSION_LESS 4.7.0) + # If CGAL_VERSION >= 4.7.0, include alpha + set(GUDHI_CYTHON_ALPHA_COMPLEX "include 'cython/alpha_complex.pyx'") +else (NOT CGAL_VERSION VERSION_LESS 4.7.0) + # Remove alpha complex unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_alpha_complex.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_user.rst") +endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) +if (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # If CGAL_VERSION >= 4.6.0, include euclidean versions of witness complex + set(GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX + "include 'cython/euclidean_witness_complex.pyx'\ninclude 'cython/euclidean_strong_witness_complex.pyx'\n") +else (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # Remove alpha complex unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_euclidean_witness_complex.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_witness_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_strong_witness_complex_ref.rst") +endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) + +if(CGAL_FOUND) + # Add CGAL compilation args + if(CGAL_HEADER_ONLY) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") + else(CGAL_HEADER_ONLY) + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL-vc140-mt-4.7', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") + endif(CGAL_HEADER_ONLY) + # GMP and GMPXX are not required, but if present, CGAL will link with them. + if(GMP_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") + if(GMPXX_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmpxx', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMPXX_LIBRARIES_DIR}', ") + endif(GMPXX_FOUND) + endif(GMP_FOUND) +endif(CGAL_FOUND) + +# Specific for Mac +if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.9', ") + set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.9', ") +endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + +# Loop on INCLUDE_DIRECTORIES PROPERTY +get_property(GUDHI_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) +foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${GUDHI_INCLUDE_DIRECTORY}', ") +endforeach() +set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/include', ") + +if (TBB_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'tbb', 'tbbmalloc', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${TBB_LIBRARY_DIRS}', ") + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${TBB_INCLUDE_DIRS}', ") +endif() + +# set sphinx-build in make files +configure_file(doc/Makefile.in "${CMAKE_CURRENT_BINARY_DIR}/doc/Makefile" @ONLY) +configure_file(doc/make.bat.in "${CMAKE_CURRENT_BINARY_DIR}/doc/make.bat" @ONLY) + +# Generate cythonize_gudhi.py file to cythonize Gudhi +configure_file(cythonize_gudhi.py.in "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" @ONLY) +# Generate gudhi.pyx - Gudhi cython file +configure_file(gudhi.pyx.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi.pyx" @ONLY) + +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" "build_ext" "--inplace") + +add_custom_target(cython ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") + +if(UNIX) + set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) +endif(UNIX) + +# Unitary tests are available through py.test +if(PYTEST_PATH) + add_test( + NAME gudhi_cython_py_test WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND python "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" "build_ext" "--inplace") - - add_custom_target(cython ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" - COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") - - if(UNIX) - set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) - endif(UNIX) - - # Unitary tests are available through py.test - find_program( PYTEST_PATH py.test ) - if(PYTEST_PATH) - add_test( - NAME gudhi_cython_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTEST_PATH}) - set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - endif(PYTEST_PATH) - - # Documentation generation is available through sphinx - find_program( SPHINX_PATH sphinx-build ) - if(SPHINX_PATH) - if (UNIX) - add_custom_target(sphinx - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" - COMMAND make html doctest) - else (UNIX) - add_custom_target(sphinx - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc - COMMAND make.bat html) - endif (UNIX) - endif(SPHINX_PATH) -endif(PYTHON_PATH AND CYTHON_PATH) + COMMAND ${PYTHON_EXECUTABLE} "${PYTEST_PATH}") + set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") +endif(PYTEST_PATH) + +# Documentation generation is available through sphinx +if(SPHINX_PATH) + if (UNIX) + add_custom_target(sphinx + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + COMMAND make html doctest) + else (UNIX) + add_custom_target(sphinx + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + COMMAND make.bat html doctest) + endif (UNIX) +endif(SPHINX_PATH) diff --git a/src/cython/cython/alpha_complex.pyx b/src/cython/cython/alpha_complex.pyx index da537c2e..a0e8f9b7 100644 --- a/src/cython/cython/alpha_complex.pyx +++ b/src/cython/cython/alpha_complex.pyx @@ -78,7 +78,7 @@ cdef class AlphaComplex: def __cinit__(self, points=None, off_file=''): if off_file is not '': if os.path.isfile(off_file): - self.thisptr = new Alpha_complex_interface(off_file, True) + self.thisptr = new Alpha_complex_interface(str.encode(off_file), True) else: print("file " + off_file + " not found.") else: diff --git a/src/cython/cython/cubical_complex.pyx b/src/cython/cython/cubical_complex.pyx index e1344f49..1ed6bc5e 100644 --- a/src/cython/cython/cubical_complex.pyx +++ b/src/cython/cython/cubical_complex.pyx @@ -80,7 +80,7 @@ cdef class CubicalComplex: self.thisptr = new Bitmap_cubical_complex_base_interface(dimensions, top_dimensional_cells) elif (dimensions is None) and (top_dimensional_cells is None) and (perseus_file is not ''): if os.path.isfile(perseus_file): - self.thisptr = new Bitmap_cubical_complex_base_interface(perseus_file) + self.thisptr = new Bitmap_cubical_complex_base_interface(str.encode(perseus_file)) else: print("file " + perseus_file + " not found.") else: diff --git a/src/cython/cython/off_reader.pyx b/src/cython/cython/off_reader.pyx index 78c37969..b6e107ef 100644 --- a/src/cython/cython/off_reader.pyx +++ b/src/cython/cython/off_reader.pyx @@ -43,7 +43,7 @@ def read_off(off_file=''): """ if off_file is not '': if os.path.isfile(off_file): - return read_points_from_OFF_file(off_file) + return read_points_from_OFF_file(str.encode(off_file)) else: print("file " + off_file + " not found.") diff --git a/src/cython/cython/periodic_cubical_complex.pyx b/src/cython/cython/periodic_cubical_complex.pyx index 1445d429..88cb4395 100644 --- a/src/cython/cython/periodic_cubical_complex.pyx +++ b/src/cython/cython/periodic_cubical_complex.pyx @@ -80,7 +80,7 @@ cdef class PeriodicCubicalComplex: self.thisptr = new Periodic_cubical_complex_base_interface(dimensions, top_dimensional_cells) elif (dimensions is None) and (top_dimensional_cells is None) and (perseus_file is not ''): if os.path.isfile(perseus_file): - self.thisptr = new Periodic_cubical_complex_base_interface(perseus_file) + self.thisptr = new Periodic_cubical_complex_base_interface(str.encode(perseus_file)) else: print("file " + perseus_file + " not found.") else: diff --git a/src/cython/cython/rips_complex.pyx b/src/cython/cython/rips_complex.pyx index 6bfb4482..ad9b0a4d 100644 --- a/src/cython/cython/rips_complex.pyx +++ b/src/cython/cython/rips_complex.pyx @@ -80,7 +80,7 @@ cdef class RipsComplex: def __cinit__(self, points=None, off_file='', distance_matrix=None, csv_file='', max_edge_length=float('inf')): if off_file is not '': if os.path.isfile(off_file): - self.thisptr = new Rips_complex_interface(off_file, + self.thisptr = new Rips_complex_interface(str.encode(off_file), max_edge_length, True, True) @@ -88,7 +88,7 @@ cdef class RipsComplex: print("file " + off_file + " not found.") elif csv_file is not '': if os.path.isfile(csv_file): - self.thisptr = new Rips_complex_interface(csv_file, + self.thisptr = new Rips_complex_interface(str.encode(csv_file), max_edge_length, False, True) diff --git a/src/cython/cython/subsampling.pyx b/src/cython/cython/subsampling.pyx index a25d196d..894a4fbe 100644 --- a/src/cython/cython/subsampling.pyx +++ b/src/cython/cython/subsampling.pyx @@ -65,10 +65,10 @@ def choose_n_farthest_points(points=None, off_file='', nb_points=0, starting_poi if off_file is not '': if os.path.isfile(off_file): if starting_point is '': - return subsampling_n_farthest_points_from_file(off_file, + return subsampling_n_farthest_points_from_file(str.encode(off_file), nb_points) else: - return subsampling_n_farthest_points_from_file(off_file, + return subsampling_n_farthest_points_from_file(str.encode(off_file), nb_points, starting_point) else: @@ -101,7 +101,8 @@ def pick_n_random_points(points=None, off_file='', nb_points=0): """ if off_file is not '': if os.path.isfile(off_file): - return subsampling_n_random_points_from_file(off_file, nb_points) + return subsampling_n_random_points_from_file(str.encode(off_file), + nb_points) else: print("file " + off_file + " not found.") else: @@ -128,7 +129,7 @@ def sparsify_point_set(points=None, off_file='', min_squared_dist=0.0): """ if off_file is not '': if os.path.isfile(off_file): - return subsampling_sparsify_points_from_file(off_file, + return subsampling_sparsify_points_from_file(str.encode(off_file), min_squared_dist) else: print("file " + off_file + " not found.") diff --git a/src/cython/cython/tangential_complex.pyx b/src/cython/cython/tangential_complex.pyx index 52bd8111..d55bb050 100644 --- a/src/cython/cython/tangential_complex.pyx +++ b/src/cython/cython/tangential_complex.pyx @@ -70,7 +70,7 @@ cdef class TangentialComplex: def __cinit__(self, points=None, off_file=''): if off_file is not '': if os.path.isfile(off_file): - self.thisptr = new Tangential_complex_interface(off_file, True) + self.thisptr = new Tangential_complex_interface(str.encode(off_file), True) else: print("file " + off_file + " not found.") else: diff --git a/src/cython/doc/Makefile b/src/cython/doc/Makefile deleted file mode 100644 index be3ff7c4..00000000 --- a/src/cython/doc/Makefile +++ /dev/null @@ -1,181 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = _build - -# User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) -endif - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - -clean: - rm -f examples.inc - rm -rf $(BUILDDIR)/* - -# GUDHI specific : Examples.inc is generated with generate_examples.py (and deleted on clean) - -html: - ./generate_examples.py - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pouet.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pouet.qhc" - -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/pouet" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pouet" - @echo "# devhelp" - -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/src/cython/doc/Makefile.in b/src/cython/doc/Makefile.in new file mode 100644 index 00000000..526350b3 --- /dev/null +++ b/src/cython/doc/Makefile.in @@ -0,0 +1,44 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = @SPHINX_PATH@ +PAPER = +BUILDDIR = _build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -f examples.inc + rm -rf $(BUILDDIR)/* + +# GUDHI specific : Examples.inc is generated with generate_examples.py (and deleted on clean) + +html: + ./generate_examples.py + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/src/cython/doc/make.bat b/src/cython/doc/make.bat deleted file mode 100644 index ba009a90..00000000 --- a/src/cython/doc/make.bat +++ /dev/null @@ -1,246 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -set I18NSPHINXOPTS=%SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. xml to make Docutils-native XML files - echo. pseudoxml to make pseudoxml-XML files for display purposes - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - del examples.inc - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - - -%SPHINXBUILD% 2> nul -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -:: GUDHI specific : Examples.inc is generated with generate_examples.py (and deleted on clean) - -if "%1" == "html" ( - generate_examples.py - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\pouet.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\pouet.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdf" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf - cd %BUILDDIR%/.. - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdfja" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf-ja - cd %BUILDDIR%/.. - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -if "%1" == "xml" ( - %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The XML files are in %BUILDDIR%/xml. - goto end -) - -if "%1" == "pseudoxml" ( - %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. - goto end -) - -:end diff --git a/src/cython/doc/make.bat.in b/src/cython/doc/make.bat.in new file mode 100644 index 00000000..ff1a6d56 --- /dev/null +++ b/src/cython/doc/make.bat.in @@ -0,0 +1,67 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=@SPHINX_PATH@ +) +set BUILDDIR=_build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . +set I18NSPHINXOPTS=%SPHINXOPTS% . +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% + set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + del examples.inc + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + + +%SPHINXBUILD% 2> nul +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +:: GUDHI specific : Examples.inc is generated with generate_examples.py (and deleted on clean) + +if "%1" == "html" ( + generate_examples.py + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +:end diff --git a/src/cython/doc/python3-sphinx-build b/src/cython/doc/python3-sphinx-build new file mode 100755 index 00000000..44b94169 --- /dev/null +++ b/src/cython/doc/python3-sphinx-build @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +""" +Emulate sphinx-build for python3 +""" + +from sys import exit, argv +from sphinx import main + +if __name__ == '__main__': + exit(main(argv)) diff --git a/src/cython/doc/simplex_tree_user.rst b/src/cython/doc/simplex_tree_user.rst index 6b55c4e7..cbfd34a7 100644 --- a/src/cython/doc/simplex_tree_user.rst +++ b/src/cython/doc/simplex_tree_user.rst @@ -41,8 +41,10 @@ Example print("[0, 1, 2] inserted") if st.find([0, 1]): print("[0, 1] found") - print("num_vertices=", st.num_vertices()) - print("num_simplices=", st.num_simplices()) + result_str = 'num_vertices=' + repr(st.num_vertices()) + print(result_str) + result_str = 'num_simplices=' + repr(st.num_simplices()) + print(result_str) print("skeleton_tree(2) =") for sk_value in st.get_skeleton_tree(2): print(sk_value) @@ -55,8 +57,8 @@ The output is: [0, 1] inserted [0, 1, 2] inserted [0, 1] found - ('num_vertices=', 3) - ('num_simplices=', 7) + num_vertices=3 + num_simplices=7 skeleton_tree(2) = ([0, 1, 2], 4.0) ([0, 1], 0.0) -- cgit v1.2.3 From 57d21359ba689f739344d67309be7efa43bf078a Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 28 Mar 2017 19:36:31 +0000 Subject: Missing a test for cython git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2272 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 223961ca5575e07d0db2c93ee0326864166980d8 --- src/cython/CMakeLists.txt | 401 +++++++++++++++++++++++----------------------- 1 file changed, 200 insertions(+), 201 deletions(-) (limited to 'src/cython') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index c51d9a1e..7c650102 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -34,9 +34,6 @@ if(PYTHONINTERP_FOUND) find_program( SPHINX_PATH sphinx-build ) elseif(PYTHON_VERSION_MAJOR EQUAL 3) FIND_PROGRAM(CYTHON_PATH cython3) - if(NOT CYTHON_PATH) - message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python is set to 3.X while no cython3 installed.") - endif(NOT CYTHON_PATH) # Unitary tests are available through py.test find_program( PYTEST_PATH py.test ) # Documentation generation is available through sphinx @@ -46,202 +43,204 @@ if(PYTHONINTERP_FOUND) endif(PYTHON_VERSION_MAJOR EQUAL 2) endif(PYTHONINTERP_FOUND) -message("${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_PATH} - py.test is ${PYTEST_PATH} - Sphinx is ${SPHINX_PATH}") - -set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") -set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") -set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") -if(WIN32) - set( returnValue "" ) - find_the_lib (${returnValue} ${Boost_SYSTEM_LIBRARY}) - set(BOOST_SYSTEM_LIB_NAME ${returnValue}) -else() - set(BOOST_SYSTEM_LIB_NAME "boost_system") - endif() -set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${BOOST_SYSTEM_LIB_NAME}', ") - -# Gudhi and CGAL compilation option -if(MSVC) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ") -else(MSVC) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-std=c++11', ") -endif(MSVC) -if(CMAKE_COMPILER_IS_GNUCXX) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-frounding-math', ") -endif(CMAKE_COMPILER_IS_GNUCXX) -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-fp-model strict', ") -endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") -if (DEBUG_TRACES) - # For programs to be more verbose - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ") -endif() - -if (EIGEN3_FOUND) - # No problem, even if no CGAL found - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_EIGEN3_ENABLED', ") -endif (EIGEN3_FOUND) - -# Copy recursively include, cython, example, doc and test repositories before packages finding -# Some tests and doc files are removed in case some packages are not found -file(COPY include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY cython DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY example DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY test DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY doc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -# Developper version for doc images -file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.png") -file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") -file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.svg") -file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") -# User version for doc images -file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.png") -file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") -file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.svg") -file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") -# Biblio -file(GLOB GUDHI_BIB_FILES "${CMAKE_SOURCE_DIR}/biblio/*.bib") -file(COPY ${GUDHI_BIB_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") -# Cubical complex perseus doc example -file(GLOB GUDHI_CUBICAL_PERSEUS_FILES "${CMAKE_SOURCE_DIR}/data/bitmap/*cubicalcomplexdoc.txt") -file(COPY ${GUDHI_CUBICAL_PERSEUS_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") -file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") -file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") -# Persistence graphical tools examples -file(COPY "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") -file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") - -if (NOT CGAL_VERSION VERSION_LESS 4.8.1) - # If CGAL_VERSION >= 4.8.1, include subsampling - set(GUDHI_CYTHON_SUBSAMPLING "include 'cython/subsampling.pyx'") - set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include 'cython/tangential_complex.pyx'") - set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include 'cython/bottleneck_distance.pyx'") -else (NOT CGAL_VERSION VERSION_LESS 4.8.1) - # Remove subsampling unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_subsampling.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_user.rst") - # Remove tangential complex and bottleneck unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_tangential_complex.py) - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_bottleneck_distance.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_user.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_user.rst") -endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) -if (NOT CGAL_VERSION VERSION_LESS 4.7.0) - # If CGAL_VERSION >= 4.7.0, include alpha - set(GUDHI_CYTHON_ALPHA_COMPLEX "include 'cython/alpha_complex.pyx'") -else (NOT CGAL_VERSION VERSION_LESS 4.7.0) - # Remove alpha complex unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_alpha_complex.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_sum.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_user.rst") -endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) -if (NOT CGAL_VERSION VERSION_LESS 4.6.0) - # If CGAL_VERSION >= 4.6.0, include euclidean versions of witness complex - set(GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX - "include 'cython/euclidean_witness_complex.pyx'\ninclude 'cython/euclidean_strong_witness_complex.pyx'\n") -else (NOT CGAL_VERSION VERSION_LESS 4.6.0) - # Remove alpha complex unitary tests - file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_euclidean_witness_complex.py) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_witness_complex_ref.rst") - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_strong_witness_complex_ref.rst") -endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) - -if(CGAL_FOUND) - # Add CGAL compilation args - if(CGAL_HEADER_ONLY) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") - else(CGAL_HEADER_ONLY) - if(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL-vc140-mt-4.7', ") - else(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") - endif(WIN32) - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") - endif(CGAL_HEADER_ONLY) - # GMP and GMPXX are not required, but if present, CGAL will link with them. - if(GMP_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") - if(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") - else(WIN32) - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") - endif(WIN32) - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") - if(GMPXX_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmpxx', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMPXX_LIBRARIES_DIR}', ") - endif(GMPXX_FOUND) - endif(GMP_FOUND) -endif(CGAL_FOUND) - -# Specific for Mac -if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.9', ") - set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.9', ") -endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - -# Loop on INCLUDE_DIRECTORIES PROPERTY -get_property(GUDHI_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) -foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${GUDHI_INCLUDE_DIRECTORY}', ") -endforeach() -set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/include', ") - -if (TBB_FOUND) - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'tbb', 'tbbmalloc', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${TBB_LIBRARY_DIRS}', ") - set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${TBB_INCLUDE_DIRS}', ") -endif() - -# set sphinx-build in make files -configure_file(doc/Makefile.in "${CMAKE_CURRENT_BINARY_DIR}/doc/Makefile" @ONLY) -configure_file(doc/make.bat.in "${CMAKE_CURRENT_BINARY_DIR}/doc/make.bat" @ONLY) - -# Generate cythonize_gudhi.py file to cythonize Gudhi -configure_file(cythonize_gudhi.py.in "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" @ONLY) -# Generate gudhi.pyx - Gudhi cython file -configure_file(gudhi.pyx.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi.pyx" @ONLY) - -add_custom_command( - OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" "build_ext" "--inplace") - -add_custom_target(cython ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" - COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") - -if(UNIX) - set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) -endif(UNIX) - -# Unitary tests are available through py.test -if(PYTEST_PATH) - add_test( - NAME gudhi_cython_py_test +if(CYTHON_PATH) + message("${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_PATH} - py.test is ${PYTEST_PATH} - Sphinx is ${SPHINX_PATH}") + + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") + if(WIN32) + set( returnValue "" ) + find_the_lib (${returnValue} ${Boost_SYSTEM_LIBRARY}) + set(BOOST_SYSTEM_LIB_NAME ${returnValue}) + else() + set(BOOST_SYSTEM_LIB_NAME "boost_system") + endif() + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${BOOST_SYSTEM_LIB_NAME}', ") + + # Gudhi and CGAL compilation option + if(MSVC) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ") + else(MSVC) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-std=c++11', ") + endif(MSVC) + if(CMAKE_COMPILER_IS_GNUCXX) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-frounding-math', ") + endif(CMAKE_COMPILER_IS_GNUCXX) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-fp-model strict', ") + endif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") + if (DEBUG_TRACES) + # For programs to be more verbose + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DDEBUG_TRACES', ") + endif() + + if (EIGEN3_FOUND) + # No problem, even if no CGAL found + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_EIGEN3_ENABLED', ") + endif (EIGEN3_FOUND) + + # Copy recursively include, cython, example, doc and test repositories before packages finding + # Some tests and doc files are removed in case some packages are not found + file(COPY include DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY cython DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY example DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY test DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(COPY doc DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + # Developper version for doc images + file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.png") + file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + file(GLOB GUDHI_DEV_DOC_IMAGES "${CMAKE_SOURCE_DIR}/src/*/doc/*.svg") + file(COPY ${GUDHI_DEV_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + # User version for doc images + file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.png") + file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + file(GLOB GUDHI_USER_DOC_IMAGES "${CMAKE_SOURCE_DIR}/doc/*/*.svg") + file(COPY ${GUDHI_USER_DOC_IMAGES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/img") + # Biblio + file(GLOB GUDHI_BIB_FILES "${CMAKE_SOURCE_DIR}/biblio/*.bib") + file(COPY ${GUDHI_BIB_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + # Cubical complex perseus doc example + file(GLOB GUDHI_CUBICAL_PERSEUS_FILES "${CMAKE_SOURCE_DIR}/data/bitmap/*cubicalcomplexdoc.txt") + file(COPY ${GUDHI_CUBICAL_PERSEUS_FILES} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + # Persistence graphical tools examples + file(COPY "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + file(COPY "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/doc/") + + if (NOT CGAL_VERSION VERSION_LESS 4.8.1) + # If CGAL_VERSION >= 4.8.1, include subsampling + set(GUDHI_CYTHON_SUBSAMPLING "include 'cython/subsampling.pyx'") + set(GUDHI_CYTHON_TANGENTIAL_COMPLEX "include 'cython/tangential_complex.pyx'") + set(GUDHI_CYTHON_BOTTLENECK_DISTANCE "include 'cython/bottleneck_distance.pyx'") + else (NOT CGAL_VERSION VERSION_LESS 4.8.1) + # Remove subsampling unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_subsampling.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/subsampling_user.rst") + # Remove tangential complex and bottleneck unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_tangential_complex.py) + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_bottleneck_distance.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/bottleneck_distance_user.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/tangential_complex_user.rst") + endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) + if (NOT CGAL_VERSION VERSION_LESS 4.7.0) + # If CGAL_VERSION >= 4.7.0, include alpha + set(GUDHI_CYTHON_ALPHA_COMPLEX "include 'cython/alpha_complex.pyx'") + else (NOT CGAL_VERSION VERSION_LESS 4.7.0) + # Remove alpha complex unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_alpha_complex.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_sum.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_user.rst") + endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) + if (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # If CGAL_VERSION >= 4.6.0, include euclidean versions of witness complex + set(GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX + "include 'cython/euclidean_witness_complex.pyx'\ninclude 'cython/euclidean_strong_witness_complex.pyx'\n") + else (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # Remove alpha complex unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_euclidean_witness_complex.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_witness_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_strong_witness_complex_ref.rst") + endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) + + if(CGAL_FOUND) + # Add CGAL compilation args + if(CGAL_HEADER_ONLY) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") + else(CGAL_HEADER_ONLY) + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL-vc140-mt-4.7', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") + endif(CGAL_HEADER_ONLY) + # GMP and GMPXX are not required, but if present, CGAL will link with them. + if(GMP_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") + if(GMPXX_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmpxx', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMPXX_LIBRARIES_DIR}', ") + endif(GMPXX_FOUND) + endif(GMP_FOUND) + endif(CGAL_FOUND) + + # Specific for Mac + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.9', ") + set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.9', ") + endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + + # Loop on INCLUDE_DIRECTORIES PROPERTY + get_property(GUDHI_INCLUDE_DIRECTORIES DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + foreach(GUDHI_INCLUDE_DIRECTORY ${GUDHI_INCLUDE_DIRECTORIES}) + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${GUDHI_INCLUDE_DIRECTORY}', ") + endforeach() + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/include', ") + + if (TBB_FOUND) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ") + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'tbb', 'tbbmalloc', ") + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${TBB_LIBRARY_DIRS}', ") + set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${TBB_INCLUDE_DIRS}', ") + endif() + + # set sphinx-build in make files + configure_file(doc/Makefile.in "${CMAKE_CURRENT_BINARY_DIR}/doc/Makefile" @ONLY) + configure_file(doc/make.bat.in "${CMAKE_CURRENT_BINARY_DIR}/doc/make.bat" @ONLY) + + # Generate cythonize_gudhi.py file to cythonize Gudhi + configure_file(cythonize_gudhi.py.in "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" @ONLY) + # Generate gudhi.pyx - Gudhi cython file + configure_file(gudhi.pyx.in "${CMAKE_CURRENT_BINARY_DIR}/gudhi.pyx" @ONLY) + + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${PYTEST_PATH}") - set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") -endif(PYTEST_PATH) - -# Documentation generation is available through sphinx -if(SPHINX_PATH) - if (UNIX) - add_custom_target(sphinx - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" - COMMAND make html doctest) - else (UNIX) - add_custom_target(sphinx - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc - COMMAND make.bat html doctest) - endif (UNIX) -endif(SPHINX_PATH) + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/cythonize_gudhi.py" "build_ext" "--inplace") + + add_custom_target(cython ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") + + if(UNIX) + set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) + endif(UNIX) + + # Unitary tests are available through py.test + if(PYTEST_PATH) + add_test( + NAME gudhi_cython_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${PYTEST_PATH}") + set_tests_properties(gudhi_cython_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + endif(PYTEST_PATH) + + # Documentation generation is available through sphinx + if(SPHINX_PATH) + if (UNIX) + add_custom_target(sphinx + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gudhi.so" + COMMAND make html doctest) + else (UNIX) + add_custom_target(sphinx + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + COMMAND make.bat html doctest) + endif (UNIX) + endif(SPHINX_PATH) +endif(CYTHON_PATH) -- cgit v1.2.3 From 3c751ee1c84a81b6a7ee2f14769f82a0e7d490ee Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 28 Mar 2017 19:39:41 +0000 Subject: Missing a test git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2274 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 30330428b0071967367d1708338de0c7d40d8a67 --- src/cython/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/cython') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 7c650102..9dcb2cf4 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -25,9 +25,6 @@ include(FindPythonInterp) if(PYTHONINTERP_FOUND) if(PYTHON_VERSION_MAJOR EQUAL 2) FIND_PROGRAM(CYTHON_PATH cython) - if(NOT CYTHON_PATH) - message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python is set to 2.X while no cython installed.") - endif(NOT CYTHON_PATH) # Unitary tests are available through py.test find_program( PYTEST_PATH py.test ) # Documentation generation is available through sphinx -- cgit v1.2.3 From 20d67edb518e21a93c73f39251588c7e9b03c4f1 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 28 Mar 2017 21:20:01 +0000 Subject: Use only insert (simplex and subfaces) Remove useless initialize_filtration git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2276 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: eed1a67e2f83e3a1945cc24b11454ed1ef024ba6 --- CMakeLists.txt | 56 ++++++++++++++--------------- src/cython/cython/simplex_tree.pyx | 20 +---------- src/cython/doc/simplex_tree_user.rst | 30 ++++++++-------- src/cython/include/Simplex_tree_interface.h | 11 +++--- src/cython/test/test_simplex_tree.py | 34 +++++++++--------- 5 files changed, 68 insertions(+), 83 deletions(-) (limited to 'src/cython') diff --git a/CMakeLists.txt b/CMakeLists.txt index 18cd0ca2..ff4df053 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,34 +53,34 @@ include_directories(src/Subsampling/include/) include_directories(src/Tangential_complex/include/) include_directories(src/Witness_complex/include/) -add_subdirectory(src/common/example) -add_subdirectory(src/common/test) -add_subdirectory(src/Simplex_tree/test) -add_subdirectory(src/Simplex_tree/example) -add_subdirectory(src/Persistent_cohomology/test) -add_subdirectory(src/Persistent_cohomology/example) -add_subdirectory(src/Persistent_cohomology/benchmark) -add_subdirectory(src/Skeleton_blocker/test) -add_subdirectory(src/Skeleton_blocker/example) -add_subdirectory(src/Contraction/example) -add_subdirectory(src/Witness_complex/test) -add_subdirectory(src/Witness_complex/example) -add_subdirectory(src/Bitmap_cubical_complex/test) -add_subdirectory(src/Bitmap_cubical_complex/example) -add_subdirectory(src/Alpha_complex/example) -add_subdirectory(src/Alpha_complex/test) -add_subdirectory(src/Spatial_searching/example) -add_subdirectory(src/Spatial_searching/test) -add_subdirectory(src/Subsampling/example) -add_subdirectory(src/Subsampling/test) -add_subdirectory(src/Tangential_complex/example) -add_subdirectory(src/Tangential_complex/test) -add_subdirectory(src/Tangential_complex/benchmark) -add_subdirectory(src/Bottleneck_distance/example) -add_subdirectory(src/Bottleneck_distance/test) -add_subdirectory(src/Bottleneck_distance/benchmark) -add_subdirectory(src/Rips_complex/example) -add_subdirectory(src/Rips_complex/test) +#add_subdirectory(src/common/example) +#add_subdirectory(src/common/test) +#add_subdirectory(src/Simplex_tree/test) +#add_subdirectory(src/Simplex_tree/example) +#add_subdirectory(src/Persistent_cohomology/test) +#add_subdirectory(src/Persistent_cohomology/example) +#add_subdirectory(src/Persistent_cohomology/benchmark) +#add_subdirectory(src/Skeleton_blocker/test) +#add_subdirectory(src/Skeleton_blocker/example) +#add_subdirectory(src/Contraction/example) +#add_subdirectory(src/Witness_complex/test) +#add_subdirectory(src/Witness_complex/example) +#add_subdirectory(src/Bitmap_cubical_complex/test) +#add_subdirectory(src/Bitmap_cubical_complex/example) +#add_subdirectory(src/Alpha_complex/example) +#add_subdirectory(src/Alpha_complex/test) +#add_subdirectory(src/Spatial_searching/example) +#add_subdirectory(src/Spatial_searching/test) +#add_subdirectory(src/Subsampling/example) +#add_subdirectory(src/Subsampling/test) +#add_subdirectory(src/Tangential_complex/example) +#add_subdirectory(src/Tangential_complex/test) +#add_subdirectory(src/Tangential_complex/benchmark) +#add_subdirectory(src/Bottleneck_distance/example) +#add_subdirectory(src/Bottleneck_distance/test) +#add_subdirectory(src/Bottleneck_distance/benchmark) +#add_subdirectory(src/Rips_complex/example) +#add_subdirectory(src/Rips_complex/test) # data points generator add_subdirectory(data/points/generator) diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 148227e1..d26a1a93 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -46,7 +46,6 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": bint find_simplex(vector[int] simplex) bint insert_simplex_and_subfaces(vector[int] simplex, double filtration) - bint insert_simplex(vector[int] simplex, double filtration) vector[pair[vector[int], double]] get_filtered_tree() vector[pair[vector[int], double]] get_skeleton_tree(int dimension) vector[pair[vector[int], double]] get_star(vector[int] simplex) @@ -197,24 +196,7 @@ cdef class SimplexTree: complex.push_back(i) return self.thisptr.find_simplex(complex) - def insert_simplex(self, simplex, filtration=0.0): - """This function inserts the given N-simplex with the given filtration - value (default value is '0.0'). - - :param simplex: The N-simplex to insert, represented by a list of - vertex. - :type simplex: list of int. - :param filtration: The filtration value of the simplex. - :type filtration: float. - :returns: true if the simplex was found, false otherwise. - :rtype: bool - """ - cdef vector[int] complex - for i in simplex: - complex.push_back(i) - return self.thisptr.insert_simplex(complex, filtration) - - def insert_simplex_and_subfaces(self, simplex, filtration=0.0): + def insert(self, simplex, filtration=0.0): """This function inserts the given N-simplex and its subfaces with the given filtration value (default value is '0.0'). diff --git a/src/cython/doc/simplex_tree_user.rst b/src/cython/doc/simplex_tree_user.rst index cbfd34a7..c4e4c1b5 100644 --- a/src/cython/doc/simplex_tree_user.rst +++ b/src/cython/doc/simplex_tree_user.rst @@ -35,9 +35,9 @@ Example import gudhi st = gudhi.SimplexTree() - if st.insert_simplex([0, 1]): + if st.insert([0, 1]): print("[0, 1] inserted") - if st.insert_simplex_and_subfaces([0, 1, 2], filtration=4.0): + if st.insert([0, 1, 2], filtration=4.0): print("[0, 1, 2] inserted") if st.find([0, 1]): print("[0, 1] found") @@ -54,16 +54,16 @@ The output is: .. testoutput:: - [0, 1] inserted - [0, 1, 2] inserted - [0, 1] found - num_vertices=3 - num_simplices=7 - skeleton_tree(2) = - ([0, 1, 2], 4.0) - ([0, 1], 0.0) - ([0, 2], 4.0) - ([0], 0.0) - ([1, 2], 4.0) - ([1], 4.0) - ([2], 4.0) + [0, 1] inserted + [0, 1, 2] inserted + [0, 1] found + num_vertices=3 + num_simplices=7 + skeleton_tree(2) = + ([0, 1, 2], 4.0) + ([0, 1], 0.0) + ([0, 2], 4.0) + ([0], 0.0) + ([1, 2], 4.0) + ([1], 0.0) + ([2], 4.0) diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index 4266b3ef..154005ae 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -52,29 +52,30 @@ class Simplex_tree_interface : public Simplex_tree { return (Base::find(vh) != Base::null_simplex()); } + bool insert(const Simplex& simplex, Filtration_value filtration = 0) { + Insertion_result result = Base::insert_simplex_and_subfaces(simplex, filtration); + return (result.second); + } + bool insert_simplex(const Simplex& simplex, Filtration_value filtration = 0) { Insertion_result result = Base::insert_simplex(simplex, filtration); - Base::initialize_filtration(); return (result.second); } bool insert_simplex_and_subfaces(const Simplex& simplex, Filtration_value filtration = 0) { Insertion_result result = Base::insert_simplex_and_subfaces(simplex, filtration); - Base::initialize_filtration(); return (result.second); } // Do not interface this function, only used in strong witness interface for complex creation bool insert_simplex(const std::vector& complex, Filtration_value filtration = 0) { Insertion_result result = Base::insert_simplex(complex, filtration); - Base::initialize_filtration(); return (result.second); } // Do not interface this function, only used in strong witness interface for complex creation bool insert_simplex_and_subfaces(const std::vector& complex, Filtration_value filtration = 0) { Insertion_result result = Base::insert_simplex_and_subfaces(complex, filtration); - Base::initialize_filtration(); return (result.second); } @@ -88,6 +89,7 @@ class Simplex_tree_interface : public Simplex_tree { } Complex get_filtered_tree() { + Base::initialize_filtration(); Complex filtered_tree; for (auto f_simplex : Base::filtration_simplex_range()) { Simplex simplex; @@ -140,6 +142,7 @@ class Simplex_tree_interface : public Simplex_tree { } void create_persistence(Gudhi::Persistent_cohomology_interface* pcoh) { + Base::initialize_filtration(); pcoh = new Gudhi::Persistent_cohomology_interface(*this); } }; diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py index af5b639a..db61f84c 100755 --- a/src/cython/test/test_simplex_tree.py +++ b/src/cython/test/test_simplex_tree.py @@ -33,8 +33,8 @@ def test_insertion(): assert st.__is_persistence_defined() == False # insert test - assert st.insert_simplex([0, 1]) == True - assert st.insert_simplex_and_subfaces([0, 1, 2], filtration=4.0) == True + assert st.insert([0, 1]) == True + assert st.insert([0, 1, 2], filtration=4.0) == True # FIXME: Remove this line st.set_dimension(2) assert st.num_simplices() == 7 @@ -62,24 +62,24 @@ def test_insertion(): assert st.filtration([2]) == 4.0 assert st.filtration([0, 1]) == 0.0 assert st.filtration([0]) == 0.0 - assert st.filtration([1]) == 4.0 + assert st.filtration([1]) == 0.0 # skeleton_tree test assert st.get_skeleton_tree(2) == \ [([0, 1, 2], 4.0), ([0, 1], 0.0), ([0, 2], 4.0), - ([0], 0.0), ([1, 2], 4.0), ([1], 4.0), ([2], 4.0)] + ([0], 0.0), ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)] assert st.get_skeleton_tree(1) == \ [([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0), - ([1, 2], 4.0), ([1], 4.0), ([2], 4.0)] + ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)] assert st.get_skeleton_tree(0) == \ - [([0], 0.0), ([1], 4.0), ([2], 4.0)] + [([0], 0.0), ([1], 0.0), ([2], 4.0)] # remove_maximal_simplex test assert st.get_cofaces([0, 1, 2], 1) == [] st.remove_maximal_simplex([0, 1, 2]) assert st.get_skeleton_tree(2) == \ [([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0), - ([1, 2], 4.0), ([1], 4.0), ([2], 4.0)] + ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)] assert st.find([0, 1, 2]) == False assert st.find([0, 1]) == True assert st.find([0, 2]) == True @@ -103,16 +103,16 @@ def test_expansion(): assert st.__is_persistence_defined() == False # insert test - assert st.insert_simplex_and_subfaces([3, 2], 0.1) == True - assert st.insert_simplex_and_subfaces([2, 0], 0.2) == True - assert st.insert_simplex_and_subfaces([1, 0], 0.3) == True - assert st.insert_simplex_and_subfaces([3, 1], 0.4) == True - assert st.insert_simplex_and_subfaces([2, 1], 0.5) == True - assert st.insert_simplex_and_subfaces([6, 5], 0.6) == True - assert st.insert_simplex_and_subfaces([4, 2], 0.7) == True - assert st.insert_simplex_and_subfaces([3, 0], 0.8) == True - assert st.insert_simplex_and_subfaces([6, 4], 0.9) == True - assert st.insert_simplex_and_subfaces([6, 3], 1.0) == True + assert st.insert([3, 2], 0.1) == True + assert st.insert([2, 0], 0.2) == True + assert st.insert([1, 0], 0.3) == True + assert st.insert([3, 1], 0.4) == True + assert st.insert([2, 1], 0.5) == True + assert st.insert([6, 5], 0.6) == True + assert st.insert([4, 2], 0.7) == True + assert st.insert([3, 0], 0.8) == True + assert st.insert([6, 4], 0.9) == True + assert st.insert([6, 3], 1.0) == True assert st.num_vertices() == 7 assert st.num_simplices() == 17 -- cgit v1.2.3 From e86e99b785f6fc8b7b0f8b6c1efc45945fba652f Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 28 Mar 2017 21:21:01 +0000 Subject: Add comment git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2277 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2df390d8a87130a01fd3cae151e5a057ab85e049 --- src/cython/include/Simplex_tree_interface.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cython') diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index 154005ae..6bdf7830 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -57,11 +57,13 @@ class Simplex_tree_interface : public Simplex_tree { return (result.second); } + // Do not interface this function, only used in alpha complex interface for complex creation bool insert_simplex(const Simplex& simplex, Filtration_value filtration = 0) { Insertion_result result = Base::insert_simplex(simplex, filtration); return (result.second); } + // Do not interface this function, only used in interface for complex creation bool insert_simplex_and_subfaces(const Simplex& simplex, Filtration_value filtration = 0) { Insertion_result result = Base::insert_simplex_and_subfaces(simplex, filtration); return (result.second); -- cgit v1.2.3 From 065e7c483af571a275d48a637aa3b77d7efe52c9 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 29 Mar 2017 19:55:21 +0000 Subject: Small modifications git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2285 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4bf077b4d3b729c4d133e242d57d08ed9a04ae76 --- src/cython/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cython') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 9dcb2cf4..7375737c 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -20,7 +20,7 @@ if(PYTHON_EXECUTABLE) message(FATAL_ERROR "ERROR: ${PYTHON_EXECUTABLE} does not exist.") endif(NOT EXISTS "${PYTHON_EXECUTABLE}") endif(PYTHON_EXECUTABLE) -include(FindPythonInterp) +find_package(PythonInterp) if(PYTHONINTERP_FOUND) if(PYTHON_VERSION_MAJOR EQUAL 2) -- cgit v1.2.3 From 1ab1897554a46a440e52a76e689aa2923d56053d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 29 Mar 2017 19:56:28 +0000 Subject: Small modifications git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2286 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 34dc48a00ed8270967952b8763006b17f96a13e7 --- src/cython/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cython') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 7375737c..233a557e 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -14,7 +14,8 @@ macro( find_the_lib placeholder THE_LIBS ) endforeach(THE_LIB ${THE_LIBS}) endmacro( find_the_lib ) -# Find the correct Python interpreter. Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 for instance. +# Find the correct Python interpreter. +# Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance. if(PYTHON_EXECUTABLE) if(NOT EXISTS "${PYTHON_EXECUTABLE}") message(FATAL_ERROR "ERROR: ${PYTHON_EXECUTABLE} does not exist.") @@ -23,6 +24,7 @@ endif(PYTHON_EXECUTABLE) find_package(PythonInterp) if(PYTHONINTERP_FOUND) + # Default found version 2 if(PYTHON_VERSION_MAJOR EQUAL 2) FIND_PROGRAM(CYTHON_PATH cython) # Unitary tests are available through py.test -- cgit v1.2.3 From 28b0a6bd117ce84f8e85b2d7278c52e8fbe02d22 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 30 Mar 2017 21:46:15 +0000 Subject: Move example tests in a new CMakeLists.txt git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2288 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 8b2bce4c8be8a34b8fba9c664d2f0b3b60a50c20 --- CMakeLists.txt | 6 +- src/CMakeLists.txt | 8 +-- src/cmake/modules/GUDHI_third_party_libraries.txt | 46 ++++++++++++ src/cython/CMakeLists.txt | 41 ----------- src/cython/example/CMakeLists.txt | 84 ++++++++++++++++++++++ ...ex_diagram_persistence_from_off_file_example.py | 2 +- ...ex_diagram_persistence_from_off_file_example.py | 2 +- 7 files changed, 140 insertions(+), 49 deletions(-) create mode 100644 src/cython/example/CMakeLists.txt (limited to 'src/cython') diff --git a/CMakeLists.txt b/CMakeLists.txt index 18cd0ca2..f95407b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ enable_testing() include("${CMAKE_MODULE_PATH}/GUDHI_user_version_target.txt") # For "make doxygen" include("${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt") +# This variable is used by Cython CMakeLists.txt to know its path +set(GUDHI_CYTHON_PATH "src/cython") # For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH include("${CMAKE_MODULE_PATH}/GUDHI_third_party_libraries.txt") @@ -87,6 +89,6 @@ add_subdirectory(data/points/generator) add_subdirectory(src/GudhUI) -# This variable is used by Cython CMakeLists.txt to know its path -set(GUDHI_CYTHON_PATH "src/cython") +# specific for cython module add_subdirectory(${GUDHI_CYTHON_PATH}) +add_subdirectory(${GUDHI_CYTHON_PATH}/example) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4fa73662..48d433bf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,6 +13,8 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/") set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR}) include(${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt) +# This variable is used by Cython CMakeLists.txt to know its path +set(GUDHI_CYTHON_PATH "cython") # For third parties libraries management - To be done last as CGAL updates CMAKE_MODULE_PATH include("${CMAKE_MODULE_PATH}/GUDHI_third_party_libraries.txt") @@ -56,13 +58,11 @@ add_subdirectory(example/Bottleneck_distance) # data points generator add_subdirectory(data/points/generator) -# Please let GudhUI in last compilation position as QT is known to modify CMAKE_CXX_FLAGS -# GudhUI add_subdirectory(GudhUI) -# This variable is used by Cython CMakeLists.txt to know its path -set(GUDHI_CYTHON_PATH "cython") +# specific for cython module add_subdirectory(${GUDHI_CYTHON_PATH}) +add_subdirectory(${GUDHI_CYTHON_PATH}/example) #--------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------- diff --git a/src/cmake/modules/GUDHI_third_party_libraries.txt b/src/cmake/modules/GUDHI_third_party_libraries.txt index 1974f70f..2ddc9f1f 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.txt +++ b/src/cmake/modules/GUDHI_third_party_libraries.txt @@ -105,3 +105,49 @@ LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) message(STATUS "boost include dirs:" ${Boost_INCLUDE_DIRS}) message(STATUS "boost library dirs:" ${Boost_LIBRARY_DIRS}) + +macro( find_the_lib placeholder THE_LIBS ) + set (THE_LIB_WE_FOUND "NO") + foreach(THE_LIB ${THE_LIBS}) + if(EXISTS ${THE_LIB}) + get_filename_component(THE_LIB_WE ${THE_LIB} NAME_WE) + if (NOT THE_LIB_WE_FOUND) + set (THE_LIB_WE_FOUND "YES") + set(returnValue "${THE_LIB_WE}") + endif(NOT THE_LIB_WE_FOUND) + endif(EXISTS ${THE_LIB}) + endforeach(THE_LIB ${THE_LIBS}) +endmacro( find_the_lib ) + +# Find the correct Python interpreter. +# Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance. +if(PYTHON_EXECUTABLE) + if(NOT EXISTS "${PYTHON_EXECUTABLE}") + message(FATAL_ERROR "ERROR: ${PYTHON_EXECUTABLE} does not exist.") + endif(NOT EXISTS "${PYTHON_EXECUTABLE}") +endif(PYTHON_EXECUTABLE) +find_package(PythonInterp) + +if(NOT GUDHI_CYTHON_PATH) + message(FATAL_ERROR "ERROR: GUDHI_CYTHON_PATH is not valid.") +endif(NOT GUDHI_CYTHON_PATH) + +if(PYTHONINTERP_FOUND) + # Default found version 2 + if(PYTHON_VERSION_MAJOR EQUAL 2) + FIND_PROGRAM(CYTHON_PATH cython) + # Unitary tests are available through py.test + find_program( PYTEST_PATH py.test ) + # Documentation generation is available through sphinx + find_program( SPHINX_PATH sphinx-build ) + elseif(PYTHON_VERSION_MAJOR EQUAL 3) + FIND_PROGRAM(CYTHON_PATH cython3) + # Unitary tests are available through py.test + find_program( PYTEST_PATH py.test ) + # Documentation generation is available through sphinx + set(SPHINX_PATH "${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build") + else() + message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python version ${PYTHON_VERSION_STRING} is not valid.") + endif(PYTHON_VERSION_MAJOR EQUAL 2) +endif(PYTHONINTERP_FOUND) + diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index 233a557e..da55fb9b 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -1,47 +1,6 @@ cmake_minimum_required(VERSION 2.8) project(Cython) -macro( find_the_lib placeholder THE_LIBS ) - set (THE_LIB_WE_FOUND "NO") - foreach(THE_LIB ${THE_LIBS}) - if(EXISTS ${THE_LIB}) - get_filename_component(THE_LIB_WE ${THE_LIB} NAME_WE) - if (NOT THE_LIB_WE_FOUND) - set (THE_LIB_WE_FOUND "YES") - set(returnValue "${THE_LIB_WE}") - endif(NOT THE_LIB_WE_FOUND) - endif(EXISTS ${THE_LIB}) - endforeach(THE_LIB ${THE_LIBS}) -endmacro( find_the_lib ) - -# Find the correct Python interpreter. -# Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance. -if(PYTHON_EXECUTABLE) - if(NOT EXISTS "${PYTHON_EXECUTABLE}") - message(FATAL_ERROR "ERROR: ${PYTHON_EXECUTABLE} does not exist.") - endif(NOT EXISTS "${PYTHON_EXECUTABLE}") -endif(PYTHON_EXECUTABLE) -find_package(PythonInterp) - -if(PYTHONINTERP_FOUND) - # Default found version 2 - if(PYTHON_VERSION_MAJOR EQUAL 2) - FIND_PROGRAM(CYTHON_PATH cython) - # Unitary tests are available through py.test - find_program( PYTEST_PATH py.test ) - # Documentation generation is available through sphinx - find_program( SPHINX_PATH sphinx-build ) - elseif(PYTHON_VERSION_MAJOR EQUAL 3) - FIND_PROGRAM(CYTHON_PATH cython3) - # Unitary tests are available through py.test - find_program( PYTEST_PATH py.test ) - # Documentation generation is available through sphinx - set(SPHINX_PATH "${CMAKE_CURRENT_BINARY_DIR}/doc/python3-sphinx-build") - else() - message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python version ${PYTHON_VERSION_STRING} is not valid.") - endif(PYTHON_VERSION_MAJOR EQUAL 2) -endif(PYTHONINTERP_FOUND) - if(CYTHON_PATH) message("${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_PATH} - py.test is ${PYTEST_PATH} - Sphinx is ${SPHINX_PATH}") diff --git a/src/cython/example/CMakeLists.txt b/src/cython/example/CMakeLists.txt new file mode 100644 index 00000000..d55b39aa --- /dev/null +++ b/src/cython/example/CMakeLists.txt @@ -0,0 +1,84 @@ +cmake_minimum_required(VERSION 2.8) +project(Cython_examples) + +if(CYTHON_PATH) + # Test examples + add_test(NAME alpha_complex_from_points_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_complex_from_points_example.py") + set_tests_properties(alpha_complex_from_points_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME alpha_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_complex_diagram_persistence_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 0.6) + set_tests_properties(alpha_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME alpha_rips_persistence_bottleneck_distance_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_rips_persistence_bottleneck_distance.py" + -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -t 0.15 -d 3) + set_tests_properties(alpha_rips_persistence_bottleneck_distance_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME bottleneck_basic_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/bottleneck_basic_example.py") + set_tests_properties(bottleneck_basic_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME euclidean_strong_witness_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 1.0 -n 20 -d 2) + set_tests_properties(euclidean_strong_witness_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME euclidean_witness_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 1.0 -n 20 -d 2) + set_tests_properties(euclidean_witness_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME periodic_cubical_complex_barcode_persistence_from_perseus_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py" + --no-barcode -f ${CMAKE_SOURCE_DIR}/data/bitmap/CubicalTwoSphere.txt) + set_tests_properties(periodic_cubical_complex_barcode_persistence_from_perseus_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME random_cubical_complex_persistence_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/random_cubical_complex_persistence_example.py" + 10 10 10) + set_tests_properties(random_cubical_complex_persistence_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME rips_complex_diagram_persistence_from_distance_matrix_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/distance_matrix/lower_triangular_distance_matrix.csv -e 12.0 -d 3) + set_tests_properties(rips_complex_diagram_persistence_from_distance_matrix_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME rips_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_diagram_persistence_from_off_file_example.py + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -e 0.25 -d 3) + set_tests_properties(rips_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME rips_complex_from_points_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_from_points_example.py) + set_tests_properties(rips_complex_from_points_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME simplex_tree_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/simplex_tree_example.py) + set_tests_properties(simplex_tree_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME tangential_complex_plain_homology_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/tangential_complex_plain_homology_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off) + set_tests_properties(tangential_complex_plain_homology_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME witness_complex_from_nearest_landmark_table_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/witness_complex_from_nearest_landmark_table.py) + set_tests_properties(witness_complex_from_nearest_landmark_table_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") +endif(CYTHON_PATH) diff --git a/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py index 2474fc87..2371c36c 100755 --- a/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py @@ -32,7 +32,7 @@ __license__ = "GPL v3" parser = argparse.ArgumentParser(description='EuclideanStrongWitnessComplex creation from ' 'points read in a OFF file.', epilog='Example: ' - 'example/witness_complex_diagram_persistence_from_off_file_example.py ' + 'example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py ' '-f ../data/points/tore3D_300.off -a 1.0 -n 20 -d 2' '- Constructs a strong witness complex with the ' 'points from the given OFF file.') diff --git a/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py index 5a75417b..5748aa8a 100755 --- a/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py +++ b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py @@ -32,7 +32,7 @@ __license__ = "GPL v3" parser = argparse.ArgumentParser(description='EuclideanWitnessComplex creation from ' 'points read in a OFF file.', epilog='Example: ' - 'example/witness_complex_diagram_persistence_from_off_file_example.py ' + 'example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py ' '-f ../data/points/tore3D_300.off -a 1.0 -n 20 -d 2' '- Constructs a weak witness complex with the ' 'points from the given OFF file.') -- cgit v1.2.3 From ed8f0a547adcac13c3c8c55bb60b5c07bfb88b1e Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 31 Mar 2017 08:02:36 +0000 Subject: Fix examples tests git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2289 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9d386b82c89601da233f7c61254a023ddffc9abc --- CMakeLists.txt | 1 - src/CMakeLists.txt | 1 - src/cython/CMakeLists.txt | 82 ++++++++++++++++++++- src/cython/example/CMakeLists.txt | 84 ---------------------- .../random_cubical_complex_persistence_example.py | 3 +- 5 files changed, 83 insertions(+), 88 deletions(-) delete mode 100644 src/cython/example/CMakeLists.txt (limited to 'src/cython') diff --git a/CMakeLists.txt b/CMakeLists.txt index f95407b7..aef771d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,4 +91,3 @@ add_subdirectory(src/GudhUI) # specific for cython module add_subdirectory(${GUDHI_CYTHON_PATH}) -add_subdirectory(${GUDHI_CYTHON_PATH}/example) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 48d433bf..0c16c9cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,7 +62,6 @@ add_subdirectory(GudhUI) # specific for cython module add_subdirectory(${GUDHI_CYTHON_PATH}) -add_subdirectory(${GUDHI_CYTHON_PATH}/example) #--------------------------------------------------------------------------------------- #--------------------------------------------------------------------------------------- diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index da55fb9b..a3a3ebc8 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -176,9 +176,89 @@ if(CYTHON_PATH) COMMENT "Do not forget to add ${CMAKE_CURRENT_BINARY_DIR}/ to your PYTHONPATH before using examples or tests") if(UNIX) - set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) + set( ENV{PYTHONPATH} $ENV{PYTHONPATH}:${CMAKE_CURRENT_BINARY_DIR}/ ) endif(UNIX) + # Test examples + add_test(NAME alpha_complex_from_points_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_complex_from_points_example.py") + set_tests_properties(alpha_complex_from_points_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME alpha_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_complex_diagram_persistence_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 0.6) + set_tests_properties(alpha_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME alpha_rips_persistence_bottleneck_distance_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_rips_persistence_bottleneck_distance.py" + -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -t 0.15 -d 3) + set_tests_properties(alpha_rips_persistence_bottleneck_distance_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME bottleneck_basic_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/bottleneck_basic_example.py") + set_tests_properties(bottleneck_basic_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME euclidean_strong_witness_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 1.0 -n 20 -d 2) + set_tests_properties(euclidean_strong_witness_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME euclidean_witness_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 1.0 -n 20 -d 2) + set_tests_properties(euclidean_witness_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME periodic_cubical_complex_barcode_persistence_from_perseus_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py" + --no-barcode -f ${CMAKE_SOURCE_DIR}/data/bitmap/CubicalTwoSphere.txt) + set_tests_properties(periodic_cubical_complex_barcode_persistence_from_perseus_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME random_cubical_complex_persistence_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/random_cubical_complex_persistence_example.py" + 10 10 10) + set_tests_properties(random_cubical_complex_persistence_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME rips_complex_diagram_persistence_from_distance_matrix_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/distance_matrix/lower_triangular_distance_matrix.csv -e 12.0 -d 3) + set_tests_properties(rips_complex_diagram_persistence_from_distance_matrix_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME rips_complex_diagram_persistence_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_diagram_persistence_from_off_file_example.py + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -e 0.25 -d 3) + set_tests_properties(rips_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME rips_complex_from_points_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_from_points_example.py) + set_tests_properties(rips_complex_from_points_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME simplex_tree_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/simplex_tree_example.py) + set_tests_properties(simplex_tree_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME tangential_complex_plain_homology_from_off_file_example_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/tangential_complex_plain_homology_from_off_file_example.py" + --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off) + set_tests_properties(tangential_complex_plain_homology_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + + add_test(NAME witness_complex_from_nearest_landmark_table_py_test + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/witness_complex_from_nearest_landmark_table.py) + set_tests_properties(witness_complex_from_nearest_landmark_table_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") + # Unitary tests are available through py.test if(PYTEST_PATH) add_test( diff --git a/src/cython/example/CMakeLists.txt b/src/cython/example/CMakeLists.txt deleted file mode 100644 index d55b39aa..00000000 --- a/src/cython/example/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(Cython_examples) - -if(CYTHON_PATH) - # Test examples - add_test(NAME alpha_complex_from_points_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_complex_from_points_example.py") - set_tests_properties(alpha_complex_from_points_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME alpha_complex_diagram_persistence_from_off_file_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_complex_diagram_persistence_from_off_file_example.py" - --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 0.6) - set_tests_properties(alpha_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME alpha_rips_persistence_bottleneck_distance_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/alpha_rips_persistence_bottleneck_distance.py" - -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -t 0.15 -d 3) - set_tests_properties(alpha_rips_persistence_bottleneck_distance_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME bottleneck_basic_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/bottleneck_basic_example.py") - set_tests_properties(bottleneck_basic_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME euclidean_strong_witness_complex_diagram_persistence_from_off_file_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py" - --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 1.0 -n 20 -d 2) - set_tests_properties(euclidean_strong_witness_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME euclidean_witness_complex_diagram_persistence_from_off_file_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py" - --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -a 1.0 -n 20 -d 2) - set_tests_properties(euclidean_witness_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME periodic_cubical_complex_barcode_persistence_from_perseus_file_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py" - --no-barcode -f ${CMAKE_SOURCE_DIR}/data/bitmap/CubicalTwoSphere.txt) - set_tests_properties(periodic_cubical_complex_barcode_persistence_from_perseus_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME random_cubical_complex_persistence_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/random_cubical_complex_persistence_example.py" - 10 10 10) - set_tests_properties(random_cubical_complex_persistence_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME rips_complex_diagram_persistence_from_distance_matrix_file_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py" - --no-diagram -f ${CMAKE_SOURCE_DIR}/data/distance_matrix/lower_triangular_distance_matrix.csv -e 12.0 -d 3) - set_tests_properties(rips_complex_diagram_persistence_from_distance_matrix_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME rips_complex_diagram_persistence_from_off_file_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_diagram_persistence_from_off_file_example.py - --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -e 0.25 -d 3) - set_tests_properties(rips_complex_diagram_persistence_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME rips_complex_from_points_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/rips_complex_from_points_example.py) - set_tests_properties(rips_complex_from_points_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME simplex_tree_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/simplex_tree_example.py) - set_tests_properties(simplex_tree_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME tangential_complex_plain_homology_from_off_file_example_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/example/tangential_complex_plain_homology_from_off_file_example.py" - --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off) - set_tests_properties(tangential_complex_plain_homology_from_off_file_example_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") - - add_test(NAME witness_complex_from_nearest_landmark_table_py_test - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/example/witness_complex_from_nearest_landmark_table.py) - set_tests_properties(witness_complex_from_nearest_landmark_table_py_test PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}") -endif(CYTHON_PATH) diff --git a/src/cython/example/random_cubical_complex_persistence_example.py b/src/cython/example/random_cubical_complex_persistence_example.py index 1c55f777..c832d6bf 100755 --- a/src/cython/example/random_cubical_complex_persistence_example.py +++ b/src/cython/example/random_cubical_complex_persistence_example.py @@ -2,6 +2,7 @@ import gudhi import numpy +from functools import reduce import argparse import operator @@ -54,4 +55,4 @@ if dimension_multiplication > 1: print(cubical_complex.persistence(homology_coeff_field=2, min_persistence=0)) print("betti_numbers()=") - print(cubical_complex.betti_numbers()) \ No newline at end of file + print(cubical_complex.betti_numbers()) -- cgit v1.2.3 From 0b9fcfeb9a18d732229c411f7e9d383596f44e66 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 31 Mar 2017 08:39:07 +0000 Subject: Typo in doc git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2290 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f71b21674190c3b4c6e472f49680de2ca211cf7c --- src/cython/cython/cubical_complex.pyx | 2 +- src/cython/cython/periodic_cubical_complex.pyx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/cubical_complex.pyx b/src/cython/cython/cubical_complex.pyx index 1ed6bc5e..5995bb50 100644 --- a/src/cython/cython/cubical_complex.pyx +++ b/src/cython/cython/cubical_complex.pyx @@ -64,7 +64,7 @@ cdef class CubicalComplex: :param dimensions: A list of number of top dimensional cells. :type dimensions: list of int - :param top_dimensional_cells: A list of top dimensional cells. + :param top_dimensional_cells: A list of cells filtration values. :type top_dimensional_cells: list of double Or diff --git a/src/cython/cython/periodic_cubical_complex.pyx b/src/cython/cython/periodic_cubical_complex.pyx index 88cb4395..0f28258d 100644 --- a/src/cython/cython/periodic_cubical_complex.pyx +++ b/src/cython/cython/periodic_cubical_complex.pyx @@ -64,7 +64,7 @@ cdef class PeriodicCubicalComplex: :param dimensions: A list of number of top dimensional cells. :type dimensions: list of int - :param top_dimensional_cells: A list of top dimensional cells. + :param top_dimensional_cells: A list of cells filtration values. :type top_dimensional_cells: list of double Or -- cgit v1.2.3 From 4f9b8bfc0c75fcc0e23ce9859224fd889f365a2d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 31 Mar 2017 08:58:27 +0000 Subject: Typo with Perseus-style file git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2291 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: d76201ecfd7a1f236a04243fe86ca4eb0c21d8b1 --- src/cython/cython/cubical_complex.pyx | 6 +++--- src/cython/cython/periodic_cubical_complex.pyx | 6 +++--- ...cubical_complex_barcode_persistence_from_perseus_file_example.py | 2 +- src/cython/test/test_cubical_complex.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/cubical_complex.pyx b/src/cython/cython/cubical_complex.pyx index 5995bb50..ffc85130 100644 --- a/src/cython/cython/cubical_complex.pyx +++ b/src/cython/cython/cubical_complex.pyx @@ -60,7 +60,7 @@ cdef class CubicalComplex: def __init__(self, dimensions=None, top_dimensional_cells=None, perseus_file=''): """CubicalComplex constructor from dimensions and - top_dimensional_cells or from a perseus file style name. + top_dimensional_cells or from a Perseus-style file name. :param dimensions: A list of number of top dimensional cells. :type dimensions: list of int @@ -69,7 +69,7 @@ cdef class CubicalComplex: Or - :param perseus_file: A perseus file style name. + :param perseus_file: A Perseus-style file name. :type perseus_file: string """ @@ -85,7 +85,7 @@ cdef class CubicalComplex: print("file " + perseus_file + " not found.") else: print("CubicalComplex can be constructed from dimensions and " - "top_dimensional_cells or from a perseus file style name.") + "top_dimensional_cells or from a Perseus-style file name.") def __dealloc__(self): if self.thisptr != NULL: diff --git a/src/cython/cython/periodic_cubical_complex.pyx b/src/cython/cython/periodic_cubical_complex.pyx index 0f28258d..581c7b69 100644 --- a/src/cython/cython/periodic_cubical_complex.pyx +++ b/src/cython/cython/periodic_cubical_complex.pyx @@ -60,7 +60,7 @@ cdef class PeriodicCubicalComplex: def __init__(self, dimensions=None, top_dimensional_cells=None, perseus_file=''): """PeriodicCubicalComplex constructor from dimensions and - top_dimensional_cells or from a perseus file style name. + top_dimensional_cells or from a Perseus-style file name. :param dimensions: A list of number of top dimensional cells. :type dimensions: list of int @@ -69,7 +69,7 @@ cdef class PeriodicCubicalComplex: Or - :param perseus_file: A perseus file style name. + :param perseus_file: A Perseus-style file name. :type perseus_file: string """ @@ -85,7 +85,7 @@ cdef class PeriodicCubicalComplex: print("file " + perseus_file + " not found.") else: print("CubicalComplex can be constructed from dimensions and " - "top_dimensional_cells or from a perseus file style name.") + "top_dimensional_cells or from a Perseus-style file name.") def __dealloc__(self): if self.thisptr != NULL: diff --git a/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py index db530161..00334121 100755 --- a/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py +++ b/src/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py @@ -49,7 +49,7 @@ def is_file_perseus(file): return False parser = argparse.ArgumentParser(description='Periodic cubical complex from a ' - 'perseus file style name.', + 'Perseus-style file name.', epilog='Example: ' './periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py' ' -f ../data/bitmap/CubicalTwoSphere.txt') diff --git a/src/cython/test/test_cubical_complex.py b/src/cython/test/test_cubical_complex.py index c8df8089..2e281ee4 100755 --- a/src/cython/test/test_cubical_complex.py +++ b/src/cython/test/test_cubical_complex.py @@ -45,7 +45,7 @@ def test_dimension_or_perseus_file_constructor(): test_file.write('2\n3\n3\n0\n0\n0\n0\n100\n0\n0\n0\n0\n') test_file.close() # CubicalComplex can be constructed from dimensions and - # top_dimensional_cells OR from a perseus file style name. + # top_dimensional_cells OR from a Perseus-style file name. cub = CubicalComplex(dimensions=[3, 3], top_dimensional_cells = [1,2,3,4,5,6,7,8,9], perseus_file='CubicalOneSphere.txt') -- cgit v1.2.3 From a445575a408258af880e2a2a100365388ad4c0cc Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 31 Mar 2017 09:03:01 +0000 Subject: PR : Typo in installation doc git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2292 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9b048844ac0bd0a7e4485b24b06d7a11ce9f9274 --- src/cython/doc/installation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cython') diff --git a/src/cython/doc/installation.rst b/src/cython/doc/installation.rst index e7d8c210..5b1e545d 100644 --- a/src/cython/doc/installation.rst +++ b/src/cython/doc/installation.rst @@ -33,9 +33,9 @@ following command in a terminal: .. code-block:: bash - cd /path-to-gudhi/build/src/cython + cd /path-to-gudhi/build/cython # For windows, you have to set PYTHONPATH environment variable - export PYTHONPATH='$PYTHONPATH:/path-to-gudhi/build/src/cython' + export PYTHONPATH='$PYTHONPATH:/path-to-gudhi/build/cython' py.test Documentation -- cgit v1.2.3 From 99695369a066962339d7f85a4dc4981a804b3a54 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 31 Mar 2017 09:57:00 +0000 Subject: Bad choose of exact / approx computation git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2293 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7ba263cefcc0a76d223e4fba7f21ed96a525d16e --- src/cython/cython/bottleneck_distance.pyx | 6 ++++-- src/cython/doc/bottleneck_distance_user.rst | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/bottleneck_distance.pyx b/src/cython/cython/bottleneck_distance.pyx index ee3e6ef9..9fb377ff 100644 --- a/src/cython/cython/bottleneck_distance.pyx +++ b/src/cython/cython/bottleneck_distance.pyx @@ -33,7 +33,7 @@ cdef extern from "Bottleneck_distance_interface.h" namespace "Gudhi::persistence double bottleneck(vector[pair[double, double]], vector[pair[double, double]], double) double bottleneck(vector[pair[double, double]], vector[pair[double, double]]) -def bottleneck_distance(diagram_1, diagram_2, e=0.0): +def bottleneck_distance(diagram_1, diagram_2, e=None): """This function returns the point corresponding to a given vertex. :param diagram_1: The first diagram. @@ -53,7 +53,9 @@ def bottleneck_distance(diagram_1, diagram_2, e=0.0): :rtype: float :returns: the bottleneck distance. """ - if e is 0.0: + if e is None: + # Default value is the smallest double value (not 0, 0 is for exact version) return bottleneck(diagram_1, diagram_2) else: + # Can be 0 for exact version return bottleneck(diagram_1, diagram_2, e) diff --git a/src/cython/doc/bottleneck_distance_user.rst b/src/cython/doc/bottleneck_distance_user.rst index 3bc170f4..8c29d069 100644 --- a/src/cython/doc/bottleneck_distance_user.rst +++ b/src/cython/doc/bottleneck_distance_user.rst @@ -26,7 +26,7 @@ This example computes the bottleneck distance from 2 persistence diagrams: message = "Bottleneck distance approximation=" + repr(gudhi.bottleneck_distance(diag1, diag2, 0.1)) print(message) - message = "Bottleneck distance exact value=" + repr(gudhi.bottleneck_distance(diag1, diag2)) + message = "Bottleneck distance exact value=" + repr(gudhi.bottleneck_distance(diag1, diag2, 0)) print(message) The output is: -- cgit v1.2.3 From 202bf9722358355c12e85c0718da567ce9d9a6ae Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Sat, 1 Apr 2017 09:36:35 +0000 Subject: remove bad named *_tree() functions git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2300 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 512403fe0838fb2691e0af94c55772bff942b740 --- src/cython/cython/simplex_tree.pyx | 46 +++++++++------------- src/cython/doc/alpha_complex_user.rst | 4 +- src/cython/doc/rips_complex_user.rst | 8 ++-- src/cython/doc/simplex_tree_user.rst | 6 +-- src/cython/doc/tangential_complex_user.rst | 2 +- .../example/alpha_complex_from_points_example.py | 2 +- .../example/rips_complex_from_points_example.py | 2 +- src/cython/example/simplex_tree_example.py | 6 +-- src/cython/include/Simplex_tree_interface.h | 16 ++++---- src/cython/test/test_alpha_complex.py | 4 +- src/cython/test/test_euclidean_witness_complex.py | 6 +-- src/cython/test/test_rips_complex.py | 4 +- src/cython/test/test_simplex_tree.py | 15 ++++--- src/cython/test/test_tangential_complex.py | 2 +- 14 files changed, 57 insertions(+), 66 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index d26a1a93..9d40a8b5 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -46,8 +46,8 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": bint find_simplex(vector[int] simplex) bint insert_simplex_and_subfaces(vector[int] simplex, double filtration) - vector[pair[vector[int], double]] get_filtered_tree() - vector[pair[vector[int], double]] get_skeleton_tree(int dimension) + 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) @@ -102,14 +102,6 @@ cdef class SimplexTree: """ return self.pcohptr != NULL - def get_filtration(self): - """This function returns the main simplicial complex filtration value. - - :returns: The simplicial complex filtration value. - :rtype: float - """ - return self.thisptr.filtration() - def filtration(self, simplex): """This function returns the simplicial complex filtration value for a given N-simplex. @@ -136,7 +128,7 @@ cdef class SimplexTree: .. note:: This function must be launched before persistence, betti_numbers, - persistent_betti_numbers or get_filtered_tree after inserting or + persistent_betti_numbers or get_filtration after inserting or removing simplices. """ self.thisptr.initialize_filtration() @@ -214,36 +206,36 @@ cdef class SimplexTree: return self.thisptr.insert_simplex_and_subfaces(complex, filtration) - def get_filtered_tree(self): - """This function returns the tree sorted by increasing filtration - values. + def get_filtration(self): + """This function returns a list of all simplices with their given + filtration values. - :returns: The tree sorted by increasing filtration values. + :returns: The simplices sorted by increasing filtration values. :rtype: list of tuples(simplex, filtration) """ - cdef vector[pair[vector[int], double]] filtered_tree \ - = self.thisptr.get_filtered_tree() + cdef vector[pair[vector[int], double]] filtration \ + = self.thisptr.get_filtration() ct = [] - for filtered_complex in filtered_tree: + for filtered_complex in filtration: v = [] for vertex in filtered_complex.first: v.append(vertex) ct.append((v, filtered_complex.second)) return ct - def get_skeleton_tree(self, dimension): - """This function returns the tree skeleton of a maximum given - dimension. + def get_skeleton(self, dimension): + """This function returns the (simplices of the) skeleton of a maximum + given dimension. :param dimension: The skeleton dimension value. :type dimension: int. - :returns: The skeleton tree of a maximum dimension. + :returns: The (simplices of the) skeleton of a maximum dimension. :rtype: list of tuples(simplex, filtration) """ - cdef vector[pair[vector[int], double]] sk_tree \ - = self.thisptr.get_skeleton_tree(dimension) + cdef vector[pair[vector[int], double]] skeletons \ + = self.thisptr.get_skeleton(dimension) ct = [] - for filtered_complex in sk_tree: + for filtered_complex in skeletons: v = [] for vertex in filtered_complex.first: v.append(vertex) @@ -255,7 +247,7 @@ cdef class SimplexTree: :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int. - :returns: The star tree of a simplex. + :returns: The (simplices of the) star of a simplex. :rtype: list of tuples(simplex, filtration) """ cdef vector[int] complex @@ -280,7 +272,7 @@ cdef class SimplexTree: :param codimension: The codimension. If codimension = 0, all cofaces are returned (equivalent of get_star function) :type codimension: int. - :returns: The coface tree of a simplex. + :returns: The (simplices of the) cofaces of a simplex :rtype: list of tuples(simplex, filtration) """ cdef vector[int] complex diff --git a/src/cython/doc/alpha_complex_user.rst b/src/cython/doc/alpha_complex_user.rst index 68e53a77..2356944d 100644 --- a/src/cython/doc/alpha_complex_user.rst +++ b/src/cython/doc/alpha_complex_user.rst @@ -30,7 +30,7 @@ This example builds the Delaunay triangulation from the given points, and initia repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for filtered_value in simplex_tree.get_filtered_tree(): + for filtered_value in simplex_tree.get_filtration(): print(filtered_value) The output is: @@ -164,7 +164,7 @@ Then, it is asked to display information about the alpha complex: repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for filtered_value in simplex_tree.get_filtered_tree(): + for filtered_value in simplex_tree.get_filtration(): print(filtered_value) the program output is: diff --git a/src/cython/doc/rips_complex_user.rst b/src/cython/doc/rips_complex_user.rst index 027c3bf7..c89409a0 100644 --- a/src/cython/doc/rips_complex_user.rst +++ b/src/cython/doc/rips_complex_user.rst @@ -60,7 +60,7 @@ Finally, it is asked to display information about the simplicial complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for filtered_value in simplex_tree.get_filtered_tree(): + for filtered_value in simplex_tree.get_filtration(): print(filtered_value) When launching (Rips maximal distance between 2 points is 12.0, is expanded @@ -107,7 +107,7 @@ Finally, it is asked to display information about the Rips complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for filtered_value in simplex_tree.get_filtered_tree(): + for filtered_value in simplex_tree.get_filtration(): print(filtered_value) the program output is: @@ -162,7 +162,7 @@ Finally, it is asked to display information about the simplicial complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for filtered_value in simplex_tree.get_filtered_tree(): + for filtered_value in simplex_tree.get_filtration(): print(filtered_value) When launching (Rips maximal distance between 2 points is 12.0, is expanded @@ -209,7 +209,7 @@ Finally, it is asked to display information about the Rips complex. repr(simplex_tree.num_simplices()) + ' simplices - ' + \ repr(simplex_tree.num_vertices()) + ' vertices.' print(result_str) - for filtered_value in simplex_tree.get_filtered_tree(): + for filtered_value in simplex_tree.get_filtration(): print(filtered_value) the program output is: diff --git a/src/cython/doc/simplex_tree_user.rst b/src/cython/doc/simplex_tree_user.rst index c4e4c1b5..b2efca8b 100644 --- a/src/cython/doc/simplex_tree_user.rst +++ b/src/cython/doc/simplex_tree_user.rst @@ -45,8 +45,8 @@ Example print(result_str) result_str = 'num_simplices=' + repr(st.num_simplices()) print(result_str) - print("skeleton_tree(2) =") - for sk_value in st.get_skeleton_tree(2): + print("skeleton(2) =") + for sk_value in st.get_skeleton(2): print(sk_value) @@ -59,7 +59,7 @@ The output is: [0, 1] found num_vertices=3 num_simplices=7 - skeleton_tree(2) = + skeleton(2) = ([0, 1, 2], 4.0) ([0, 1], 0.0) ([0, 2], 4.0) diff --git a/src/cython/doc/tangential_complex_user.rst b/src/cython/doc/tangential_complex_user.rst index 6a7e6e41..24f68f85 100644 --- a/src/cython/doc/tangential_complex_user.rst +++ b/src/cython/doc/tangential_complex_user.rst @@ -133,7 +133,7 @@ This example builds the Tangential complex of point set read in an OFF file. ' - ' + repr(st.num_simplices()) + ' simplices - ' + \ repr(st.num_vertices()) + ' vertices.' print(result_str) - for filtered_value in st.get_filtered_tree(): + for filtered_value in st.get_filtration(): print(filtered_value) The output is: diff --git a/src/cython/example/alpha_complex_from_points_example.py b/src/cython/example/alpha_complex_from_points_example.py index 688edb65..7d6278ce 100755 --- a/src/cython/example/alpha_complex_from_points_example.py +++ b/src/cython/example/alpha_complex_from_points_example.py @@ -59,7 +59,7 @@ else: print("[4] Not found...") print("dimension=", simplex_tree.dimension()) -print("filtered_tree=", simplex_tree.get_filtered_tree()) +print("filtrations=", simplex_tree.get_filtration()) print("star([0])=", simplex_tree.get_star([0])) print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1)) diff --git a/src/cython/example/rips_complex_from_points_example.py b/src/cython/example/rips_complex_from_points_example.py index 9b7fc79d..5d411b1a 100755 --- a/src/cython/example/rips_complex_from_points_example.py +++ b/src/cython/example/rips_complex_from_points_example.py @@ -35,6 +35,6 @@ rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]], simplex_tree = rips.create_simplex_tree(max_dimension=1) -print("filtered_tree=", simplex_tree.get_filtered_tree()) +print("filtrations=", simplex_tree.get_filtration()) print("star([0])=", simplex_tree.get_star([0])) print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1)) diff --git a/src/cython/example/simplex_tree_example.py b/src/cython/example/simplex_tree_example.py index bf5f17a2..3af20fcf 100755 --- a/src/cython/example/simplex_tree_example.py +++ b/src/cython/example/simplex_tree_example.py @@ -61,6 +61,6 @@ print("filtration[4, 2]=", st.filtration([4, 2])) print("num_simplices=", st.num_simplices()) print("num_vertices=", st.num_vertices()) -print("skeleton_tree[2]=", st.get_skeleton_tree(2)) -print("skeleton_tree[1]=", st.get_skeleton_tree(1)) -print("skeleton_tree[0]=", st.get_skeleton_tree(0)) +print("skeleton[2]=", st.get_skeleton(2)) +print("skeleton[1]=", st.get_skeleton(1)) +print("skeleton[0]=", st.get_skeleton(0)) diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index 6bdf7830..45ce1916 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -90,29 +90,29 @@ class Simplex_tree_interface : public Simplex_tree { Base::initialize_filtration(); } - Complex get_filtered_tree() { + Complex get_filtration() { Base::initialize_filtration(); - Complex filtered_tree; + Complex filtrations; for (auto f_simplex : Base::filtration_simplex_range()) { Simplex simplex; for (auto vertex : Base::simplex_vertex_range(f_simplex)) { simplex.insert(simplex.begin(), vertex); } - filtered_tree.push_back(std::make_pair(simplex, Base::filtration(f_simplex))); + filtrations.push_back(std::make_pair(simplex, Base::filtration(f_simplex))); } - return filtered_tree; + return filtrations; } - Complex get_skeleton_tree(int dimension) { - Complex skeleton_tree; + Complex get_skeleton(int dimension) { + Complex skeletons; for (auto f_simplex : Base::skeleton_simplex_range(dimension)) { Simplex simplex; for (auto vertex : Base::simplex_vertex_range(f_simplex)) { simplex.insert(simplex.begin(), vertex); } - skeleton_tree.push_back(std::make_pair(simplex, Base::filtration(f_simplex))); + skeletons.push_back(std::make_pair(simplex, Base::filtration(f_simplex))); } - return skeleton_tree; + return skeletons; } Complex get_star(const Simplex& simplex) { diff --git a/src/cython/test/test_alpha_complex.py b/src/cython/test/test_alpha_complex.py index 2625d529..2c76d9d7 100755 --- a/src/cython/test/test_alpha_complex.py +++ b/src/cython/test/test_alpha_complex.py @@ -42,7 +42,7 @@ def test_infinite_alpha(): assert simplex_tree.num_simplices() == 11 assert simplex_tree.num_vertices() == 4 - assert simplex_tree.get_filtered_tree() == \ + assert simplex_tree.get_filtration() == \ [([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0), ([0, 1], 0.25), ([0, 2], 0.25), ([1, 3], 0.25), ([2, 3], 0.25), ([1, 2], 0.5), ([0, 1, 2], 0.5), @@ -76,7 +76,7 @@ def test_filtered_alpha(): assert filtered_alpha.get_point(4) == [] assert filtered_alpha.get_point(125) == [] - assert simplex_tree.get_filtered_tree() == \ + assert simplex_tree.get_filtration() == \ [([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0), ([0, 1], 0.25), ([0, 2], 0.25), ([1, 3], 0.25), ([2, 3], 0.25)] diff --git a/src/cython/test/test_euclidean_witness_complex.py b/src/cython/test/test_euclidean_witness_complex.py index 0947cc09..737f1ef4 100755 --- a/src/cython/test/test_euclidean_witness_complex.py +++ b/src/cython/test/test_euclidean_witness_complex.py @@ -42,7 +42,7 @@ def test_witness_complex(): assert landmarks[1] == euclidean_witness_complex.get_point(1) assert landmarks[2] == euclidean_witness_complex.get_point(2) - assert simplex_tree.get_filtered_tree() == [([0], 0.0), ([1], 0.0), + assert simplex_tree.get_filtration() == [([0], 0.0), ([1], 0.0), ([0, 1], 0.0), ([2], 0.0), ([0, 2], 0.0), ([1, 2], 0.0), ([0, 1, 2], 0.0)] @@ -61,11 +61,11 @@ def test_strong_witness_complex(): assert landmarks[1] == euclidean_strong_witness_complex.get_point(1) assert landmarks[2] == euclidean_strong_witness_complex.get_point(2) - assert simplex_tree.get_filtered_tree() == [([0], 0.0), ([1], 0.0), ([2], 0.0)] + assert simplex_tree.get_filtration() == [([0], 0.0), ([1], 0.0), ([2], 0.0)] simplex_tree = euclidean_strong_witness_complex.create_simplex_tree(max_alpha_square=100.0) - assert simplex_tree.get_filtered_tree() == [([0], 0.0), ([1], 0.0), + assert simplex_tree.get_filtration() == [([0], 0.0), ([1], 0.0), ([2], 0.0), ([1, 2], 15.0), ([0, 2], 34.0), ([0, 1], 37.0), ([0, 1, 2], 37.0)] diff --git a/src/cython/test/test_rips_complex.py b/src/cython/test/test_rips_complex.py index 286a645b..c7d2ead4 100755 --- a/src/cython/test/test_rips_complex.py +++ b/src/cython/test/test_rips_complex.py @@ -44,7 +44,7 @@ def test_rips_from_points(): assert simplex_tree.num_simplices() == 10 assert simplex_tree.num_vertices() == 4 - assert simplex_tree.get_filtered_tree() == \ + assert simplex_tree.get_filtration() == \ [([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0), ([0, 1], 1.0), ([0, 2], 1.0), ([1, 3], 1.0), ([2, 3], 1.0), ([1, 2], 1.4142135623730951), @@ -83,7 +83,7 @@ def test_rips_from_distance_matrix(): assert simplex_tree.num_simplices() == 10 assert simplex_tree.num_vertices() == 4 - assert simplex_tree.get_filtered_tree() == \ + assert simplex_tree.get_filtration() == \ [([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0), ([0, 1], 1.0), ([0, 2], 1.0), ([1, 3], 1.0), ([2, 3], 1.0), ([1, 2], 1.4142135623730951), diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py index db61f84c..3ae537e3 100755 --- a/src/cython/test/test_simplex_tree.py +++ b/src/cython/test/test_simplex_tree.py @@ -55,7 +55,6 @@ def test_insertion(): # filtration test st.set_filtration(5.0) st.initialize_filtration() - assert st.get_filtration() == 5.0 assert st.filtration([0, 1, 2]) == 4.0 assert st.filtration([0, 2]) == 4.0 assert st.filtration([1, 2]) == 4.0 @@ -64,20 +63,20 @@ def test_insertion(): assert st.filtration([0]) == 0.0 assert st.filtration([1]) == 0.0 - # skeleton_tree test - assert st.get_skeleton_tree(2) == \ + # skeleton test + assert st.get_skeleton(2) == \ [([0, 1, 2], 4.0), ([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0), ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)] - assert st.get_skeleton_tree(1) == \ + assert st.get_skeleton(1) == \ [([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0), ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)] - assert st.get_skeleton_tree(0) == \ + assert st.get_skeleton(0) == \ [([0], 0.0), ([1], 0.0), ([2], 4.0)] # remove_maximal_simplex test assert st.get_cofaces([0, 1, 2], 1) == [] st.remove_maximal_simplex([0, 1, 2]) - assert st.get_skeleton_tree(2) == \ + assert st.get_skeleton(2) == \ [([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0), ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)] assert st.find([0, 1, 2]) == False @@ -116,7 +115,7 @@ def test_expansion(): assert st.num_vertices() == 7 assert st.num_simplices() == 17 - assert st.get_filtered_tree() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1), + assert st.get_filtration() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1), ([0], 0.2), ([0, 2], 0.2), ([1], 0.3), ([0, 1], 0.3), ([1, 3], 0.4), ([1, 2], 0.5), ([5], 0.6), ([6], 0.6), ([5, 6], 0.6), ([4], 0.7), ([2, 4], 0.7), ([0, 3], 0.8), ([4, 6], 0.9), ([3, 6], 1.0)] @@ -126,7 +125,7 @@ def test_expansion(): assert st.num_simplices() == 22 st.initialize_filtration() - assert st.get_filtered_tree() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1), + assert st.get_filtration() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1), ([0], 0.2), ([0, 2], 0.2), ([1], 0.3), ([0, 1], 0.3), ([1, 3], 0.4), ([1, 2], 0.5), ([0, 1, 2], 0.5), ([1, 2, 3], 0.5), ([5], 0.6), ([6], 0.6), ([5, 6], 0.6), ([4], 0.7), ([2, 4], 0.7), ([0, 3], 0.8), ([0, 1, 3], 0.8), diff --git a/src/cython/test/test_tangential_complex.py b/src/cython/test/test_tangential_complex.py index c191baa4..8aa4023c 100755 --- a/src/cython/test/test_tangential_complex.py +++ b/src/cython/test/test_tangential_complex.py @@ -40,7 +40,7 @@ def test_tangential(): assert st.num_simplices() == 6 assert st.num_vertices() == 4 - assert st.get_filtered_tree() == \ + assert st.get_filtration() == \ [([0], 0.0), ([1], 0.0), ([2], 0.0), ([0, 2], 0.0), ([3], 0.0), ([1, 3], 0.0)] assert st.get_cofaces([0], 1) == [([0, 2], 0.0)] -- cgit v1.2.3 From 2334cb2704e84792f3972ba7d3b45a7b9ee75f67 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 10 Apr 2017 13:42:31 +0000 Subject: mac osx version is 10.12 and not 10.9 (cf. mail Bertrand Michel) Add text for Windows Python 3.X installation and forinstallation with several Python installed on the system. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2324 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 939d5d4a94c2430de11b3dcbc29a65aad4bfd885 --- src/cython/CMakeLists.txt | 4 ++-- src/cython/doc/installation.rst | 15 ++++++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/cython') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index a3a3ebc8..51c208aa 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -140,8 +140,8 @@ if(CYTHON_PATH) # Specific for Mac if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.9', ") - set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.9', ") + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-mmacosx-version-min=10.12', ") + set(GUDHI_CYTHON_EXTRA_LINK_ARGS "${GUDHI_CYTHON_EXTRA_LINK_ARGS}'-mmacosx-version-min=10.12', ") endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # Loop on INCLUDE_DIRECTORIES PROPERTY diff --git a/src/cython/doc/installation.rst b/src/cython/doc/installation.rst index 5b1e545d..f818366b 100644 --- a/src/cython/doc/installation.rst +++ b/src/cython/doc/installation.rst @@ -4,12 +4,19 @@ Installation Compiling ********* -The library uses c++11 and requires `Boost `_ with version -1.48.0 or more recent. It is a multi-platform library and compiles on Linux, -Mac OSX and Visual Studio 2015. +The library uses c++11 and requires `Boost `_ with +version 1.48.0 or more recent. It is a multi-platform library and compiles on +Linux, Mac OSX and Visual Studio 2015. It also requires cmake to generate makefiles, and cython to compile the library. +On `Windows `_ , only Python +3.5 and 3.6 are available because of required Visual Studio version. + +On other systems, if you have several Python/cython installed, the version 2.X +will be used by default, but you can force it by adding +:code:`-DPython_ADDITIONAL_VERSIONS=3` to the cmake command. + GUDHI Cythonization =================== @@ -23,8 +30,6 @@ To build the GUDHI cython module, run the following commands in a terminal: cmake .. make cython -A list of examples is available here. - Test suites =========== -- cgit v1.2.3 From d9922fab02fd28d60601dab1aeb5ede2246286d7 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 10 Apr 2017 14:25:01 +0000 Subject: Typo fix git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2326 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7c88a0635bdeffc643127106574501ce72645546 --- src/cython/doc/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cython') diff --git a/src/cython/doc/installation.rst b/src/cython/doc/installation.rst index f818366b..373e0717 100644 --- a/src/cython/doc/installation.rst +++ b/src/cython/doc/installation.rst @@ -11,7 +11,7 @@ It also requires cmake to generate makefiles, and cython to compile the library. On `Windows `_ , only Python -3.5 and 3.6 are available because of required Visual Studio version. +3.5 and 3.6 are available because of the required Visual Studio version. On other systems, if you have several Python/cython installed, the version 2.X will be used by default, but you can force it by adding -- cgit v1.2.3