From 6dbf0ab8f84fd57d4fb80cd3c1bcf0aca6f0bb05 Mon Sep 17 00:00:00 2001 From: cjamin Date: Wed, 15 Nov 2017 15:57:48 +0000 Subject: Doc git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/add_utils_in_gudhi_v2@2884 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c5e0a65a484a71d8a9fc1fc2b695dd20a367fd0c --- src/Alpha_complex/utilities/CMakeLists.txt | 4 +- src/Alpha_complex/utilities/README | 17 ++++++++ src/Bottleneck_distance/example/CMakeLists.txt | 4 ++ src/Bottleneck_distance/utilities/CMakeLists.txt | 11 ++--- .../utilities/bottleneck_read_file.cpp | 50 ++++++++++++++++++++++ .../utilities/bottleneck_read_file_example.cpp | 50 ---------------------- 6 files changed, 77 insertions(+), 59 deletions(-) create mode 100644 src/Bottleneck_distance/utilities/bottleneck_read_file.cpp delete mode 100644 src/Bottleneck_distance/utilities/bottleneck_read_file_example.cpp diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt index 120ca416..18699650 100644 --- a/src/Alpha_complex/utilities/CMakeLists.txt +++ b/src/Alpha_complex/utilities/CMakeLists.txt @@ -17,9 +17,9 @@ if(CGAL_FOUND) add_test(NAME Alpha_complex_utilities_alpha_complex_3d_persistence COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "2" "0.45") - add_test(NAME Persistent_cohomology_example_exact_alpha_complex_3d COMMAND $ + add_test(NAME Alpha_complex_utilities_exact_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "2" "0.45") - add_test(NAME Persistent_cohomology_example_weighted_alpha_complex_3d COMMAND $ + add_test(NAME Alpha_complex_utilities_weighted_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.weights" "2" "0.45") install(TARGETS alpha_complex_3d_persistence DESTINATION bin) diff --git a/src/Alpha_complex/utilities/README b/src/Alpha_complex/utilities/README index 67ea1875..6e7d16b7 100644 --- a/src/Alpha_complex/utilities/README +++ b/src/Alpha_complex/utilities/README @@ -39,6 +39,23 @@ N.B.: +## `exact_alpha_complex_3d_persistence` ## +Same as `alpha_complex_3d_persistence`, but using exact computation. It is slower, but it is necessary when points are on a grid for instance. + + + +## `weighted_alpha_complex_3d_persistence` ## +Same as `alpha_complex_3d_persistence`, but using weighted points. + +**Usage** +`weighted_alpha_complex_3d_persistence

` +where +`` is the path to the input point cloud in OFF format. +`` is the path to the file containing the weights of the points (one value per line). +`

` is the characteristic p of the coefficient field *Z/pZ* for computing homology. It must be a stricly positive integer. +`` is the minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals. + + ## `periodic_alpha_complex_3d_persistence` ## This program computes the persistent homology with coefficient field Z/pZ of the 3D periodic alpha complex built from a 3D point cloud. The output diagram contains one bar per line, written with the convention: diff --git a/src/Bottleneck_distance/example/CMakeLists.txt b/src/Bottleneck_distance/example/CMakeLists.txt index 9677f5c5..2ae45dc5 100644 --- a/src/Bottleneck_distance/example/CMakeLists.txt +++ b/src/Bottleneck_distance/example/CMakeLists.txt @@ -6,6 +6,10 @@ if (NOT CGAL_VERSION VERSION_LESS 4.8.1) add_executable (alpha_rips_persistence_bottleneck_distance alpha_rips_persistence_bottleneck_distance.cpp) target_link_libraries(alpha_rips_persistence_bottleneck_distance ${Boost_PROGRAM_OPTIONS_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES}) + endif(TBB_FOUND) + add_test(NAME Bottleneck_distance_example_basic COMMAND $) add_test(NAME Bottleneck_distance_example_alpha_rips_persistence_bottleneck COMMAND $ diff --git a/src/Bottleneck_distance/utilities/CMakeLists.txt b/src/Bottleneck_distance/utilities/CMakeLists.txt index decdc789..cdf76c85 100644 --- a/src/Bottleneck_distance/utilities/CMakeLists.txt +++ b/src/Bottleneck_distance/utilities/CMakeLists.txt @@ -2,15 +2,12 @@ cmake_minimum_required(VERSION 2.6) project(Bottleneck_distance_utilities) if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) - add_executable (bottleneck_read_file_example bottleneck_read_file_example.cpp) - if (TBB_FOUND) - target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES}) - endif(TBB_FOUND) + add_executable (bottleneck_read_file bottleneck_read_file.cpp) - add_test(NAME Bottleneck_read_file_example - COMMAND $ + add_test(NAME Bottleneck_distance_utilities_Bottleneck_read_file + COMMAND $ "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers" "${CMAKE_SOURCE_DIR}/data/persistence_diagram/second.pers") - install(TARGETS bottleneck_read_file_example DESTINATION bin) + install(TARGETS bottleneck_read_file DESTINATION bin) endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/Bottleneck_distance/utilities/bottleneck_read_file.cpp b/src/Bottleneck_distance/utilities/bottleneck_read_file.cpp new file mode 100644 index 00000000..9dd52b31 --- /dev/null +++ b/src/Bottleneck_distance/utilities/bottleneck_read_file.cpp @@ -0,0 +1,50 @@ +/* This file is part of the Gudhi Library. The Gudhi library + * (Geometric Understanding in Higher Dimensions) is a generic C++ + * library for computational topology. + * + * Authors: Francois Godi, small modifications by Pawel Dlotko + * + * Copyright (C) 2015 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 . + */ + +#include +#include +#include +#include +#include // for pair +#include +#include // for numeric_limits + +int main(int argc, char** argv) { + if (argc < 3) { + std::cout << "To run this program please provide as an input two files with persistence diagrams. Each file" << + " should contain a birth-death pair per line. Third, optional parameter is an error bound on the bottleneck" << + " distance (set by default to the smallest positive double value). If you set the error bound to 0, be" << + " aware this version is exact but expensive. The program will now terminate \n"; + return -1; + } + std::vector> diag1 = Gudhi::read_persistence_intervals_in_dimension(argv[1]); + std::vector> diag2 = Gudhi::read_persistence_intervals_in_dimension(argv[2]); + + double tolerance = std::numeric_limits::min(); + if (argc == 4) { + tolerance = atof(argv[3]); + } + double b = Gudhi::persistence_diagram::bottleneck_distance(diag1, diag2, tolerance); + std::cout << "The distance between the diagrams is : " << b << ". The tolerance is : " << tolerance << std::endl; + + return 0; +} diff --git a/src/Bottleneck_distance/utilities/bottleneck_read_file_example.cpp b/src/Bottleneck_distance/utilities/bottleneck_read_file_example.cpp deleted file mode 100644 index 9dd52b31..00000000 --- a/src/Bottleneck_distance/utilities/bottleneck_read_file_example.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* This file is part of the Gudhi Library. The Gudhi library - * (Geometric Understanding in Higher Dimensions) is a generic C++ - * library for computational topology. - * - * Authors: Francois Godi, small modifications by Pawel Dlotko - * - * Copyright (C) 2015 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 . - */ - -#include -#include -#include -#include -#include // for pair -#include -#include // for numeric_limits - -int main(int argc, char** argv) { - if (argc < 3) { - std::cout << "To run this program please provide as an input two files with persistence diagrams. Each file" << - " should contain a birth-death pair per line. Third, optional parameter is an error bound on the bottleneck" << - " distance (set by default to the smallest positive double value). If you set the error bound to 0, be" << - " aware this version is exact but expensive. The program will now terminate \n"; - return -1; - } - std::vector> diag1 = Gudhi::read_persistence_intervals_in_dimension(argv[1]); - std::vector> diag2 = Gudhi::read_persistence_intervals_in_dimension(argv[2]); - - double tolerance = std::numeric_limits::min(); - if (argc == 4) { - tolerance = atof(argv[3]); - } - double b = Gudhi::persistence_diagram::bottleneck_distance(diag1, diag2, tolerance); - std::cout << "The distance between the diagrams is : " << b << ". The tolerance is : " << tolerance << std::endl; - - return 0; -} -- cgit v1.2.3