summaryrefslogtreecommitdiff
path: root/example/Bottleneck_distance
diff options
context:
space:
mode:
Diffstat (limited to 'example/Bottleneck_distance')
-rw-r--r--example/Bottleneck_distance/CMakeLists.txt34
-rw-r--r--example/Bottleneck_distance/README19
-rw-r--r--example/Bottleneck_distance/bottleneck_read_file_example.cpp50
3 files changed, 28 insertions, 75 deletions
diff --git a/example/Bottleneck_distance/CMakeLists.txt b/example/Bottleneck_distance/CMakeLists.txt
index eac617db..6095d6eb 100644
--- a/example/Bottleneck_distance/CMakeLists.txt
+++ b/example/Bottleneck_distance/CMakeLists.txt
@@ -2,37 +2,21 @@ cmake_minimum_required(VERSION 2.6)
project(Bottleneck_distance_examples)
if (NOT CGAL_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_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(bottleneck_read_file_example ${TBB_LIBRARIES})
+ target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES})
target_link_libraries(bottleneck_basic_example ${TBB_LIBRARIES})
endif(TBB_FOUND)
-
+
add_test(NAME Bottleneck_distance_example_basic COMMAND $<TARGET_FILE:bottleneck_basic_example>)
-
- add_test(NAME Bottleneck_read_file_example
- COMMAND $<TARGET_FILE:bottleneck_read_file_example>
- "${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_basic_example DESTINATION bin)
-
-endif (NOT CGAL_VERSION VERSION_LESS 4.8.1)
-
-# Eigen3 and CGAL > 4.7.0 is required for alpha complex
-# CGAL > 4.8.1 is required for bottleneck distance =>
-if (NOT CGAL_WITH_EIGEN3_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})
-
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")
+ 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")
+ install(TARGETS bottleneck_basic_example DESTINATION bin)
install(TARGETS alpha_rips_persistence_bottleneck_distance DESTINATION bin)
- if (TBB_FOUND)
- target_link_libraries(alpha_rips_persistence_bottleneck_distance ${TBB_LIBRARIES})
- endif(TBB_FOUND)
-endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1)
+
+endif (NOT CGAL_VERSION VERSION_LESS 4.8.1)
diff --git a/example/Bottleneck_distance/README b/example/Bottleneck_distance/README
new file mode 100644
index 00000000..01bcd74a
--- /dev/null
+++ b/example/Bottleneck_distance/README
@@ -0,0 +1,19 @@
+# Bottleneck_distance #
+
+## `alpha_rips_persistence_bottleneck_distance` ##
+This program computes the persistent homology with coefficient field Z/pZ of a Rips complex defined on a set of input points. The output diagram contains one bar per line, written with the convention:
+
+`p dim birth death`
+
+where `dim` is the dimension of the homological feature, `birth` and `death` are respectively the birth and death of the feature, and `p` is the characteristic of the field *Z/pZ* used for homology coefficients.
+
+Usage:
+`alpha_rips_persistence_bottleneck_distance [options] <OFF input file>`
+
+Allowed options:
+
+* `-h [ --help ]` Produce help message
+* `-r [ --max-edge-length ]` (default = inf) Maximal length of an edge for the Rips complex construction.`
+* `-d [ --cpx-dimension ]` (default = 1) Maximal dimension of the Rips complex we want to compute.`
+* `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology.
+* `-m [ --min-persistence ]` (default = 0) Minimal lifetime of homology feature to be recorded. Enter a negative value to see zero length intervals.
diff --git a/example/Bottleneck_distance/bottleneck_read_file_example.cpp b/example/Bottleneck_distance/bottleneck_read_file_example.cpp
deleted file mode 100644
index 24d73c57..00000000
--- a/example/Bottleneck_distance/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 <http://www.gnu.org/licenses/>.
- */
-
-#include <gudhi/Bottleneck.h>
-#include <gudhi/reader_utils.h>
-#include <iostream>
-#include <vector>
-#include <utility> // for pair
-#include <string>
-#include <limits> // 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 a 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<std::pair<double, double>> diag1 = Gudhi::read_persistence_intervals_in_dimension(argv[1]);
- std::vector<std::pair<double, double>> diag2 = Gudhi::read_persistence_intervals_in_dimension(argv[2]);
-
- double tolerance = std::numeric_limits<double>::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;
-}