summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt12
-rw-r--r--GUDHIVersion.cmake.in1
-rw-r--r--biblio/bibliography.bib2
-rw-r--r--biblio/how_to_cite_gudhi.bib2
-rw-r--r--data/points/SO3.COPYRIGHT2
-rw-r--r--data/points/generator/CMakeLists.txt19
-rw-r--r--data/points/generator/README8
-rwxr-xr-xscripts/generate_version.sh124
-rw-r--r--src/Alpha_complex/doc/Intro_alpha_complex.h87
-rw-r--r--src/Alpha_complex/example/CMakeLists.txt29
-rw-r--r--src/Alpha_complex/test/CMakeLists.txt21
-rw-r--r--src/Alpha_complex/test/README2
-rw-r--r--src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp26
-rw-r--r--src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp21
-rw-r--r--src/Bitmap_cubical_complex/example/CMakeLists.txt20
-rw-r--r--src/Bitmap_cubical_complex/test/CMakeLists.txt22
-rw-r--r--src/Bottleneck_distance/example/CMakeLists.txt10
-rw-r--r--src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp2
-rw-r--r--src/Bottleneck_distance/include/gudhi/Bottleneck.h4
-rw-r--r--src/Bottleneck_distance/include/gudhi/Graph_matching.h38
-rw-r--r--src/Bottleneck_distance/include/gudhi/Neighbors_finder.h48
-rw-r--r--src/Bottleneck_distance/include/gudhi/Persistence_graph.h8
-rw-r--r--src/Bottleneck_distance/test/CMakeLists.txt24
-rw-r--r--src/Bottleneck_distance/test/README2
-rw-r--r--src/CMakeLists.txt13
-rw-r--r--src/Contraction/example/CMakeLists.txt9
-rw-r--r--src/Doxyfile8
-rw-r--r--src/Persistent_cohomology/benchmark/performance_rips_persistence.cpp2
-rw-r--r--src/Persistent_cohomology/example/CMakeLists.txt56
-rw-r--r--src/Persistent_cohomology/example/README2
-rw-r--r--src/Persistent_cohomology/example/rips_multifield_persistence.cpp2
-rw-r--r--src/Persistent_cohomology/example/rips_persistence.cpp2
-rw-r--r--src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp2
-rw-r--r--src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp2
-rw-r--r--src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h19
-rw-r--r--src/Persistent_cohomology/test/CMakeLists.txt54
-rw-r--r--src/Persistent_cohomology/test/README10
-rw-r--r--src/Persistent_cohomology/test/betti_numbers_unit_test.cpp4
-rw-r--r--src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp14
-rw-r--r--src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp16
-rw-r--r--src/Rips_complex/doc/Intro_rips_complex.h8
-rw-r--r--src/Rips_complex/example/CMakeLists.txt61
-rw-r--r--src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp2
-rw-r--r--src/Rips_complex/example/example_rips_complex_from_off_file.cpp2
-rw-r--r--src/Rips_complex/test/CMakeLists.txt19
-rw-r--r--src/Rips_complex/test/test_rips_complex.cpp8
-rw-r--r--src/Simplex_tree/doc/Intro_simplex_tree.h2
-rw-r--r--src/Simplex_tree/example/CMakeLists.txt33
-rw-r--r--src/Simplex_tree/example/README8
-rw-r--r--src/Simplex_tree/test/CMakeLists.txt22
-rw-r--r--src/Skeleton_blocker/example/CMakeLists.txt14
-rw-r--r--src/Skeleton_blocker/test/CMakeLists.txt37
-rw-r--r--src/Spatial_searching/example/CMakeLists.txt16
-rw-r--r--src/Spatial_searching/test/CMakeLists.txt15
-rw-r--r--src/Subsampling/example/CMakeLists.txt12
-rw-r--r--src/Subsampling/example/example_choose_n_farthest_points.cpp4
-rw-r--r--src/Subsampling/example/example_custom_kernel.cpp4
-rw-r--r--src/Subsampling/include/gudhi/choose_n_farthest_points.h94
-rw-r--r--src/Subsampling/test/CMakeLists.txt25
-rw-r--r--src/Subsampling/test/test_choose_n_farthest_points.cpp47
-rw-r--r--src/Tangential_complex/example/CMakeLists.txt9
-rw-r--r--src/Tangential_complex/include/gudhi/Tangential_complex.h5
-rw-r--r--src/Tangential_complex/test/CMakeLists.txt15
-rw-r--r--src/Witness_complex/example/CMakeLists.txt30
-rw-r--r--src/Witness_complex/include/gudhi/Strong_witness_complex.h4
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex.h4
-rw-r--r--src/Witness_complex/test/CMakeLists.txt21
-rw-r--r--src/cmake/modules/FindCython.cmake44
-rw-r--r--src/cmake/modules/GUDHI_doxygen_target.cmake (renamed from src/cmake/modules/GUDHI_doxygen_target.txt)0
-rw-r--r--src/cmake/modules/GUDHI_test_coverage.cmake14
-rw-r--r--src/cmake/modules/GUDHI_third_party_libraries.cmake (renamed from src/cmake/modules/GUDHI_third_party_libraries.txt)37
-rw-r--r--src/cmake/modules/GUDHI_user_version_target.txt2
-rw-r--r--src/common/doc/MathJax.COPYRIGHT55
-rw-r--r--src/common/doc/MathJax.js53
-rw-r--r--src/common/doc/header.html4
-rw-r--r--src/common/doc/main_page.h8
-rw-r--r--src/common/example/CMakeLists.txt9
-rw-r--r--src/common/include/gudhi/Null_output_iterator.h48
-rw-r--r--src/common/include/gudhi/distance_functions.h11
-rw-r--r--src/common/test/CMakeLists.txt29
-rw-r--r--src/cython/CMakeLists.txt131
-rw-r--r--src/cython/cython/bottleneck_distance.pyx6
-rw-r--r--src/cython/cython/cubical_complex.pyx8
-rw-r--r--src/cython/cython/periodic_cubical_complex.pyx8
-rw-r--r--src/cython/cython/simplex_tree.pyx66
-rw-r--r--src/cython/doc/_templates/layout.html4
-rw-r--r--src/cython/doc/alpha_complex_sum.rst2
-rw-r--r--src/cython/doc/alpha_complex_user.rst108
-rw-r--r--src/cython/doc/bottleneck_distance_user.rst7
-rw-r--r--src/cython/doc/cubical_complex_user.rst3
-rw-r--r--src/cython/doc/img/average_landscape.pngbin14917 -> 0 bytes
-rw-r--r--src/cython/doc/index.rst19
-rw-r--r--src/cython/doc/installation.rst23
-rw-r--r--src/cython/doc/persistence_graphical_tools_user.rst1
-rw-r--r--src/cython/doc/persistent_cohomology_user.rst3
-rw-r--r--src/cython/doc/rips_complex_user.rst165
-rw-r--r--src/cython/doc/simplex_tree_user.rst35
-rw-r--r--src/cython/doc/tangential_complex_user.rst38
-rw-r--r--src/cython/doc/witness_complex_user.rst6
-rwxr-xr-xsrc/cython/example/alpha_complex_from_points_example.py2
-rwxr-xr-xsrc/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py2
-rwxr-xr-xsrc/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py2
-rwxr-xr-xsrc/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py2
-rwxr-xr-xsrc/cython/example/random_cubical_complex_persistence_example.py3
-rwxr-xr-xsrc/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py45
-rwxr-xr-xsrc/cython/example/rips_complex_from_points_example.py2
-rwxr-xr-xsrc/cython/example/simplex_tree_example.py6
-rw-r--r--src/cython/include/Rips_complex_interface.h5
-rw-r--r--src/cython/include/Simplex_tree_interface.h29
-rw-r--r--src/cython/include/Subsampling_interface.h2
-rwxr-xr-xsrc/cython/test/test_alpha_complex.py4
-rwxr-xr-xsrc/cython/test/test_cubical_complex.py2
-rwxr-xr-xsrc/cython/test/test_euclidean_witness_complex.py6
-rwxr-xr-xsrc/cython/test/test_rips_complex.py4
-rwxr-xr-xsrc/cython/test/test_simplex_tree.py49
-rwxr-xr-xsrc/cython/test/test_tangential_complex.py2
116 files changed, 1212 insertions, 1172 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 754a7bd1..4c772506 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.6)
project(GUDHIdev)
include(CMakeGUDHIVersion.txt)
-# Generate GUDHI official version file
-configure_file(GUDHIVersion.cmake.in "${CMAKE_SOURCE_DIR}/GUDHIVersion.cmake" @ONLY)
set(CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/src/cmake/modules/")
@@ -15,9 +13,11 @@ enable_testing()
# For "make user_version"
include("${CMAKE_MODULE_PATH}/GUDHI_user_version_target.txt")
# For "make doxygen"
-include("${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt")
+include(GUDHI_doxygen_target)
+# 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")
+include(GUDHI_third_party_libraries)
if(MSVC)
# Turn off some VC++ warnings
@@ -84,7 +84,6 @@ add_subdirectory(src/Rips_complex/example)
add_subdirectory(src/Rips_complex/test)
add_subdirectory(src/Gudhi_stat/test)
add_subdirectory(src/Gudhi_stat/example)
-add_subdirectory(src/Gudhi_stat/utilities)
add_subdirectory(src/Gudhi_stat/utilities/persistence_heat_maps)
add_subdirectory(src/Gudhi_stat/utilities/persistence_intervals)
add_subdirectory(src/Gudhi_stat/utilities/persistence_landscapes)
@@ -96,6 +95,5 @@ 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})
diff --git a/GUDHIVersion.cmake.in b/GUDHIVersion.cmake.in
deleted file mode 100644
index 2f433c1c..00000000
--- a/GUDHIVersion.cmake.in
+++ /dev/null
@@ -1 +0,0 @@
-@GUDHI_VERSION@
diff --git a/biblio/bibliography.bib b/biblio/bibliography.bib
index 37aa8198..1e14565a 100644
--- a/biblio/bibliography.bib
+++ b/biblio/bibliography.bib
@@ -111,7 +111,7 @@ language={English},
@techreport{boissonnat:hal-00922572,
hal_id = {hal-00922572},
url = {http://hal.inria.fr/hal-00922572},
- title = {\href{http://hal.inria.fr/hal-00922572}{Computing Persistent Homology with Various Coefficient Fields in a Single Pass}},
+ title = {Computing Persistent Homology with Various Coefficient Fields in a Single Pass},
author = {Boissonnat, Jean-Daniel and Maria, Cl{\'e}ment},
abstract = {{In this article, we introduce the multi-field persistence diagram for the persistence homology of a filtered complex. It encodes compactly the superimposition of the persistence diagrams of the complex with several field coefficients, and provides a substantially more precise description of the topology of the filtered complex. Specifically, the multi-field persistence diagram encodes the Betti numbers of integral homology and the prime divisors of the torsion coefficients of the underlying shape. Moreover, it enjoys similar stability properties as the ones of standard persistence diagrams, with the appropriate notion of distance. These properties make the multi-field persistence diagram a useful tool in computational topology.}},
keywords = {Computational Topology, Persistent homology, Modular reconstruction},
diff --git a/biblio/how_to_cite_gudhi.bib b/biblio/how_to_cite_gudhi.bib
index 79b1ddd6..59c05a5b 100644
--- a/biblio/how_to_cite_gudhi.bib
+++ b/biblio/how_to_cite_gudhi.bib
@@ -119,6 +119,6 @@
, title = "Cython interface"
, publisher = "{GUDHI Editorial Board}"
, booktitle = "{GUDHI} User and Reference Manual"
-, url = "http://gudhi.gforge.inria.fr/cython/latest/"
+, url = "http://gudhi.gforge.inria.fr/python/latest/"
, year = 2016
}
diff --git a/data/points/SO3.COPYRIGHT b/data/points/SO3.COPYRIGHT
index 26bbb0ad..a9383f8f 100644
--- a/data/points/SO3.COPYRIGHT
+++ b/data/points/SO3.COPYRIGHT
@@ -7,3 +7,5 @@ This software is an implementation of the two following papers:
J. C. Mitchell. Discrete Uniform Sampling of Rotation Groups Using Orthogonal Images. SIAM Journal of Scientific Computing, 30(1):525-547, 2007.
A. Yershova, S. Jain, S. M. LaValle, and J. C. Mitchell. Generating Uniform Incremental Grids on SO(3) Using the Hopf Fibration International Journal of Robotics Research, November 2009.
+
+This software copyright is GNU General Public License as published by the Free Software Foundation version 2.
diff --git a/data/points/generator/CMakeLists.txt b/data/points/generator/CMakeLists.txt
index 9a7f7bce..88d377a7 100644
--- a/data/points/generator/CMakeLists.txt
+++ b/data/points/generator/CMakeLists.txt
@@ -1,14 +1,15 @@
cmake_minimum_required(VERSION 2.6)
-project(Data_points_generator)
+project(data_points_generator)
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
- add_executable ( hypergenerator hypergenerator.cpp )
- target_link_libraries(hypergenerator ${Boost_SYSTEM_LIBRARY})
- add_test(hypergenerator_on_sphere_3000_10_5.0 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator on sphere onSphere.off 3000 10 5.0)
- add_test(hypergenerator_on_sphere_10000_3 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator on sphere onSphere.off 10000 3)
- add_test(hypergenerator_in_sphere_7000_12_10.8 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in sphere inSphere.off 7000 12 10.8)
- add_test(hypergenerator_in_sphere_50000_2 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in sphere inSphere.off 50000 2)
+ add_executable ( data_points_generator hypergenerator.cpp )
+ target_link_libraries(data_points_generator ${Boost_SYSTEM_LIBRARY})
+ add_test(NAME data_points_generator_on_sphere_1000_3_15.2 COMMAND $<TARGET_FILE:data_points_generator>
+ "on" "sphere" "onSphere.off" "1000" "3" "15.2")
+ add_test(NAME data_points_generator_in_sphere_100_2 COMMAND $<TARGET_FILE:data_points_generator>
+ "in" "sphere" "inSphere.off" "100" "2")
+
# on cube is not available in CGAL
- add_test(hypergenerator_in_cube_7000_12_10.8 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 7000 12 10.8)
- add_test(hypergenerator_in_cube_50000_2 ${CMAKE_CURRENT_BINARY_DIR}/hypergenerator in cube inCube.off 50000 3)
+ add_test(NAME data_points_generator_in_cube_10000_3_5.8 COMMAND $<TARGET_FILE:data_points_generator>
+ "in" "cube" "inCube.off" "10000" "3" "5.8")
endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
diff --git a/data/points/generator/README b/data/points/generator/README
index 41cb9165..951bcfe1 100644
--- a/data/points/generator/README
+++ b/data/points/generator/README
@@ -7,21 +7,21 @@ cmake .
cd /path-to-data-generator/
make
-=========================== hypergenerator =====================================
+======================= data_points_generator ==================================
Example of use :
*** Hyper sphere|cube generator
-./hypergenerator on sphere onSphere.off 1000 3 15.2
+./data_points_generator on sphere onSphere.off 1000 3 15.2
=> generates a onSphere.off file with 1000 points randomized on a sphere of dimension 3 and radius 15.2
-./hypergenerator in sphere inSphere.off 100 2
+./data_points_generator in sphere inSphere.off 100 2
=> generates a inSphere.off file with 100 points randomized in a sphere of dimension 2 (circle) and radius 1.0 (default)
-./hypergenerator in cube inCube.off 10000 3 5.8
+./data_points_generator in cube inCube.off 10000 3 5.8
=> generates a inCube.off file with 10000 points randomized in a cube of dimension 3 and side 5.8
diff --git a/scripts/generate_version.sh b/scripts/generate_version.sh
deleted file mode 100755
index f999c6c4..00000000
--- a/scripts/generate_version.sh
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/bash
-#usage bash generate_version.sh : dont generate if svn st non empty
-#usage bash generate_version.sh -f : generate even if svn is empty
-#usage bash generate_version.sh -f DIR : generate even if svn is empty and save library in dir
-#
-# 23/06/2015 - Remove source, add biblio, and doc
-# 06/10/2015 - Replace static Version.txt with generated GUDHIVersion.cmake file
-# VERSION CHECK
-ROOT_DIR=..
-VERSION_FILE="$ROOT_DIR/GUDHIVersion.cmake"
-
-if [ ! -f $VERSION_FILE ]; then
- echo "File not found! : $VERSION_FILE - Please launch cmake first to generate file"
- exit 1
-fi
-
-# SVN STATUS CHECK OR IF FORCED BY USER
-if [ "$1" != "-f" ]
-then
- SVN_STATUS=`svn status $ROOT_DIR | grep -v $VERSION_FILE`
- echo $SVN_STATUS
-fi
-
-
-TARGET_DIR=""
-if [ "$2" != "-f" ]
-then
- TARGET_DIR=$2
- echo "Install folder : $TARGET_DIR"
-fi
-
-if [ "$SVN_STATUS" != "" ]
-then
- echo "Svn status must be empty to create a version!"
- exit 1
-fi
-
-# TEMPORARY FOLDER CREATION
-VERSION_DATE=`date +"%Y-%m-%d-%H-%M-%S"`
-GUDHI="_GUDHI_"
-VERSION_REVISION=`cat $VERSION_FILE`
-VERSION_DIR="$VERSION_DATE$GUDHI$VERSION_REVISION"
-echo $VERSION_DIR
-mkdir "$VERSION_DIR"
-
-# TOP LEVEL FILE COPY
-cp $ROOT_DIR/README $VERSION_DIR
-cp $ROOT_DIR/Conventions.txt $VERSION_DIR
-cp $ROOT_DIR/COPYING $VERSION_DIR
-cp -R $ROOT_DIR/data $VERSION_DIR
-cp $ROOT_DIR/src/CMakeLists.txt $VERSION_DIR
-cp $ROOT_DIR/src/Doxyfile $VERSION_DIR
-cp -R $ROOT_DIR/biblio $VERSION_DIR
-cp $ROOT_DIR/src/GUDHIConfigVersion.cmake.in $VERSION_DIR
-cp $ROOT_DIR/src/GUDHIConfig.cmake.in $VERSION_DIR
-cp $ROOT_DIR/CMakeGUDHIVersion.txt $VERSION_DIR
-cp $ROOT_DIR/GUDHIVersion.cmake.in $VERSION_DIR
-
-# PACKAGE LEVEL COPY
-PACKAGE_INC_DIR="/include"
-PACKAGE_EX_DIR="/example"
-PACKAGE_CONCEPT_DIR="/concept"
-PACKAGE_DOC_DIR="/doc"
-for package in `ls $ROOT_DIR/src/`
-do
- if [ -d "$ROOT_DIR/src/$package" ] && [ $package != "Bottleneck" ]
- then
- echo $package
- if [ "$package" == "cmake" ]
- then
- # SPECIFIC FOR CMAKE MODULES
- cp -R $ROOT_DIR/src/$package $VERSION_DIR
- elif [ "$package" == "GudhUI" ]
- then
- # SPECIFIC FOR GUDHI USER INTERFACE
- cp -R $ROOT_DIR/src/$package $VERSION_DIR
- elif [ "$package" == "cython" ]
- then
- # SPECIFIC FOR CYTHON INTERFACE
- cp -R $ROOT_DIR/src/$package $VERSION_DIR
- else
- # PACKAGE COPY
- if [ -d "$ROOT_DIR/src/$package$PACKAGE_INC_DIR" ]
- then
- if [ ! -d "$VERSION_DIR$PACKAGE_INC_DIR" ]
- then
- # MUST CREATE DIRECTORY ON FIRST LOOP
- mkdir $VERSION_DIR$PACKAGE_INC_DIR
- fi
- cp -R $ROOT_DIR/src/$package$PACKAGE_INC_DIR/* $VERSION_DIR$PACKAGE_INC_DIR/
- fi
- if [ -d "$ROOT_DIR/src/$package$PACKAGE_EX_DIR" ]
- then
- mkdir -p $VERSION_DIR$PACKAGE_EX_DIR/$package
- cp -R $ROOT_DIR/src/$package$PACKAGE_EX_DIR/* $VERSION_DIR$PACKAGE_EX_DIR/$package
- fi
- if [ -d "$ROOT_DIR/src/$package$PACKAGE_CONCEPT_DIR" ]
- then
- mkdir -p $VERSION_DIR$PACKAGE_CONCEPT_DIR/$package
- cp -R $ROOT_DIR/src/$package$PACKAGE_CONCEPT_DIR/* $VERSION_DIR$PACKAGE_CONCEPT_DIR/$package
- fi
- if [ -d "$ROOT_DIR/src/$package$PACKAGE_DOC_DIR" ]
- then
- mkdir -p $VERSION_DIR$PACKAGE_DOC_DIR/$package
- cp -R $ROOT_DIR/src/$package$PACKAGE_DOC_DIR/* $VERSION_DIR$PACKAGE_DOC_DIR/$package
- fi
- fi
- fi
-done
-
-
-#INSTALL to some directory
-if [ "$TARGET_DIR" != "" ]; then
- echo "Install in dir $TARGET_DIR"
- mv "$VERSION_DIR" "$TARGET_DIR"
-else
- # ZIP DIR AND REMOVE IT
- tar -zcf "$VERSION_DIR.tar.gz" "$VERSION_DIR"
- rm -rf "$VERSION_DIR"
-fi
-
-
-
-
diff --git a/src/Alpha_complex/doc/Intro_alpha_complex.h b/src/Alpha_complex/doc/Intro_alpha_complex.h
index 3ffdae7f..cf1a946a 100644
--- a/src/Alpha_complex/doc/Intro_alpha_complex.h
+++ b/src/Alpha_complex/doc/Intro_alpha_complex.h
@@ -71,7 +71,7 @@ namespace alpha_complex {
*
* When launching:
*
- * \code $> ./alphapoints
+ * \code $> ./Alpha_complex_example_from_points
* \endcode
*
* the program output is:
@@ -89,31 +89,64 @@ namespace alpha_complex {
* \image html "alpha_complex_doc.png" "Simplicial complex structure construction example"
*
* \subsection filtrationcomputation Filtration value computation algorithm
- *
- * \f{algorithm}{
- * \caption{Filtration value computation algorithm}\label{alpha}
- * \begin{algorithmic}
- * \For{i : dimension $\rightarrow$ 0}
- * \ForAll{$\sigma$ of dimension i}
- * \If {filtration($\sigma$) is NaN}
- * \State filtration($\sigma$) = $\alpha^2(\sigma)$
- * \EndIf
- * \ForAll{$\tau$ face of $\sigma$} \Comment{propagate alpha filtration value}
- * \If {filtration($\tau$) is not NaN}
- * \State filtration($\tau$) = min (filtration($\tau$), filtration($\sigma$))
- * \Else
- * \If {$\tau$ is not Gabriel for $\sigma$}
- * \State filtration($\tau$) = filtration($\sigma$)
- * \EndIf
- * \EndIf
- * \EndFor
- * \EndFor
- * \EndFor
- * \State make\_filtration\_non\_decreasing()
- * \State prune\_above\_filtration()
- * \end{algorithmic}
- * \f}
- *
+ *
+ *
+ *
+ * <ul>
+ * <li style="list-style-type: none;">\f$ \textbf{for } i : dimension \rightarrow 0 \textbf{ do} \f$
+ * <ul>
+ * <li style="list-style-type: none;">\f$\textbf{for all } \sigma of dimension i \f$
+ * <ul>
+ * <li style="list-style-type: none;">\f$\textbf{if } filtration( \sigma ) is NaN \textbf{ then} \f$
+ * <ul>
+ * <li style="list-style-type: none;">\f$ filtration( \sigma ) = \alpha^2( \sigma ) \f$
+ * </li>
+ * </ul>
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{end if}\f$
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{for all } \tau face of \sigma \textbf{ do} \f$
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// propagate alpha filtration value
+ * <ul>
+ * <li style="list-style-type: none;">\f$\textbf{if } filtration( \tau ) is not NaN \textbf{ then} \f$
+ * <ul>
+ * <li style="list-style-type: none;">\f$ filtration( \tau ) = min ( filtration( \tau ), filtration( \sigma ) ) \f$
+ * </li>
+ * </ul>
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{else}\f$
+ * <ul>
+ * <li style="list-style-type: none;">\f$\textbf{if } \tau is not Gabriel for \sigma \textbf{ then} \f$
+ * <ul>
+ * <li style="list-style-type: none;">\f$ filtration( \tau ) = filtration( \sigma ) \f$
+ * </li>
+ * </ul>
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{end if}\f$
+ * </li>
+ * </ul>
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{end if}\f$
+ * </li>
+ * </ul>
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{end for}\f$
+ * </li>
+ * </ul>
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{end for}\f$
+ * </li>
+ * </ul>
+ * </li>
+ * <li style="list-style-type: none;">\f$\textbf{end for}\f$
+ * </li>
+ * <li style="list-style-type: none;">\f$make\_filtration\_non\_decreasing()\f$
+ * </li>
+ * <li style="list-style-type: none;">\f$prune\_above\_filtration()\f$
+ * </li>
+ * </ul>
+ *
+ *
* \subsubsection dimension2 Dimension 2
*
* From the example above, it means the algorithm looks into each triangle ([0,1,2], [0,2,4], [1,2,3], ...),
@@ -155,7 +188,7 @@ namespace alpha_complex {
*
* When launching:
*
- * \code $> ./alphaoffreader ../../data/points/alphacomplexdoc.off 32.0
+ * \code $> ./Alpha_complex_example_from_off ../../data/points/alphacomplexdoc.off 32.0
* \endcode
*
* the program output is:
diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt
index b9bcdb55..a4853d78 100644
--- a/src/Alpha_complex/example/CMakeLists.txt
+++ b/src/Alpha_complex/example/CMakeLists.txt
@@ -4,26 +4,29 @@ project(Alpha_complex_examples)
# need CGAL 4.7
# cmake -DCGAL_DIR=~/workspace/CGAL-4.7 ..
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
- add_executable ( alphapoints Alpha_complex_from_points.cpp )
- target_link_libraries(alphapoints ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY})
- add_executable ( alphaoffreader Alpha_complex_from_off.cpp )
- target_link_libraries(alphaoffreader ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY})
+ add_executable ( Alpha_complex_example_from_points Alpha_complex_from_points.cpp )
+ target_link_libraries(Alpha_complex_example_from_points ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY})
+ add_executable ( Alpha_complex_example_from_off Alpha_complex_from_off.cpp )
+ target_link_libraries(Alpha_complex_example_from_off ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(alphapoints ${TBB_LIBRARIES})
- target_link_libraries(alphaoffreader ${TBB_LIBRARIES})
+ target_link_libraries(Alpha_complex_example_from_points ${TBB_LIBRARIES})
+ target_link_libraries(Alpha_complex_example_from_off ${TBB_LIBRARIES})
endif()
- add_test(alphapoints ${CMAKE_CURRENT_BINARY_DIR}/alphapoints)
- # Do not forget to copy test files in current binary dir
- file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- add_test(alphaoffreader_doc_60 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader alphacomplexdoc.off 60.0 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt)
- add_test(alphaoffreader_doc_32 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader alphacomplexdoc.off 32.0 ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt)
+ add_test(NAME Alpha_complex_example_from_points COMMAND $<TARGET_FILE:Alpha_complex_example_from_points>)
+
+ add_test(NAME Alpha_complex_example_from_off_60 COMMAND $<TARGET_FILE:Alpha_complex_example_from_off>
+ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" "60.0" "${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt")
+ add_test(NAME Alpha_complex_example_from_off_32 COMMAND $<TARGET_FILE:Alpha_complex_example_from_off>
+ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" "32.0" "${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt")
if (DIFF_PATH)
# Do not forget to copy test results files in current binary dir
file(COPY "alphaoffreader_for_doc_32.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "alphaoffreader_for_doc_60.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- add_test(alphaoffreader_doc_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt)
- add_test(alphaoffreader_doc_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt)
+ add_test(Alpha_complex_example_from_off_60_diff_files ${DIFF_PATH}
+ ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt)
+ add_test(Alpha_complex_example_from_off_32_diff_files ${DIFF_PATH}
+ ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt)
endif()
endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
diff --git a/src/Alpha_complex/test/CMakeLists.txt b/src/Alpha_complex/test/CMakeLists.txt
index 32091196..d7f49b53 100644
--- a/src/Alpha_complex/test/CMakeLists.txt
+++ b/src/Alpha_complex/test/CMakeLists.txt
@@ -1,28 +1,19 @@
cmake_minimum_required(VERSION 2.6)
project(Alpha_complex_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
-
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
- add_executable ( AlphaComplexUT Alpha_complex_unit_test.cpp )
- target_link_libraries(AlphaComplexUT ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+ include(GUDHI_test_coverage)
+
+ add_executable ( Alpha_complex_test_unit Alpha_complex_unit_test.cpp )
+ target_link_libraries(Alpha_complex_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(AlphaComplexUT ${TBB_LIBRARIES})
+ target_link_libraries(Alpha_complex_test_unit ${TBB_LIBRARIES})
endif()
# Do not forget to copy test files in current binary dir
file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- add_test(AlphaComplexUT ${CMAKE_CURRENT_BINARY_DIR}/AlphaComplexUT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/AlphaComplexUT.xml --log_level=test_suite --report_level=no)
+ gudhi_add_coverage_test(Alpha_complex_test_unit)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
diff --git a/src/Alpha_complex/test/README b/src/Alpha_complex/test/README
index 45b87d91..0e5b9eb1 100644
--- a/src/Alpha_complex/test/README
+++ b/src/Alpha_complex/test/README
@@ -7,6 +7,6 @@ make
To launch with details:
***********************
-./AlphaComplexUnitTest --report_level=detailed --log_level=all
+./Alpha_complex_unit_test --report_level=detailed --log_level=all
==> echo $? returns 0 in case of success (non-zero otherwise)
diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
index af87687d..67735ba1 100644
--- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
+++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex.cpp
@@ -27,8 +27,9 @@
// standard stuff
#include <iostream>
-#include <sstream>
+#include <string>
#include <vector>
+#include <cstddef>
int main(int argc, char** argv) {
std::cout << "This program computes persistent homology, by using bitmap_cubical_complex class, of cubical " <<
@@ -38,9 +39,6 @@ int main(int argc, char** argv) {
"filtrations of top dimensional cells. We assume that the cells are in the lexicographical order. See " <<
"CubicalOneSphere.txt or CubicalTwoSphere.txt for example.\n" << std::endl;
- int p = 2;
- double min_persistence = 0;
-
if (argc != 2) {
std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at " <<
"the input. The program will now terminate.\n";
@@ -56,16 +54,26 @@ int main(int argc, char** argv) {
// Compute the persistence diagram of the complex
Persistent_cohomology pcoh(b);
+ int p = 2;
+ double min_persistence = 0;
+
pcoh.init_coefficients(p); // initializes the coefficient field for homology
pcoh.compute_persistent_cohomology(min_persistence);
-
- std::stringstream ss;
- ss << argv[1] << "_persistence";
- std::ofstream out(ss.str().c_str());
+
+ std::string output_file_name(argv[1]);
+ output_file_name += "_persistence";
+
+ std::size_t last_in_path = output_file_name.find_last_of("/\\");
+
+ if (last_in_path != std::string::npos) {
+ output_file_name = output_file_name.substr(last_in_path+1);
+ }
+
+ std::ofstream out(output_file_name.c_str());
pcoh.output_diagram(out);
out.close();
- std::cout << "Result in file: " << ss.str().c_str() << "\n";
+ std::cout << "Result in file: " << output_file_name << "\n";
return 0;
}
diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
index 839a4c89..f8754345 100644
--- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
+++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp
@@ -40,9 +40,6 @@ int main(int argc, char** argv) {
"assume that the cells are in the lexicographical order. See CubicalOneSphere.txt or CubicalTwoSphere.txt for" <<
" example.\n" << std::endl;
- int p = 2;
- double min_persistence = 0;
-
if (argc != 2) {
std::cerr << "Wrong number of parameters. Please provide the name of a file with a Perseus style bitmap at " <<
"the input. The program will now terminate.\n";
@@ -58,16 +55,26 @@ int main(int argc, char** argv) {
typedef Gudhi::persistent_cohomology::Persistent_cohomology<Bitmap_cubical_complex, Field_Zp> Persistent_cohomology;
// Compute the persistence diagram of the complex
Persistent_cohomology pcoh(b, true);
+
+ int p = 2;
+ double min_persistence = 0;
pcoh.init_coefficients(p); // initializes the coefficient field for homology
pcoh.compute_persistent_cohomology(min_persistence);
- std::stringstream ss;
- ss << argv[1] << "_persistence";
- std::ofstream out(ss.str().c_str());
+ std::string output_file_name(argv[1]);
+ output_file_name += "_persistence";
+
+ std::size_t last_in_path = output_file_name.find_last_of("/\\");
+
+ if (last_in_path != std::string::npos) {
+ output_file_name = output_file_name.substr(last_in_path+1);
+ }
+
+ std::ofstream out(output_file_name.c_str());
pcoh.output_diagram(out);
out.close();
- std::cout << "Result in file: " << ss.str().c_str() << "\n";
+ std::cout << "Result in file: " << output_file_name << "\n";
return 0;
}
diff --git a/src/Bitmap_cubical_complex/example/CMakeLists.txt b/src/Bitmap_cubical_complex/example/CMakeLists.txt
index 2fddc514..241a11e5 100644
--- a/src/Bitmap_cubical_complex/example/CMakeLists.txt
+++ b/src/Bitmap_cubical_complex/example/CMakeLists.txt
@@ -6,21 +6,31 @@ target_link_libraries(Bitmap_cubical_complex ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Bitmap_cubical_complex ${TBB_LIBRARIES})
endif()
-add_test(Bitmap_cubical_complex_one_sphere ${CMAKE_CURRENT_BINARY_DIR}/Bitmap_cubical_complex ${CMAKE_SOURCE_DIR}/data/bitmap/CubicalOneSphere.txt)
-add_test(Bitmap_cubical_complex_two_sphere ${CMAKE_CURRENT_BINARY_DIR}/Bitmap_cubical_complex ${CMAKE_SOURCE_DIR}/data/bitmap/CubicalTwoSphere.txt)
+
+add_test(NAME Bitmap_cubical_complex_example_persistence_one_sphere COMMAND $<TARGET_FILE:Bitmap_cubical_complex>
+ "${CMAKE_SOURCE_DIR}/data/bitmap/CubicalOneSphere.txt")
+
+add_test(NAME Bitmap_cubical_complex_example_persistence_two_sphere COMMAND $<TARGET_FILE:Bitmap_cubical_complex>
+ "${CMAKE_SOURCE_DIR}/data/bitmap/CubicalTwoSphere.txt")
add_executable ( Random_bitmap_cubical_complex Random_bitmap_cubical_complex.cpp )
target_link_libraries(Random_bitmap_cubical_complex ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Random_bitmap_cubical_complex ${TBB_LIBRARIES})
endif()
-add_test(Random_bitmap_cubical_complex ${CMAKE_CURRENT_BINARY_DIR}/Random_bitmap_cubical_complex 2 100 100)
+add_test(NAME Bitmap_cubical_complex_example_random COMMAND $<TARGET_FILE:Random_bitmap_cubical_complex>
+ "2" "100" "100")
add_executable ( Bitmap_cubical_complex_periodic_boundary_conditions Bitmap_cubical_complex_periodic_boundary_conditions.cpp )
target_link_libraries(Bitmap_cubical_complex_periodic_boundary_conditions ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Bitmap_cubical_complex_periodic_boundary_conditions ${TBB_LIBRARIES})
endif()
-add_test(Bitmap_cubical_complex_periodic_2d_torus ${CMAKE_CURRENT_BINARY_DIR}/Bitmap_cubical_complex_periodic_boundary_conditions ${CMAKE_SOURCE_DIR}/data/bitmap/2d_torus.txt)
-add_test(Bitmap_cubical_complex_periodic_3d_torus ${CMAKE_CURRENT_BINARY_DIR}/Bitmap_cubical_complex_periodic_boundary_conditions ${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt)
+add_test(NAME Bitmap_cubical_complex_example_periodic_boundary_conditions_2d_torus
+ COMMAND $<TARGET_FILE:Bitmap_cubical_complex_periodic_boundary_conditions>
+ "${CMAKE_SOURCE_DIR}/data/bitmap/2d_torus.txt")
+
+add_test(NAME Bitmap_cubical_complex_example_periodic_boundary_conditions_3d_torus
+ COMMAND $<TARGET_FILE:Bitmap_cubical_complex_periodic_boundary_conditions>
+ "${CMAKE_SOURCE_DIR}/data/bitmap/3d_torus.txt")
diff --git a/src/Bitmap_cubical_complex/test/CMakeLists.txt b/src/Bitmap_cubical_complex/test/CMakeLists.txt
index daf0e14f..b2895f85 100644
--- a/src/Bitmap_cubical_complex/test/CMakeLists.txt
+++ b/src/Bitmap_cubical_complex/test/CMakeLists.txt
@@ -1,24 +1,12 @@
cmake_minimum_required(VERSION 2.6)
project(Bitmap_cubical_complex_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
+include(GUDHI_test_coverage)
-add_executable ( BitmapCCUT Bitmap_test.cpp )
-target_link_libraries(BitmapCCUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Bitmap_cubical_complex_test_unit Bitmap_test.cpp )
+target_link_libraries(Bitmap_cubical_complex_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(BitmapCCUT ${TBB_LIBRARIES})
+ target_link_libraries(Bitmap_cubical_complex_test_unit ${TBB_LIBRARIES})
endif()
-# Unitary tests
-add_test(NAME BitmapCCUT
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/BitmapCCUT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/BitmapCCUT.xml --log_level=test_suite --report_level=no)
-
+gudhi_add_coverage_test(Bitmap_cubical_complex_test_unit)
diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt
index b0a19f8b..0d0bff45 100644
--- a/src/Bottleneck_distance/example/CMakeLists.txt
+++ b/src/Bottleneck_distance/example/CMakeLists.txt
@@ -5,8 +5,6 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
add_executable (bottleneck_read_file_example bottleneck_read_file_example.cpp)
add_executable (bottleneck_basic_example bottleneck_basic_example.cpp)
- add_test(bottleneck_basic_example ${CMAKE_CURRENT_BINARY_DIR}/bottleneck_basic_example)
-
add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp)
target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (TBB_FOUND)
@@ -14,7 +12,11 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
target_link_libraries(bottleneck_basic_example ${TBB_LIBRARIES})
target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES})
endif(TBB_FOUND)
- add_test(alpha_rips_persistence_bottleneck_distance ${CMAKE_CURRENT_BINARY_DIR}/alpha_rips_persistence_bottleneck_distance
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -r 0.15 -m 0.12 -d 3 -p 3)
+
+ add_test(NAME Bottleneck_distance_example_basic COMMAND $<TARGET_FILE:bottleneck_basic_example>)
+
+ add_test(NAME Bottleneck_distance_example_alpha_rips_persistence_bottleneck
+ COMMAND $<TARGET_FILE:alpha_rips_persistence_bottleneck_distance>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.15" "-m" "0.12" "-d" "3" "-p" "3")
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp b/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp
index fd9f0858..fd164b22 100644
--- a/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp
+++ b/src/Bottleneck_distance/example/alpha_rips_persistence_bottleneck_distance.cpp
@@ -74,7 +74,7 @@ int main(int argc, char * argv[]) {
// --------------------------------------------
// Rips persistence
// --------------------------------------------
- Rips_complex rips_complex(off_reader.get_point_cloud(), threshold, Euclidean_distance());
+ Rips_complex rips_complex(off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
// Construct the Rips complex in a Simplex Tree
Simplex_tree rips_stree;
diff --git a/src/Bottleneck_distance/include/gudhi/Bottleneck.h b/src/Bottleneck_distance/include/gudhi/Bottleneck.h
index b90a0ee0..8c97dce9 100644
--- a/src/Bottleneck_distance/include/gudhi/Bottleneck.h
+++ b/src/Bottleneck_distance/include/gudhi/Bottleneck.h
@@ -101,11 +101,11 @@ double bottleneck_distance_exact(Persistence_graph& g) {
*/
template<typename Persistence_diagram1, typename Persistence_diagram2>
double bottleneck_distance(const Persistence_diagram1 &diag1, const Persistence_diagram2 &diag2,
- double e = std::numeric_limits<double>::min()) {
+ double e = (std::numeric_limits<double>::min)()) {
Persistence_graph g(diag1, diag2, e);
if (g.bottleneck_alive() == std::numeric_limits<double>::infinity())
return std::numeric_limits<double>::infinity();
- return std::max(g.bottleneck_alive(), e == 0. ? bottleneck_distance_exact(g) : bottleneck_distance_approx(g, e));
+ return (std::max)(g.bottleneck_alive(), e == 0. ? bottleneck_distance_exact(g) : bottleneck_distance_approx(g, e));
}
} // namespace persistence_diagram
diff --git a/src/Bottleneck_distance/include/gudhi/Graph_matching.h b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
index e1708c5b..f51e22e9 100644
--- a/src/Bottleneck_distance/include/gudhi/Graph_matching.h
+++ b/src/Bottleneck_distance/include/gudhi/Graph_matching.h
@@ -26,7 +26,8 @@
#include <gudhi/Neighbors_finder.h>
#include <vector>
-#include <list>
+#include <unordered_set>
+#include <algorithm>
namespace Gudhi {
@@ -40,8 +41,6 @@ class Graph_matching {
public:
/** \internal \brief Constructor constructing an empty matching. */
explicit Graph_matching(Persistence_graph &g);
- /** \internal \brief Copy operator. */
- Graph_matching& operator=(const Graph_matching& m);
/** \internal \brief Is the matching perfect ? */
bool perfect() const;
/** \internal \brief Augments the matching with a maximal set of edge-disjoint shortest augmenting paths. */
@@ -50,12 +49,12 @@ class Graph_matching {
void set_r(double r);
private:
- Persistence_graph& g;
+ Persistence_graph* gp;
double r;
/** \internal \brief Given a point from V, provides its matched point in U, null_point_index() if there isn't. */
std::vector<int> v_to_u;
/** \internal \brief All the unmatched points in U. */
- std::list<int> unmatched_in_u;
+ std::unordered_set<int> unmatched_in_u;
/** \internal \brief Provides a Layered_neighbors_finder dividing the graph in layers. Basically a BFS. */
Layered_neighbors_finder layering() const;
@@ -66,17 +65,9 @@ class Graph_matching {
};
inline Graph_matching::Graph_matching(Persistence_graph& g)
- : g(g), r(0.), v_to_u(g.size(), null_point_index()), unmatched_in_u() {
+ : gp(&g), r(0.), v_to_u(g.size(), null_point_index()), unmatched_in_u(g.size()) {
for (int u_point_index = 0; u_point_index < g.size(); ++u_point_index)
- unmatched_in_u.emplace_back(u_point_index);
-}
-
-inline Graph_matching& Graph_matching::operator=(const Graph_matching& m) {
- g = m.g;
- r = m.r;
- v_to_u = m.v_to_u;
- unmatched_in_u = m.unmatched_in_u;
- return *this;
+ unmatched_in_u.insert(u_point_index);
}
inline bool Graph_matching::perfect() const {
@@ -88,12 +79,12 @@ inline bool Graph_matching::multi_augment() {
return false;
Layered_neighbors_finder layered_nf(layering());
int max_depth = layered_nf.vlayers_number()*2 - 1;
- double rn = sqrt(g.size());
+ double rn = sqrt(gp->size());
// verification of a necessary criterion in order to shortcut if possible
if (max_depth < 0 || (unmatched_in_u.size() > rn && max_depth >= rn))
return false;
bool successful = false;
- std::list<int> tries(unmatched_in_u);
+ std::vector<int> tries(unmatched_in_u.cbegin(), unmatched_in_u.cend());
for (auto it = tries.cbegin(); it != tries.cend(); it++)
// 'augment' has side-effects which have to be always executed, don't change order
successful = augment(layered_nf, *it, max_depth) || successful;
@@ -133,12 +124,12 @@ inline bool Graph_matching::augment(Layered_neighbors_finder & layered_nf, int u
}
inline Layered_neighbors_finder Graph_matching::layering() const {
- std::list<int> u_vertices(unmatched_in_u);
- std::list<int> v_vertices;
- Neighbors_finder nf(g, r);
- for (int v_point_index = 0; v_point_index < g.size(); ++v_point_index)
+ std::vector<int> u_vertices(unmatched_in_u.cbegin(), unmatched_in_u.cend());
+ std::vector<int> v_vertices;
+ Neighbors_finder nf(*gp, r);
+ for (int v_point_index = 0; v_point_index < gp->size(); ++v_point_index)
nf.add(v_point_index);
- Layered_neighbors_finder layered_nf(g, r);
+ Layered_neighbors_finder layered_nf(*gp, r);
for (int layer = 0; !u_vertices.empty(); layer++) {
// one layer is one step in the BFS
for (auto it1 = u_vertices.cbegin(); it1 != u_vertices.cend(); ++it1) {
@@ -166,7 +157,8 @@ inline Layered_neighbors_finder Graph_matching::layering() const {
}
inline void Graph_matching::update(std::vector<int>& path) {
- unmatched_in_u.remove(path.front());
+ // Must return 1.
+ unmatched_in_u.erase(path.front());
for (auto it = path.cbegin(); it != path.cend(); ++it) {
// Be careful, the iterator is incremented twice each time
int tmp = *it;
diff --git a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h
index cd5486f8..bdc47578 100644
--- a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h
+++ b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h
@@ -25,9 +25,6 @@
// Inclusion order is important for CGAL patch
#include <CGAL/Kd_tree.h>
-#include <CGAL/Kd_tree_node.h>
-#include <CGAL/Orthogonal_k_neighbor_search.h>
-#include <CGAL/Weighted_Minkowski_distance.h>
#include <CGAL/Search_traits.h>
#include <gudhi/Persistence_graph.h>
@@ -40,6 +37,33 @@ namespace Gudhi {
namespace persistence_diagram {
+/** \internal \brief Variant of CGAL::Fuzzy_iso_box to ensure that the box ic closed. It isn't clear how necessary that is.
+ */
+struct Square_query {
+ typedef CGAL::Dimension_tag<2> D;
+ typedef Internal_point Point_d;
+ typedef double FT;
+ bool contains(Point_d p) const {
+ return std::abs(p.x()-c.x())<=size && std::abs(p.y()-c.y())<=size;
+ }
+ bool inner_range_intersects(CGAL::Kd_tree_rectangle<FT,D> const&r) const {
+ return
+ r.max_coord(0) >= c.x() - size &&
+ r.min_coord(0) <= c.x() + size &&
+ r.max_coord(1) >= c.y() - size &&
+ r.min_coord(1) <= c.y() + size;
+ }
+ bool outer_range_contains(CGAL::Kd_tree_rectangle<FT,D> const&r) const {
+ return
+ r.min_coord(0) >= c.x() - size &&
+ r.max_coord(0) <= c.x() + size &&
+ r.min_coord(1) >= c.y() - size &&
+ r.max_coord(1) <= c.y() + size;
+ }
+ Point_d c;
+ FT size;
+};
+
/** \internal \brief data structure used to find any point (including projections) in V near to a query point from U
* (which can be a projection).
*
@@ -51,9 +75,7 @@ namespace persistence_diagram {
class Neighbors_finder {
typedef CGAL::Dimension_tag<2> D;
typedef CGAL::Search_traits<double, Internal_point, const double*, Construct_coord_iterator, D> Traits;
- typedef CGAL::Weighted_Minkowski_distance<Traits> Distance;
- typedef CGAL::Orthogonal_k_neighbor_search<Traits, Distance> K_neighbor_search;
- typedef K_neighbor_search::Tree Kd_tree;
+ typedef CGAL::Kd_tree<Traits> Kd_tree;
public:
/** \internal \brief Constructor taking the near distance definition as parameter. */
@@ -123,15 +145,13 @@ inline int Neighbors_finder::pull_near(int u_point_index) {
} else {
// Is the query point near to a V point in the plane ?
Internal_point u_point = g.get_u_point(u_point_index);
- std::array<double, 2> w = {
- {1., 1.}
- };
- K_neighbor_search search(kd_t, u_point, 1, 0., true, Distance(0, 2, w.begin(), w.end()));
- auto it = search.begin();
- if (it == search.end() || g.distance(u_point_index, it->first.point_index) > r)
+ auto neighbor = kd_t.search_any_point(Square_query{u_point, r});
+ if(!neighbor)
return null_point_index();
- tmp = it->first.point_index;
- kd_t.remove(g.get_v_point(tmp));
+ tmp = neighbor->point_index;
+ auto point = g.get_v_point(tmp);
+ int idx = point.point_index;
+ kd_t.remove(point, [idx](Internal_point const&p){return p.point_index == idx;});
}
return tmp;
}
diff --git a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h
index 44f4b827..622b0691 100644
--- a/src/Bottleneck_distance/include/gudhi/Persistence_graph.h
+++ b/src/Bottleneck_distance/include/gudhi/Persistence_graph.h
@@ -102,7 +102,7 @@ Persistence_graph::Persistence_graph(const Persistence_diagram1 &diag1,
b_alive = std::numeric_limits<double>::infinity();
} else {
for (auto it_u = u_alive.cbegin(), it_v = v_alive.cbegin(); it_u != u_alive.cend(); ++it_u, ++it_v)
- b_alive = std::max(b_alive, std::fabs(*it_u - *it_v));
+ b_alive = (std::max)(b_alive, std::fabs(*it_u - *it_v));
}
}
@@ -129,7 +129,7 @@ inline double Persistence_graph::distance(int u_point_index, int v_point_index)
return 0.;
Internal_point p_u = get_u_point(u_point_index);
Internal_point p_v = get_v_point(v_point_index);
- return std::max(std::fabs(p_u.x() - p_v.x()), std::fabs(p_u.y() - p_v.y()));
+ return (std::max)(std::fabs(p_u.x() - p_v.x()), std::fabs(p_u.y() - p_v.y()));
}
inline int Persistence_graph::size() const {
@@ -175,9 +175,9 @@ inline Internal_point Persistence_graph::get_v_point(int v_point_index) const {
inline double Persistence_graph::diameter_bound() const {
double max = 0.;
for (auto it = u.cbegin(); it != u.cend(); it++)
- max = std::max(max, it->y());
+ max = (std::max)(max, it->y());
for (auto it = v.cbegin(); it != v.cend(); it++)
- max = std::max(max, it->y());
+ max = (std::max)(max, it->y());
return max;
}
diff --git a/src/Bottleneck_distance/test/CMakeLists.txt b/src/Bottleneck_distance/test/CMakeLists.txt
index 3d8e1f95..e1bbbbec 100644
--- a/src/Bottleneck_distance/test/CMakeLists.txt
+++ b/src/Bottleneck_distance/test/CMakeLists.txt
@@ -1,25 +1,15 @@
cmake_minimum_required(VERSION 2.6)
project(Bottleneck_distance_tests)
-
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
-
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
- add_executable ( bottleneckUT bottleneck_unit_test.cpp )
- target_link_libraries(bottleneckUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+ include(GUDHI_test_coverage)
+
+ add_executable ( Bottleneck_distance_test_unit bottleneck_unit_test.cpp )
+ target_link_libraries(Bottleneck_distance_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(bottleneckUT ${TBB_LIBRARIES})
+ target_link_libraries(Bottleneck_distance_test_unit ${TBB_LIBRARIES})
endif(TBB_FOUND)
- # Unitary tests
- add_test(NAME bottleneckUT COMMAND ${CMAKE_CURRENT_BINARY_DIR}/bottleneckUT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/bottleneckUT.xml --log_level=test_suite --report_level=no)
+ gudhi_add_coverage_test(Bottleneck_distance_test_unit)
+
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Bottleneck_distance/test/README b/src/Bottleneck_distance/test/README
index 0e7b8673..00bd9a91 100644
--- a/src/Bottleneck_distance/test/README
+++ b/src/Bottleneck_distance/test/README
@@ -7,6 +7,6 @@ make
To launch with details:
***********************
-./BottleneckUnitTest --report_level=detailed --log_level=all
+./Bottleneck_distance_unit_test --report_level=detailed --log_level=all
==> echo $? returns 0 in case of success (non-zero otherwise)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 678303de..fe4eb677 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.6)
project(GUDHI)
include("CMakeGUDHIVersion.txt")
-# Generate GUDHI official version file
-configure_file(GUDHIVersion.cmake.in "${CMAKE_SOURCE_DIR}/GUDHIVersion.cmake" @ONLY)
enable_testing()
@@ -11,10 +9,12 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules/")
# For "make doxygen"
set(GUDHI_USER_VERSION_DIR ${CMAKE_SOURCE_DIR})
-include(${CMAKE_MODULE_PATH}/GUDHI_doxygen_target.txt)
+include(GUDHI_doxygen_target)
+# 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")
+include(GUDHI_third_party_libraries)
if(MSVC)
# Turn off some VC++ warnings
@@ -62,12 +62,9 @@ add_subdirectory(utilities/Gudhi_stat/persistence_vectors)
# 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})
#---------------------------------------------------------------------------------------
diff --git a/src/Contraction/example/CMakeLists.txt b/src/Contraction/example/CMakeLists.txt
index 4c09a0a7..51a6832d 100644
--- a/src/Contraction/example/CMakeLists.txt
+++ b/src/Contraction/example/CMakeLists.txt
@@ -9,7 +9,10 @@ target_link_libraries(RipsContraction ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBR
target_link_libraries(GarlandHeckbert ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBRARY})
-add_test(RipsContraction.tore3D.0.2 ${CMAKE_CURRENT_BINARY_DIR}/RipsContraction ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 0.2)
+add_test(NAME Contraction_example_tore3D_0.2 COMMAND $<TARGET_FILE:RipsContraction>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "0.2")
# TODO(DS) : These tests are too long under Windows
-#add_test(RipsContraction.sphere.0.2 ${CMAKE_CURRENT_BINARY_DIR}/RipsContraction ${CMAKE_SOURCE_DIR}/data/points/sphere3D_2646.off 0.2)
-#add_test(RipsContraction.S0310000 ${CMAKE_CURRENT_BINARY_DIR}/RipsContraction ${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off 0.3)
+#add_test(NAME Contraction_example_sphere_0.2 COMMAND $<TARGET_FILE:RipsContraction>
+# "${CMAKE_SOURCE_DIR}/data/points/sphere3D_2646.off" "0.2")
+#add_test(NAME Contraction_example_SO3_0.3 COMMAND $<TARGET_FILE:RipsContraction>
+# "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off" "0.3")
diff --git a/src/Doxyfile b/src/Doxyfile
index f3782148..f4df4e84 100644
--- a/src/Doxyfile
+++ b/src/Doxyfile
@@ -1428,7 +1428,7 @@ FORMULA_TRANSPARENT = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
-USE_MATHJAX = NO
+USE_MATHJAX = YES
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
@@ -1451,14 +1451,14 @@ MATHJAX_FORMAT = HTML-CSS
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_RELPATH = ../common
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
@@ -1613,7 +1613,7 @@ PAPER_TYPE = a4
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES = amsfonts amsmath amssymb algorithm algpseudocode
+EXTRA_PACKAGES = amsfonts amsmath amssymb
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
diff --git a/src/Persistent_cohomology/benchmark/performance_rips_persistence.cpp b/src/Persistent_cohomology/benchmark/performance_rips_persistence.cpp
index ba752999..252e8aef 100644
--- a/src/Persistent_cohomology/benchmark/performance_rips_persistence.cpp
+++ b/src/Persistent_cohomology/benchmark/performance_rips_persistence.cpp
@@ -83,7 +83,7 @@ int main(int argc, char * argv[]) {
// Compute the proximity graph of the points
start = std::chrono::system_clock::now();
- Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
end = std::chrono::system_clock::now();
elapsed_sec = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
std::cout << "Compute Rips graph in " << elapsed_sec << " ms.\n";
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt
index a6b698c3..3c45e79b 100644
--- a/src/Persistent_cohomology/example/CMakeLists.txt
+++ b/src/Persistent_cohomology/example/CMakeLists.txt
@@ -32,20 +32,21 @@ if (TBB_FOUND)
target_link_libraries(persistence_from_file ${TBB_LIBRARIES})
endif()
-add_test(plain_homology ${CMAKE_CURRENT_BINARY_DIR}/plain_homology)
-add_test(persistence_from_simple_simplex_tree ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_simple_simplex_tree 1 0)
-add_test(rips_distance_matrix ${CMAKE_CURRENT_BINARY_DIR}/rips_distance_matrix_persistence
- ${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv -r 1.0 -d 3 -p 3 -m 0)
-add_test(rips_persistence_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -r 0.25 -m 0.5 -d 3 -p 3)
-add_test(rips_persistence_step_by_step_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence_step_by_step
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -r 0.25 -m 0.5 -d 3 -p 3)
-add_test(rips_persistence_via_boundary_matrix_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence_via_boundary_matrix
- ${CMAKE_SOURCE_DIR}/data/points/Kl.off -r 0.16 -d 3 -p 3 -m 100)
-add_test(persistence_from_file_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file
- ${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/bunny_5000_complex.fsc -p 2 -m 0)
-add_test(persistence_from_file_3_3_100 ${CMAKE_CURRENT_BINARY_DIR}/persistence_from_file
- ${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/bunny_5000_complex.fsc -p 3 -m 100)
+add_test(NAME Persistent_cohomology_example_plain_homology COMMAND $<TARGET_FILE:plain_homology>)
+add_test(NAME Persistent_cohomology_example_from_simple_simplex_tree COMMAND $<TARGET_FILE:persistence_from_simple_simplex_tree>
+ "1" "0")
+add_test(NAME Persistent_cohomology_example_from_rips_distance_matrix COMMAND $<TARGET_FILE:rips_distance_matrix_persistence>
+ "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" "-r" "1.0" "-d" "3" "-p" "3" "-m" "0")
+add_test(NAME Persistent_cohomology_example_from_rips_on_tore_3D COMMAND $<TARGET_FILE:rips_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3")
+add_test(NAME Persistent_cohomology_example_from_rips_step_by_step_on_tore_3D COMMAND $<TARGET_FILE:rips_persistence_step_by_step>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "3")
+add_test(NAME Persistent_cohomology_example_via_boundary_matrix COMMAND $<TARGET_FILE:rips_persistence_via_boundary_matrix>
+ "${CMAKE_SOURCE_DIR}/data/points/Kl.off" "-r" "0.16" "-d" "3" "-p" "3" "-m" "100")
+add_test(NAME Persistent_cohomology_example_from_file_3_2_0 COMMAND $<TARGET_FILE:persistence_from_file>
+ "${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/bunny_5000_complex.fsc" "-p" "2" "-m" "0")
+add_test(NAME Persistent_cohomology_example_from_file_3_3_100 COMMAND $<TARGET_FILE:persistence_from_file>
+ "${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/bunny_5000_complex.fsc" "-p" "3" "-m" "100")
if(GMP_FOUND)
if(GMPXX_FOUND)
@@ -55,8 +56,8 @@ if(GMP_FOUND)
if (TBB_FOUND)
target_link_libraries(rips_multifield_persistence ${TBB_LIBRARIES})
endif(TBB_FOUND)
- add_test(rips_multifield_persistence_2_71 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -r 0.25 -m 0.5 -d 3 -p 2 -q 71)
+ add_test(NAME Persistent_cohomology_example_multifield_2_71 COMMAND $<TARGET_FILE:rips_multifield_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-r" "0.25" "-m" "0.5" "-d" "3" "-p" "2" "-q" "71")
endif(GMPXX_FOUND)
endif(GMP_FOUND)
@@ -73,13 +74,12 @@ if(CGAL_FOUND)
target_link_libraries(exact_alpha_complex_3d_persistence ${TBB_LIBRARIES})
target_link_libraries(weighted_alpha_complex_3d_persistence ${TBB_LIBRARIES})
endif(TBB_FOUND)
- add_test(alpha_complex_3d_persistence_2_0_5 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_3d_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off 2 0.45)
- add_test(exact_alpha_complex_3d_persistence_2_0_5 ${CMAKE_CURRENT_BINARY_DIR}/exact_alpha_complex_3d_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off 2 0.45)
- add_test(weighted_alpha_complex_3d_persistence_2_0_5 ${CMAKE_CURRENT_BINARY_DIR}/weighted_alpha_complex_3d_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.weights 2 0.45)
-
+ add_test(NAME Persistent_cohomology_example_alpha_complex_3d COMMAND $<TARGET_FILE:alpha_complex_3d_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "2" "0.45")
+ add_test(NAME Persistent_cohomology_example_exact_alpha_complex_3d COMMAND $<TARGET_FILE:exact_alpha_complex_3d_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "2" "0.45")
+ add_test(NAME Persistent_cohomology_example_weighted_alpha_complex_3d COMMAND $<TARGET_FILE:weighted_alpha_complex_3d_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.weights" "2" "0.45")
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
add_executable (alpha_complex_persistence alpha_complex_persistence.cpp)
@@ -97,10 +97,10 @@ if(CGAL_FOUND)
target_link_libraries(periodic_alpha_complex_3d_persistence ${TBB_LIBRARIES})
target_link_libraries(custom_persistence_sort ${TBB_LIBRARIES})
endif(TBB_FOUND)
- add_test(alpha_complex_persistence_2_0_45 ${CMAKE_CURRENT_BINARY_DIR}/alpha_complex_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off -m 0.45 -p 2)
- add_test(periodic_alpha_complex_3d_persistence_2_0 ${CMAKE_CURRENT_BINARY_DIR}/periodic_alpha_complex_3d_persistence
- ${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off ${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt 2 0)
- add_test(custom_persistence_sort ${CMAKE_CURRENT_BINARY_DIR}/custom_persistence_sort)
+ add_test(NAME Persistent_cohomology_example_alpha_complex COMMAND $<TARGET_FILE:alpha_complex_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "-p" "2" "-m" "0.45")
+ add_test(NAME Persistent_cohomology_example_periodic_alpha_complex_3d COMMAND $<TARGET_FILE:periodic_alpha_complex_3d_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/grid_10_10_10_in_0_1.off" "${CMAKE_SOURCE_DIR}/data/points/iso_cuboid_3_in_0_1.txt" "2" "0")
+ add_test(NAME Persistent_cohomology_example_custom_persistence_sort COMMAND $<TARGET_FILE:custom_persistence_sort>)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
endif(CGAL_FOUND)
diff --git a/src/Persistent_cohomology/example/README b/src/Persistent_cohomology/example/README
index 2ac79398..794b94ae 100644
--- a/src/Persistent_cohomology/example/README
+++ b/src/Persistent_cohomology/example/README
@@ -121,7 +121,7 @@ N.B.: - alpha_complex_persistence accepts OFF files in d-Dimension.
3) 3D periodic special case
---------------------------
-./periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off 3 1.0
+./periodic_alpha_complex_3d_persistence ../../data/points/grid_10_10_10_in_0_1.off ../../data/points/iso_cuboid_3_in_0_1.txt 3 1.0
output:
Periodic Delaunay computed.
diff --git a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
index 7674b5a5..dae36ed2 100644
--- a/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_multifield_persistence.cpp
@@ -62,7 +62,7 @@ int main(int argc, char * argv[]) {
program_options(argc, argv, off_file_points, filediag, threshold, dim_max, min_p, max_p, min_persistence);
Points_off_reader off_reader(off_file_points);
- Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
// Construct the Rips complex in a Simplex Tree
Simplex_tree simplex_tree;
diff --git a/src/Persistent_cohomology/example/rips_persistence.cpp b/src/Persistent_cohomology/example/rips_persistence.cpp
index c6378de7..d504798b 100644
--- a/src/Persistent_cohomology/example/rips_persistence.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence.cpp
@@ -60,7 +60,7 @@ int main(int argc, char * argv[]) {
program_options(argc, argv, off_file_points, filediag, threshold, dim_max, p, min_persistence);
Points_off_reader off_reader(off_file_points);
- Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
// Construct the Rips complex in a Simplex Tree
Simplex_tree simplex_tree;
diff --git a/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp b/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
index b159c62e..554eeba6 100644
--- a/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence_step_by_step.cpp
@@ -82,7 +82,7 @@ int main(int argc, char * argv[]) {
// Compute the proximity graph of the points
Graph_t prox_graph = compute_proximity_graph(off_reader.get_point_cloud(), threshold
- , Euclidean_distance());
+ , Gudhi::Euclidean_distance());
// Construct the Rips complex in a Simplex Tree
Simplex_tree st;
diff --git a/src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp b/src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp
index 63da9847..9618f278 100644
--- a/src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp
+++ b/src/Persistent_cohomology/example/rips_persistence_via_boundary_matrix.cpp
@@ -70,7 +70,7 @@ int main(int argc, char * argv[]) {
program_options(argc, argv, off_file_points, filediag, threshold, dim_max, p, min_persistence);
Points_off_reader off_reader(off_file_points);
- Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
// Construct the Rips complex in a Simplex Tree
Simplex_tree& st = *new Simplex_tree;
diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
index 6f194f57..672fda48 100644
--- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
+++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h
@@ -597,25 +597,6 @@ class Persistent_cohomology {
<< cpx_->filtration(get<1>(pair)) << std::endl;
}
}
-
-
- /** @brief Vector of persistence intervals.
- * @return A vector of persistence intervals on a fixed dimension. Each persistence pair is represented as a pair of objects of a type Filtration_value.
- */
- std::vector< std::pair< Filtration_value , Filtration_value > > paris_in_dimension( unsigned dimension )
- {
- std::vector< std::pair< Filtration_value , Filtration_value > > result;
- //should I initialize this somehow locally?? Even to the size of persistent_pairs_ list.
- for (auto pair : persistent_pairs_)
- {
- if ( ( cpx_->dimension( get<0>(pair) ) == dimension ) && ( cpx_->null_simplex() != get<1>(pair) ) )
- {
- result.push_back( std::pair<Filtration_value , Filtration_value>(cpx_->filtration( get<0>(pair) ) , cpx_->filtration( get<1>(pair) ) ) );
- }
- }
- return result;
- }
-
/** @brief Returns Betti numbers.
* @return A vector of Betti numbers.
diff --git a/src/Persistent_cohomology/test/CMakeLists.txt b/src/Persistent_cohomology/test/CMakeLists.txt
index a21f39c4..11e9a951 100644
--- a/src/Persistent_cohomology/test/CMakeLists.txt
+++ b/src/Persistent_cohomology/test/CMakeLists.txt
@@ -1,49 +1,37 @@
cmake_minimum_required(VERSION 2.6)
project(Persistent_cohomology_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif(GCOVR_PATH)
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif(GPROF_PATH)
-
-add_executable ( PersistentCohomologyUT persistent_cohomology_unit_test.cpp )
-target_link_libraries(PersistentCohomologyUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
-add_executable ( BettiNumbersUT betti_numbers_unit_test.cpp )
-target_link_libraries(BettiNumbersUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+include(GUDHI_test_coverage)
+
+add_executable ( Persistent_cohomology_test_unit persistent_cohomology_unit_test.cpp )
+target_link_libraries(Persistent_cohomology_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Persistent_cohomology_test_betti_numbers betti_numbers_unit_test.cpp )
+target_link_libraries(Persistent_cohomology_test_betti_numbers ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(PersistentCohomologyUT ${TBB_LIBRARIES})
- target_link_libraries(BettiNumbersUT ${TBB_LIBRARIES})
+ target_link_libraries(Persistent_cohomology_test_unit ${TBB_LIBRARIES})
+ target_link_libraries(Persistent_cohomology_test_betti_numbers ${TBB_LIBRARIES})
endif(TBB_FOUND)
-# Unitary tests
-add_test(NAME PersistentCohomologyUT
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/PersistentCohomologyUT
- ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_unit_test.txt
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/PersistentCohomologyUT.xml --log_level=test_suite --report_level=no)
+# Do not forget to copy test results files in current binary dir
+file(COPY "${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_unit_test.txt"
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-add_test(NAME BettiNumbersUT
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/BettiNumbersUT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/BettiNumbersUT.xml --log_level=test_suite --report_level=no)
+# Unitary tests
+gudhi_add_coverage_test(Persistent_cohomology_test_unit)
+gudhi_add_coverage_test(Persistent_cohomology_test_betti_numbers)
if(GMPXX_FOUND AND GMP_FOUND)
- add_executable ( PersistentCohomologyMultiFieldUT persistent_cohomology_unit_test_multi_field.cpp )
- target_link_libraries(PersistentCohomologyMultiFieldUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
+ add_executable ( Persistent_cohomology_test_unit_multi_field persistent_cohomology_unit_test_multi_field.cpp )
+ target_link_libraries(Persistent_cohomology_test_unit_multi_field ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES})
if (TBB_FOUND)
- target_link_libraries(PersistentCohomologyMultiFieldUT ${TBB_LIBRARIES})
+ target_link_libraries(Persistent_cohomology_test_unit_multi_field ${TBB_LIBRARIES})
endif(TBB_FOUND)
+ # Do not forget to copy test results files in current binary dir
+ file(COPY "${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt"
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
# Unitary tests
- add_test(NAME PersistentCohomologyMultiFieldUT
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/PersistentCohomologyMultiFieldUT
- ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology/test/simplex_tree_file_for_multi_field_unit_test.txt
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/PersistentCohomologyMultiFieldUT.xml --log_level=test_suite --report_level=no)
+ gudhi_add_coverage_test(Persistent_cohomology_test_unit_multi_field)
endif(GMPXX_FOUND AND GMP_FOUND)
diff --git a/src/Persistent_cohomology/test/README b/src/Persistent_cohomology/test/README
index 6c64b5fe..0c41feed 100644
--- a/src/Persistent_cohomology/test/README
+++ b/src/Persistent_cohomology/test/README
@@ -11,13 +11,19 @@ To launch with details:
SINGLE FIELD
------------
-./PersistentCohomologyUT simplex_tree_file_for_unit_test.txt --report_level=detailed --log_level=all
+./Persistent_cohomology_test_unit --report_level=detailed --log_level=all
==> echo $? returns 0 in case of success (non-zero otherwise)
MULTI FIELD
-----------
-./PersistentCohomologyMultiFieldUT simplex_tree_file_for_multi_field_unit_test.txt --report_level=detailed --log_level=all
+./Persistent_cohomology_test_unit_multi_field --report_level=detailed --log_level=all
+
+ ==> echo $? returns 0 in case of success (non-zero otherwise)
+
+BETTI NUMBERS
+-------------
+./Persistent_cohomology_test_betti_numbers --report_level=detailed --log_level=all
==> echo $? returns 0 in case of success (non-zero otherwise)
diff --git a/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp b/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp
index 0ed3fddf..da418034 100644
--- a/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp
+++ b/src/Persistent_cohomology/test/betti_numbers_unit_test.cpp
@@ -9,8 +9,8 @@
#define BOOST_TEST_MODULE "betti_numbers"
#include <boost/test/unit_test.hpp>
-#include "gudhi/Simplex_tree.h"
-#include "gudhi/Persistent_cohomology.h"
+#include <gudhi/Simplex_tree.h>
+#include <gudhi/Persistent_cohomology.h>
struct MiniSTOptions : Gudhi::Simplex_tree_options_full_featured {
// Implicitly use 0 as filtration value for all simplices
diff --git a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
index 6efd749e..f8174020 100644
--- a/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
+++ b/src/Persistent_cohomology/test/persistent_cohomology_unit_test.cpp
@@ -10,10 +10,10 @@
#define BOOST_TEST_MODULE "persistent_cohomology"
#include <boost/test/unit_test.hpp>
-#include "gudhi/graph_simplicial_complex.h"
-#include "gudhi/reader_utils.h"
-#include "gudhi/Simplex_tree.h"
-#include "gudhi/Persistent_cohomology.h"
+#include <gudhi/graph_simplicial_complex.h>
+#include <gudhi/reader_utils.h>
+#include <gudhi/Simplex_tree.h>
+#include <gudhi/Persistent_cohomology.h>
using namespace Gudhi;
using namespace Gudhi::persistent_cohomology;
@@ -22,11 +22,9 @@ using namespace boost::unit_test;
typedef Simplex_tree<> typeST;
std::string test_rips_persistence(int coefficient, int min_persistence) {
- // file name is given as parameter from CMakeLists.txt
- const std::string inputFile(framework::master_test_suite().argv[1]);
-
+ // file is copied in CMakeLists.txt
std::ifstream simplex_tree_stream;
- simplex_tree_stream.open(inputFile.c_str());
+ simplex_tree_stream.open("simplex_tree_file_for_unit_test.txt");
typeST st;
simplex_tree_stream >> st;
simplex_tree_stream.close();
diff --git a/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp b/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp
index 1a6e3296..3537cfa4 100644
--- a/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp
+++ b/src/Persistent_cohomology/test/persistent_cohomology_unit_test_multi_field.cpp
@@ -9,11 +9,11 @@
#define BOOST_TEST_MODULE "persistent_cohomology_multi_field"
#include <boost/test/unit_test.hpp>
-#include "gudhi/graph_simplicial_complex.h"
-#include "gudhi/reader_utils.h"
-#include "gudhi/Simplex_tree.h"
-#include "gudhi/Persistent_cohomology.h"
-#include "gudhi/Persistent_cohomology/Multi_field.h"
+#include <gudhi/graph_simplicial_complex.h>
+#include <gudhi/reader_utils.h>
+#include <gudhi/Simplex_tree.h>
+#include <gudhi/Persistent_cohomology.h>
+#include <gudhi/Persistent_cohomology/Multi_field.h>
using namespace Gudhi;
using namespace Gudhi::persistent_cohomology;
@@ -22,11 +22,9 @@ using namespace boost::unit_test;
typedef Simplex_tree<> typeST;
std::string test_rips_persistence(int min_coefficient, int max_coefficient, double min_persistence) {
- // file name is given as parameter from CMakeLists.txt
- const std::string inputFile(framework::master_test_suite().argv[1]);
-
+ // file is copied in CMakeLists.txt
std::ifstream simplex_tree_stream;
- simplex_tree_stream.open(inputFile.c_str());
+ simplex_tree_stream.open("simplex_tree_file_for_multi_field_unit_test.txt");
typeST st;
simplex_tree_stream >> st;
simplex_tree_stream.close();
diff --git a/src/Rips_complex/doc/Intro_rips_complex.h b/src/Rips_complex/doc/Intro_rips_complex.h
index 8e374c09..124dfec9 100644
--- a/src/Rips_complex/doc/Intro_rips_complex.h
+++ b/src/Rips_complex/doc/Intro_rips_complex.h
@@ -77,7 +77,7 @@ namespace rips_complex {
* When launching (Rips maximal distance between 2 points is 12.0, is expanded until dimension 1 - one skeleton graph
* in other words):
*
- * \code $> ./oneskeletonripspoints
+ * \code $> ./Rips_complex_example_one_skeleton_from_points
* \endcode
*
* the program output is:
@@ -97,7 +97,7 @@ namespace rips_complex {
*
* When launching:
*
- * \code $> ./ripsoffreader ../../data/points/alphacomplexdoc.off 12.0 3
+ * \code $> ./Rips_complex_example_from_off ../../data/points/alphacomplexdoc.off 12.0 3
* \endcode
*
* the program output is:
@@ -120,7 +120,7 @@ namespace rips_complex {
* When launching (Rips maximal distance between 2 points is 1.0, is expanded until dimension 1 - one skeleton graph
* with other words):
*
- * \code $> ./oneskeletonripsdistance
+ * \code $> ./Rips_complex_example_one_skeleton_from_distance_matrix
* \endcode
*
* the program output is:
@@ -139,7 +139,7 @@ namespace rips_complex {
*
* When launching:
*
- * \code $> ./ripscsvdistancereader ../../data/distance_matrix/full_square_distance_matrix.csv 1.0 3
+ * \code $> ./Rips_complex_example_from_csv_distance_matrix ../../data/distance_matrix/full_square_distance_matrix.csv 1.0 3
* \endcode
*
* the program output is:
diff --git a/src/Rips_complex/example/CMakeLists.txt b/src/Rips_complex/example/CMakeLists.txt
index 070ac710..8aee79e2 100644
--- a/src/Rips_complex/example/CMakeLists.txt
+++ b/src/Rips_complex/example/CMakeLists.txt
@@ -2,37 +2,40 @@ cmake_minimum_required(VERSION 2.6)
project(Rips_complex_examples)
# Point cloud
-add_executable ( ripsoffreader example_rips_complex_from_off_file.cpp )
-target_link_libraries(ripsoffreader ${Boost_SYSTEM_LIBRARY})
+add_executable ( Rips_complex_example_from_off example_rips_complex_from_off_file.cpp )
+target_link_libraries(Rips_complex_example_from_off ${Boost_SYSTEM_LIBRARY})
-add_executable ( oneskeletonripspoints example_one_skeleton_rips_from_points.cpp )
-target_link_libraries(oneskeletonripspoints ${Boost_SYSTEM_LIBRARY})
+add_executable ( Rips_complex_example_one_skeleton_from_points example_one_skeleton_rips_from_points.cpp )
+target_link_libraries(Rips_complex_example_one_skeleton_from_points ${Boost_SYSTEM_LIBRARY})
# Distance matrix
-add_executable ( oneskeletonripsdistance example_one_skeleton_rips_from_distance_matrix.cpp )
-target_link_libraries(oneskeletonripsdistance ${Boost_SYSTEM_LIBRARY})
+add_executable ( Rips_complex_example_one_skeleton_from_distance_matrix example_one_skeleton_rips_from_distance_matrix.cpp )
+target_link_libraries(Rips_complex_example_one_skeleton_from_distance_matrix ${Boost_SYSTEM_LIBRARY})
-add_executable ( ripscsvdistancereader example_rips_complex_from_csv_distance_matrix_file.cpp )
-target_link_libraries(ripscsvdistancereader ${Boost_SYSTEM_LIBRARY})
+add_executable ( Rips_complex_example_from_csv_distance_matrix example_rips_complex_from_csv_distance_matrix_file.cpp )
+target_link_libraries(Rips_complex_example_from_csv_distance_matrix ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(ripsoffreader ${TBB_LIBRARIES})
- target_link_libraries(oneskeletonripspoints ${TBB_LIBRARIES})
- target_link_libraries(oneskeletonripsdistance ${TBB_LIBRARIES})
- target_link_libraries(ripscsvdistancereader ${TBB_LIBRARIES})
+ target_link_libraries(Rips_complex_example_from_off ${TBB_LIBRARIES})
+ target_link_libraries(Rips_complex_example_one_skeleton_from_points ${TBB_LIBRARIES})
+ target_link_libraries(Rips_complex_example_one_skeleton_from_distance_matrix ${TBB_LIBRARIES})
+ target_link_libraries(Rips_complex_example_from_csv_distance_matrix ${TBB_LIBRARIES})
endif()
-add_test(oneskeletonripspoints ${CMAKE_CURRENT_BINARY_DIR}/oneskeletonripspoints)
-add_test(oneskeletonripsdistance ${CMAKE_CURRENT_BINARY_DIR}/oneskeletonripsdistance)
+add_test(NAME Rips_complex_example_one_skeleton_from_points
+ COMMAND $<TARGET_FILE:Rips_complex_example_one_skeleton_from_points>)
+add_test(NAME Rips_complex_example_one_skeleton_from_distance_matrix
+ COMMAND $<TARGET_FILE:Rips_complex_example_one_skeleton_from_distance_matrix>)
-# Do not forget to copy test files in current binary dir
-file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-add_test(ripsoffreader_doc_12_1 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader alphacomplexdoc.off 12.0 1 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt)
-add_test(ripsoffreader_doc_12_3 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader alphacomplexdoc.off 12.0 3 ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt)
+add_test(NAME Rips_complex_example_from_off_doc_12_1 COMMAND $<TARGET_FILE:Rips_complex_example_from_off>
+ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" "12.0" "1" "${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt")
+add_test(NAME Rips_complex_example_from_off_doc_12_3 COMMAND $<TARGET_FILE:Rips_complex_example_from_off>
+ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" "12.0" "3" "${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt")
-file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-add_test(ripscsvdistancereader_doc_12_1 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvdistancereader full_square_distance_matrix.csv 12.0 1 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_1.txt)
-add_test(ripscsvdistancereader_doc_12_3 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvdistancereader full_square_distance_matrix.csv 12.0 3 ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt)
+add_test(NAME Rips_complex_example_from_csv_distance_matrix_doc_12_1 COMMAND $<TARGET_FILE:Rips_complex_example_from_csv_distance_matrix>
+ "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" "12.0" "1" "${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_1.txt")
+add_test(NAME Rips_complex_example_from_csv_distance_matrix_doc_12_3 COMMAND $<TARGET_FILE:Rips_complex_example_from_csv_distance_matrix>
+ "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" "12.0" "3" "${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt")
if (DIFF_PATH)
@@ -40,8 +43,16 @@ if (DIFF_PATH)
file(COPY "one_skeleton_rips_for_doc.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "full_skeleton_rips_for_doc.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
- add_test(ripsoffreader_doc_12_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt)
- add_test(ripsoffreader_doc_12_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt)
- add_test(ripscsvreader_doc_12_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt)
- add_test(ripscsvreader_doc_12_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt)
+ add_test(Rips_complex_example_from_off_doc_12_1_diff_files ${DIFF_PATH}
+ ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt
+ ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt)
+ add_test(Rips_complex_example_from_off_doc_12_3_diff_files ${DIFF_PATH}
+ ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt
+ ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt)
+ add_test(Rips_complex_example_from_csv_distance_matrix_doc_12_1_diff_files ${DIFF_PATH}
+ ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_1.txt
+ ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt)
+ add_test(Rips_complex_example_from_csv_distance_matrix_doc_12_3_diff_files ${DIFF_PATH}
+ ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt
+ ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt)
endif()
diff --git a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
index 3fd69ebc..a1db8910 100644
--- a/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
+++ b/src/Rips_complex/example/example_one_skeleton_rips_from_points.cpp
@@ -27,7 +27,7 @@ int main() {
// Init of a Rips complex from points
// ----------------------------------------------------------------------------
double threshold = 12.0;
- Rips_complex rips_complex_from_points(points, threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_points(points, threshold, Gudhi::Euclidean_distance());
Simplex_tree stree;
rips_complex_from_points.create_complex(stree, 1);
diff --git a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
index a1e4e255..de2e4ea4 100644
--- a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
+++ b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
@@ -32,7 +32,7 @@ int main(int argc, char **argv) {
// Init of a Rips complex from an OFF file
// ----------------------------------------------------------------------------
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
- Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
std::streambuf* streambufffer;
std::ofstream ouput_file_stream;
diff --git a/src/Rips_complex/test/CMakeLists.txt b/src/Rips_complex/test/CMakeLists.txt
index 87bad2ed..57f780f1 100644
--- a/src/Rips_complex/test/CMakeLists.txt
+++ b/src/Rips_complex/test/CMakeLists.txt
@@ -1,25 +1,16 @@
cmake_minimum_required(VERSION 2.6)
project(Rips_complex_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
+include(GUDHI_test_coverage)
-add_executable ( rips_complex_UT test_rips_complex.cpp )
-target_link_libraries(rips_complex_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Rips_complex_test_unit test_rips_complex.cpp )
+target_link_libraries(Rips_complex_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(rips_complex_UT ${TBB_LIBRARIES})
+ target_link_libraries(Rips_complex_test_unit ${TBB_LIBRARIES})
endif()
# Do not forget to copy test files in current binary dir
file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-add_test(rips_complex_UT ${CMAKE_CURRENT_BINARY_DIR}/rips_complex_UT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/rips_complex_UT.xml --log_level=test_suite --report_level=no)
+gudhi_add_coverage_test(Rips_complex_test_unit)
diff --git a/src/Rips_complex/test/test_rips_complex.cpp b/src/Rips_complex/test/test_rips_complex.cpp
index ae68ba0d..fc2179f2 100644
--- a/src/Rips_complex/test/test_rips_complex.cpp
+++ b/src/Rips_complex/test/test_rips_complex.cpp
@@ -60,7 +60,7 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) {
rips_threshold << "==========" << std::endl;
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
- Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), rips_threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), rips_threshold, Gudhi::Euclidean_distance());
const int DIMENSION_1 = 1;
Simplex_tree st;
@@ -89,10 +89,10 @@ BOOST_AUTO_TEST_CASE(RIPS_DOC_OFF_file) {
std::cout << vertex << ",";
vp.push_back(off_reader.get_point_cloud().at(vertex));
}
- std::cout << ") - distance =" << Euclidean_distance()(vp.at(0), vp.at(1)) <<
+ std::cout << ") - distance =" << Gudhi::Euclidean_distance()(vp.at(0), vp.at(1)) <<
" - filtration =" << st.filtration(f_simplex) << std::endl;
BOOST_CHECK(vp.size() == 2);
- BOOST_CHECK(are_almost_the_same(st.filtration(f_simplex), Euclidean_distance()(vp.at(0), vp.at(1))));
+ BOOST_CHECK(are_almost_the_same(st.filtration(f_simplex), Gudhi::Euclidean_distance()(vp.at(0), vp.at(1))));
}
}
@@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE(Rips_create_complex_throw) {
rips_threshold << "==========" << std::endl;
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
- Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), rips_threshold, Euclidean_distance());
+ Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), rips_threshold, Gudhi::Euclidean_distance());
Simplex_tree stree;
std::vector<int> simplex = {0, 1, 2};
diff --git a/src/Simplex_tree/doc/Intro_simplex_tree.h b/src/Simplex_tree/doc/Intro_simplex_tree.h
index 940dd694..f5b72ff6 100644
--- a/src/Simplex_tree/doc/Intro_simplex_tree.h
+++ b/src/Simplex_tree/doc/Intro_simplex_tree.h
@@ -32,7 +32,7 @@ namespace Gudhi {
* \author Cl&eacute;ment Maria
*
* A simplicial complex \f$\mathbf{K}\f$ on a set of vertices \f$V = \{1, \cdots ,|V|\}\f$ is a collection of
- * implices \f$\{\sigma\}\f$, \f$\sigma \subseteq V\f$ such that
+ * simplices \f$\{\sigma\}\f$, \f$\sigma \subseteq V\f$ such that
* \f$\tau \subseteq \sigma \in \mathbf{K} \rightarrow \tau \in \mathbf{K}\f$. The dimension \f$n=|\sigma|-1\f$ of
* \f$\sigma\f$ is its number of elements minus \f$1\f$.
*
diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt
index e5285591..b1ea98d4 100644
--- a/src/Simplex_tree/example/CMakeLists.txt
+++ b/src/Simplex_tree/example/CMakeLists.txt
@@ -1,33 +1,32 @@
cmake_minimum_required(VERSION 2.6)
project(Simplex_tree_examples)
-add_executable ( simplex_tree_from_cliques_of_graph simplex_tree_from_cliques_of_graph.cpp )
+add_executable ( Simplex_tree_example_from_cliques_of_graph simplex_tree_from_cliques_of_graph.cpp )
if (TBB_FOUND)
- target_link_libraries(simplex_tree_from_cliques_of_graph ${TBB_LIBRARIES})
+ target_link_libraries(Simplex_tree_example_from_cliques_of_graph ${TBB_LIBRARIES})
endif()
-add_test(simplex_tree_from_cliques_of_graph_2 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_cliques_of_graph
- ${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/Klein_bottle_complex.fsc 2)
-add_test(simplex_tree_from_cliques_of_graph_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_cliques_of_graph
- ${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/Klein_bottle_complex.fsc 3)
+add_test(NAME Simplex_tree_example_from_cliques_of_graph_2 COMMAND $<TARGET_FILE:Simplex_tree_example_from_cliques_of_graph>
+ "${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/Klein_bottle_complex.fsc" "2")
+add_test(NAME Simplex_tree_example_from_cliques_of_graph_3 COMMAND $<TARGET_FILE:Simplex_tree_example_from_cliques_of_graph>
+ "${CMAKE_SOURCE_DIR}/data/filtered_simplicial_complex/Klein_bottle_complex.fsc" "3")
-add_executable ( simple_simplex_tree simple_simplex_tree.cpp )
+add_executable ( Simplex_tree_example_simple_simplex_tree simple_simplex_tree.cpp )
if (TBB_FOUND)
- target_link_libraries(simple_simplex_tree ${TBB_LIBRARIES})
+ target_link_libraries(Simplex_tree_example_simple_simplex_tree ${TBB_LIBRARIES})
endif()
-add_test(simple_simplex_tree ${CMAKE_CURRENT_BINARY_DIR}/simple_simplex_tree)
+add_test(NAME Simplex_tree_example_simple_simplex_tree COMMAND $<TARGET_FILE:Simplex_tree_example_simple_simplex_tree>)
-add_executable ( mini_simplex_tree mini_simplex_tree.cpp )
-add_test(mini_simplex_tree ${CMAKE_CURRENT_BINARY_DIR}/mini_simplex_tree)
+add_executable ( Simplex_tree_example_mini_simplex_tree mini_simplex_tree.cpp )
+add_test(NAME Simplex_tree_example_mini_simplex_tree COMMAND $<TARGET_FILE:Simplex_tree_example_mini_simplex_tree>)
# An example with Simplex-tree using CGAL alpha_shapes_3
if(GMP_FOUND AND CGAL_FOUND)
- add_executable ( alpha_shapes_3_simplex_tree_from_off_file example_alpha_shapes_3_simplex_tree_from_off_file.cpp )
- target_link_libraries(alpha_shapes_3_simplex_tree_from_off_file ${GMP_LIBRARIES} ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+ add_executable ( Simplex_tree_example_alpha_shapes_3_from_off example_alpha_shapes_3_simplex_tree_from_off_file.cpp )
+ target_link_libraries(Simplex_tree_example_alpha_shapes_3_from_off ${GMP_LIBRARIES} ${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(alpha_shapes_3_simplex_tree_from_off_file ${TBB_LIBRARIES})
+ target_link_libraries(Simplex_tree_example_alpha_shapes_3_from_off ${TBB_LIBRARIES})
endif()
- add_test(alpha_shapes_3_simplex_tree_from_off_file
- ${CMAKE_CURRENT_BINARY_DIR}/alpha_shapes_3_simplex_tree_from_off_file
- ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.off)
+ add_test(NAME Simplex_tree_example_alpha_shapes_3_from_off COMMAND $<TARGET_FILE:Simplex_tree_example_alpha_shapes_3_from_off>
+ "${CMAKE_SOURCE_DIR}/data/points/bunny_5000.off")
endif()
diff --git a/src/Simplex_tree/example/README b/src/Simplex_tree/example/README
index e37af790..a9498173 100644
--- a/src/Simplex_tree/example/README
+++ b/src/Simplex_tree/example/README
@@ -10,7 +10,7 @@ Example of use :
*** Simple simplex tree construction
-./simple_simplex_tree
+./Simplex_tree_example_simple_simplex_tree
********************************************************************
EXAMPLE OF SIMPLE INSERTION
@@ -52,7 +52,7 @@ EXAMPLE OF SIMPLE INSERTION
*** Simplex tree construction with Z/2Z coefficients on weighted graph Klein bottle file:
-./simplex_tree_from_cliques_of_graph ../../../data/points/Klein_bottle_complex.txt 2
+./Simplex_tree_example_from_cliques_of_graph ../../../data/points/Klein_bottle_complex.txt 2
Insert the 1-skeleton in the simplex tree in 0 s.
Expand the simplex tree in 0 s.
Information of the Simplex Tree:
@@ -60,7 +60,7 @@ Information of the Simplex Tree:
with Z/3Z coefficients:
-./simplex_tree_from_cliques_of_graph ../../../data/points/Klein_bottle_complex.txt 3
+./Simplex_tree_example_from_cliques_of_graph ../../../data/points/Klein_bottle_complex.txt 3
Insert the 1-skeleton in the simplex tree in 0 s.
Expand the simplex tree in 0 s.
@@ -70,4 +70,4 @@ Information of the Simplex Tree:
*** Simplex_tree computed and displayed from a 3D alpha complex:
[ Requires CGAL, GMP and GMPXX to be installed]
-./simplex_tree_from_alpha_shapes_3 ../../../data/points/bunny_5000
+./Simplex_tree_example_alpha_shapes_3_from_off ../../../data/points/bunny_5000
diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt
index e95d0782..17b0f2c2 100644
--- a/src/Simplex_tree/test/CMakeLists.txt
+++ b/src/Simplex_tree/test/CMakeLists.txt
@@ -1,27 +1,15 @@
cmake_minimum_required(VERSION 2.6)
project(Simplex_tree_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
+include(GUDHI_test_coverage)
-add_executable ( SimplexTreeUT simplex_tree_unit_test.cpp )
-target_link_libraries(SimplexTreeUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Simplex_tree_test_unit simplex_tree_unit_test.cpp )
+target_link_libraries(Simplex_tree_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
- target_link_libraries(SimplexTreeUT ${TBB_LIBRARIES})
+ target_link_libraries(Simplex_tree_test_unit ${TBB_LIBRARIES})
endif()
# Do not forget to copy test files in current binary dir
file(COPY "simplex_tree_for_unit_test.txt" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-# Unitary tests
-add_test(NAME SimplexTreeUT
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/SimplexTreeUT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/SimplexTreeUT.xml --log_level=test_suite --report_level=no)
-
+gudhi_add_coverage_test(Simplex_tree_test_unit)
diff --git a/src/Skeleton_blocker/example/CMakeLists.txt b/src/Skeleton_blocker/example/CMakeLists.txt
index cc7f37f3..c887e408 100644
--- a/src/Skeleton_blocker/example/CMakeLists.txt
+++ b/src/Skeleton_blocker/example/CMakeLists.txt
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 2.6)
project(Skeleton_blocker_examples)
-add_executable(SkeletonBlockerFromSimplices Skeleton_blocker_from_simplices.cpp)
-add_executable(SkeletonBlockerIteration Skeleton_blocker_iteration.cpp)
-add_executable(SkeletonBlockerLink Skeleton_blocker_link.cpp)
+add_executable(Skeleton_blocker_example_from_simplices Skeleton_blocker_from_simplices.cpp)
+add_executable(Skeleton_blocker_example_iteration Skeleton_blocker_iteration.cpp)
+add_executable(Skeleton_blocker_example_link Skeleton_blocker_link.cpp)
-target_link_libraries(SkeletonBlockerIteration ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBRARY})
+target_link_libraries(Skeleton_blocker_example_iteration ${Boost_TIMER_LIBRARY} ${Boost_SYSTEM_LIBRARY})
-add_test(SkeletonBlockerFromSimplices ${CMAKE_CURRENT_BINARY_DIR}/SkeletonBlockerFromSimplices)
-add_test(SkeletonBlockerIteration ${CMAKE_CURRENT_BINARY_DIR}/SkeletonBlockerIteration)
-add_test(SkeletonBlockerLink ${CMAKE_CURRENT_BINARY_DIR}/SkeletonBlockerLink)
+add_test(NAME Skeleton_blocker_example_from_simplices COMMAND $<TARGET_FILE:Skeleton_blocker_example_from_simplices>)
+add_test(NAME Skeleton_blocker_example_iteration COMMAND $<TARGET_FILE:Skeleton_blocker_example_iteration>)
+add_test(NAME Skeleton_blocker_example_link COMMAND $<TARGET_FILE:Skeleton_blocker_example_link>)
diff --git a/src/Skeleton_blocker/test/CMakeLists.txt b/src/Skeleton_blocker/test/CMakeLists.txt
index f98517f0..0887fcff 100644
--- a/src/Skeleton_blocker/test/CMakeLists.txt
+++ b/src/Skeleton_blocker/test/CMakeLists.txt
@@ -1,35 +1,18 @@
cmake_minimum_required(VERSION 2.6)
project(Skeleton_blocker_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
+include(GUDHI_test_coverage)
-add_executable ( test_skeleton_blocker_complex test_skeleton_blocker_complex.cpp )
-target_link_libraries(test_skeleton_blocker_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
-add_executable ( test_skeleton_blocker_geometric_complex test_skeleton_blocker_geometric_complex.cpp )
-target_link_libraries(test_skeleton_blocker_geometric_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
-add_executable ( test_skeleton_blocker_simplifiable test_skeleton_blocker_simplifiable.cpp )
-target_link_libraries(test_skeleton_blocker_simplifiable ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Skeleton_blocker_test_unit test_skeleton_blocker_complex.cpp )
+target_link_libraries(Skeleton_blocker_test_unit ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Skeleton_blocker_test_geometric_complex test_skeleton_blocker_geometric_complex.cpp )
+target_link_libraries(Skeleton_blocker_test_geometric_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Skeleton_blocker_test_simplifiable test_skeleton_blocker_simplifiable.cpp )
+target_link_libraries(Skeleton_blocker_test_simplifiable ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
# Do not forget to copy test files in current binary dir
file(COPY "test2.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-# Unitary tests
-add_test(NAME test_skeleton_blocker_complex
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_skeleton_blocker_complex
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/skbl_complexUT.xml --log_level=test_suite --report_level=no)
-add_test(NAME test_skeleton_blocker_geometric_complex
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_skeleton_blocker_geometric_complex
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/skbl_geometric_complexUT.xml --log_level=test_suite --report_level=no)
-add_test(NAME test_skeleton_blocker_simplifiable
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_skeleton_blocker_simplifiable
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/skbl_simplifiableUT.xml --log_level=test_suite --report_level=no)
+gudhi_add_coverage_test(Skeleton_blocker_test_unit)
+gudhi_add_coverage_test(Skeleton_blocker_test_geometric_complex)
+gudhi_add_coverage_test(Skeleton_blocker_test_simplifiable)
diff --git a/src/Spatial_searching/example/CMakeLists.txt b/src/Spatial_searching/example/CMakeLists.txt
index 6238a0ec..f4b9f3cb 100644
--- a/src/Spatial_searching/example/CMakeLists.txt
+++ b/src/Spatial_searching/example/CMakeLists.txt
@@ -1,13 +1,9 @@
cmake_minimum_required(VERSION 2.6)
project(Spatial_searching_examples)
-if(CGAL_FOUND)
- if (NOT CGAL_VERSION VERSION_LESS 4.8.1)
- if (EIGEN3_FOUND)
- add_executable( Spatial_searching_example_spatial_searching example_spatial_searching.cpp )
- target_link_libraries(Spatial_searching_example_spatial_searching ${CGAL_LIBRARY})
- add_test(Spatial_searching_example_spatial_searching
- ${CMAKE_CURRENT_BINARY_DIR}/Spatial_searching_example_spatial_searching)
- endif()
- endif()
-endif()
+if(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+ add_executable( Spatial_searching_example_spatial_searching example_spatial_searching.cpp )
+ target_link_libraries(Spatial_searching_example_spatial_searching ${CGAL_LIBRARY})
+ add_test(NAME Spatial_searching_example_spatial_searching
+ COMMAND $<TARGET_FILE:Spatial_searching_example_spatial_searching>)
+endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Spatial_searching/test/CMakeLists.txt b/src/Spatial_searching/test/CMakeLists.txt
index bdc95e4a..2502ea5e 100644
--- a/src/Spatial_searching/test/CMakeLists.txt
+++ b/src/Spatial_searching/test/CMakeLists.txt
@@ -1,21 +1,12 @@
cmake_minimum_required(VERSION 2.6)
project(Spatial_searching_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
-
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+ include(GUDHI_test_coverage)
+
add_executable( Spatial_searching_test_Kd_tree_search test_Kd_tree_search.cpp )
target_link_libraries(Spatial_searching_test_Kd_tree_search
${CGAL_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
- add_test(Spatial_searching_test_Kd_tree_search ${CMAKE_CURRENT_BINARY_DIR}/Spatial_searching_test_Kd_tree_search
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Spatial_searching_UT.xml --log_level=test_suite --report_level=no)
+ gudhi_add_coverage_test(Spatial_searching_test_Kd_tree_search)
endif ()
diff --git a/src/Subsampling/example/CMakeLists.txt b/src/Subsampling/example/CMakeLists.txt
index bb043297..71b8d2e8 100644
--- a/src/Subsampling/example/CMakeLists.txt
+++ b/src/Subsampling/example/CMakeLists.txt
@@ -8,10 +8,10 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
add_executable(Subsampling_example_sparsify_point_set example_sparsify_point_set.cpp)
target_link_libraries(Subsampling_example_sparsify_point_set ${CGAL_LIBRARY})
- add_test(Subsampling_example_pick_n_random_points
- ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_pick_n_random_points)
- add_test(Subsampling_example_choose_n_farthest_points
- ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_choose_n_farthest_points)
- add_test(Subsampling_example_sparsify_point_set
- ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_example_sparsify_point_set)
+ add_test(NAME Subsampling_example_pick_n_random_points
+ COMMAND $<TARGET_FILE:Subsampling_example_pick_n_random_points>)
+ add_test(NAME Subsampling_example_choose_n_farthest_points
+ COMMAND $<TARGET_FILE:Subsampling_example_choose_n_farthest_points>)
+ add_test(NAME Subsampling_example_sparsify_point_set
+ COMMAND $<TARGET_FILE:Subsampling_example_sparsify_point_set>)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Subsampling/example/example_choose_n_farthest_points.cpp b/src/Subsampling/example/example_choose_n_farthest_points.cpp
index 533aba74..ebf631fc 100644
--- a/src/Subsampling/example/example_choose_n_farthest_points.cpp
+++ b/src/Subsampling/example/example_choose_n_farthest_points.cpp
@@ -19,7 +19,9 @@ int main(void) {
K k;
std::vector<Point_d> results;
- Gudhi::subsampling::choose_n_farthest_points(k, points, 100, std::back_inserter(results));
+ Gudhi::subsampling::choose_n_farthest_points(k, points, 100,
+ Gudhi::subsampling::random_starting_point,
+ std::back_inserter(results));
std::cout << "Before sparsification: " << points.size() << " points.\n";
std::cout << "After sparsification: " << results.size() << " points.\n";
diff --git a/src/Subsampling/example/example_custom_kernel.cpp b/src/Subsampling/example/example_custom_kernel.cpp
index 25b5bf6c..2d42bdde 100644
--- a/src/Subsampling/example/example_custom_kernel.cpp
+++ b/src/Subsampling/example/example_custom_kernel.cpp
@@ -54,7 +54,9 @@ int main(void) {
std::vector<Point_d> points = {0, 1, 2, 3};
std::vector<Point_d> results;
- Gudhi::subsampling::choose_n_farthest_points(k, points, 2, std::back_inserter(results));
+ Gudhi::subsampling::choose_n_farthest_points(k, points, 2,
+ Gudhi::subsampling::random_starting_point,
+ std::back_inserter(results));
std::cout << "Before sparsification: " << points.size() << " points.\n";
std::cout << "After sparsification: " << results.size() << " points.\n";
std::cout << "Result table: {" << results[0] << "," << results[1] << "}\n";
diff --git a/src/Subsampling/include/gudhi/choose_n_farthest_points.h b/src/Subsampling/include/gudhi/choose_n_farthest_points.h
index 5e908090..86500b28 100644
--- a/src/Subsampling/include/gudhi/choose_n_farthest_points.h
+++ b/src/Subsampling/include/gudhi/choose_n_farthest_points.h
@@ -25,16 +25,9 @@
#include <boost/range.hpp>
-#include <gudhi/Kd_tree_search.h>
-
-#include <gudhi/Clock.h>
-
-#include <CGAL/Search_traits.h>
-#include <CGAL/Search_traits_adapter.h>
-#include <CGAL/Fuzzy_sphere.h>
+#include <gudhi/Null_output_iterator.h>
#include <iterator>
-#include <algorithm> // for sort
#include <vector>
#include <random>
#include <limits> // for numeric_limits<>
@@ -43,36 +36,51 @@ namespace Gudhi {
namespace subsampling {
+/**
+ * \ingroup subsampling
+ */
+enum : std::size_t {
+/**
+ * Argument for `choose_n_farthest_points` to indicate that the starting point should be picked randomly.
+ */
+ random_starting_point = std::size_t(-1)
+};
+
/**
* \ingroup subsampling
* \brief Subsample by a greedy strategy of iteratively adding the farthest point from the
* current chosen point set to the subsampling.
- * The iteration starts with the landmark `starting point`.
+ * The iteration starts with the landmark `starting point` or, if `starting point==random_starting_point`, with a random landmark.
* \tparam Kernel must provide a type Kernel::Squared_distance_d which is a model of the
* concept <a target="_blank"
- * href="http://doc.cgal.org/latest/Kernel_d/classKernel__d_1_1Squared__distance__d.html">Kernel_d::Squared_distance_d</a>
- * concept.
- * It must also contain a public member 'squared_distance_d_object' of this type.
+ * href="http://doc.cgal.org/latest/Kernel_d/classKernel__d_1_1Squared__distance__d.html">Kernel_d::Squared_distance_d</a> (despite the name, taken from CGAL, this can be any kind of metric or proximity measure).
+ * It must also contain a public member `squared_distance_d_object()` that returns an object of this type.
* \tparam Point_range Range whose value type is Kernel::Point_d. It must provide random-access
* via `operator[]` and the points should be stored contiguously in memory.
- * \tparam OutputIterator Output iterator whose value type is Kernel::Point_d.
- * \details It chooses `final_size` points from a random access range `input_pts` and
- * outputs it in the output iterator `output_it`.
+ * \tparam PointOutputIterator Output iterator whose value type is Kernel::Point_d.
+ * \tparam DistanceOutputIterator Output iterator for distances.
+ * \details It chooses `final_size` points from a random access range
+ * `input_pts` and outputs them in the output iterator `output_it`. It also
+ * outputs the distance from each of those points to the set of previous
+ * points in `dist_it`.
* @param[in] k A kernel object.
* @param[in] input_pts Const reference to the input points.
* @param[in] final_size The size of the subsample to compute.
* @param[in] starting_point The seed in the farthest point algorithm.
- * @param[out] output_it The output iterator.
+ * @param[out] output_it The output iterator for points.
+ * @param[out] dist_it The optional output iterator for distances.
*
*/
template < typename Kernel,
typename Point_range,
-typename OutputIterator>
+typename PointOutputIterator,
+typename DistanceOutputIterator = Null_output_iterator>
void choose_n_farthest_points(Kernel const &k,
Point_range const &input_pts,
std::size_t final_size,
std::size_t starting_point,
- OutputIterator output_it) {
+ PointOutputIterator output_it,
+ DistanceOutputIterator dist_it = {}) {
std::size_t nb_points = boost::size(input_pts);
if (final_size > nb_points)
final_size = nb_points;
@@ -81,6 +89,14 @@ void choose_n_farthest_points(Kernel const &k,
if (final_size < 1)
return;
+ if (starting_point == random_starting_point) {
+ // Choose randomly the first landmark
+ std::random_device rd;
+ std::mt19937 gen(rd());
+ std::uniform_int_distribution<std::size_t> dis(0, (input_pts.size() - 1));
+ starting_point = dis(gen);
+ }
+
typename Kernel::Squared_distance_d sqdist = k.squared_distance_d_object();
std::size_t current_number_of_landmarks = 0; // counter for landmarks
@@ -92,6 +108,7 @@ void choose_n_farthest_points(Kernel const &k,
for (current_number_of_landmarks = 0; current_number_of_landmarks != final_size; current_number_of_landmarks++) {
// curr_max_w at this point is the next landmark
*output_it++ = input_pts[curr_max_w];
+ *dist_it++ = dist_to_L[curr_max_w];
std::size_t i = 0;
for (auto& p : input_pts) {
double curr_dist = sqdist(p, *(std::begin(input_pts) + curr_max_w));
@@ -109,47 +126,6 @@ void choose_n_farthest_points(Kernel const &k,
}
}
-/**
- * \ingroup subsampling
- * \brief Subsample by a greedy strategy of iteratively adding the farthest point from the
- * current chosen point set to the subsampling.
- * The iteration starts with a random landmark.
- * \tparam Kernel must provide a type Kernel::Squared_distance_d which is a model of the
- * concept <a target="_blank"
- * href="http://doc.cgal.org/latest/Kernel_d/classKernel__d_1_1Squared__distance__d.html">Kernel_d::Squared_distance_d</a>
- * concept.
- * It must also contain a public member 'squared_distance_d_object' of this type.
- * \tparam Point_range Range whose value type is Kernel::Point_d. It must provide random-access
- * via `operator[]` and the points should be stored contiguously in memory.
- * \tparam OutputIterator Output iterator whose value type is Kernel::Point_d.
- * \details It chooses `final_size` points from a random access range `input_pts` and
- * outputs it in the output iterator `output_it`.
- * @param[in] k A kernel object.
- * @param[in] input_pts Const reference to the input points.
- * @param[in] final_size The size of the subsample to compute.
- * @param[out] output_it The output iterator.
- *
- */
-template < typename Kernel,
-typename Point_range,
-typename OutputIterator>
-void choose_n_farthest_points(Kernel const& k,
- Point_range const &input_pts,
- unsigned final_size,
- OutputIterator output_it) {
- // Tests to the limit
- if ((final_size < 1) || (input_pts.size() == 0))
- return;
-
- // Choose randomly the first landmark
- std::random_device rd;
- std::mt19937 gen(rd());
- std::uniform_int_distribution<> dis(0, (input_pts.size() - 1));
- std::size_t starting_point = dis(gen);
-
- choose_n_farthest_points(k, input_pts, final_size, starting_point, output_it);
-}
-
} // namespace subsampling
} // namespace Gudhi
diff --git a/src/Subsampling/test/CMakeLists.txt b/src/Subsampling/test/CMakeLists.txt
index 5517fe9d..dbf97db3 100644
--- a/src/Subsampling/test/CMakeLists.txt
+++ b/src/Subsampling/test/CMakeLists.txt
@@ -1,16 +1,9 @@
cmake_minimum_required(VERSION 2.6)
project(Subsampling_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
-
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+ include(GUDHI_test_coverage)
+
add_executable( Subsampling_test_pick_n_random_points test_pick_n_random_points.cpp )
target_link_libraries(Subsampling_test_pick_n_random_points ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
@@ -20,15 +13,7 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
add_executable(Subsampling_test_sparsify_point_set test_sparsify_point_set.cpp)
target_link_libraries(Subsampling_test_sparsify_point_set ${CGAL_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
- add_test(Subsampling_test_pick_n_random_points ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_pick_n_random_points
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_pick_n_random_points_UT.xml --log_level=test_suite --report_level=no)
-
- add_test(Subsampling_test_choose_n_farthest_points ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_choose_n_farthest_points
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_choose_n_farthest_points_UT.xml --log_level=test_suite --report_level=no)
-
- add_test(Subsampling_test_sparsify_point_set ${CMAKE_CURRENT_BINARY_DIR}/Subsampling_test_sparsify_point_set
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Subsampling_test_sparsify_point_set_UT.xml --log_level=test_suite --report_level=no)
+ gudhi_add_coverage_test(Subsampling_test_pick_n_random_points)
+ gudhi_add_coverage_test(Subsampling_test_choose_n_farthest_points)
+ gudhi_add_coverage_test(Subsampling_test_sparsify_point_set)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Subsampling/test/test_choose_n_farthest_points.cpp b/src/Subsampling/test/test_choose_n_farthest_points.cpp
index 0bc0dff4..ee9d4c77 100644
--- a/src/Subsampling/test/test_choose_n_farthest_points.cpp
+++ b/src/Subsampling/test/test_choose_n_farthest_points.cpp
@@ -25,7 +25,7 @@
// #endif
#define BOOST_TEST_DYN_LINK
-#define BOOST_TEST_MODULE "witness_complex_points"
+#define BOOST_TEST_MODULE Subsampling - test choose_n_farthest_points
#include <boost/test/unit_test.hpp>
#include <boost/mpl/list.hpp>
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_choose_farthest_point, Kernel, list_of_tested
landmarks.clear();
Kernel k;
- Gudhi::subsampling::choose_n_farthest_points(k, points, 100, std::back_inserter(landmarks));
+ Gudhi::subsampling::choose_n_farthest_points(k, points, 100, Gudhi::subsampling::random_starting_point, std::back_inserter(landmarks));
BOOST_CHECK(landmarks.size() == 100);
for (auto landmark : landmarks)
@@ -70,34 +70,45 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(test_choose_farthest_point_limits, Kernel, list_of
typedef typename Kernel::FT FT;
typedef typename Kernel::Point_d Point_d;
std::vector< Point_d > points, landmarks;
+ std::vector< FT > distances;
landmarks.clear();
Kernel k;
// Choose -1 farthest points in an empty point cloud
- Gudhi::subsampling::choose_n_farthest_points(k, points, -1, std::back_inserter(landmarks));
+ Gudhi::subsampling::choose_n_farthest_points(k, points, -1, -1, std::back_inserter(landmarks), std::back_inserter(distances));
BOOST_CHECK(landmarks.size() == 0);
- landmarks.clear();
+ landmarks.clear(); distances.clear();
// Choose 0 farthest points in an empty point cloud
- Gudhi::subsampling::choose_n_farthest_points(k, points, 0, std::back_inserter(landmarks));
+ Gudhi::subsampling::choose_n_farthest_points(k, points, 0, -1, std::back_inserter(landmarks), std::back_inserter(distances));
BOOST_CHECK(landmarks.size() == 0);
- landmarks.clear();
+ landmarks.clear(); distances.clear();
// Choose 1 farthest points in an empty point cloud
- Gudhi::subsampling::choose_n_farthest_points(k, points, 1, std::back_inserter(landmarks));
+ Gudhi::subsampling::choose_n_farthest_points(k, points, 1, -1, std::back_inserter(landmarks), std::back_inserter(distances));
BOOST_CHECK(landmarks.size() == 0);
- landmarks.clear();
+ landmarks.clear(); distances.clear();
std::vector<FT> point({0.0, 0.0, 0.0, 0.0});
points.push_back(Point_d(point.begin(), point.end()));
- // Choose -1 farthest points in an empty point cloud
- Gudhi::subsampling::choose_n_farthest_points(k, points, -1, std::back_inserter(landmarks));
- BOOST_CHECK(landmarks.size() == 1);
- landmarks.clear();
+ // Choose -1 farthest points in a one point cloud
+ Gudhi::subsampling::choose_n_farthest_points(k, points, -1, -1, std::back_inserter(landmarks), std::back_inserter(distances));
+ BOOST_CHECK(landmarks.size() == 1 && distances.size() == 1);
+ BOOST_CHECK(distances[0] == std::numeric_limits<FT>::infinity());
+ landmarks.clear(); distances.clear();
// Choose 0 farthest points in a one point cloud
- Gudhi::subsampling::choose_n_farthest_points(k, points, 0, std::back_inserter(landmarks));
- BOOST_CHECK(landmarks.size() == 0);
- landmarks.clear();
+ Gudhi::subsampling::choose_n_farthest_points(k, points, 0, -1, std::back_inserter(landmarks), std::back_inserter(distances));
+ BOOST_CHECK(landmarks.size() == 0 && distances.size() == 0);
+ landmarks.clear(); distances.clear();
// Choose 1 farthest points in a one point cloud
- Gudhi::subsampling::choose_n_farthest_points(k, points, 1, std::back_inserter(landmarks));
- BOOST_CHECK(landmarks.size() == 1);
- landmarks.clear();
+ Gudhi::subsampling::choose_n_farthest_points(k, points, 1, -1, std::back_inserter(landmarks), std::back_inserter(distances));
+ BOOST_CHECK(landmarks.size() == 1 && distances.size() == 1);
+ BOOST_CHECK(distances[0] == std::numeric_limits<FT>::infinity());
+ landmarks.clear(); distances.clear();
+ std::vector<FT> point2({1.0, 0.0, 0.0, 0.0});
+ points.push_back(Point_d(point2.begin(), point2.end()));
+ // Choose all farthest points in a one point cloud
+ Gudhi::subsampling::choose_n_farthest_points(k, points, -1, -1, std::back_inserter(landmarks), std::back_inserter(distances));
+ BOOST_CHECK(landmarks.size() == 2 && distances.size() == 2);
+ BOOST_CHECK(distances[0] == std::numeric_limits<FT>::infinity());
+ BOOST_CHECK(distances[1] == 1);
+ landmarks.clear(); distances.clear();
}
diff --git a/src/Tangential_complex/example/CMakeLists.txt b/src/Tangential_complex/example/CMakeLists.txt
index 47a56e3b..339d0581 100644
--- a/src/Tangential_complex/example/CMakeLists.txt
+++ b/src/Tangential_complex/example/CMakeLists.txt
@@ -11,9 +11,8 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
target_link_libraries(Tangential_complex_example_with_perturb ${TBB_LIBRARIES})
endif(TBB_FOUND)
- add_test(Tangential_complex_example_basic
- ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_example_basic)
-
- add_test(Tangential_complex_example_with_perturb
- ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_example_with_perturb)
+ add_test(NAME Tangential_complex_example_basic
+ COMMAND $<TARGET_FILE:Tangential_complex_example_basic>)
+ add_test(NAME Tangential_complex_example_with_perturb
+ COMMAND $<TARGET_FILE:Tangential_complex_example_with_perturb>)
endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Tangential_complex/include/gudhi/Tangential_complex.h b/src/Tangential_complex/include/gudhi/Tangential_complex.h
index cfc82eb1..9fa7c825 100644
--- a/src/Tangential_complex/include/gudhi/Tangential_complex.h
+++ b/src/Tangential_complex/include/gudhi/Tangential_complex.h
@@ -1059,7 +1059,6 @@ class Tangential_complex {
Triangulation &triangulation, bool verbose = false) {
int tangent_space_dim = tsb.dimension();
const Tr_traits &local_tr_traits = triangulation.geom_traits();
- Tr_vertex_handle center_vertex;
// Kernel functor & objects
typename K::Squared_distance_d k_sqdist = m_k.squared_distance_d_object();
@@ -1084,7 +1083,7 @@ class Tangential_complex {
proj_wp = project_point_and_compute_weight(wp, tsb, local_tr_traits);
}
- center_vertex = triangulation.insert(proj_wp);
+ Tr_vertex_handle center_vertex = triangulation.insert(proj_wp);
center_vertex->data() = i;
if (verbose)
std::cerr << "* Inserted point #" << i << "\n";
@@ -1823,7 +1822,6 @@ class Tangential_complex {
bool is_inconsistent = false;
Star const& star = m_stars[tr_index];
- Tr_vertex_handle center_vh = m_triangulations[tr_index].center_vertex();
// For each incident simplex
Star::const_iterator it_inc_simplex = star.begin();
@@ -1950,7 +1948,6 @@ class Tangential_complex {
bool is_star_inconsistent = false;
Triangulation const& tr = it_tr->tr();
- Tr_vertex_handle center_vh = it_tr->center_vertex();
if (tr.current_dimension() < m_intrinsic_dim)
continue;
diff --git a/src/Tangential_complex/test/CMakeLists.txt b/src/Tangential_complex/test/CMakeLists.txt
index b2bf5dd7..fc710676 100644
--- a/src/Tangential_complex/test/CMakeLists.txt
+++ b/src/Tangential_complex/test/CMakeLists.txt
@@ -1,23 +1,14 @@
cmake_minimum_required(VERSION 2.6)
project(Tangential_complex_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
-
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+ include(GUDHI_test_coverage)
+
add_executable( Tangential_complex_test_TC test_tangential_complex.cpp )
target_link_libraries(Tangential_complex_test_TC ${CGAL_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Tangential_complex_test_TC ${TBB_LIBRARIES})
endif()
- add_test(Tangential_complex_test_TC ${CMAKE_CURRENT_BINARY_DIR}/Tangential_complex_test_TC
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Tangential_complex_UT.xml --log_level=test_suite --report_level=no)
+ gudhi_add_coverage_test(Tangential_complex_test_TC)
endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
diff --git a/src/Witness_complex/example/CMakeLists.txt b/src/Witness_complex/example/CMakeLists.txt
index 549a85be..670651ce 100644
--- a/src/Witness_complex/example/CMakeLists.txt
+++ b/src/Witness_complex/example/CMakeLists.txt
@@ -6,7 +6,8 @@ target_link_libraries(Witness_complex_example_nearest_landmark_table ${Boost_SYS
if (TBB_FOUND)
target_link_libraries(Witness_complex_example_nearest_landmark_table ${TBB_LIBRARIES})
endif()
-add_test(Witness_complex_test_nearest_landmark_table Witness_complex_example_nearest_landmark_table)
+add_test(NAME Witness_complex_example_nearest_landmark_table
+ COMMAND $<TARGET_FILE:Witness_complex_example_nearest_landmark_table>)
# CGAL and Eigen3 are required for Euclidean version of Witness
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
@@ -28,17 +29,18 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
target_link_libraries(Witness_complex_example_strong_witness_persistence ${TBB_LIBRARIES})
endif()
- add_test(Witness_complex_off_test_torus
- ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_off
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 20 1.0 3)
- add_test(Witness_complex_strong_off_test_torus
- ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_strong_off
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off 20 1.0 3)
- add_test(Witness_complex_test_sphere_10 Witness_complex_example_sphere 10)
- add_test(Witness_complex_test_torus_persistence
- ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_witness_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5)
- add_test(Witness_complex_strong_test_torus_persistence
- ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_example_strong_witness_persistence
- ${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off -l 20 -a 0.5)
+ add_test(NAME Witness_complex_example_off_test_torus
+ COMMAND $<TARGET_FILE:Witness_complex_example_off>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "20" "1.0" "3")
+ add_test(NAME Witness_complex_example_strong_off_test_torus
+ COMMAND $<TARGET_FILE:Witness_complex_example_strong_off>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "20" "1.0" "3")
+ add_test(NAME Witness_complex_example_test_sphere_10
+ COMMAND $<TARGET_FILE:Witness_complex_example_sphere> "10")
+ add_test(NAME Witness_complex_example_test_torus_persistence
+ COMMAND $<TARGET_FILE:Witness_complex_example_witness_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-l" "20" "-a" "0.5")
+ add_test(NAME Witness_complex_example_strong_test_torus_persistence
+ COMMAND $<TARGET_FILE:Witness_complex_example_strong_witness_persistence>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_1307.off" "-l" "20" "-a" "0.5")
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h
index a973ddb7..6f4bcf60 100644
--- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h
@@ -105,10 +105,6 @@ class Strong_witness_complex {
<< "non-negative.\n";
return false;
}
- if (limit_dimension < 0) {
- std::cerr << "Strong witness complex cannot create complex - limit dimension must be non-negative.\n";
- return false;
- }
for (auto w : nearest_landmark_table_) {
ActiveWitness aw(w);
typeVectorVertex simplex;
diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h
index 63f03687..bcfe8484 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex.h
@@ -106,10 +106,6 @@ class Witness_complex {
std::cerr << "Witness complex cannot create complex - squared relaxation parameter must be non-negative.\n";
return false;
}
- if (limit_dimension < 0) {
- std::cerr << "Witness complex cannot create complex - limit dimension must be non-negative.\n";
- return false;
- }
ActiveWitnessList active_witnesses;
Landmark_id k = 0; /* current dimension in iterative construction */
for (auto w : nearest_landmark_table_)
diff --git a/src/Witness_complex/test/CMakeLists.txt b/src/Witness_complex/test/CMakeLists.txt
index e73f9c3a..152e2f2c 100644
--- a/src/Witness_complex/test/CMakeLists.txt
+++ b/src/Witness_complex/test/CMakeLists.txt
@@ -1,14 +1,7 @@
cmake_minimum_required(VERSION 2.6)
project(Witness_complex_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
+include(GUDHI_test_coverage)
add_executable ( Witness_complex_test_simple_witness_complex test_simple_witness_complex.cpp )
target_link_libraries(Witness_complex_test_simple_witness_complex ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
@@ -16,11 +9,7 @@ if (TBB_FOUND)
target_link_libraries(Witness_complex_test_simple_witness_complex ${TBB_LIBRARIES})
endif(TBB_FOUND)
-# Unitary tests definition and xml result file generation
-add_test(NAME simple_witness_complex
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_simple_witness_complex
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_simple_witness_complexUT.xml --log_level=test_suite --report_level=no)
+gudhi_add_coverage_test(Witness_complex_test_simple_witness_complex)
# CGAL and Eigen3 are required for Euclidean version of Witness
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
@@ -30,9 +19,5 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
target_link_libraries(Witness_complex_test_euclidean_simple_witness_complex ${TBB_LIBRARIES})
endif(TBB_FOUND)
- # Unitary tests definition and xml result file generation
- add_test(NAME euclidean_simple_witness_complex
- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/Witness_complex_test_euclidean_simple_witness_complex
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/Witness_complex_test_euclidean_simple_witness_complexUT.xml --log_level=test_suite --report_level=no)
+ gudhi_add_coverage_test(Witness_complex_test_euclidean_simple_witness_complex)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
diff --git a/src/cmake/modules/FindCython.cmake b/src/cmake/modules/FindCython.cmake
new file mode 100644
index 00000000..04aed1f8
--- /dev/null
+++ b/src/cmake/modules/FindCython.cmake
@@ -0,0 +1,44 @@
+# Find the Cython compiler.
+#
+# This code sets the following variables:
+#
+# CYTHON_EXECUTABLE
+#
+# See also UseCython.cmake
+
+#=============================================================================
+# Copyright 2011 Kitware, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#=============================================================================
+
+# Use the Cython executable that lives next to the Python executable
+# if it is a local installation.
+find_package( PythonInterp )
+if( PYTHONINTERP_FOUND )
+ get_filename_component( _python_path ${PYTHON_EXECUTABLE} PATH )
+ find_program( CYTHON_EXECUTABLE
+ NAMES cython cython.bat cython3
+ HINTS ${_python_path}
+ )
+else()
+ find_program( CYTHON_EXECUTABLE
+ NAMES cython cython.bat cython3
+ )
+endif()
+
+
+include( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( Cython REQUIRED_VARS CYTHON_EXECUTABLE )
+
+mark_as_advanced( CYTHON_EXECUTABLE )
diff --git a/src/cmake/modules/GUDHI_doxygen_target.txt b/src/cmake/modules/GUDHI_doxygen_target.cmake
index d2cb952d..d2cb952d 100644
--- a/src/cmake/modules/GUDHI_doxygen_target.txt
+++ b/src/cmake/modules/GUDHI_doxygen_target.cmake
diff --git a/src/cmake/modules/GUDHI_test_coverage.cmake b/src/cmake/modules/GUDHI_test_coverage.cmake
new file mode 100644
index 00000000..ce171a0e
--- /dev/null
+++ b/src/cmake/modules/GUDHI_test_coverage.cmake
@@ -0,0 +1,14 @@
+
+if (GCOVR_PATH)
+ # for gcovr to make coverage reports - Corbera Jenkins plugin
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
+endif()
+if (GPROF_PATH)
+ # for gprof to make coverage reports - Jenkins
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
+endif()
+
+function(gudhi_add_coverage_test unitary_test)
+ add_test(NAME ${unitary_test} COMMAND $<TARGET_FILE:${unitary_test}>
+ "--log_format=XML" "--log_sink=${CMAKE_BINARY_DIR}/${unitary_test}_UT.xml" "--log_level=test_suite" "--report_level=no")
+endfunction()
diff --git a/src/cmake/modules/GUDHI_third_party_libraries.txt b/src/cmake/modules/GUDHI_third_party_libraries.cmake
index 1974f70f..5f84c602 100644
--- a/src/cmake/modules/GUDHI_third_party_libraries.txt
+++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake
@@ -105,3 +105,40 @@ 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.
+find_package(Cython)
+
+if(NOT GUDHI_CYTHON_PATH)
+ message(FATAL_ERROR "ERROR: GUDHI_CYTHON_PATH is not valid.")
+endif(NOT GUDHI_CYTHON_PATH)
+
+if(PYTHONINTERP_FOUND AND CYTHON_FOUND)
+ # Unitary tests are available through py.test
+ find_program( PYTEST_PATH py.test )
+ # Default found version 2
+ if(PYTHON_VERSION_MAJOR EQUAL 2)
+ # Documentation generation is available through sphinx
+ find_program( SPHINX_PATH sphinx-build )
+ elseif(PYTHON_VERSION_MAJOR EQUAL 3)
+ # 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 AND CYTHON_FOUND)
+
diff --git a/src/cmake/modules/GUDHI_user_version_target.txt b/src/cmake/modules/GUDHI_user_version_target.txt
index a971f1d9..8b7cf0e2 100644
--- a/src/cmake/modules/GUDHI_user_version_target.txt
+++ b/src/cmake/modules/GUDHI_user_version_target.txt
@@ -35,8 +35,6 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.11)
copy ${CMAKE_SOURCE_DIR}/src/GUDHIConfig.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIConfig.cmake.in)
add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
copy ${CMAKE_SOURCE_DIR}/CMakeGUDHIVersion.txt ${GUDHI_USER_VERSION_DIR}/CMakeGUDHIVersion.txt)
- add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
- copy ${CMAKE_SOURCE_DIR}/GUDHIVersion.cmake.in ${GUDHI_USER_VERSION_DIR}/GUDHIVersion.cmake.in)
add_custom_command(TARGET user_version PRE_BUILD COMMAND ${CMAKE_COMMAND} -E
copy_directory ${CMAKE_SOURCE_DIR}/biblio ${GUDHI_USER_VERSION_DIR}/biblio)
diff --git a/src/common/doc/MathJax.COPYRIGHT b/src/common/doc/MathJax.COPYRIGHT
new file mode 100644
index 00000000..077d6dc5
--- /dev/null
+++ b/src/common/doc/MathJax.COPYRIGHT
@@ -0,0 +1,55 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
diff --git a/src/common/doc/MathJax.js b/src/common/doc/MathJax.js
new file mode 100644
index 00000000..35e1994e
--- /dev/null
+++ b/src/common/doc/MathJax.js
@@ -0,0 +1,53 @@
+(function () {
+ var newMathJax = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js';
+ var oldMathJax = 'cdn.mathjax.org/mathjax/latest/MathJax.js';
+
+ var replaceScript = function (script, src) {
+ //
+ // Make redirected script
+ //
+ var newScript = document.createElement('script');
+ newScript.src = newMathJax + src.replace(/.*?(\?|$)/, '$1');
+ //
+ // Move onload and onerror handlers to new script
+ //
+ newScript.onload = script.onload;
+ newScript.onerror = script.onerror;
+ script.onload = script.onerror = null;
+ //
+ // Move any content (old-style configuration scripts)
+ //
+ while (script.firstChild) newScript.appendChild(script.firstChild);
+ //
+ // Copy script id
+ //
+ if (script.id != null) newScript.id = script.id;
+ //
+ // Replace original script with new one
+ //
+ script.parentNode.replaceChild(newScript, script);
+ //
+ // Issue a console warning
+ //
+ console.warn('WARNING: cdn.mathjax.org has been retired. Check https://www.mathjax.org/cdn-shutting-down/ for migration tips.')
+ }
+
+ if (document.currentScript) {
+ var script = document.currentScript;
+ replaceScript(script, script.src);
+ } else {
+ //
+ // Look for current script by searching for one with the right source
+ //
+ var n = oldMathJax.length;
+ var scripts = document.getElementsByTagName('script');
+ for (var i = 0; i < scripts.length; i++) {
+ var script = scripts[i];
+ var src = (script.src || '').replace(/.*?:\/\//,'');
+ if (src.substr(0, n) === oldMathJax) {
+ replaceScript(script, src);
+ break;
+ }
+ }
+ }
+})(); \ No newline at end of file
diff --git a/src/common/doc/header.html b/src/common/doc/header.html
index 94e641b2..53b5c0a2 100644
--- a/src/common/doc/header.html
+++ b/src/common/doc/header.html
@@ -64,8 +64,8 @@ $extrastylesheet
<ul class="dropdown">
<li><a href="http://gudhi.gforge.inria.fr/doc/latest/">C++ documentation</a></li>
<li><a href="http://gudhi.gforge.inria.fr/doc/latest/installation.html">C++ installation manual</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/cython/latest/">Cython documentation</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/cython/latest/installation.html">Cython installation manual</a></li>
+ <li><a href="http://gudhi.gforge.inria.fr/python/latest/">Python documentation</a></li>
+ <li><a href="http://gudhi.gforge.inria.fr/python/latest/installation.html">Python installation manual</a></li>
</ul>
</li>
<li class="divider"></li>
diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h
index f3816238..d1cb691c 100644
--- a/src/common/doc/main_page.h
+++ b/src/common/doc/main_page.h
@@ -1,11 +1,10 @@
-/*! \mainpage
+/*! \mainpage The C++ library
* \tableofcontents
* \image html "Gudhi_banner.png" "" width=20cm
*
* \section Introduction Introduction
* The GUDHI library (Geometry Understanding in Higher Dimensions) is a generic open source
- * <a class="el" target="_blank" href="http://gudhi.gforge.inria.fr/doc/latest/">C++ library</a>, with a
- * <a class="el" target="_blank" href="http://gudhi.gforge.inria.fr/cython/latest/">Cython interface</a>, for
+ * <a class="el" target="_blank" href="http://gudhi.gforge.inria.fr/doc/latest/">C++ library</a> for
* Computational Topology and Topological Data Analysis
* (<a class="el" target="_blank" href="https://en.wikipedia.org/wiki/Topological_data_analysis">TDA</a>).
* The GUDHI library intends to help the development of new algorithmic solutions in TDA and their transfer to
@@ -16,7 +15,7 @@
*
* \li Data structures to represent, construct and manipulate simplicial complexes.
* \li Simplification of simplicial complexes by edge contraction.
- * \li Algorithms to compute persistent homology persistent homology.
+ * \li Algorithms to compute persistent homology and bottleneck distance.
*
* All data-structures are generic and several of their aspects can be parameterized via template classes.
* We refer to \cite gudhilibrary_ICMS14 for a detailed description of the design of the library.
@@ -151,7 +150,6 @@
</td>
</tr>
</table>
-</table>
\section Toolbox Toolbox
\subsection BottleneckDistanceToolbox Bottleneck distance
diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt
index 61c94391..d5311b18 100644
--- a/src/common/example/CMakeLists.txt
+++ b/src/common/example/CMakeLists.txt
@@ -3,17 +3,20 @@ project(Common_examples)
add_executable ( vector_double_off_reader example_vector_double_points_off_reader.cpp )
target_link_libraries(vector_double_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
-add_test(vector_double_off_reader ${CMAKE_CURRENT_BINARY_DIR}/vector_double_off_reader ${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off)
+add_test(NAME Common_example_vector_double_off_reader COMMAND $<TARGET_FILE:vector_double_off_reader>
+ "${CMAKE_SOURCE_DIR}/data/points/SO3_10000.off")
if(CGAL_FOUND)
add_executable ( cgal_3D_off_reader example_CGAL_3D_points_off_reader.cpp )
target_link_libraries(cgal_3D_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
- add_test(cgal_3D_off_reader ${CMAKE_CURRENT_BINARY_DIR}/cgal_3D_off_reader ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off)
+ add_test(NAME Common_example_vector_cgal_3D_off_reader COMMAND $<TARGET_FILE:cgal_3D_off_reader>
+ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off")
# need CGAL 4.7and Eigen3
if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
add_executable ( cgal_off_reader example_CGAL_points_off_reader.cpp )
target_link_libraries(cgal_off_reader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
- add_test(cgal_off_reader ${CMAKE_CURRENT_BINARY_DIR}/cgal_off_reader ${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off)
+ add_test(NAME Common_example_vector_cgal_off_reader COMMAND $<TARGET_FILE:cgal_off_reader>
+ "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off")
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0)
endif()
diff --git a/src/common/include/gudhi/Null_output_iterator.h b/src/common/include/gudhi/Null_output_iterator.h
new file mode 100644
index 00000000..42e6e449
--- /dev/null
+++ b/src/common/include/gudhi/Null_output_iterator.h
@@ -0,0 +1,48 @@
+/* This file is part of the Gudhi Library. The Gudhi library
+ * (Geometric Understanding in Higher Dimensions) is a generic C++
+ * library for computational topology.
+ *
+ * Author(s): Marc Glisse
+ *
+ * Copyright (C) 2017 INRIA
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef NULL_OUTPUT_ITERATOR_H_
+#define NULL_OUTPUT_ITERATOR_H_
+
+#include <iterator>
+
+namespace Gudhi {
+
+/** An output iterator that ignores whatever it is given. */
+struct Null_output_iterator {
+ typedef std::output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void difference_type;
+ typedef void pointer;
+ typedef void reference;
+
+ Null_output_iterator& operator++() {return *this;}
+ Null_output_iterator operator++(int) {return *this;}
+ struct proxy {
+ template<class T>
+ proxy& operator=(T&&){return *this;}
+ };
+ proxy operator*()const{return {};}
+};
+} // namespace Gudhi
+
+#endif // NULL_OUTPUT_ITERATOR_H_
diff --git a/src/common/include/gudhi/distance_functions.h b/src/common/include/gudhi/distance_functions.h
index 7f33a804..f6e2ab5a 100644
--- a/src/common/include/gudhi/distance_functions.h
+++ b/src/common/include/gudhi/distance_functions.h
@@ -27,6 +27,8 @@
#include <type_traits> // for std::decay
#include <iterator> // for std::begin, std::end
+namespace Gudhi {
+
/** @file
* @brief Global distance functions
*/
@@ -35,7 +37,7 @@
* have the same dimension. */
class Euclidean_distance {
public:
- template< typename Point >
+ template< typename Point >
auto operator()(const Point& p1, const Point& p2) const -> typename std::decay<decltype(*std::begin(p1))>::type {
auto it1 = p1.begin();
auto it2 = p2.begin();
@@ -46,11 +48,8 @@ class Euclidean_distance {
}
return std::sqrt(dist);
}
- template< typename T >
- T operator() ( const std::pair< T,T >& f , const std::pair< T,T >& s )
- {
- return sqrt( (f.first-s.first)*(f.first-s.first) + (f.second-s.second)*(f.second-s.second) );
- }
};
+} // namespace Gudhi
+
#endif // DISTANCE_FUNCTIONS_H_
diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt
index baa24539..c695fbf4 100644
--- a/src/common/test/CMakeLists.txt
+++ b/src/common/test/CMakeLists.txt
@@ -1,33 +1,18 @@
cmake_minimum_required(VERSION 2.6)
project(Common_tests)
-if (GCOVR_PATH)
- # for gcovr to make coverage reports - Corbera Jenkins plugin
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
-endif()
-if (GPROF_PATH)
- # for gprof to make coverage reports - Jenkins
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
-endif()
+include(GUDHI_test_coverage)
-add_executable ( poffreader_UT test_points_off_reader.cpp )
-target_link_libraries(poffreader_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Common_test_points_off_reader test_points_off_reader.cpp )
+target_link_libraries(Common_test_points_off_reader ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
-add_executable ( distancematrixreader_UT test_distance_matrix_reader.cpp )
-target_link_libraries(distancematrixreader_UT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
+add_executable ( Common_test_distance_matrix_reader test_distance_matrix_reader.cpp )
+target_link_libraries(Common_test_distance_matrix_reader ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
# Do not forget to copy test files in current binary dir
file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/lower_triangular_distance_matrix.csv" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-# Unitary tests
-add_test(poffreader_UT ${CMAKE_CURRENT_BINARY_DIR}/poffreader_UT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/poffreader_UT.xml --log_level=test_suite --report_level=no)
-
-add_test(distancematrixreader_UT ${CMAKE_CURRENT_BINARY_DIR}/distancematrixreader_UT
- # XML format for Jenkins xUnit plugin
- --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/distancematrixreader_UT.xml --log_level=test_suite --report_level=no)
-
-
+gudhi_add_coverage_test(Common_test_points_off_reader)
+gudhi_add_coverage_test(Common_test_distance_matrix_reader)
diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt
index 9dcb2cf4..96c2acb3 100644
--- a/src/cython/CMakeLists.txt
+++ b/src/cython/CMakeLists.txt
@@ -1,47 +1,8 @@
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 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)
- # 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}")
+if(CYTHON_FOUND)
+ message("++ ${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_EXECUTABLE} - 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', ")
@@ -179,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
@@ -215,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(
@@ -240,4 +281,4 @@ if(CYTHON_PATH)
COMMAND make.bat html doctest)
endif (UNIX)
endif(SPHINX_PATH)
-endif(CYTHON_PATH)
+endif(CYTHON_FOUND)
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/cython/cubical_complex.pyx b/src/cython/cython/cubical_complex.pyx
index 1ed6bc5e..ffc85130 100644
--- a/src/cython/cython/cubical_complex.pyx
+++ b/src/cython/cython/cubical_complex.pyx
@@ -60,16 +60,16 @@ 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
- :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
- :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 88cb4395..581c7b69 100644
--- a/src/cython/cython/periodic_cubical_complex.pyx
+++ b/src/cython/cython/periodic_cubical_complex.pyx
@@ -60,16 +60,16 @@ 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
- :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
- :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/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx
index 148227e1..9d40a8b5 100644
--- a/src/cython/cython/simplex_tree.pyx
+++ b/src/cython/cython/simplex_tree.pyx
@@ -46,9 +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)
- 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_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)
@@ -103,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.
@@ -137,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()
@@ -197,24 +188,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, <double>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').
@@ -232,36 +206,36 @@ cdef class SimplexTree:
return self.thisptr.insert_simplex_and_subfaces(complex,
<double>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(<int>dimension)
+ cdef vector[pair[vector[int], double]] skeletons \
+ = self.thisptr.get_skeleton(<int>dimension)
ct = []
- for filtered_complex in sk_tree:
+ for filtered_complex in skeletons:
v = []
for vertex in filtered_complex.first:
v.append(vertex)
@@ -273,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
@@ -298,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/_templates/layout.html b/src/cython/doc/_templates/layout.html
index af0eef64..b11c1236 100644
--- a/src/cython/doc/_templates/layout.html
+++ b/src/cython/doc/_templates/layout.html
@@ -205,8 +205,8 @@
<ul class="dropdown">
<li><a href="http://gudhi.gforge.inria.fr/doc/latest/">C++ documentation</a></li>
<li><a href="http://gudhi.gforge.inria.fr/doc/latest/installation.html">C++ installation manual</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/cython/latest/">Cython documentation</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/cython/latest/installation.html">Cython installation manual</a></li>
+ <li><a href="http://gudhi.gforge.inria.fr/python/latest/">Python documentation</a></li>
+ <li><a href="http://gudhi.gforge.inria.fr/python/latest/installation.html">Python installation manual</a></li>
</ul>
</li>
<li class="divider"></li>
diff --git a/src/cython/doc/alpha_complex_sum.rst b/src/cython/doc/alpha_complex_sum.rst
index 8437e901..a5f6420a 100644
--- a/src/cython/doc/alpha_complex_sum.rst
+++ b/src/cython/doc/alpha_complex_sum.rst
@@ -16,7 +16,7 @@
| | complex. |
| | |
| | This package requires having CGAL version 4.7 or higher (4.8.1 is |
-| | advised for better perfomances). |
+| | advised for better performance). |
+----------------------------------------------------------------+------------------------------------------------------------------------+
| :doc:`alpha_complex_user` | :doc:`alpha_complex_ref` |
+----------------------------------------------------------------+------------------------------------------------------------------------+
diff --git a/src/cython/doc/alpha_complex_user.rst b/src/cython/doc/alpha_complex_user.rst
index 68e53a77..e8268ef1 100644
--- a/src/cython/doc/alpha_complex_user.rst
+++ b/src/cython/doc/alpha_complex_user.rst
@@ -1,4 +1,3 @@
-=========================
Alpha complex user manual
=========================
Definition
@@ -30,39 +29,40 @@ 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():
- print(filtered_value)
+ fmt = '%s -> %.2f'
+ for filtered_value in simplex_tree.get_filtration():
+ print(fmt % tuple(filtered_value))
The output is:
.. testoutput::
Alpha complex is of dimension 2 - 25 simplices - 7 vertices.
- ([0], 0.0)
- ([1], 0.0)
- ([2], 0.0)
- ([3], 0.0)
- ([4], 0.0)
- ([5], 0.0)
- ([6], 0.0)
- ([2, 3], 6.25)
- ([4, 5], 7.25)
- ([0, 2], 8.5)
- ([0, 1], 9.25)
- ([1, 3], 10.0)
- ([1, 2], 11.25)
- ([1, 2, 3], 12.5)
- ([0, 1, 2], 12.995867768595042)
- ([5, 6], 13.25)
- ([2, 4], 20.0)
- ([4, 6], 22.736686390532547)
- ([4, 5, 6], 22.736686390532547)
- ([3, 6], 30.25)
- ([2, 6], 36.5)
- ([2, 3, 6], 36.5)
- ([2, 4, 6], 37.24489795918368)
- ([0, 4], 59.710743801652896)
- ([0, 2, 4], 59.710743801652896)
+ [0] -> 0.00
+ [1] -> 0.00
+ [2] -> 0.00
+ [3] -> 0.00
+ [4] -> 0.00
+ [5] -> 0.00
+ [6] -> 0.00
+ [2, 3] -> 6.25
+ [4, 5] -> 7.25
+ [0, 2] -> 8.50
+ [0, 1] -> 9.25
+ [1, 3] -> 10.00
+ [1, 2] -> 11.25
+ [1, 2, 3] -> 12.50
+ [0, 1, 2] -> 13.00
+ [5, 6] -> 13.25
+ [2, 4] -> 20.00
+ [4, 6] -> 22.74
+ [4, 5, 6] -> 22.74
+ [3, 6] -> 30.25
+ [2, 6] -> 36.50
+ [2, 3, 6] -> 36.50
+ [2, 4, 6] -> 37.24
+ [0, 4] -> 59.71
+ [0, 2, 4] -> 59.71
Algorithm
@@ -164,39 +164,39 @@ 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():
- print(filtered_value)
+ fmt = '%s -> %.2f'
+ for filtered_value in simplex_tree.get_filtration():
+ print(fmt % tuple(filtered_value))
the program output is:
.. testoutput::
Alpha complex is of dimension 2 - 23 simplices - 7 vertices.
- ([0], 0.0)
- ([1], 0.0)
- ([2], 0.0)
- ([3], 0.0)
- ([4], 0.0)
- ([5], 0.0)
- ([6], 0.0)
- ([2, 3], 6.25)
- ([4, 5], 7.25)
- ([0, 2], 8.5)
- ([0, 1], 9.25)
- ([1, 3], 10.0)
- ([1, 2], 11.25)
- ([1, 2, 3], 12.5)
- ([0, 1, 2], 12.995867768595042)
- ([5, 6], 13.25)
- ([2, 4], 20.0)
- ([4, 6], 22.736686390532547)
- ([4, 5, 6], 22.736686390532547)
- ([3, 6], 30.25)
- ([2, 6], 36.5)
- ([2, 3, 6], 36.5)
- ([2, 4, 6], 37.24489795918368)
+ [0] -> 0.00
+ [1] -> 0.00
+ [2] -> 0.00
+ [3] -> 0.00
+ [4] -> 0.00
+ [5] -> 0.00
+ [6] -> 0.00
+ [2, 3] -> 6.25
+ [4, 5] -> 7.25
+ [0, 2] -> 8.50
+ [0, 1] -> 9.25
+ [1, 3] -> 10.00
+ [1, 2] -> 11.25
+ [1, 2, 3] -> 12.50
+ [0, 1, 2] -> 13.00
+ [5, 6] -> 13.25
+ [2, 4] -> 20.00
+ [4, 6] -> 22.74
+ [4, 5, 6] -> 22.74
+ [3, 6] -> 30.25
+ [2, 6] -> 36.50
+ [2, 3, 6] -> 36.50
+ [2, 4, 6] -> 37.24
-==============
CGAL citations
==============
diff --git a/src/cython/doc/bottleneck_distance_user.rst b/src/cython/doc/bottleneck_distance_user.rst
index 3bc170f4..0066992f 100644
--- a/src/cython/doc/bottleneck_distance_user.rst
+++ b/src/cython/doc/bottleneck_distance_user.rst
@@ -1,4 +1,3 @@
-===============================
Bottleneck distance user manual
===============================
Definition
@@ -23,15 +22,15 @@ This example computes the bottleneck distance from 2 persistence diagrams:
diag1 = [[2.7, 3.7],[9.6, 14.],[34.2, 34.974], [3.,float('Inf')]]
diag2 = [[2.8, 4.45],[9.5, 14.1],[3.2,float('Inf')]]
- message = "Bottleneck distance approximation=" + repr(gudhi.bottleneck_distance(diag1, diag2, 0.1))
+ message = "Bottleneck distance approximation=" + '%.2f' % 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=" + '%.2f' % gudhi.bottleneck_distance(diag1, diag2, 0)
print(message)
The output is:
.. testoutput::
- Bottleneck distance approximation=0.8081763781405569
+ Bottleneck distance approximation=0.81
Bottleneck distance exact value=0.75
diff --git a/src/cython/doc/cubical_complex_user.rst b/src/cython/doc/cubical_complex_user.rst
index 692acdd9..344b9554 100644
--- a/src/cython/doc/cubical_complex_user.rst
+++ b/src/cython/doc/cubical_complex_user.rst
@@ -1,4 +1,3 @@
-===========================
Cubical complex user manual
===========================
Definition
@@ -154,7 +153,7 @@ Examples.
End user programs are available in cython/example/ folder.
Bibliography
-************
+============
.. bibliography:: bibliography.bib
:filter: docnames
diff --git a/src/cython/doc/img/average_landscape.png b/src/cython/doc/img/average_landscape.png
deleted file mode 100644
index ea59926b..00000000
--- a/src/cython/doc/img/average_landscape.png
+++ /dev/null
Binary files differ
diff --git a/src/cython/doc/index.rst b/src/cython/doc/index.rst
index fca63d65..f6d10567 100644
--- a/src/cython/doc/index.rst
+++ b/src/cython/doc/index.rst
@@ -1,5 +1,5 @@
-GUDHI documentation
-###################
+GUDHI Python module documentation
+#################################
.. image:: img/Gudhi_banner.png
:align: center
@@ -7,9 +7,9 @@ GUDHI documentation
Introduction
************
-The Gudhi library (Geometry Understanding in Higher Dimensions) is a generic
-open source `C++ library <http://gudhi.gforge.inria.fr/doc/latest/>`_, with a
-`Cython interface <http://gudhi.gforge.inria.fr/cython/latest/>`_, for
+The Python interface for the Gudhi library (Geometry Understanding in Higher
+Dimensions) is a generic open source
+`Python module <http://gudhi.gforge.inria.fr/python/latest/>`_, for
Computational Topology and Topological Data Analysis
(`TDA <https://en.wikipedia.org/wiki/Topological_data_analysis>`_).
The GUDHI library intends to help the development of new algorithmic solutions
@@ -20,12 +20,11 @@ data structures.
The current release of the GUDHI library includes:
* Data structures to represent, construct and manipulate simplicial complexes.
-* Algorithms to compute persistent homology and multi-field persistent homology.
-* Simplication of simplicial complexes by edge contraction.
+* Simplification of simplicial complexes by edge contraction.
+* Algorithms to compute persistent homology and bottleneck distance.
-All data-structures are generic and several of their aspects can be
-parameterized via template classes. We refer to :cite:`gudhilibrary_ICMS14`
-for a detailed description of the design of the library.
+We refer to :cite:`gudhilibrary_ICMS14` for a detailed description of the
+design of the library.
Data structures
***************
diff --git a/src/cython/doc/installation.rst b/src/cython/doc/installation.rst
index e7d8c210..f98a5039 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 <http://www.boost.org/>`_ 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 <http://www.boost.org/>`_ 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 <https://wiki.python.org/moin/WindowsCompilers>`_ , only Python
+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
+:code:`-DPython_ADDITIONAL_VERSIONS=3` to the cmake command.
+
GUDHI Cythonization
===================
@@ -23,20 +30,18 @@ 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
===========
-To test your build, `py.test <http://doc.pytest.org>`_ is required. Run the
+To test your build, `py.test <http://doc.pytest.org>`_ is optional. Run the
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'
- py.test
+ export PYTHONPATH='$PYTHONPATH:/path-to-gudhi/build/cython'
+ ctest -R py_test
Documentation
=============
diff --git a/src/cython/doc/persistence_graphical_tools_user.rst b/src/cython/doc/persistence_graphical_tools_user.rst
index f713e971..cae18323 100644
--- a/src/cython/doc/persistence_graphical_tools_user.rst
+++ b/src/cython/doc/persistence_graphical_tools_user.rst
@@ -1,4 +1,3 @@
-=======================================
Persistence graphical tools user manual
=======================================
Definition
diff --git a/src/cython/doc/persistent_cohomology_user.rst b/src/cython/doc/persistent_cohomology_user.rst
index 69be3b86..72f1a7f7 100644
--- a/src/cython/doc/persistent_cohomology_user.rst
+++ b/src/cython/doc/persistent_cohomology_user.rst
@@ -1,4 +1,3 @@
-=================================
Persistent cohomology user manual
=================================
Definition
@@ -108,7 +107,7 @@ We provide several example files: run these examples with -h for details on thei
* :download:`tangential_complex_plain_homology_from_off_file_example.py <../example/tangential_complex_plain_homology_from_off_file_example.py>`
Bibliography
-************
+============
.. bibliography:: bibliography.bib
:filter: docnames
diff --git a/src/cython/doc/rips_complex_user.rst b/src/cython/doc/rips_complex_user.rst
index 027c3bf7..f9760976 100644
--- a/src/cython/doc/rips_complex_user.rst
+++ b/src/cython/doc/rips_complex_user.rst
@@ -1,4 +1,3 @@
-=========================
Rips complex user manual
=========================
Definition
@@ -60,8 +59,9 @@ 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():
- print(filtered_value)
+ fmt = '%s -> %.2f'
+ for filtered_value in simplex_tree.get_filtration():
+ print(fmt % tuple(filtered_value))
When launching (Rips maximal distance between 2 points is 12.0, is expanded
until dimension 1 - one skeleton graph in other words), the output is:
@@ -69,24 +69,24 @@ until dimension 1 - one skeleton graph in other words), the output is:
.. testoutput::
Rips complex is of dimension 1 - 18 simplices - 7 vertices.
- ([0], 0.0)
- ([1], 0.0)
- ([2], 0.0)
- ([3], 0.0)
- ([4], 0.0)
- ([5], 0.0)
- ([6], 0.0)
- ([2, 3], 5.0)
- ([4, 5], 5.385164807134504)
- ([0, 2], 5.830951894845301)
- ([0, 1], 6.082762530298219)
- ([1, 3], 6.324555320336759)
- ([1, 2], 6.708203932499369)
- ([5, 6], 7.280109889280518)
- ([2, 4], 8.94427190999916)
- ([0, 3], 9.433981132056603)
- ([4, 6], 9.486832980505138)
- ([3, 6], 11.0)
+ [0] -> 0.00
+ [1] -> 0.00
+ [2] -> 0.00
+ [3] -> 0.00
+ [4] -> 0.00
+ [5] -> 0.00
+ [6] -> 0.00
+ [2, 3] -> 5.00
+ [4, 5] -> 5.39
+ [0, 2] -> 5.83
+ [0, 1] -> 6.08
+ [1, 3] -> 6.32
+ [1, 2] -> 6.71
+ [5, 6] -> 7.28
+ [2, 4] -> 8.94
+ [0, 3] -> 9.43
+ [4, 6] -> 9.49
+ [3, 6] -> 11.00
Example from OFF file
^^^^^^^^^^^^^^^^^^^^^
@@ -107,32 +107,33 @@ 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():
- print(filtered_value)
+ fmt = '%s -> %.2f'
+ for filtered_value in simplex_tree.get_filtration():
+ print(fmt % tuple(filtered_value))
the program output is:
.. testoutput::
Rips complex is of dimension 1 - 18 simplices - 7 vertices.
- ([0], 0.0)
- ([1], 0.0)
- ([2], 0.0)
- ([3], 0.0)
- ([4], 0.0)
- ([5], 0.0)
- ([6], 0.0)
- ([2, 3], 5.0)
- ([4, 5], 5.385164807134504)
- ([0, 2], 5.830951894845301)
- ([0, 1], 6.082762530298219)
- ([1, 3], 6.324555320336759)
- ([1, 2], 6.708203932499369)
- ([5, 6], 7.280109889280518)
- ([2, 4], 8.94427190999916)
- ([0, 3], 9.433981132056603)
- ([4, 6], 9.486832980505138)
- ([3, 6], 11.0)
+ [0] -> 0.00
+ [1] -> 0.00
+ [2] -> 0.00
+ [3] -> 0.00
+ [4] -> 0.00
+ [5] -> 0.00
+ [6] -> 0.00
+ [2, 3] -> 5.00
+ [4, 5] -> 5.39
+ [0, 2] -> 5.83
+ [0, 1] -> 6.08
+ [1, 3] -> 6.32
+ [1, 2] -> 6.71
+ [5, 6] -> 7.28
+ [2, 4] -> 8.94
+ [0, 3] -> 9.43
+ [4, 6] -> 9.49
+ [3, 6] -> 11.00
Distance matrix
---------------
@@ -162,8 +163,9 @@ 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():
- print(filtered_value)
+ fmt = '%s -> %.2f'
+ for filtered_value in simplex_tree.get_filtration():
+ print(fmt % tuple(filtered_value))
When launching (Rips maximal distance between 2 points is 12.0, is expanded
until dimension 1 - one skeleton graph in other words), the output is:
@@ -171,24 +173,24 @@ until dimension 1 - one skeleton graph in other words), the output is:
.. testoutput::
Rips complex is of dimension 1 - 18 simplices - 7 vertices.
- ([0], 0.0)
- ([1], 0.0)
- ([2], 0.0)
- ([3], 0.0)
- ([4], 0.0)
- ([5], 0.0)
- ([6], 0.0)
- ([2, 3], 5.0)
- ([4, 5], 5.3851648071)
- ([0, 2], 5.8309518948)
- ([0, 1], 6.0827625303)
- ([1, 3], 6.3245553203)
- ([1, 2], 6.7082039325)
- ([5, 6], 7.2801098893)
- ([2, 4], 8.94427191)
- ([0, 3], 9.4339811321)
- ([4, 6], 9.4868329805)
- ([3, 6], 11.0)
+ [0] -> 0.00
+ [1] -> 0.00
+ [2] -> 0.00
+ [3] -> 0.00
+ [4] -> 0.00
+ [5] -> 0.00
+ [6] -> 0.00
+ [2, 3] -> 5.00
+ [4, 5] -> 5.39
+ [0, 2] -> 5.83
+ [0, 1] -> 6.08
+ [1, 3] -> 6.32
+ [1, 2] -> 6.71
+ [5, 6] -> 7.28
+ [2, 4] -> 8.94
+ [0, 3] -> 9.43
+ [4, 6] -> 9.49
+ [3, 6] -> 11.00
Example from csv file
^^^^^^^^^^^^^^^^^^^^^
@@ -209,29 +211,30 @@ 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():
- print(filtered_value)
+ fmt = '%s -> %.2f'
+ for filtered_value in simplex_tree.get_filtration():
+ print(fmt % tuple(filtered_value))
the program output is:
.. testoutput::
Rips complex is of dimension 1 - 18 simplices - 7 vertices.
- ([0], 0.0)
- ([1], 0.0)
- ([2], 0.0)
- ([3], 0.0)
- ([4], 0.0)
- ([5], 0.0)
- ([6], 0.0)
- ([2, 3], 5.0)
- ([4, 5], 5.3851648071)
- ([0, 2], 5.8309518948)
- ([0, 1], 6.0827625303)
- ([1, 3], 6.3245553203)
- ([1, 2], 6.7082039325)
- ([5, 6], 7.2801098893)
- ([2, 4], 8.94427191)
- ([0, 3], 9.4339811321)
- ([4, 6], 9.4868329805)
- ([3, 6], 11.0)
+ [0] -> 0.00
+ [1] -> 0.00
+ [2] -> 0.00
+ [3] -> 0.00
+ [4] -> 0.00
+ [5] -> 0.00
+ [6] -> 0.00
+ [2, 3] -> 5.00
+ [4, 5] -> 5.39
+ [0, 2] -> 5.83
+ [0, 1] -> 6.08
+ [1, 3] -> 6.32
+ [1, 2] -> 6.71
+ [5, 6] -> 7.28
+ [2, 4] -> 8.94
+ [0, 3] -> 9.43
+ [4, 6] -> 9.49
+ [3, 6] -> 11.00
diff --git a/src/cython/doc/simplex_tree_user.rst b/src/cython/doc/simplex_tree_user.rst
index cbfd34a7..4b1dde19 100644
--- a/src/cython/doc/simplex_tree_user.rst
+++ b/src/cython/doc/simplex_tree_user.rst
@@ -1,4 +1,3 @@
-========================
Simplex tree user manual
========================
Definition
@@ -35,9 +34,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")
@@ -45,8 +44,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)
@@ -54,16 +53,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(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/doc/tangential_complex_user.rst b/src/cython/doc/tangential_complex_user.rst
index 6a7e6e41..03f9fea6 100644
--- a/src/cython/doc/tangential_complex_user.rst
+++ b/src/cython/doc/tangential_complex_user.rst
@@ -1,4 +1,3 @@
-==============================
Tangential complex user manual
==============================
.. include:: tangential_complex_sum.rst
@@ -133,8 +132,8 @@ 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():
- print(filtered_value)
+ for filtered_value in st.get_filtration():
+ print(filtered_value[0])
The output is:
@@ -142,21 +141,21 @@ The output is:
Tangential contains 12 simplices - 7 vertices.
Simplex tree is of dimension 1 - 15 simplices - 7 vertices.
- ([0], 0.0)
- ([1], 0.0)
- ([0, 1], 0.0)
- ([2], 0.0)
- ([0, 2], 0.0)
- ([1, 2], 0.0)
- ([3], 0.0)
- ([1, 3], 0.0)
- ([4], 0.0)
- ([2, 4], 0.0)
- ([5], 0.0)
- ([4, 5], 0.0)
- ([6], 0.0)
- ([3, 6], 0.0)
- ([5, 6], 0.0)
+ [0]
+ [1]
+ [0, 1]
+ [2]
+ [0, 2]
+ [1, 2]
+ [3]
+ [1, 3]
+ [4]
+ [2, 4]
+ [5]
+ [4, 5]
+ [6]
+ [3, 6]
+ [5, 6]
Example with perturbation
@@ -187,8 +186,9 @@ The output is:
Tangential contains 4 vertices.
Inconsistencies has been fixed.
+
Bibliography
-************
+============
.. bibliography:: bibliography.bib
:filter: docnames
diff --git a/src/cython/doc/witness_complex_user.rst b/src/cython/doc/witness_complex_user.rst
index 07945361..aa9cbb2c 100644
--- a/src/cython/doc/witness_complex_user.rst
+++ b/src/cython/doc/witness_complex_user.rst
@@ -1,12 +1,8 @@
-===========================
Witness complex user manual
===========================
-Definition
-----------
.. include:: witness_complex_sum.rst
-
Definitions
-----------
@@ -128,7 +124,7 @@ Here is an example of constructing a strong witness complex filtration and compu
* :download:`euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py <../example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py>`
Bibliography
-************
+============
.. bibliography:: bibliography.bib
:filter: docnames
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/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.')
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/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())
diff --git a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
index 664eb5c4..984dbf1b 100755
--- a/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
+++ b/src/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
@@ -43,29 +43,22 @@ parser.add_argument('--no-diagram', default=False, action='store_true' , help='F
args = parser.parse_args()
-with open(args.file, 'r') as f:
- first_line = f.readline()
- if (first_line == 'OFF\n') or (first_line == 'nOFF\n'):
- print("#####################################################################")
- print("RipsComplex creation from distance matrix read in a csv file")
-
- message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length)
- print(message)
-
- rips_complex = gudhi.RipsComplex(off_file=args.file, max_edge_length=args.max_edge_length)
- simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
-
- message = "Number of simplices=" + repr(simplex_tree.num_simplices())
- print(message)
-
- diag = simplex_tree.persistence()
-
- print("betti_numbers()=")
- print(simplex_tree.betti_numbers())
-
- if args.no_diagram == False:
- gudhi.plot_persistence_diagram(diag)
- else:
- print(args.file, "is not a valid OFF file")
-
- f.close()
+print("#####################################################################")
+print("RipsComplex creation from distance matrix read in a csv file")
+
+message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length)
+print(message)
+
+rips_complex = gudhi.RipsComplex(csv_file=args.file, max_edge_length=args.max_edge_length)
+simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
+
+message = "Number of simplices=" + repr(simplex_tree.num_simplices())
+print(message)
+
+diag = simplex_tree.persistence()
+
+print("betti_numbers()=")
+print(simplex_tree.betti_numbers())
+
+if args.no_diagram == False:
+ gudhi.plot_persistence_diagram(diag)
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/Rips_complex_interface.h b/src/cython/include/Rips_complex_interface.h
index 1879bd74..6d813f4a 100644
--- a/src/cython/include/Rips_complex_interface.h
+++ b/src/cython/include/Rips_complex_interface.h
@@ -49,7 +49,7 @@ class Rips_complex_interface {
if (euclidean) {
// Rips construction where values is a vector of points
rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(values, threshold,
- Euclidean_distance());
+ Gudhi::Euclidean_distance());
} else {
// Rips construction where values is a distance matrix
rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(values, threshold);
@@ -61,7 +61,8 @@ class Rips_complex_interface {
// Rips construction where file_name is an OFF file
Gudhi::Points_off_reader<Point_d> off_reader(file_name);
rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(off_reader.get_point_cloud(),
- threshold, Euclidean_distance());
+ threshold,
+ Gudhi::Euclidean_distance());
} else {
// Rips construction where values is a distance matrix
Distance_matrix distances =
diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h
index 4266b3ef..45ce1916 100644
--- a/src/cython/include/Simplex_tree_interface.h
+++ b/src/cython/include/Simplex_tree_interface.h
@@ -52,29 +52,32 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> {
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);
+ }
+
+ // 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);
- Base::initialize_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);
- 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<std::size_t>& 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<std::size_t>& complex, Filtration_value filtration = 0) {
Insertion_result result = Base::insert_simplex_and_subfaces(complex, filtration);
- Base::initialize_filtration();
return (result.second);
}
@@ -87,28 +90,29 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> {
Base::initialize_filtration();
}
- Complex get_filtered_tree() {
- Complex filtered_tree;
+ Complex get_filtration() {
+ Base::initialize_filtration();
+ 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) {
@@ -140,6 +144,7 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> {
}
void create_persistence(Gudhi::Persistent_cohomology_interface<Base>* pcoh) {
+ Base::initialize_filtration();
pcoh = new Gudhi::Persistent_cohomology_interface<Base>(*this);
}
};
diff --git a/src/cython/include/Subsampling_interface.h b/src/cython/include/Subsampling_interface.h
index 1c6032c0..b0f4a50a 100644
--- a/src/cython/include/Subsampling_interface.h
+++ b/src/cython/include/Subsampling_interface.h
@@ -46,7 +46,7 @@ std::vector<std::vector<double>> subsampling_n_farthest_points(const std::vector
unsigned nb_points) {
std::vector<std::vector<double>> landmarks;
Subsampling_dynamic_kernel k;
- choose_n_farthest_points(k, points, nb_points, std::back_inserter(landmarks));
+ choose_n_farthest_points(k, points, nb_points, random_starting_point, std::back_inserter(landmarks));
return landmarks;
}
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_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')
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 af5b639a..3ae537e3 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
@@ -55,31 +55,30 @@ 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
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) == \
+ # 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], 4.0), ([2], 4.0)]
- assert st.get_skeleton_tree(1) == \
+ ([0], 0.0), ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)]
+ assert st.get_skeleton(1) == \
[([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0),
- ([1, 2], 4.0), ([1], 4.0), ([2], 4.0)]
- assert st.get_skeleton_tree(0) == \
- [([0], 0.0), ([1], 4.0), ([2], 4.0)]
+ ([1, 2], 4.0), ([1], 0.0), ([2], 4.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], 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,20 +102,20 @@ 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
- 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)]